diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:00:50 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:00:50 +0000 |
| commit | 8e4a7eb6d2e8e12360fdef93501e1a4cf8526bcb (patch) | |
| tree | 79ef0007f6d8a340cad1527c4798989d3591ad3a /bindings | |
| parent | 9d9956b25bf2c4e8463de4d502dd1e103b68f017 (diff) | |
[project @ fpeters@0d.be-20071004203137-j6p42c5e48qgc5fq]
added support for enums
Original author: Frederic Peters <fpeters@0d.be>
Date: 2007-10-04 22:31:37.240000+02:00
Diffstat (limited to 'bindings')
| -rw-r--r-- | bindings/t.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bindings/t.py b/bindings/t.py index 3ba0235f..12bbad41 100644 --- a/bindings/t.py +++ b/bindings/t.py @@ -7,6 +7,7 @@ constants = [] def parse(header_file): in_comment = False + in_enum = False content = file(header_file).read().replace('\\\n', ' ') for line in content.splitlines(): @@ -16,8 +17,18 @@ def parse(header_file): continue if '/*' in line and not '*/' in line: + in_comment = True continue + if in_enum: + if line.startswith('}'): + in_enum = False + else: + m = re.match('\s*([a-zA-Z0-9_]+)', line) + if m: + constants.append(m.group(1)) + continue + if line.startswith('#define'): m = re.match(r'#define\s+([a-zA-Z0-9_]+)\s+[-\w"]', line) if not m: @@ -27,6 +38,13 @@ def parse(header_file): # ignore private constants continue constants.append(constant) + continue + + if line.startswith('typedef enum {'): + in_enum = True + continue + + for base, dirnames, filenames in os.walk('../lasso/'): |
