1#!/usr/bin/env python 2 3""" 4 5(c) 2002, 2003, 2004, 2005 Simon Burton <simon@arrowtheory.com> 6Released under GNU LGPL license. 7 8version 0.xx 9 10""" 11 12 13import sys 14import os 15 16from work_unit import WorkUnit, get_syms 17import ir 18 19 20def mk_tao(CPPFLAGS = "", CPP = "gcc -E", modname = '_yasm', oname = None, YASM_DIR = ".", **options): 21 if oname is None: 22 oname = modname+'.pyx' 23 CPPFLAGS += " -I"+YASM_DIR 24 CPPFLAGS += " -DYASM_PYXELATOR" 25 CPPFLAGS += " -DYASM_LIB_INTERNAL" 26 CPPFLAGS += " -DYASM_BC_INTERNAL" 27 CPPFLAGS += " -DYASM_EXPR_INTERNAL" 28 files = [ 'libyasm.h', 'libyasm/assocdat.h', 'libyasm/bitvect.h' ] 29 30 syms = get_syms( ['yasm'], [YASM_DIR] ) 31 def cb(trans_unit, node, *args): 32 name, file = node.name, node.file 33 return True 34 return name in syms 35 extradefs = "" 36 unit = WorkUnit(files,modname,oname,False,mark_cb=cb,extradefs=extradefs, 37 CPPFLAGS=CPPFLAGS, CPP=CPP, **options) 38 39 40 unit.parse( False ) 41 unit.transform(verbose=False, test_parse=False, test_types=False) 42 unit.output() 43 44def main(): 45 options = {} 46 for i,arg in enumerate(sys.argv[1:]): 47 if arg.count('='): 48 key,val = arg.split('=', 1) 49 options[key]=val 50 mk_tao(**options) 51 52if __name__=="__main__": 53 main() 54 55 56 57 58