source: proto/Compiler/workspace/prototype.py @ 668

Last change on this file since 668 was 668, checked in by ksherdy, 9 years ago

Fix print_aligned_streams.

File size: 1.0 KB
Line 
1# -*- coding: utf-8 -*-
2#
3# prototype.py
4#
5# Parallel Prototype Skeleton
6#
7# Ken Herdy
8# Oct. 13, 2010
9#
10#----------------------------------------------------------------------------
11#
12# We use python's unlimited precision integers for unbounded bit streams.
13# This permits simple logical operations on the entire stream.
14# Assumption: bitstreams are little-endian (e.g., as on x86).
15#
16#----------------------------------------------------------------------------
17#
18
19import bitutil
20import byteclass
21import sys
22
23filename = "prototype.py"
24
25def XXX(data):
26        """
27        >>> XXX('Expected Value')
28        'Expected Value'
29        """
30        return data
31
32def demo_XXX(data):
33        XXX(data)
34        return data
35
36def main():
37
38        return
39                sys.stderr.write("Usage: " + filename + " <infile> [outfile]\n")
40if __name__ == "__main__":
41        import doctest
42        doctest.testmod()
43
44        if len(sys.argv) < 2:
45
46                sys.exit(2)
47        if len(sys.argv) == 3:
48                outfile = open(sys.argv[2],"w")
49        else: outfile = sys.stdout
50
51        data = bitutil.readfile(sys.argv[1]) 
52
53        result = demo_XXX(data)
54       
55        outfile.write(result)
56        outfile.close()
57
Note: See TracBrowser for help on using the repository browser.