More installation info. Bump alpha version.
[python/dscho.git] / Mac / Modules / ah / ahsupport.py
bloba1e6d00ac4779281ecbe354a79d3b9dde738fb98
1 # This script generates a Python interface for an Apple Macintosh Manager.
2 # It uses the "bgen" package to generate C code.
3 # The function specifications are generated by scanning the mamager's header file,
4 # using the "scantools" package (customized for this particular manager).
6 import string
8 # Declarations that change for each manager
9 MACHEADERFILE = 'AppleHelp.h' # The Apple header file
10 MODNAME = '_AH' # The name of the module
12 # The following is *usually* unchanged but may still require tuning
13 MODPREFIX = 'Ah' # The prefix for module-wide routines
14 INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
15 OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
17 from macsupport import *
19 # Create the type objects
20 AHTOCType = Type("AHTOCType", "h")
22 includestuff = includestuff + """
23 #ifdef WITHOUT_FRAMEWORKS
24 #include <AppleHelp.h>
25 #else
26 #include <Carbon/Carbon.h>
27 #endif
29 """
31 # From here on it's basically all boiler plate...
33 # Create the generator groups and link them
34 module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
36 # Create the generator classes used to populate the lists
37 Function = OSErrFunctionGenerator
39 # Create and populate the lists
40 functions = []
41 execfile(INPUTFILE)
43 # add the populated lists to the generator groups
44 # (in a different wordl the scan program would generate this)
45 for f in functions: module.add(f)
47 # generate output (open the output file as late as possible)
48 SetOutputFileName(OUTPUTFILE)
49 module.generate()