]> thyrsus.com Git - comparator.git/commitdiff
All correct, except for the odd-chunk-out.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 30 Aug 2003 00:06:12 +0000 (00:06 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 30 Aug 2003 00:06:12 +0000 (00:06 +0000)
filterator
shredtree.c

index 81c4f6b67c1c119c22646d213bf66824c082286a..ddb2f7f6e26776d96ba6922b53018850d3522591 100755 (executable)
@@ -8,9 +8,11 @@ import os, sys, re, getopt
 shredline = re.compile("-> ([^:]*):([0-9]+)-([0-9]+)")
 
 # Tokens to be removed when checking whether a shred is significant
-C_junk = [r'\bbreak\b', r'\bcontinue\b', r'\bdefault\b',
-          r'\belse\b', r'\bif\b', r'\bgoto\b', r'\breturn\b',
-          r'\bint\b', r'\blong\b', r'\bshort\b', r'\bstatic\b', r'\bvoid\b',
+C_junk = [r'\bbreak\b',  r'\bcase\b',r'\bcontinue\b', r'\bdefault\b',
+          r'\bdo\b', r'\belse\b', r'\bif\b', r'\bgoto\b', r'\breturn\b',
+          r'\bswitch\b', r'\bwhile\b',
+          r'enum', r'\bint\b', r'\blong\b', r'\bshort\b', r'\bstatic\b',
+          r'\bstruct\b', r'typedef', r'\bunion\b', r'\bvoid\b',
           r'#define',r'#endif',r'#else',r'#if\b',r'#ifdef\b',r'#ifndef\b', 
           r'/\*+', r'\*+/', r'\*+',
           r'\b0\b', r'\b1\b',
@@ -35,8 +37,8 @@ def nontrivial(text):
     # there is still an identifier with a name longer than one char left,
     # we're looking at something that might be interesting.
     text = ' ' + text
-    for ch in ('{','}', '(',')',
-               ';', ':', ',',
+    for ch in ('{','}', '(',')','<','>',
+               ';', ':', ',','%','^','&','|','*','?',
                '+', '-', '/', '=', '!', '\n','\t'):
         text = text.replace(ch, ' ')
     while True:
index 00290b1eb29e7f3e56276af2343ef4ce534d10c4..2315b116e4b971c274fbb281e352b144dc73805f 100644 (file)
@@ -68,6 +68,7 @@ static void emit_chunk(shred *display, int linecount)
        for (i = 0; i < shredsize; i++)
            if (display[i].line)
            {
+               putchar('"');
                for (cp = display[i].line; *cp; cp++)
                    if (*cp == '\n')
                        fputs("\\n", stdout);
@@ -75,6 +76,7 @@ static void emit_chunk(shred *display, int linecount)
                        fputs("\\t", stdout);
                    else
                        putchar(*cp);
+               putchar('"');
                putchar('\n');
            }    
     }
@@ -229,8 +231,6 @@ main(int argc, char *argv[])
     /* make file list */
     ftw(argv[optind], treewalker, 16);
 
-    printf("Filecount: %d\n", filecount);
-
     /* now that we know the length, copy into an array */
     list = place = (char **)calloc(sizeof(char *), filecount);
     for (; head->next; head = head->next)