Commit db6c8a01 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b2bd316e
...@@ -121,7 +121,7 @@ class ZCtx(object): ...@@ -121,7 +121,7 @@ class ZCtx(object):
zblk = ZBlk() zblk = ZBlk()
zblk.setblkdata(v) zblk.setblkdata(v)
zctx.valdict[v] = zblk zctx.valdict[v] = zblk
commit('treegen/values -> %r' % valv) commit('treegen/values: init %r' % valv)
# close release resources associated with zctx. # close release resources associated with zctx.
def close(zctx): def close(zctx):
...@@ -138,7 +138,9 @@ class ZCtx(object): ...@@ -138,7 +138,9 @@ class ZCtx(object):
return k return k
raise KeyError("%r not found in value registry" % (vobj,)) raise KeyError("%r not found in value registry" % (vobj,))
# XXX doc
# Trees generates tree structures given their topology encoding on input.
# See top-level documentation for details.
@func @func
def Trees(zstor, r): def Trees(zstor, r):
zctx = ZCtx(zstor) zctx = ZCtx(zstor)
...@@ -147,10 +149,14 @@ def Trees(zstor, r): ...@@ -147,10 +149,14 @@ def Trees(zstor, r):
trees = zctx.root.get('treegen/trees') trees = zctx.root.get('treegen/trees')
if trees is None: if trees is None:
trees = zctx.root['treegen/trees'] = PersistentMapping() trees = zctx.root['treegen/trees'] = PersistentMapping()
commit('mk treegen/trees') commit('treegen/trees: init')
while 1:
treetxt = r.readline()
if treetxt == '':
break # EOF
for treetxt in r.readlines(): treetxt = treetxt.rstrip() # trim trailing \n
treetxt = treetxt.rstrip() # trim trailin \n
tree = zctx.TopoDecode(treetxt) tree = zctx.TopoDecode(treetxt)
ztree = trees[treetxt] = XLOTree() ztree = trees[treetxt] = XLOTree()
zctx.zconn.add(ztree) # so that restructure can see we are working under zconn zctx.zconn.add(ztree) # so that restructure can see we are working under zconn
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment