mirror of
https://github.com/Z3Prover/z3
synced 2025-07-03 11:25:40 +00:00
working on new global parameter setting framework
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
0733db382f
commit
c6bd31e01d
1 changed files with 13 additions and 4 deletions
|
@ -1602,6 +1602,8 @@ def mk_mem_initializer_cpp(cnames, path):
|
||||||
fout = open(fullname, 'w')
|
fout = open(fullname, 'w')
|
||||||
fout.write('// Automatically generated file.\n')
|
fout.write('// Automatically generated file.\n')
|
||||||
initializer_pat = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\'\)')
|
initializer_pat = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\'\)')
|
||||||
|
# ADD_INITIALIZER with priority
|
||||||
|
initializer_prio_pat = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\',[ \t]*(-?[0-9]*)\)')
|
||||||
finalizer_pat = re.compile('[ \t]*ADD_FINALIZER\(\'([^\']*)\'\)')
|
finalizer_pat = re.compile('[ \t]*ADD_FINALIZER\(\'([^\']*)\'\)')
|
||||||
for cname in cnames:
|
for cname in cnames:
|
||||||
c = get_component(cname)
|
c = get_component(cname)
|
||||||
|
@ -1615,15 +1617,22 @@ def mk_mem_initializer_cpp(cnames, path):
|
||||||
if not added_include:
|
if not added_include:
|
||||||
added_include = True
|
added_include = True
|
||||||
fout.write('#include"%s"\n' % h_file)
|
fout.write('#include"%s"\n' % h_file)
|
||||||
initializer_cmds.append(m.group(1))
|
initializer_cmds.append((m.group(1), 0))
|
||||||
|
m = initializer_prio_pat.match(line)
|
||||||
|
if m:
|
||||||
|
if not added_include:
|
||||||
|
added_include = True
|
||||||
|
fout.write('#include"%s"\n' % h_file)
|
||||||
|
initializer_cmds.append((m.group(1), int(m.group(2))))
|
||||||
m = finalizer_pat.match(line)
|
m = finalizer_pat.match(line)
|
||||||
if m:
|
if m:
|
||||||
if not added_include:
|
if not added_include:
|
||||||
added_include = True
|
added_include = True
|
||||||
fout.write('#include"%s"\n' % h_file)
|
fout.write('#include"%s"\n' % h_file)
|
||||||
finalizer_cmds.append(m.group(1))
|
finalizer_cmds.append(m.group(1))
|
||||||
|
initializer_cmds.sort(key=lambda tup: tup[1])
|
||||||
fout.write('void mem_initialize() {\n')
|
fout.write('void mem_initialize() {\n')
|
||||||
for cmd in initializer_cmds:
|
for (cmd, prio) in initializer_cmds:
|
||||||
fout.write(cmd)
|
fout.write(cmd)
|
||||||
fout.write('\n')
|
fout.write('\n')
|
||||||
fout.write('}\n')
|
fout.write('}\n')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue