blob: 39b5a0552afc4d7d681a89ead5accaebfc3044a4 [file] [log] [blame]
Jack Jansene2ba8732002-11-22 14:58:35 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
3import sys
4import os
5from bgenlocations import TOOLBOXDIR, BGENDIR
6sys.path.append(BGENDIR)
7from scantools import Scanner_OSX
8
9LONG = "Folders"
10SHORT = "folder"
11OBJECT = "NOTUSED"
12
13def main():
14 input = LONG + ".h"
15 output = SHORT + "gen.py"
16 defsoutput = TOOLBOXDIR + LONG + ".py"
17 scanner = MyScanner(input, output, defsoutput)
18 scanner.scan()
19 scanner.close()
20 scanner.gentypetest(SHORT+"typetest.py")
21 print "=== Testing definitions output code ==="
22 execfile(defsoutput, {}, {})
23 print "=== Done scanning and generating, now importing the generated code... ==="
24 exec "import " + SHORT + "support"
25 print "=== Done. It's up to you to compile it now! ==="
26
27class MyScanner(Scanner_OSX):
28
29 def destination(self, type, name, arglist):
30 classname = "Function"
31 listname = "functions"
32 if arglist:
33 t, n, m = arglist[0]
34 # This is non-functional today
35 if t == OBJECT and m == "InMode":
36 classname = "Method"
37 listname = "methods"
38 return classname, listname
39
40 def makeblacklistnames(self):
41 return [
42 "FindFolderExtended", # Has funny void* argument
43 "FSFindFolderExtended", # ditto
44 "FolderManagerRegisterCallNotificationProcs", # ditto
45
46 "FindFolderEx", # Non-MacOS routine
47 ]
48
49 def makeblacklisttypes(self):
50 return [
51 "FolderManagerNotificationProcPtr",
52 "FolderManagerNotificationUPP",
53 "FolderRouting", # To be done, not difficult
54 "FolderDesc", # To be done, not difficult
55
56 ]
57
58 def makerepairinstructions(self):
59 return [
60 ]
61
62 def writeinitialdefs(self):
63 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
64 self.defsfile.write("true = True\n")
65 self.defsfile.write("false = False\n")
66
67if __name__ == "__main__":
68 main()