[mod_term] Bring back play_macro function
This commit is contained in:
parent
6eda583880
commit
1272cc1549
@ -430,6 +430,27 @@ class FileChooser():
|
|||||||
finally:
|
finally:
|
||||||
self.droid.fullDismiss()
|
self.droid.fullDismiss()
|
||||||
|
|
||||||
|
def play_macro(mname, elm):
|
||||||
|
global macro
|
||||||
|
global var
|
||||||
|
global stack
|
||||||
|
|
||||||
|
if mname in stack:
|
||||||
|
print 'Error: recursion prohibited:', mname
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
stack.append(mname)
|
||||||
|
|
||||||
|
for l in macro[mname]:
|
||||||
|
|
||||||
|
if l in macro.keys():
|
||||||
|
play_macro(l, elm)
|
||||||
|
continue
|
||||||
|
|
||||||
|
proc_line( l, elm )
|
||||||
|
|
||||||
|
stack.remove(mname)
|
||||||
|
|
||||||
def run_init_function(mname, elm):
|
def run_init_function(mname, elm):
|
||||||
global var
|
global var
|
||||||
|
|
||||||
@ -445,6 +466,8 @@ def run_init_function(mname, elm):
|
|||||||
elm.set_iso_addr(var['$addr'], {'protocol': 'PRNA2000'})
|
elm.set_iso_addr(var['$addr'], {'protocol': 'PRNA2000'})
|
||||||
else:
|
else:
|
||||||
elm.set_iso_addr(var['$addr'], {})
|
elm.set_iso_addr(var['$addr'], {})
|
||||||
|
else:
|
||||||
|
print("Unrecognized init command: ", mname)
|
||||||
|
|
||||||
def term_cmd( c, elm ):
|
def term_cmd( c, elm ):
|
||||||
global var
|
global var
|
||||||
@ -687,6 +710,9 @@ def proc_line( l, elm ):
|
|||||||
if l.startswith("init"):
|
if l.startswith("init"):
|
||||||
run_init_function(l, elm)
|
run_init_function(l, elm)
|
||||||
return
|
return
|
||||||
|
elif l in macro.keys():
|
||||||
|
play_macro(l, elm)
|
||||||
|
return
|
||||||
|
|
||||||
m = re.search('\$\S+\s*=\s*\S+', l)
|
m = re.search('\$\S+\s*=\s*\S+', l)
|
||||||
if m:
|
if m:
|
||||||
@ -836,6 +862,8 @@ def main():
|
|||||||
if auto_macro != '':
|
if auto_macro != '':
|
||||||
if auto_macro.startswith("init"):
|
if auto_macro.startswith("init"):
|
||||||
run_init_function(auto_macro, elm)
|
run_init_function(auto_macro, elm)
|
||||||
|
elif auto_macro in macro.keys():
|
||||||
|
play_macro( auto_macro, elm )
|
||||||
else:
|
else:
|
||||||
print 'Error: unknown macro name:', auto_macro
|
print 'Error: unknown macro name:', auto_macro
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user