New script removehyphen.py fixes up the use of \-
authorDavid Anderson <davea42@earthlink.net>
Fri, 3 May 2013 21:21:43 +0000 (14:21 -0700)
committerDavid Anderson <davea42@earthlink.net>
Fri, 3 May 2013 21:21:43 +0000 (14:21 -0700)
by removing them.

dwarf5/tools/fileio.py
dwarf5/tools/removehyphen.py [new file with mode: 0644]

index eb6a19d..feca379 100644 (file)
@@ -66,6 +66,11 @@ def isIndivid(c):
     return "y"
   return "n"
 
+# self._tex        DW\-\_ATE and the like
+# self._underbar   DW\_ATE  and the like
+# self._std   the way a DW_ATE and the like looks in the standard
+# self._label With all _ and - removed.  Like DWATE
+
 class dwtoken:
   """ Token types: 
   id: identifier
diff --git a/dwarf5/tools/removehyphen.py b/dwarf5/tools/removehyphen.py
new file mode 100644 (file)
index 0000000..d106345
--- /dev/null
@@ -0,0 +1,53 @@
+# Copyright 2013 DWARF Debugging Information Format Committee
+#
+# Convert DW\-\_ and names to DW\_ 
+# The \_ turned out not be useful or usable.
+# python removehyphen.py *.tex
+# The output files have .out appended to the name.
+
+import sys
+import fileio
+
+def convertToNonHyphen(s):
+  out = []
+  for c in s:
+    if c == "_":
+      out += ["\\"]
+    out += [c]  
+  os = ''.join(out)
+  return os
+
+def transfunc(linetoks,myfile,linenum):
+  if len(linetoks) < 1:
+    return linetoks
+  outtoks = []
+  for t in linetoks:
+    stdname= ''.join(t._std)
+    if stdname.startswith("DW_") != 0:
+      xs = convertToNonHyphen(stdname)
+      x = fileio.dwtoken()
+      x.insertid(xs)
+      x.finishUpId()
+      outtoks += [x]
+    else:
+      outtoks += [t]
+    # End of for loop.
+  return outtoks
+
+def read_args():
+  cur = 1
+  filelist = []
+  while  len(sys.argv) > cur:
+    v = sys.argv[cur]
+    filelist += [v]
+    cur = int(cur) + 1
+
+  dwf = fileio.readFilelist(filelist)
+  dwf.dwtransformline(transfunc)
+  dwf.dwwrite()
+
+if __name__ == '__main__':
+  read_args()
+  
+
+