@@ -29,7 +29,6 @@ def do_work(infiles):
2929 for infile in infiles :
3030 with open (infile , 'rt' ) as f :
3131 line_number = 0
32- conditional = None
3332 for line in f :
3433 line_number += 1
3534 line = line .strip ()
@@ -38,18 +37,6 @@ def do_work(infiles):
3837 if len (line ) == 0 or line .startswith ('//' ):
3938 continue
4039
41- if line [0 ] == '#' :
42- if conditional == "<endif>" :
43- assert line == "#endif"
44- conditional = None
45- else :
46- assert conditional is None
47- conditional = line
48- continue
49-
50- if conditional == "<endif>" :
51- assert False , "#endif expected before '%s'" % line
52-
5340 # verify line is of the correct form
5441 match = re .match (r'Q\((.+)\)$' , line )
5542 if not match :
@@ -65,21 +52,15 @@ def do_work(infiles):
6552 continue
6653
6754 # add the qstr to the list, with order number to retain original order in file
68- qstrs [ident ] = (len (qstrs ), ident , qstr , conditional )
69- if conditional is not None :
70- conditional = "<endif>"
55+ qstrs [ident ] = (len (qstrs ), ident , qstr )
7156
7257 # process the qstrs, printing out the generated C header file
7358 print ('// This file was automatically generated by makeqstrdata.py' )
7459 print ('' )
75- for order , ident , qstr , conditional in sorted (qstrs .values (), key = lambda x : x [0 ]):
60+ for order , ident , qstr in sorted (qstrs .values (), key = lambda x : x [0 ]):
7661 qhash = compute_hash (qstr )
7762 qlen = len (qstr )
78- if conditional :
79- print (conditional )
8063 print ('Q({}, (const byte*)"\\ x{:02x}\\ x{:02x}\\ x{:02x}\\ x{:02x}" "{}")' .format (ident , qhash & 0xff , (qhash >> 8 ) & 0xff , qlen & 0xff , (qlen >> 8 ) & 0xff , qstr ))
81- if conditional :
82- print ('#endif' )
8364
8465 return True
8566
0 commit comments