1 # Scan an Apple header file, generating a Python file of generator calls.
4 addpack
.addpack(':tools:bgen:bgen')
5 from scantools
import Scanner
9 OBJECTS
= ("Movie", "Track", "Media", "UserData", "TimeBase", "MovieController")
13 output
= SHORT
+ "gen.py"
14 defsoutput
= LONG
+ ".py"
15 scanner
= MyScanner(input, output
, defsoutput
)
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"
29 if t
in OBJECTS
and m
== "InMode":
31 listname
= t
+ "_methods"
32 return classname
, listname
34 def makeblacklistnames(self
):
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...
53 # bgen gets the argument in/out wrong..
60 def makeblacklisttypes(self
):
62 # I don't think we want to do these
64 # We dont do callbacks yet, so no need for these
66 # Skipped for now, due to laziness
74 # "SampleDescription",
78 # I dont know yet how to do these.
81 # Routine pointers, not yet.
83 "MoviePreviewCallOutUPP",
84 "MovieDrawingCompleteUPP",
90 "MCActionFilterWithRefConUPP",
95 def makerepairinstructions(self
):
97 ([('FSSpec', '*', 'OutMode')], [('FSSpec_ptr', '*', 'InMode')]),
99 # Movie controller creation
100 ([('ComponentInstance', 'NewMovieController', 'ReturnMode')],
101 [('MovieController', '*', 'ReturnMode')]),
104 ([('short', 'resId', 'OutMode'), ('StringPtr', 'resName', 'InMode')],
105 [('dummyshortptr', 'resId', 'InMode'), ('dummyStringPtr', 'resName', 'InMode')]),
108 ([('void', 'params', 'OutMode')], [('mcactionparams', 'params', 'InMode')]),
111 if __name__
== "__main__":