summaryrefslogtreecommitdiffstats
path: root/parsers/survex.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/survex.py')
-rw-r--r--parsers/survex.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/parsers/survex.py b/parsers/survex.py
index 5f23c5c..ebf1cb0 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -162,7 +162,7 @@ def RecursiveLoad(survexblock, survexfile, fin):
global callcount
global survexlegsnumber
- print(insp+" - MEM:{} Reading. parent:{} <> {} ".format(get_process_memory(),survexblock.survexfile.path,survexfile.path))
+ print(insp+" - MEM:{:.3f} Reading. parent:{} <> {} ".format(get_process_memory(),survexblock.survexfile.path,survexfile.path))
stamp = datetime.now()
lineno = 0
@@ -181,6 +181,8 @@ def RecursiveLoad(survexblock, survexfile, fin):
survexfile.cave = cave
svxlines = ''
svxlines = fin.read().splitlines()
+ # cannot close file now as it may be recursively called with the same file id fin if nested *begin
+ # occurs.
for svxline in svxlines:
lineno += 1
# break the line at the comment
@@ -341,20 +343,23 @@ def RecursiveLoad(survexblock, survexfile, fin):
survexblockdown.save()
survexblock.save()
survexblock = survexblockdown
+ print(insp+" - ENTERING nested *begin/*end block: {}".format(name))
insp += "> "
RecursiveLoad(survexblockdown, survexfile, fin)
#--------------------------------------------------------
# do not close the file as there may be more blocks in this one
+ # and it is re-read afresh with every nested begin-end block.
insp = insp[2:]
else:
iblankbegins += 1
elif re.match("end$(?i)", cmd):
if iblankbegins:
+ print(insp+" - RETURNING from nested *begin/*end block: {}".format(line))
iblankbegins -= 1
else:
legsinblock = survexlegsnumber - previousnlegs
- print(insp+"LEGS: {} (previous: {}, now:{})".format(legsinblock,previousnlegs,survexlegsnumber))
+ print(insp+" - LEGS: {} (previous: {}, now:{})".format(legsinblock,previousnlegs,survexlegsnumber))
survexblock.legsall = legsinblock
survexblock.save()
endstamp = datetime.now()