+
+def niceerror (s):
+ return bg ('yellow') + fg ('red') + s + attr (0)
+
+def nicemeaning (s):
+ return attr ('bold') + s + attr (0)
+
+def nicetag (ds):
+ if type (ds) == int:
+ ds = 'tag 0x%02x' % ds
+ return fg ('green') + ds + attr (0)
+
+def nicecontlen (ds, depth):
+ if type (ds) == int:
+ ds = str (ds)
+ return fg ('magenta') + '#' * depth + ds + attr (0)
+
+def nicetagofs (ds):
+ if type (ds) == int:
+ ds = str (ds)
+ return fg ('cyan') + '@' + ds + attr (0)
+
+def nicenesting (ad):
+ if type (ad) == type ([]):
+ ad = len (ad)
+ return fg ('light_blue') + '^' + str (ad) + attr (0)
+
+def niceclass (ds):
+ if type (ds) == int:
+ ds = class2str [ds]
+ return attr ('dim') + ds + attr (0)
+
+def niceprimconstr (ds):
+ if type (ds) == bool:
+ ds = int (ds)
+ if type (ds) == int:
+ ds = pc2str [ds]
+ return attr ('dim') + ds + attr (0)
+
+der = open (args [0], 'r').read (65537)
+ofs = 0
+
+def eof ():
+ global ofs, der
+ return ofs >= len (der)
+
+def read1 ():
+ global ofs, der
+ if eof ():
+ print 'ATTEMPTED READ BEYOND EOF (RETURNING 0x00)'
+ return 0
+ else:
+ ofs = ofs + 1
+ return ord (der [ofs-1])
+
+nesting = []
+