Exemplo n.º 1
0
        # Count line breaks
        l = cls.do_account(s)
        sys.stdout.write('\n' * l)

debug = False

if 'PLATDEBUG' in os.environ:
    debug = True

if len(sys.argv) == 1 or not 'PLATCACHE' in os.environ:
    print >> sys.stderr, 'Usage: PLATCACHE="file" process-source.py <source-file>'
    sys.exit(1)

plat_funcs = {}
try:
    plat_funcs = PlatCache.read()
except Exception as e:
    print >> sys.stderr, "Couldn't read PLATAPI cache file %s: %s" % (os.environ['PLATCACHE'], str(e))
    sys.exit(1)

source_fn = sys.argv[1]
source_file = file(source_fn, 'r')

if debug:
    print >> sys.stderr, 'Processing %s' % source_fn

source = source_file.read()
old_pos, pos = 0, 0
func_pos = 0
brace_pos = 0
decl_end_pos = 0
Exemplo n.º 2
0
debug = False

if 'PLATDEBUG' in os.environ:
    debug = True

if len(sys.argv) == 1 or not 'PLATCACHE' in os.environ:
    print >> sys.stderr, 'Usage: PLATCACHE="file" parse-include.py <include-file>'
    sys.exit(1)

for include_fn in sys.argv[1:]:
    include_file = file(include_fn, 'r')
    
    plat_funcs = {}
    
    PlatCache.delete(include_fn)
    
    if debug:
        print >> sys.stderr, 'Parsing %s' % str(include_fn)
    
    include = include_file.read()
    func_list = PlatFunction.re.findall(include)
    
    for ret_type, name, args in func_list:
        func = PlatFunction(name, ret_type, include_fn)
        
        plat_funcs[name] = func
        
        if debug:
            print >> sys.stderr, '\tFUNC %s' % func.name