Changeset 669 for proto/Compiler


Ignore:
Timestamp:
Oct 20, 2010, 6:09:10 PM (9 years ago)
Author:
ksherdy
Message:

Update demo prototype.

Location:
proto/Compiler/workspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/workspace/bitutil.py

    r668 r669  
    1818#
    1919#----------------------------------------------------------------------------
    20 #
     20#
     21import os
    2122import sys
    2223import codecs
     
    137138        label_max = max([len(p[0]) for p in stream_list])
    138139        for p in stream_list:
    139                 aligned_streams += (p[0] + " "*(label_max - len(p[0]))) + ": " + p[1] + "\n"
     140                aligned_streams += (p[0] + " "*(label_max - len(p[0]))) + ": " + p[1] + os.linesep
    140141        return aligned_streams
    141142
  • proto/Compiler/workspace/prototype.py

    r668 r669  
    3737
    3838        return
    39                 sys.stderr.write("Usage: " + filename + " <infile> [outfile]\n")
     39       
    4040if __name__ == "__main__":
    4141        import doctest
    4242        doctest.testmod()
    4343
    44         if len(sys.argv) < 2:
    45 
     44        if len(sys.argv) < 1:
     45                sys.stderr.write("Usage: " + filename + "\n")
    4646                sys.exit(2)
    47         if len(sys.argv) == 3:
    48                 outfile = open(sys.argv[2],"w")
    49         else: outfile = sys.stdout
    5047
    5148        data = bitutil.readfile(sys.argv[1])
     49        demo_validate_number(data)
    5250
    53         result = demo_XXX(data)
    54        
    55         outfile.write(result)
    56         outfile.close()
    57 
Note: See TracChangeset for help on using the changeset viewer.