]> thyrsus.com Git - comparator.git/commitdiff
Ready to ship the fixed version.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 12 Sep 2003 10:17:48 +0000 (10:17 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 12 Sep 2003 10:17:48 +0000 (10:17 +0000)
scf-standard.xml
shredcompare.py
shredtree.py

index f0a7bf6f05a67309f5f5d0bcd050a13b1f9a3563..ee128d92daba399924f66664c28e37bdb882ffbf 100644 (file)
@@ -324,10 +324,15 @@ comparisons.</para>
 </varlistentry>
 </variablelist>
 
-<para>The data section consists of a sequence of range sets.  Each range set
-consists of two or more ranges followed by a line containing a %%\n
-section marker.  A range is represented as three tab-separated fields:
-filename, start line, and end line.  Line numbers are 1-origin.</para>
+<para>The data section consists of a statistics block followed by a
+sequence of range sets.  The statistics block consists of ant number 
+of count lines followed by a %%\n section marker. Each linecount line
+consists of two colon-separated fields, a tree name and a line count.</para>
+
+<para>Each range set consists of two or more ranges followed by a line
+containing a %%\n section marker.  A range is represented as three
+tab-separated fields: filename, start line, and end line.  Line
+numbers are 1-origin.</para>
 
 <para>The natural sort order for range sets is by filename, then by
 start line, then by end line.  Ranges within range sets should be
index 69a259ecd0f50827b74e4022a58bbd57468c560f..49d2d8357fab78f28a300930b54ae4b92ce89ba9 100755 (executable)
@@ -9,6 +9,7 @@ class SCF:
     def __init__(self, name):
         self.name = name
         self.fp = open(name)
+        shif.totallines = 0
         self.comments = []
         self.hashcount = 0
         id = self.fp.readline()
@@ -100,6 +101,7 @@ def merge_hashes(shif, dict):
         shif.hashcount += 1
         if hashcount % 10000 == 0:
             sys.stderr.write("\b\b\b%02.0f%%" % (shif.fp.tell() / (total * 0.01)))
+    (shif.totallines,) = struct.unpack("!i", shif.fp.read(4))
     return True
 
 def item_factory(db):
@@ -239,12 +241,15 @@ if __name__ == '__main__':
     print "After sorting:", matches
     report_time("Reduction done")
     # OK, dump all matches.
-    print "#SCF-B 1.0"
+    print "#SCF-B 1.1"
     print "Hash-Method: MD5"
     print "Normalization:", ",".join(shiflist[0].normalization)
-    print "Merge-Program: shredcompare.py 1.0"
+    print "Merge-Program: shredcompare.py 1.1"
     print "Shred-Size: %d" % shiflist[0].shredsize
     print "%%"
+    for shif in shiflist:
+        print "%s:%d" % (shif.name,shif.totallines)
+    print "%%"
     # FIXME: do something appropriate with comments
     for match in matches:
         for range in match:
index 232019aa5cebc4d65812a5f482ee795e9704152b..9a6ebd5bcdbdfda7742188702fb2c19e819f4ab9 100755 (executable)
@@ -99,7 +99,7 @@ if __name__ == '__main__':
         elif opt == '-x':
             debug = True
     if args:
-        print "#SCF-A 1.0"
+        print "#SCF-A 1.1"
         print "Generator-Program: shredtree.py 1.0"
         print "Hash-Method: MD5"
         print "Normalization: %s" % ",".join(normalization);
@@ -108,7 +108,8 @@ if __name__ == '__main__':
         if ws: normalization.append("remove_whitespace")
         if not normalization:
             normalization.append("none")
-        print "%%"        
+        print "%%"
+        totalbytes = 0
         filenames = []
         for root, dirs, files in os.walk(args[0]):
             for file in files:
@@ -118,5 +119,6 @@ if __name__ == '__main__':
         filenames.sort()
         sys.stdout.write(struct.pack("!i", len(filenames)))
         for path in filenames:
-            shredfile(path)
+            totalbytes = totalbytes + shredfile(path)
+        sys.stdout.write(struct.pack("!i", totalbytes))
 # End