#9 Parse preprocessor directives

closed
nobody
None
5
2012-09-16
2012-09-13
bgrupczy
No

I am taking raw data from an embedded system developed in C++ and attempting to parse out the data using information from existing header files. So far, I think your module is going to help me greatly.

I would be interested in a few features.

1. Parse #pragma

I'm most interested in where an enum is surrounded by the #pragma:

#pragma options enum=small
...enum definition...
#pragma options enum=reset

Possibly decorate the enum or at least some way of knowing when the compiler is begin told to change behavior.

2. Parse #define

Looking at NUM_ENTRIES in the following parsed class, I would be able to query for NUM_ENTRIES and parse out the data fully.

class Status
{
public
// Properties
{'line_number': 108, 'constant': 0, 'name': 'header', 'reference': 0, 'type': 'Hdr', 'static': 0, 'pointer': 0}
{'line_number': 110, 'constant': 0, 'name': 'entry', 'reference': 0, 'array_size': 'NUM_ENTRIES', 'type': 'Entry', 'static': 0, 'pointer': 0}
protected
private
}

3. Also I noticed that one of your enhancements was to have the 'array' attributes.

Identify array data members as arrays - ID: 3488050
Variables have the following 2 new attributes:
* array: 0 or 1 depending on if its an array
* array_size: If something is between [ and ], that will go here

But I don't see 'array'. My work around will be to use 'array_size' to infer it.

Discussion

  • Jashua Cloutier

    Jashua Cloutier - 2012-09-16
    • status: open --> closed
     
  • Jashua Cloutier

    Jashua Cloutier - 2012-09-16

    For #1 and #2, this has been implemented in commit 91:eec1a06ac390

    For #3, please create a bug with an example if the issue

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks