#! /usr/bin/env python """List of sources file of Psyco, the Python specializing compiler This script can be used to rebuild various headers.""" class Source: def __init__(self, filename, initname=None): self.filename = filename self.initname = initname class Object(Source): def __init__(self, name, has_init=1): if has_init: initname = 'psy_%s_init' % name else: initname = None Source.__init__(self, 'Objects/p%s.c' % name, initname) class Module(Source): def __init__(self, name): Source.__init__(self, 'Modules/p%s.c' % name, 'psyco_init%s' % name) SRC = [ Source('processor.c', 'psyco_processor_init'), Source('dispatcher.c'), Source('vcompiler.c', 'psyco_compiler_init'), Source('psyco.c'), Source('codemanager.c'), Source('mergepoints.c'), Source('pycencoding.c'), Source('selective.c'), Source('linuxmemchk.c'), Source('Python/pycompiler.c', 'psyco_pycompiler_init'), Source('Python/pbltinmodule.c', 'psyco_bltinmodule_init'), Object('object'), Object('abstract', 0), Object('classobject'), Object('descrobject'), Object('dictobject'), Object('floatobject'), Object('funcobject'), Object('intobject'), Object('iterobject'), Object('listobject'), Object('longobject'), Object('methodobject'), Object('stringobject'), Object('structmember', 0), Object('tupleobject'), Module('array'), Module('math'), ] MAINFILE = 'psyco.c' if __name__ == '__main__': header = """\ /***************************************************************/ /*** Automatically generated support file ***/ /***************************************************************/ /* This file is automatically generated by 'files.py'. DO NOT MODIFY. Changes will be overwritten ! */ """ print 'Rebuilding initialize.h...' f = open('initialize.h', 'w') print >> f, header print >> f, ' /* Do not use this file directly. Only included from psyco.c. */' print >> f print >> f, '#if ALL_STATIC' for s in SRC: if s.filename != MAINFILE: print >> f, '# include "%s"' % s.filename print >> f, '#else /* if !ALL_STATIC */' for s in SRC: if s.initname: print >> f, ' EXTERNFN void %s(void);\t/* %s */' % (s.initname, s.filename) print >> f, '#endif /* !ALL_STATIC */' print >> f print >> f, 'inline void initialize_all_files(void) {' for s in SRC: if s.initname: print >> f, ' %s();\t/* %s */' % (s.initname, s.filename) print >> f, '}' f.close()