| 1 | n/a | # This script generates a Python interface for an Apple Macintosh Manager. |
|---|
| 2 | n/a | # It uses the "bgen" package to generate C code. |
|---|
| 3 | n/a | # The function specifications are generated by scanning the mamager's header file, |
|---|
| 4 | n/a | # using the "scantools" package (customized for this particular manager). |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | #error missing SetActionFilter |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | import string |
|---|
| 9 | n/a | |
|---|
| 10 | n/a | # Declarations that change for each manager |
|---|
| 11 | n/a | MACHEADERFILE = 'Movies.h' # The Apple header file |
|---|
| 12 | n/a | MODNAME = '_Qt' # The name of the module |
|---|
| 13 | n/a | OBJECTNAME = 'Movie' # The basic name of the objects used here |
|---|
| 14 | n/a | |
|---|
| 15 | n/a | # The following is *usually* unchanged but may still require tuning |
|---|
| 16 | n/a | MODPREFIX = 'Qt' # The prefix for module-wide routines |
|---|
| 17 | n/a | OBJECTTYPE = "Movie" # The C type used to represent them |
|---|
| 18 | n/a | OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods |
|---|
| 19 | n/a | INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner |
|---|
| 20 | n/a | OUTPUTFILE = MODNAME + "module.c" # The file generated by this program |
|---|
| 21 | n/a | |
|---|
| 22 | n/a | from macsupport import * |
|---|
| 23 | n/a | |
|---|
| 24 | n/a | # Create the type objects |
|---|
| 25 | n/a | |
|---|
| 26 | n/a | includestuff = includestuff + """ |
|---|
| 27 | n/a | #include <QuickTime/QuickTime.h> |
|---|
| 28 | n/a | |
|---|
| 29 | n/a | |
|---|
| 30 | n/a | #ifdef USE_TOOLBOX_OBJECT_GLUE |
|---|
| 31 | n/a | extern PyObject *_TrackObj_New(Track); |
|---|
| 32 | n/a | extern int _TrackObj_Convert(PyObject *, Track *); |
|---|
| 33 | n/a | extern PyObject *_MovieObj_New(Movie); |
|---|
| 34 | n/a | extern int _MovieObj_Convert(PyObject *, Movie *); |
|---|
| 35 | n/a | extern PyObject *_MovieCtlObj_New(MovieController); |
|---|
| 36 | n/a | extern int _MovieCtlObj_Convert(PyObject *, MovieController *); |
|---|
| 37 | n/a | extern PyObject *_TimeBaseObj_New(TimeBase); |
|---|
| 38 | n/a | extern int _TimeBaseObj_Convert(PyObject *, TimeBase *); |
|---|
| 39 | n/a | extern PyObject *_UserDataObj_New(UserData); |
|---|
| 40 | n/a | extern int _UserDataObj_Convert(PyObject *, UserData *); |
|---|
| 41 | n/a | extern PyObject *_MediaObj_New(Media); |
|---|
| 42 | n/a | extern int _MediaObj_Convert(PyObject *, Media *); |
|---|
| 43 | n/a | |
|---|
| 44 | n/a | #define TrackObj_New _TrackObj_New |
|---|
| 45 | n/a | #define TrackObj_Convert _TrackObj_Convert |
|---|
| 46 | n/a | #define MovieObj_New _MovieObj_New |
|---|
| 47 | n/a | #define MovieObj_Convert _MovieObj_Convert |
|---|
| 48 | n/a | #define MovieCtlObj_New _MovieCtlObj_New |
|---|
| 49 | n/a | #define MovieCtlObj_Convert _MovieCtlObj_Convert |
|---|
| 50 | n/a | #define TimeBaseObj_New _TimeBaseObj_New |
|---|
| 51 | n/a | #define TimeBaseObj_Convert _TimeBaseObj_Convert |
|---|
| 52 | n/a | #define UserDataObj_New _UserDataObj_New |
|---|
| 53 | n/a | #define UserDataObj_Convert _UserDataObj_Convert |
|---|
| 54 | n/a | #define MediaObj_New _MediaObj_New |
|---|
| 55 | n/a | #define MediaObj_Convert _MediaObj_Convert |
|---|
| 56 | n/a | #endif |
|---|
| 57 | n/a | |
|---|
| 58 | n/a | /* Macro to allow us to GetNextInterestingTime without duration */ |
|---|
| 59 | n/a | #define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \ |
|---|
| 60 | n/a | GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL) |
|---|
| 61 | n/a | |
|---|
| 62 | n/a | /* |
|---|
| 63 | n/a | ** Parse/generate time records |
|---|
| 64 | n/a | */ |
|---|
| 65 | n/a | static PyObject * |
|---|
| 66 | n/a | QtTimeRecord_New(TimeRecord *itself) |
|---|
| 67 | n/a | { |
|---|
| 68 | n/a | if (itself->base) |
|---|
| 69 | n/a | return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale, |
|---|
| 70 | n/a | TimeBaseObj_New, itself->base); |
|---|
| 71 | n/a | else |
|---|
| 72 | n/a | return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale, |
|---|
| 73 | n/a | Py_None); |
|---|
| 74 | n/a | } |
|---|
| 75 | n/a | |
|---|
| 76 | n/a | static int |
|---|
| 77 | n/a | QtTimeRecord_Convert(PyObject *v, TimeRecord *p_itself) |
|---|
| 78 | n/a | { |
|---|
| 79 | n/a | PyObject *base = NULL; |
|---|
| 80 | n/a | if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale, |
|---|
| 81 | n/a | &base) ) |
|---|
| 82 | n/a | return 0; |
|---|
| 83 | n/a | if ( base == NULL || base == Py_None ) |
|---|
| 84 | n/a | p_itself->base = NULL; |
|---|
| 85 | n/a | else |
|---|
| 86 | n/a | if ( !TimeBaseObj_Convert(base, &p_itself->base) ) |
|---|
| 87 | n/a | return 0; |
|---|
| 88 | n/a | return 1; |
|---|
| 89 | n/a | } |
|---|
| 90 | n/a | |
|---|
| 91 | n/a | static int |
|---|
| 92 | n/a | QtMusicMIDIPacket_Convert(PyObject *v, MusicMIDIPacket *p_itself) |
|---|
| 93 | n/a | { |
|---|
| 94 | n/a | int dummy; |
|---|
| 95 | n/a | |
|---|
| 96 | n/a | if( !PyArg_ParseTuple(v, "hls#", &p_itself->length, &p_itself->reserved, p_itself->data, dummy) ) |
|---|
| 97 | n/a | return 0; |
|---|
| 98 | n/a | return 1; |
|---|
| 99 | n/a | } |
|---|
| 100 | n/a | |
|---|
| 101 | n/a | |
|---|
| 102 | n/a | |
|---|
| 103 | n/a | """ |
|---|
| 104 | n/a | |
|---|
| 105 | n/a | initstuff = initstuff + """ |
|---|
| 106 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New); |
|---|
| 107 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert); |
|---|
| 108 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New); |
|---|
| 109 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert); |
|---|
| 110 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New); |
|---|
| 111 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert); |
|---|
| 112 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New); |
|---|
| 113 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert); |
|---|
| 114 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New); |
|---|
| 115 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert); |
|---|
| 116 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New); |
|---|
| 117 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert); |
|---|
| 118 | n/a | """ |
|---|
| 119 | n/a | |
|---|
| 120 | n/a | # Our (opaque) objects |
|---|
| 121 | n/a | Movie = OpaqueByValueType('Movie', 'MovieObj') |
|---|
| 122 | n/a | NullMovie = FakeType("(Movie)0") |
|---|
| 123 | n/a | Track = OpaqueByValueType('Track', 'TrackObj') |
|---|
| 124 | n/a | Media = OpaqueByValueType('Media', 'MediaObj') |
|---|
| 125 | n/a | UserData = OpaqueByValueType('UserData', 'UserDataObj') |
|---|
| 126 | n/a | TimeBase = OpaqueByValueType('TimeBase', 'TimeBaseObj') |
|---|
| 127 | n/a | MovieController = OpaqueByValueType('MovieController', 'MovieCtlObj') |
|---|
| 128 | n/a | IdleManager = OpaqueByValueType('IdleManager', 'IdleManagerObj') |
|---|
| 129 | n/a | SGOutput = OpaqueByValueType('SGOutput', 'SGOutputObj') |
|---|
| 130 | n/a | |
|---|
| 131 | n/a | # Other opaque objects |
|---|
| 132 | n/a | Component = OpaqueByValueType('Component', 'CmpObj') |
|---|
| 133 | n/a | MediaHandlerComponent = OpaqueByValueType('MediaHandlerComponent', 'CmpObj') |
|---|
| 134 | n/a | DataHandlerComponent = OpaqueByValueType('DataHandlerComponent', 'CmpObj') |
|---|
| 135 | n/a | CompressorComponent = OpaqueByValueType('CompressorComponent', 'CmpObj') |
|---|
| 136 | n/a | DecompressorComponent = OpaqueByValueType('DecompressorComponent', 'CmpObj') |
|---|
| 137 | n/a | CodecComponent = OpaqueByValueType('CodecComponent', 'CmpObj') |
|---|
| 138 | n/a | |
|---|
| 139 | n/a | # Despite their names, these are all ComponentInstance types |
|---|
| 140 | n/a | GraphicsImportComponent = OpaqueByValueType('GraphicsImportComponent', 'CmpInstObj') |
|---|
| 141 | n/a | GraphicsExportComponent = OpaqueByValueType('GraphicsExportComponent', 'CmpInstObj') |
|---|
| 142 | n/a | ImageTranscoderComponent = OpaqueByValueType('ImageTranscoderComponent', 'CmpInstObj') |
|---|
| 143 | n/a | MovieImportComponent = OpaqueByValueType('MovieImportComponent', 'CmpInstObj') |
|---|
| 144 | n/a | MovieExportComponent = OpaqueByValueType('MovieExportComponent', 'CmpInstObj') |
|---|
| 145 | n/a | TextExportComponent = OpaqueByValueType('TextExportComponent', 'CmpInstObj') |
|---|
| 146 | n/a | GraphicImageMovieImportComponent = OpaqueByValueType('GraphicImageMovieImportComponent', 'CmpInstObj') |
|---|
| 147 | n/a | pnotComponent = OpaqueByValueType('pnotComponent', 'CmpInstObj') |
|---|
| 148 | n/a | # DataCompressorComponent, DataDecompressorComponent would go here |
|---|
| 149 | n/a | DataCodecComponent = OpaqueByValueType('DataCodecComponent', 'CmpInstObj') |
|---|
| 150 | n/a | TweenerComponent = OpaqueByValueType('TweenerComponent', 'CmpInstObj') |
|---|
| 151 | n/a | QTVideoOutputComponent = OpaqueByValueType('QTVideoOutputComponent', 'CmpInstObj') |
|---|
| 152 | n/a | SeqGrabComponent = OpaqueByValueType('SeqGrabComponent', 'CmpInstObj') |
|---|
| 153 | n/a | VideoDigitizerComponent = OpaqueByValueType('VideoDigitizerComponent', 'CmpInstObj') |
|---|
| 154 | n/a | |
|---|
| 155 | n/a | ComponentInstance = OpaqueByValueType('ComponentInstance', 'CmpInstObj') |
|---|
| 156 | n/a | MediaHandler = OpaqueByValueType('MediaHandler', 'CmpInstObj') |
|---|
| 157 | n/a | DataHandler = OpaqueByValueType('DataHandler', 'CmpInstObj') |
|---|
| 158 | n/a | SGChannel = OpaqueByValueType('SGChannel', 'CmpInstObj') |
|---|
| 159 | n/a | TunePlayer = OpaqueByValueType('TunePlayer', 'CmpInstObj') |
|---|
| 160 | n/a | MusicComponent = OpaqueByValueType('MusicComponent', 'CmpInstObj') |
|---|
| 161 | n/a | NoteAllocator = OpaqueByValueType('NoteAllocator', 'CmpInstObj') |
|---|
| 162 | n/a | QTMIDIComponent = OpaqueByValueType('QTMIDIComponent', 'CmpInstObj') |
|---|
| 163 | n/a | |
|---|
| 164 | n/a | ConstFSSpecPtr = FSSpec_ptr |
|---|
| 165 | n/a | GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") |
|---|
| 166 | n/a | Byte = Boolean # XXXX For GetPaused and SetPaused |
|---|
| 167 | n/a | |
|---|
| 168 | n/a | RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") |
|---|
| 169 | n/a | PicHandle = OpaqueByValueType("PicHandle", "ResObj") |
|---|
| 170 | n/a | CTabHandle = OpaqueByValueType("CTabHandle", "ResObj") |
|---|
| 171 | n/a | PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj") |
|---|
| 172 | n/a | SampleDescriptionHandle = OpaqueByValueType("SampleDescriptionHandle", "ResObj") |
|---|
| 173 | n/a | ImageDescriptionHandle = OpaqueByValueType("ImageDescriptionHandle", "ResObj") |
|---|
| 174 | n/a | TextDescriptionHandle = OpaqueByValueType("TextDescriptionHandle", "ResObj") |
|---|
| 175 | n/a | TEHandle = OpaqueByValueType("TEHandle", "ResObj") |
|---|
| 176 | n/a | CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj") |
|---|
| 177 | n/a | GDHandle = OpaqueByValueType("GDHandle", "OptResObj") |
|---|
| 178 | n/a | AliasHandle = OpaqueByValueType("AliasHandle", "ResObj") |
|---|
| 179 | n/a | SoundDescriptionHandle = OpaqueByValueType("SoundDescriptionHandle", "ResObj") |
|---|
| 180 | n/a | VdigBufferRecListHandle = OpaqueByValueType("VdigBufferRecListHandle", "ResObj") |
|---|
| 181 | n/a | VDCompressionListHandle = OpaqueByValueType("VDCompressionListHandle", "ResObj") |
|---|
| 182 | n/a | TimeCodeDescriptionHandle = OpaqueByValueType("TimeCodeDescriptionHandle", "ResObj") |
|---|
| 183 | n/a | DataHFileTypeOrderingHandle = OpaqueByValueType("DataHFileTypeOrderingHandle", "ResObj") |
|---|
| 184 | n/a | QTMIDIPortListHandle = OpaqueByValueType("QTMIDIPortListHandle", "ResObj") |
|---|
| 185 | n/a | GenericKnobDescriptionListHandle = OpaqueByValueType("GenericKnobDescriptionListHandle", "ResObj") |
|---|
| 186 | n/a | InstrumentInfoListHandle = OpaqueByValueType("InstrumentInfoListHandle", "ResObj") |
|---|
| 187 | n/a | # Silly Apple, passing an OStype by reference... |
|---|
| 188 | n/a | OSType_ptr = OpaqueType("OSType", "PyMac_BuildOSType", "PyMac_GetOSType") |
|---|
| 189 | n/a | # And even sillier: passing floats by address |
|---|
| 190 | n/a | float_ptr = ByAddressType("float", "f") |
|---|
| 191 | n/a | |
|---|
| 192 | n/a | RGBColor = OpaqueType("RGBColor", "QdRGB") |
|---|
| 193 | n/a | RGBColor_ptr = RGBColor |
|---|
| 194 | n/a | TimeRecord = OpaqueType("TimeRecord", "QtTimeRecord") |
|---|
| 195 | n/a | TimeRecord_ptr = TimeRecord |
|---|
| 196 | n/a | MusicMIDIPacket = OpaqueType("MusicMIDIPacket", "QtMusicMIDIPacket") |
|---|
| 197 | n/a | MusicMIDIPacket_ptr = MusicMIDIPacket |
|---|
| 198 | n/a | |
|---|
| 199 | n/a | # Non-opaque types, mostly integer-ish |
|---|
| 200 | n/a | TimeValue = Type("TimeValue", "l") |
|---|
| 201 | n/a | TimeScale = Type("TimeScale", "l") |
|---|
| 202 | n/a | TimeBaseFlags = Type("TimeBaseFlags", "l") |
|---|
| 203 | n/a | QTCallBackFlags = Type("QTCallBackFlags", "H") |
|---|
| 204 | n/a | TimeBaseStatus = Type("TimeBaseStatus", "l") |
|---|
| 205 | n/a | QTCallBackType = Type("QTCallBackType", "H") |
|---|
| 206 | n/a | nextTimeFlagsEnum = Type("nextTimeFlagsEnum", "H") |
|---|
| 207 | n/a | createMovieFileFlagsEnum = Type("createMovieFileFlagsEnum", "l") |
|---|
| 208 | n/a | movieFlattenFlagsEnum = Type("movieFlattenFlagsEnum", "l") |
|---|
| 209 | n/a | dataRefAttributesFlags = Type("dataRefAttributesFlags", "l") |
|---|
| 210 | n/a | playHintsEnum = Type("playHintsEnum", "l") |
|---|
| 211 | n/a | mediaHandlerFlagsEnum = Type("mediaHandlerFlagsEnum", "l") |
|---|
| 212 | n/a | ComponentResult = Type("ComponentResult", "l") |
|---|
| 213 | n/a | VideoDigitizerError = Type("ComponentResult", "l") |
|---|
| 214 | n/a | HandlerError = Type("HandlerError", "l") |
|---|
| 215 | n/a | Ptr = InputOnlyType("Ptr", "s") |
|---|
| 216 | n/a | StringPtr = Type("StringPtr", "s") |
|---|
| 217 | n/a | UnsignedLongPtr = Type("unsigned long *", "s") |
|---|
| 218 | n/a | mcactionparams = InputOnlyType("void *", "s") |
|---|
| 219 | n/a | QTParameterDialog = Type("QTParameterDialog", "l") |
|---|
| 220 | n/a | QTAtomID = Type("QTAtomID", "l") |
|---|
| 221 | n/a | MCInterfaceElement = Type("MCInterfaceElement", "l") |
|---|
| 222 | n/a | CodecType = OSTypeType("CodecType") |
|---|
| 223 | n/a | GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj") |
|---|
| 224 | n/a | QTFloatSingle = Type("QTFloatSingle", "f") |
|---|
| 225 | n/a | CodecQ = Type("CodecQ", "l") |
|---|
| 226 | n/a | MusicController = Type("MusicController", "l") |
|---|
| 227 | n/a | |
|---|
| 228 | n/a | # Could-not-be-bothered-types (NewMovieFromFile) |
|---|
| 229 | n/a | dummyshortptr = FakeType('(short *)0') |
|---|
| 230 | n/a | dummyStringPtr = FakeType('(StringPtr)0') |
|---|
| 231 | n/a | |
|---|
| 232 | n/a | # Not-quite-sure-this-is-okay types |
|---|
| 233 | n/a | AtomicInstrument = OpaqueByValueType("AtomicInstrument", "ResObj") |
|---|
| 234 | n/a | AtomicInstrumentPtr = InputOnlyType("AtomicInstrumentPtr", "s") |
|---|
| 235 | n/a | |
|---|
| 236 | n/a | # XXXX Need to override output_tp_newBody() to allow for None initializer. |
|---|
| 237 | n/a | class QtGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition): |
|---|
| 238 | n/a | def outputCheckNewArg(self): |
|---|
| 239 | n/a | # We don't allow NULL pointers to be returned by QuickTime API calls, |
|---|
| 240 | n/a | # in stead we raise an exception |
|---|
| 241 | n/a | Output("""if (itself == NULL) { |
|---|
| 242 | n/a | PyErr_SetString(Qt_Error,"Cannot create %s from NULL pointer"); |
|---|
| 243 | n/a | return NULL; |
|---|
| 244 | n/a | }""", self.name) |
|---|
| 245 | n/a | |
|---|
| 246 | n/a | def outputCheckConvertArg(self): |
|---|
| 247 | n/a | # But what we do allow is passing None whereever a quicktime object is |
|---|
| 248 | n/a | # expected, and pass this as NULL to the API routines. Note you can |
|---|
| 249 | n/a | # call methods too by creating an object with None as the initializer. |
|---|
| 250 | n/a | Output("if (v == Py_None)") |
|---|
| 251 | n/a | OutLbrace() |
|---|
| 252 | n/a | Output("*p_itself = NULL;") |
|---|
| 253 | n/a | Output("return 1;") |
|---|
| 254 | n/a | OutRbrace() |
|---|
| 255 | n/a | |
|---|
| 256 | n/a | class MovieObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 257 | n/a | def outputFreeIt(self, itselfname): |
|---|
| 258 | n/a | Output("if (%s) DisposeMovie(%s);", itselfname, itselfname) |
|---|
| 259 | n/a | |
|---|
| 260 | n/a | class TrackObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 261 | n/a | def outputFreeIt(self, itselfname): |
|---|
| 262 | n/a | Output("if (%s) DisposeMovieTrack(%s);", itselfname, itselfname) |
|---|
| 263 | n/a | |
|---|
| 264 | n/a | class MediaObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 265 | n/a | def outputFreeIt(self, itselfname): |
|---|
| 266 | n/a | Output("if (%s) DisposeTrackMedia(%s);", itselfname, itselfname) |
|---|
| 267 | n/a | |
|---|
| 268 | n/a | class UserDataObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 269 | n/a | def outputFreeIt(self, itselfname): |
|---|
| 270 | n/a | Output("if (%s) DisposeUserData(%s);", itselfname, itselfname) |
|---|
| 271 | n/a | |
|---|
| 272 | n/a | class TimeBaseObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 273 | n/a | pass |
|---|
| 274 | n/a | |
|---|
| 275 | n/a | class MovieCtlObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 276 | n/a | def outputFreeIt(self, itselfname): |
|---|
| 277 | n/a | Output("if (%s) DisposeMovieController(%s);", itselfname, itselfname) |
|---|
| 278 | n/a | |
|---|
| 279 | n/a | class IdleManagerObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 280 | n/a | pass |
|---|
| 281 | n/a | |
|---|
| 282 | n/a | class SGOutputObjectDefinition(QtGlobalObjectDefinition): |
|---|
| 283 | n/a | # XXXX I'm not sure I fully understand how SGOutput works. It seems it's always tied |
|---|
| 284 | n/a | # to a specific SeqGrabComponent, but I'm not 100% sure. Also, I'm not sure all the |
|---|
| 285 | n/a | # routines that return an SGOutput actually return a *new* SGOutput. Need to read up on |
|---|
| 286 | n/a | # this. |
|---|
| 287 | n/a | pass |
|---|
| 288 | n/a | |
|---|
| 289 | n/a | |
|---|
| 290 | n/a | # From here on it's basically all boiler plate... |
|---|
| 291 | n/a | |
|---|
| 292 | n/a | # Create the generator groups and link them |
|---|
| 293 | n/a | module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) |
|---|
| 294 | n/a | Movie_object = MovieObjectDefinition('Movie', 'MovieObj', 'Movie') |
|---|
| 295 | n/a | Track_object = TrackObjectDefinition('Track', 'TrackObj', 'Track') |
|---|
| 296 | n/a | Media_object = MediaObjectDefinition('Media', 'MediaObj', 'Media') |
|---|
| 297 | n/a | UserData_object = UserDataObjectDefinition('UserData', 'UserDataObj', 'UserData') |
|---|
| 298 | n/a | TimeBase_object = TimeBaseObjectDefinition('TimeBase', 'TimeBaseObj', 'TimeBase') |
|---|
| 299 | n/a | MovieController_object = MovieCtlObjectDefinition('MovieController', 'MovieCtlObj', 'MovieController') |
|---|
| 300 | n/a | IdleManager_object = IdleManagerObjectDefinition('IdleManager', 'IdleManagerObj', 'IdleManager') |
|---|
| 301 | n/a | SGOutput_object = SGOutputObjectDefinition('SGOutput', 'SGOutputObj', 'SGOutput') |
|---|
| 302 | n/a | |
|---|
| 303 | n/a | module.addobject(IdleManager_object) |
|---|
| 304 | n/a | module.addobject(MovieController_object) |
|---|
| 305 | n/a | module.addobject(TimeBase_object) |
|---|
| 306 | n/a | module.addobject(UserData_object) |
|---|
| 307 | n/a | module.addobject(Media_object) |
|---|
| 308 | n/a | module.addobject(Track_object) |
|---|
| 309 | n/a | module.addobject(Movie_object) |
|---|
| 310 | n/a | module.addobject(SGOutput_object) |
|---|
| 311 | n/a | |
|---|
| 312 | n/a | # Test which types we are still missing. |
|---|
| 313 | n/a | execfile(string.lower(MODPREFIX) + 'typetest.py') |
|---|
| 314 | n/a | |
|---|
| 315 | n/a | # Create the generator classes used to populate the lists |
|---|
| 316 | n/a | Function = OSErrWeakLinkFunctionGenerator |
|---|
| 317 | n/a | Method = OSErrWeakLinkMethodGenerator |
|---|
| 318 | n/a | |
|---|
| 319 | n/a | # Create and populate the lists |
|---|
| 320 | n/a | functions = [] |
|---|
| 321 | n/a | IdleManager_methods = [] |
|---|
| 322 | n/a | MovieController_methods = [] |
|---|
| 323 | n/a | TimeBase_methods = [] |
|---|
| 324 | n/a | UserData_methods = [] |
|---|
| 325 | n/a | Media_methods = [] |
|---|
| 326 | n/a | Track_methods = [] |
|---|
| 327 | n/a | Movie_methods = [] |
|---|
| 328 | n/a | SGOutput_methods = [] |
|---|
| 329 | n/a | execfile(INPUTFILE) |
|---|
| 330 | n/a | |
|---|
| 331 | n/a | # |
|---|
| 332 | n/a | # Some functions from ImageCompression.h that we need: |
|---|
| 333 | n/a | ICMAlignmentProcRecordPtr = FakeType('(ICMAlignmentProcRecordPtr)0') |
|---|
| 334 | n/a | dummyRect = FakeType('(Rect *)0') |
|---|
| 335 | n/a | |
|---|
| 336 | n/a | f = Function(void, 'AlignWindow', |
|---|
| 337 | n/a | (WindowPtr, 'wp', InMode), |
|---|
| 338 | n/a | (Boolean, 'front', InMode), |
|---|
| 339 | n/a | (dummyRect, 'alignmentRect', InMode), |
|---|
| 340 | n/a | (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode), |
|---|
| 341 | n/a | ) |
|---|
| 342 | n/a | functions.append(f) |
|---|
| 343 | n/a | |
|---|
| 344 | n/a | f = Function(void, 'DragAlignedWindow', |
|---|
| 345 | n/a | (WindowPtr, 'wp', InMode), |
|---|
| 346 | n/a | (Point, 'startPt', InMode), |
|---|
| 347 | n/a | (Rect_ptr, 'boundsRect', InMode), |
|---|
| 348 | n/a | (dummyRect, 'alignmentRect', InMode), |
|---|
| 349 | n/a | (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode), |
|---|
| 350 | n/a | ) |
|---|
| 351 | n/a | functions.append(f) |
|---|
| 352 | n/a | |
|---|
| 353 | n/a | # And we want the version of MoviesTask without a movie argument |
|---|
| 354 | n/a | f = Function(void, 'MoviesTask', |
|---|
| 355 | n/a | (NullMovie, 'theMovie', InMode), |
|---|
| 356 | n/a | (long, 'maxMilliSecToUse', InMode), |
|---|
| 357 | n/a | ) |
|---|
| 358 | n/a | functions.append(f) |
|---|
| 359 | n/a | |
|---|
| 360 | n/a | # And we want a GetMediaNextInterestingTime without duration |
|---|
| 361 | n/a | f = Method(void, 'GetMediaNextInterestingTimeOnly', |
|---|
| 362 | n/a | (Media, 'theMedia', InMode), |
|---|
| 363 | n/a | (short, 'interestingTimeFlags', InMode), |
|---|
| 364 | n/a | (TimeValue, 'time', InMode), |
|---|
| 365 | n/a | (Fixed, 'rate', InMode), |
|---|
| 366 | n/a | (TimeValue, 'interestingTime', OutMode), |
|---|
| 367 | n/a | ) |
|---|
| 368 | n/a | Media_methods.append(f) |
|---|
| 369 | n/a | |
|---|
| 370 | n/a | # add the populated lists to the generator groups |
|---|
| 371 | n/a | # (in a different wordl the scan program would generate this) |
|---|
| 372 | n/a | for f in functions: module.add(f) |
|---|
| 373 | n/a | for f in MovieController_methods: MovieController_object.add(f) |
|---|
| 374 | n/a | for f in TimeBase_methods: TimeBase_object.add(f) |
|---|
| 375 | n/a | for f in UserData_methods: UserData_object.add(f) |
|---|
| 376 | n/a | for f in Media_methods: Media_object.add(f) |
|---|
| 377 | n/a | for f in Track_methods: Track_object.add(f) |
|---|
| 378 | n/a | for f in Movie_methods: Movie_object.add(f) |
|---|
| 379 | n/a | |
|---|
| 380 | n/a | # generate output (open the output file as late as possible) |
|---|
| 381 | n/a | SetOutputFileName(OUTPUTFILE) |
|---|
| 382 | n/a | module.generate() |
|---|