File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def compute_hash(qstr):
2626def do_work (infiles ):
2727 # read the qstrs in from the input files
2828 qstrs = {}
29+ cpp_header_blocks = 3
2930 for infile in infiles :
3031 with open (infile , 'rt' ) as f :
3132 line_number = 0
@@ -37,6 +38,14 @@ def do_work(infiles):
3738 if len (line ) == 0 or line .startswith ('//' ):
3839 continue
3940
41+ # We'll have 3 line-number lines for py/qstrdefs.h - initial, leaving it to
42+ # go into other headers, and returning to it.
43+ if line .startswith ('# ' ) and 'py/qstrdefs.h' in line :
44+ cpp_header_blocks -= 1
45+ continue
46+ if cpp_header_blocks != 0 :
47+ continue
48+
4049 # verify line is of the correct form
4150 match = re .match (r'Q\((.+)\)$' , line )
4251 if not match :
Original file line number Diff line number Diff line change @@ -104,9 +104,10 @@ $(PY_BUILD)/py-version.h: FORCE
104104# Adding an order only dependency on $(PY_BUILD) causes $(PY_BUILD) to get
105105# created before we run the script to generate the .h
106106$(PY_BUILD ) /qstrdefs.generated.h : | $(PY_BUILD ) /
107- $(PY_BUILD ) /qstrdefs.generated.h : $(PY_QSTR_DEFS ) $(QSTR_DEFS ) $(PY_SRC ) /makeqstrdata.py
107+ $(PY_BUILD ) /qstrdefs.generated.h : $(PY_QSTR_DEFS ) $(QSTR_DEFS ) $(PY_SRC ) /makeqstrdata.py mpconfigport.h $( PY_SRC ) /mpconfig.h
108108 $(ECHO ) " makeqstrdata $( PY_QSTR_DEFS) $( QSTR_DEFS) "
109- $(Q )$(PYTHON ) $(PY_SRC ) /makeqstrdata.py $(PY_QSTR_DEFS ) $(QSTR_DEFS ) > $@
109+ $(CPP ) $(CFLAGS ) $(PY_QSTR_DEFS ) -o $(PY_BUILD ) /qstrdefs.preprocessed.h
110+ $(Q )$(PYTHON ) $(PY_SRC ) /makeqstrdata.py $(PY_BUILD ) /qstrdefs.preprocessed.h $(QSTR_DEFS ) > $@
110111
111112# We don't know which source files actually need the generated.h (since
112113# it is #included from str.h). The compiler generated dependencies will cause
Original file line number Diff line number Diff line change 1+ #include "mpconfig.h"
12// All the qstr definitions in this file are available as constants.
23// That is, they are in ROM and you can reference them simply as MP_QSTR_xxxx.
3- // TODO make it so we can use #defines here to select only those words that will be used
44
55Q (__build_class__ )
66Q (__class__ )
You can’t perform that action at this time.
0 commit comments