"Fossies" - the Fresh Open Source Software Archive

Member "ncc-2.8/scripts/nccstrip.py" (15 Dec 2004, 911 Bytes) of package /linux/privat/old/ncc-2.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/env python
    2 """I'd rather we did this in perl because
    3 it is strictly a practical extraction and report
    4 application. Anyway, this compresses nccout files
    5 by removing duplicate data as structure declarations
    6 from header files which are reported in every source
    7 file."""
    8 
    9 import sys
   10 
   11 have = {}
   12 
   13 def getsub (line, set):
   14     TS = ''
   15     TL = [ line ]
   16     for j in sys.stdin:
   17         if j[0] not in set:
   18             break
   19     j = j[:-1]
   20     TS += j
   21     TL.append (j)
   22     if line in have:
   23     X = have [line]
   24     if type(X) == type (''):
   25         if X == TS:
   26         return
   27         have [line] = [X, TS]
   28     else:
   29         for k in have [line]:
   30             if k == TS:
   31             return
   32         have [line].append (TS)
   33     else:
   34     have [line] = TS
   35     for j in TL:
   36     print j;
   37     print
   38 
   39 for i in sys.stdin:
   40     if i [0] == '#':
   41     continue
   42     if i [0] == 'D':
   43     getsub (i[:-1], 'FgGsS')
   44     elif i [0] == 'P':
   45     getsub (i[:-1], 'YL')
   46     else:
   47     print i[:-1]
   48