ยปCore Development>Code coverage>Mac/Modules/folder/foldersupport.py

Python code coverage for Mac/Modules/folder/foldersupport.py

#countcontent
1n/a# This script generates a Python interface for an Apple Macintosh Manager.
2n/a# It uses the "bgen" package to generate C code.
3n/a# The function specifications are generated by scanning the mamager's header file,
4n/a# using the "scantools" package (customized for this particular manager).
5n/a
6n/aimport string
7n/a
8n/a# Declarations that change for each manager
9n/aMACHEADERFILE = 'Folders.h' # The Apple header file
10n/aMODNAME = '_Folder' # The name of the module
11n/a
12n/a# The following is *usually* unchanged but may still require tuning
13n/aMODPREFIX = 'Folder' # The prefix for module-wide routines
14n/aINPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
15n/aOUTPUTFILE = MODNAME + "module.c" # The file generated by this program
16n/a
17n/afrom macsupport import *
18n/a
19n/a# Create the type objects
20n/aConstStrFileNameParam = ConstStr255Param
21n/aStrFileName = Str255
22n/aFolderClass = OSTypeType("FolderClass")
23n/a# FolderDesc
24n/aFolderDescFlags = Type("FolderDescFlags", "l")
25n/aFolderLocation = OSTypeType("FolderLocation")
26n/a# FolderRouting
27n/aFolderType = OSTypeType("FolderType")
28n/aRoutingFlags = Type("RoutingFlags", "l")
29n/a
30n/a
31n/aincludestuff = includestuff + """
32n/a#include <Carbon/Carbon.h>
33n/a
34n/a"""
35n/a
36n/aexecfile(string.lower(MODPREFIX) + 'typetest.py')
37n/a
38n/a# From here on it's basically all boiler plate...
39n/a
40n/a# Create the generator groups and link them
41n/amodule = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
42n/a
43n/a# Create the generator classes used to populate the lists
44n/aFunction = OSErrFunctionGenerator
45n/a
46n/a# Create and populate the lists
47n/afunctions = []
48n/aexecfile(INPUTFILE)
49n/a
50n/a# add the populated lists to the generator groups
51n/a# (in a different wordl the scan program would generate this)
52n/afor f in functions: module.add(f)
53n/a
54n/a# generate output (open the output file as late as possible)
55n/aSetOutputFileName(OUTPUTFILE)
56n/amodule.generate()