2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

Merge branch 'python3-new' of ssh://expo.survex.com/home/expo/troggle into python3-new

This commit is contained in:
Philip Sargent 2021-12-30 01:01:07 +00:00
commit 1da2be03e6

View File

@ -130,6 +130,10 @@ class LoadingSurvex():
rx_star = re.compile(r'(?i)\s*\*[\s,]*(\w+)\s*(.*?)\s*(?:;.*)?$')
rx_starref = re.compile(r'(?i)^\s*\*ref[\s.:]*((?:19[6789]\d)|(?:20[0123]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
rx_argsref = re.compile(r'(?i)^[\s.:]*((?:19[6789]\d)|(?:20[0123]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
rx_ref2 = re.compile(r'(?i)\s*ref[.;]?')
rx_ref3 = re.compile(r'(?i)\s*wallet[.;]?')
# This interprets the survex "*data normal" command which sets out the order of the fields in the data, e.g.
# *DATA normal from to length gradient bearing ignore ignore ignore ignore
@ -760,13 +764,18 @@ class LoadingSurvex():
def LoadSurvexComment(self, survexblock, comment):
# ignore all comments except ;ref, ; wallet and ;QM and ;*include (for collated survex file)
# rx_ref2 = re.compile(r'(?i)\s*ref[.;]?')
# rx_ref3 = re.compile(r'(?i)\s*wallet[.;]?')
refline = self.rx_commref.match(comment)
if refline:
comment = re.sub('(?i)\s*ref[.;]?',"",comment.strip())
#comment = re.sub('(?i)\s*ref[.;]?',"",comment.strip())
comment = self.rx_ref2.sub("",comment.strip())
self.LoadSurvexRef(survexblock, comment)
walletline = self.rx_wallet.match(comment)
if walletline:
comment = re.sub('(?i)\s*wallet[.;]?',"",comment.strip())
#comment = re.sub('(?i)\s*wallet[.;]?',"",comment.strip())
comment = self.rx_ref3.sub("",comment.strip())
self.LoadSurvexRef(survexblock, comment)
implicitline = self.rx_implicit.match(comment)
if implicitline:
@ -1287,9 +1296,16 @@ def FindAndLoadSurvex(survexblockroot):
# line is held in memory at a time:
with open(collatefilename, "r") as fcollate:
svxlines = fcollate.read().splitlines()
#pr2 = cProfile.Profile()
#pr2.enable()
#----------------------------------------------------------------
svx_load.LinearLoad(survexblockroot,survexfileroot.path, svxlines)
#----------------------------------------------------------------
#pr2.disable()
# with open('LinearLoad.prof', 'w') as f:
# ps = pstats.Stats(pr2, stream=f)
# ps.sort_stats(SortKey.CUMULATIVE)
# ps.print_stats()
print("\n - MEM:{:7.2f} MB STOP".format(mem1),file=sys.stderr)
print(" - MEM:{:7.3f} MB USED".format(mem1-mem0),file=sys.stderr)