Ditched '_find_SET()', since it was a no-value-added wrapper around
[python/dscho.git] / Mac / Modules / qt / qtscan.py
blobce79380e005d010ff9933cf79b465fe96f5aec4e
1 # Scan an Apple header file, generating a Python file of generator calls.
3 import sys
4 import os
5 BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
6 sys.path.append(BGENDIR)
7 from scantools import Scanner
8 from bgenlocations import TOOLBOXDIR
10 LONG = "QuickTime"
11 SHORT = "qt"
12 OBJECTS = ("Movie", "Track", "Media", "UserData", "TimeBase", "MovieController")
14 def main():
15 input = "Movies.h"
16 output = SHORT + "gen.py"
17 defsoutput = TOOLBOXDIR + LONG + ".py"
18 scanner = MyScanner(input, output, defsoutput)
19 scanner.scan()
20 scanner.close()
21 print "=== Done scanning and generating, now importing the generated code... ==="
22 exec "import " + SHORT + "support"
23 print "=== Done. It's up to you to compile it now! ==="
25 class MyScanner(Scanner):
27 def destination(self, type, name, arglist):
28 classname = "Function"
29 listname = "functions"
30 if arglist:
31 t, n, m = arglist[0]
32 if t in OBJECTS and m == "InMode":
33 classname = "Method"
34 listname = t + "_methods"
35 return classname, listname
37 def writeinitialdefs(self):
38 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
40 def makeblacklistnames(self):
41 return [
42 "DisposeMovie", # Done on python-object disposal
43 "DisposeMovieTrack", # ditto
44 "DisposeTrackMedia", # ditto
45 "DisposeUserData", # ditto
46 # "DisposeTimeBase", # ditto
47 "DisposeMovieController", # ditto
49 # The following 4 use 'void *' in an uncontrolled way
50 # TBD when I've read the manual...
51 "GetUserDataItem",
52 "SetUserDataItem",
53 "SetTextSampleData",
54 "BeginFullScreen",
55 # bgen gets the argument in/out wrong..
56 "AddTextSample",
57 "AddTESample",
58 "AddHiliteSample",
59 "HiliteTextSample",
61 "MakeTrackTimeTable", # Uses long * return?
62 "MakeMediaTimeTable", # ditto
63 ## "VideoMediaGetStallCount", # Undefined in CW Pro 3 library
66 def makeblacklisttypes(self):
67 return [
68 # I don't think we want to do these
69 "QTSyncTaskPtr",
70 # We dont do callbacks yet, so no need for these
71 "QTCallBack",
72 # Skipped for now, due to laziness
73 "TrackEditState",
74 "MovieEditState",
75 "MatrixRecord",
76 "MatrixRecord_ptr",
77 "SampleReferencePtr",
78 "QTTweener",
80 # Routine pointers, not yet.
81 "MoviesErrorUPP",
82 "MoviePreviewCallOutUPP",
83 "MovieDrawingCompleteUPP",
84 "QTCallBackUPP",
85 "TextMediaUPP",
86 "MovieProgressUPP",
87 "MovieRgnCoverUPP",
88 "MCActionFilterUPP",
89 "MCActionFilterWithRefConUPP",
90 "GetMovieUPP",
91 "ModalFilterUPP",
92 "TrackTransferUPP",
93 "QTAtomContainer",
94 "SpriteWorld",
95 "Sprite",
98 def makerepairinstructions(self):
99 return [
100 ([('FSSpec', '*', 'OutMode')], [('FSSpec_ptr', '*', 'InMode')]),
102 # Movie controller creation
103 ([('ComponentInstance', 'NewMovieController', 'ReturnMode')],
104 [('MovieController', '*', 'ReturnMode')]),
106 # NewMovieFromFile
107 ([('short', 'resId', 'OutMode'), ('StringPtr', 'resName', 'InMode')],
108 [('short', 'resId', 'InOutMode'), ('dummyStringPtr', 'resName', 'InMode')]),
110 # MCDoAction and more
111 ([('void', '*', 'OutMode')], [('mcactionparams', '*', 'InMode')]),
115 if __name__ == "__main__":
116 main()