]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/auxiliar/ref_check.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / auxiliar / ref_check.py
index 8050272d9fbed687e44f79b3076912fff400b564..33a610d9c0bb5873f5faf0bdb4f9d759a5721889 100755 (executable)
@@ -46,13 +46,20 @@ class CrossRefs:
   def addNode(self, nodeName, manualName, fileName):
     global returnCode
 #    print "Node: ", nodeName, " in ", manualName, " found in ", fileName
+    if "\\" in nodeName:
+      returnCode = 1
+      print "nodeName: ", nodeName, " in ", fileName, " contains backslash"
     if manualName+"/"+nodeName in self.Nodes.keys():
-      print "Error: Duplicate nodename ",nodeName, " in ", fileName, " and ", self.Nodes[manualName+nodeName]
+      print "Error: Duplicate nodename ",nodeName, " in ", fileName, " and ", self.Nodes[manualName+"/"+nodeName][1]
       returnCode=1
     self.Nodes[manualName + "/" + nodeName] = [manualName, fileName]
     self.nodeNames[nodeName] = fileName
 
   def addRef(self, toManualName, toHeading, inFileName):
+    global returnCode
+    if "\\" in toHeading:
+      returnCode = 1
+      print "ref to: ", toHeading, " in ", inFileName, " contains backslash"
 #    if inFileName == "notation/vocal.itely":
 #      print "Ref to ", toManualName, "/",toHeading, " found in ", inFileName
     self.Refs.append([toManualName + "/" + toHeading, inFileName])
@@ -94,7 +101,11 @@ class File:
     """ Process File """
 
     skip = False
-    myfile = open(self.fullFileName, 'r')
+    try:
+      myfile = open(self.fullFileName, 'r')
+    except IOError:
+      print "File ", self.fullFileName, " referenced in ", File.CurrentManualName, " but not found"
+      return
     remainderLine = ""
     lineNo = 0
     for line in myfile:
@@ -107,7 +118,7 @@ class File:
           if words[0] == "@end" and (words[1].find("ignore") >= 0 or words[1].find("macro") >= 0):
             skip = False
 
-        if not skip and words[0].find("@c") < 0:
+        if not skip and words[0] != "@c":
           if words[0].find("@defManual") >= 0:
             # Manual definition found - extract manual name and refManual string
             manualName = words[1]
@@ -154,7 +165,7 @@ class File:
             if refStart >= 0:
               refFound = True
               if actualToManualName == File.CurrentManualName:
-                print "Warning: xref should be internal around line ", lineNo, " in ", self.fileName
+                print "Warning: should xref be internal around line ", lineNo, " in ", self.fileName, "?"
               twoLines = twoLines[refStart:]
               refNodeStart = twoLines.find("{") + 1
               # TODO Need to check here for nested {}
@@ -181,4 +192,4 @@ crossRefs = CrossRefs()
 topFile.read(crossRefs)
 crossRefs.check()
 if returnCode > 0:
-  print "Errors found: status code: ",returnCode
\ No newline at end of file
+  print "Errors found: status code: ",returnCode