diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-11 20:50:15 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-12 00:39:55 +0300 |
commit | a925cb54f1b3490a9e082816eb785750c4b25324 (patch) | |
tree | 1bc15ed93d55561ad1d4f895097201af54ccca4b /py/makeqstrdata.py | |
parent | 6ea0e928d8aced4f8ce5ab451105c199092eb6df (diff) | |
download | micropython-a925cb54f1b3490a9e082816eb785750c4b25324.tar.gz micropython-a925cb54f1b3490a9e082816eb785750c4b25324.zip |
py: Preprocess qstrdefs.h before feeding to makeqstrdata.py.
This is alternative implementation of supporting conditionals in qstrdefs.h,
hard to say if it's much cleaner than munging #ifdef's in Python code...
Diffstat (limited to 'py/makeqstrdata.py')
-rw-r--r-- | py/makeqstrdata.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 7413365712..81b0035451 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -26,6 +26,7 @@ def compute_hash(qstr): def do_work(infiles): # read the qstrs in from the input files qstrs = {} + cpp_header_blocks = 3 for infile in infiles: with open(infile, 'rt') as f: line_number = 0 @@ -37,6 +38,14 @@ def do_work(infiles): if len(line) == 0 or line.startswith('//'): continue + # We'll have 3 line-number lines for py/qstrdefs.h - initial, leaving it to + # go into other headers, and returning to it. + if line.startswith('# ') and 'py/qstrdefs.h' in line: + cpp_header_blocks -= 1 + continue + if cpp_header_blocks != 0: + continue + # verify line is of the correct form match = re.match(r'Q\((.+)\)$', line) if not match: |