Added ref to Misc/NEWS file; added hint to run regen script on Linux.
[python/dscho.git] / Mac / Modules / qt / qtscan.py
blob020c48786cc3702a5c24fb1bdd5f478b5205d30c
1 # Scan an Apple header file, generating a Python file of generator calls.
3 import addpack
4 addpack.addpack(':tools:bgen:bgen')
5 from scantools import Scanner
7 LONG = "QuickTime"
8 SHORT = "qt"
9 OBJECTS = ("Movie", "Track", "Media", "UserData", "TimeBase", "MovieController")
11 def main():
12 input = "Movies.h"
13 output = SHORT + "gen.py"
14 defsoutput = LONG + ".py"
15 scanner = MyScanner(input, output, defsoutput)
16 scanner.scan()
17 scanner.close()
18 print "=== Done scanning and generating, now importing the generated code... ==="
19 exec "import " + SHORT + "support"
20 print "=== Done. It's up to you to compile it now! ==="
22 class MyScanner(Scanner):
24 def destination(self, type, name, arglist):
25 classname = "Function"
26 listname = "functions"
27 if arglist:
28 t, n, m = arglist[0]
29 if t in OBJECTS and m == "InMode":
30 classname = "Method"
31 listname = t + "_methods"
32 return classname, listname
34 def makeblacklistnames(self):
35 return [
36 "DisposeMovie", # Done on python-object disposal
37 "DisposeMovieTrack", # ditto
38 "DisposeTrackMedia", # ditto
39 "DisposeUserData", # ditto
40 "DisposeTimeBase", # ditto
41 "DisposeMovieController", # ditto
42 "GetMovieCreationTime", # type "unsigned long" in C, inparseable
43 "GetMovieModificationTime", # Ditto
44 "GetTrackCreationTime", # ditto
45 "GetTrackModificationTime", # Ditto
46 "GetMediaCreationTime", # ditto
47 "GetMediaModificationTime", # Ditto
48 # The following 4 use 'void *' in an uncontrolled way
49 # TBD when I've read the manual...
50 "GetUserDataItem",
51 "SetUserDataItem",
52 "SetTextSampleData",
53 # bgen gets the argument in/out wrong..
54 "AddTextSample",
55 "AddTESample",
56 "AddHiliteSample",
57 "HiliteTextSample",
60 def makeblacklisttypes(self):
61 return [
62 # I don't think we want to do these
63 "QTSyncTaskPtr",
64 # We dont do callbacks yet, so no need for these
65 "QTCallBack",
66 # Skipped for now, due to laziness
67 "TimeRecord",
68 "TimeRecord_ptr",
69 "TrackEditState",
70 "MovieEditState",
71 "MatrixRecord",
72 "MatrixRecord_ptr",
73 "SampleReferencePtr",
74 # "SampleDescription",
75 # "SoundDescription",
76 # "TextDescription",
77 # "MusicDescription",
78 # I dont know yet how to do these.
79 "CGrafPtr",
80 "GDHandle",
81 # Routine pointers, not yet.
82 "MoviesErrorUPP",
83 "MoviePreviewCallOutUPP",
84 "MovieDrawingCompleteUPP",
85 "QTCallBackUPP",
86 "TextMediaUPP",
87 "MovieProgressUPP",
88 "MovieRgnCoverUPP",
89 "MCActionFilterUPP",
90 "MCActionFilterWithRefConUPP",
91 "GetMovieUPP",
92 "ModalFilterUPP",
95 def makerepairinstructions(self):
96 return [
97 ([('FSSpec', '*', 'OutMode')], [('FSSpec_ptr', '*', 'InMode')]),
99 # Movie controller creation
100 ([('ComponentInstance', 'NewMovieController', 'ReturnMode')],
101 [('MovieController', '*', 'ReturnMode')]),
103 # NewMovieFromFile
104 ([('short', 'resId', 'OutMode'), ('StringPtr', 'resName', 'InMode')],
105 [('dummyshortptr', 'resId', 'InMode'), ('dummyStringPtr', 'resName', 'InMode')]),
107 # MCDoAction
108 ([('void', 'params', 'OutMode')], [('mcactionparams', 'params', 'InMode')]),
111 if __name__ == "__main__":
112 main()