From b81cf9d61c71f9b5949b9424cec1f59ac4a426e8 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Tue, 6 Jun 1995 13:08:40 +0000 Subject: Trying again to check it in. Changes to: - Use Universal Headers as input - Change addpack calls to not depend on Guido's disklayout - Checkge testprograms to use new names for some functions --- Mac/Lib/test/tmenu.py | 18 +- Mac/Lib/toolbox/Events.py | 56 ++--- Mac/Lib/toolbox/Menus.py | 4 +- Mac/Lib/toolbox/QuickDraw.py | 38 ++- Mac/Lib/toolbox/Resources.py | 6 +- Mac/Lib/toolbox/Sound.py | 49 ++-- Mac/Lib/toolbox/Windows.py | 22 +- Mac/Modules/evt/Evtmodule.c | 183 +++++++++++++- Mac/Modules/evt/evtgen.py | 58 ++++- Mac/Modules/evt/evtscan.py | 10 +- Mac/Modules/evt/evtsupport.py | 1 - Mac/Modules/menu/Menumodule.c | 160 +++++++++--- Mac/Modules/menu/menugen.py | 99 +++++--- Mac/Modules/menu/menuscan.py | 4 +- Mac/Modules/menu/menusupport.py | 5 +- Mac/Modules/qd/Qdmodule.c | 532 +++++++++++++++++++--------------------- Mac/Modules/qd/qdgen.py | 154 ++++++------ Mac/Modules/qd/qdscan.py | 32 ++- Mac/Modules/qd/qdsupport.py | 2 +- Mac/Modules/res/Resmodule.c | 71 ++++-- Mac/Modules/res/resgen.py | 24 +- Mac/Modules/res/resscan.py | 5 + Mac/Modules/res/ressupport.py | 3 + Mac/Modules/snd/Sndmodule.c | 136 +++++++++- Mac/Modules/snd/sndgen.py | 54 ++-- Mac/Modules/snd/sndscan.py | 11 + Mac/Modules/snd/sndsupport.py | 7 + Mac/Modules/win/Winmodule.c | 9 +- Mac/Modules/win/wingen.py | 73 +++--- Mac/Modules/win/winscan.py | 8 +- Mac/Modules/win/winsupport.py | 4 + 31 files changed, 1235 insertions(+), 603 deletions(-) diff --git a/Mac/Lib/test/tmenu.py b/Mac/Lib/test/tmenu.py index 1b156d7..bc972a8 100644 --- a/Mac/Lib/test/tmenu.py +++ b/Mac/Lib/test/tmenu.py @@ -2,12 +2,19 @@ import os from Menu import * - -# Since we can't (yet) list the mounted volumes, here's a list of some: -my_volumes = ['C:', 'D:', 'E:', 'F:'] +import macfs +import sys def main(): global oldbar + my_volumes = [] + while 1: + fss, ok = macfs.GetDirectory() + if not ok: + break + my_volumes.append(fss.as_pathname()) + if not my_volumes: + return oldbar = GetMenuBar() ClearMenuBar() makevolmenus(my_volumes) @@ -40,10 +47,10 @@ def adddirectory(menu, dir, maxdepth = 1): for file in files: item = item+1 menu.AppendMenu('x') # add a dummy string - menu.SetItem(item, file) # set the actual text + menu.SetMenuItemText(item, file) # set the actual text fullname = os.path.join(dir, file) if os.path.isdir(fullname): - menu.SetItem(item, ':' + file + ':') # append colons + menu.SetMenuItemText(item, ':' + file + ':') # append colons if maxdepth > 0: id = nextid() submenu = NewMenu(id, fullname) @@ -58,3 +65,4 @@ def adddirectory(menu, dir, maxdepth = 1): if __name__ == '__main__': main() + sys.exit(1) # To allow the user to interact... diff --git a/Mac/Lib/toolbox/Events.py b/Mac/Lib/toolbox/Events.py index 943c9e5..3d4ff94 100644 --- a/Mac/Lib/toolbox/Events.py +++ b/Mac/Lib/toolbox/Events.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Events.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Events.h' nullEvent = 0 mouseDown = 1 @@ -10,41 +10,41 @@ updateEvt = 6 diskEvt = 7 activateEvt = 8 osEvt = 15 -mDownMask = 2 -mUpMask = 4 -keyDownMask = 8 -keyUpMask = 16 -autoKeyMask = 32 -updateMask = 64 -diskMask = 128 -activMask = 256 -highLevelEventMask = 1024 -osMask = -32768 -everyEvent = -1 +mDownMask = 0x0002 +mUpMask = 0x0004 +keyDownMask = 0x0008 +keyUpMask = 0x0010 +autoKeyMask = 0x0020 +updateMask = 0x0040 +diskMask = 0x0080 +activMask = 0x0100 +highLevelEventMask = 0x0400 +osMask = 0x8000 +everyEvent = 0xFFFF charCodeMask = 0x000000FF keyCodeMask = 0x0000FF00 adbAddrMask = 0x00FF0000 -osEvtMessageMask = 0xFF000000 -mouseMovedMessage = 0xFA -suspendResumeMessage = 0x01 +osEvtMessageMask = 0xFF000000L +mouseMovedMessage = 0x00FA +suspendResumeMessage = 0x0001 resumeFlag = 1 convertClipboardFlag = 2 -activeFlag = 1 -btnState = 128 -cmdKey = 256 -shiftKey = 512 -alphaLock = 1024 -optionKey = 2048 -controlKey = 4096 +activeFlag = 0x0001 +btnState = 0x0080 +cmdKey = 0x0100 +shiftKey = 0x0200 +alphaLock = 0x0400 +optionKey = 0x0800 +controlKey = 0x1000 networkEvt = 10 driverEvt = 11 app1Evt = 12 app2Evt = 13 app3Evt = 14 app4Evt = 15 -networkMask = 1024 -driverMask = 2048 -app1Mask = 4096 -app2Mask = 8192 -app3Mask = 16384 -app4Mask = -32768 +networkMask = 0x0400 +driverMask = 0x0800 +app1Mask = 0x1000 +app2Mask = 0x2000 +app3Mask = 0x4000 +app4Mask = 0x8000 diff --git a/Mac/Lib/toolbox/Menus.py b/Mac/Lib/toolbox/Menus.py index 59dc89a..3729810 100644 --- a/Mac/Lib/toolbox/Menus.py +++ b/Mac/Lib/toolbox/Menus.py @@ -1,5 +1,6 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Menus.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Menus.h' +noMark = 0 mDrawMsg = 0 mChooseMsg = 1 mSizeMsg = 2 @@ -11,4 +12,3 @@ hierMenu = -1 mPopUpMsg = 3 mctAllItems = -98 mctLastIDIndic = -99 - diff --git a/Mac/Lib/toolbox/QuickDraw.py b/Mac/Lib/toolbox/QuickDraw.py index b09628f..e0a8ff1 100644 --- a/Mac/Lib/toolbox/QuickDraw.py +++ b/Mac/Lib/toolbox/QuickDraw.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:QuickDraw.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:QuickDraw.h' invalColReq = -1 srcCopy = 0 @@ -47,18 +47,12 @@ magentaColor = 137 yellowColor = 69 picLParen = 0 picRParen = 1 -normal = 0 -bold = 1 -italic = 2 -underline = 4 -outline = 8 -shadow = 0x10 -condense = 0x20 -extend = 0x40 clutType = 0 fixedType = 1 directType = 2 gdDevType = 0 +roundedDevice = 5 +hasAuxMenuBar = 6 burstDevice = 7 ext32Device = 8 ramInit = 10 @@ -72,6 +66,28 @@ pHiliteBit = 0 defQDColors = 127 RGBDirect = 16 baseAddr32 = 4 -rgnOverflowErr = -147 -insufficientStackErr = -149 +singleDevicesBit = 0 +dontMatchSeedsBit = 1 +allDevicesBit = 2 +singleDevices = 1 << singleDevicesBit +dontMatchSeeds = 1 << dontMatchSeedsBit allDevices = 1 << allDevicesBit +kNoConstraint = 0 +kVerticalConstraint = 1 +kHorizontalConstraint = 2 +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:QuickDrawText.h' + +leftCaret = 0 +rightCaret = -1 +hilite = 1 +smLeftCaret = 0 +smRightCaret = -1 +smHilite = 1 +onlyStyleRun = 0 +leftStyleRun = 1 +rightStyleRun = 2 +middleStyleRun = 3 +smOnlyStyleRun = 0 +smLeftStyleRun = 1 +smRightStyleRun = 2 +smMiddleStyleRun = 3 diff --git a/Mac/Lib/toolbox/Resources.py b/Mac/Lib/toolbox/Resources.py index e2ed97a..7d51d6d 100644 --- a/Mac/Lib/toolbox/Resources.py +++ b/Mac/Lib/toolbox/Resources.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Resources.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Resources.h' resSysHeap = 64 resPurgeable = 32 @@ -9,5 +9,5 @@ resChanged = 2 mapReadOnly = 128 mapCompact = 64 mapChanged = 32 -mapTrue = 0xFFFF -mapFalse = 0xFF00 +kResFileNotOpened = -1 +kSystemResFile = 0 diff --git a/Mac/Lib/toolbox/Sound.py b/Mac/Lib/toolbox/Sound.py index a65c652..515d024 100644 --- a/Mac/Lib/toolbox/Sound.py +++ b/Mac/Lib/toolbox/Sound.py @@ -1,15 +1,20 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Sound.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Sound.h' -swMode = -1 -ftMode = 1 -ffMode = 0 -rate22khz = 0x56EE8BA3 -rate11khz = 0x2B7745D1 +soundListRsrc = 'snd ' +rate44khz = 0xAC440000L +rate22050hz = 0x56220000L +rate22khz = 0x56EE8BA3L +rate11khz = 0x2B7745D1L +rate11025hz = 0x2B110000 squareWaveSynth = 1 waveTableSynth = 3 sampledSynth = 5 MACE3snthID = 11 MACE6snthID = 13 +kMiddleC = 60 +kSimpleBeepID = 1 +kFullVolume = 0x0100 +kNoVolume = 0 nullCmd = 0 initCmd = 1 freeCmd = 2 @@ -21,23 +26,18 @@ pauseCmd = 11 resumeCmd = 12 callBackCmd = 13 syncCmd = 14 -emptyCmd = 15 -tickleCmd = 20 -requestNextCmd = 21 -howOftenCmd = 22 -wakeUpCmd = 23 availableCmd = 24 versionCmd = 25 totalLoadCmd = 26 loadCmd = 27 -scaleCmd = 30 -tempoCmd = 31 freqDurationCmd = 40 restCmd = 41 freqCmd = 42 ampCmd = 43 timbreCmd = 44 getAmpCmd = 45 +volumeCmd = 46 +getVolumeCmd = 47 waveTableCmd = 60 phaseCmd = 61 soundCmd = 80 @@ -46,6 +46,8 @@ rateCmd = 82 continueCmd = 83 doubleBufferCmd = 84 getRateCmd = 85 +rateMultiplierCmd = 86 +getRateMultiplierCmd = 87 sizeCmd = 90 convertCmd = 91 stdQLength = 128 @@ -55,10 +57,6 @@ waveInitChannel0 = 0x04 waveInitChannel1 = 0x05 waveInitChannel2 = 0x06 waveInitChannel3 = 0x07 -initPanMask = 0x0003 -initSRateMask = 0x0030 -initStereoMask = 0x00C0 -initCompMask = 0xFF00 initChanLeft = 0x0002 initChanRight = 0x0003 initNoInterp = 0x0004 @@ -67,18 +65,21 @@ initMono = 0x0080 initStereo = 0x00C0 initMACE3 = 0x0300 initMACE6 = 0x0400 -initChan0 = 0x0004 -initChan1 = 0x0005 -initChan2 = 0x0006 -initChan3 = 0x0007 -stdSH = 0x00 -extSH = 0xFF -cmpSH = 0xFE +initPanMask = 0x0003 +initSRateMask = 0x0030 +initStereoMask = 0x00C0 +initCompMask = 0xFF00 +kUseOptionalOutputDevice = -1 notCompressed = 0 +fixedCompression = -1 +variableCompression = -2 twoToOne = 1 eightToThree = 2 threeToOne = 3 sixToOne = 4 +stdSH = 0x00 +extSH = 0xFF +cmpSH = 0xFE outsideCmpSH = 0 insideCmpSH = 1 aceSuccess = 0 diff --git a/Mac/Lib/toolbox/Windows.py b/Mac/Lib/toolbox/Windows.py index 037000f..9a615cd 100644 --- a/Mac/Lib/toolbox/Windows.py +++ b/Mac/Lib/toolbox/Windows.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Windows.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Windows.h' documentProc = 0 dBoxProc = 1 @@ -9,6 +9,14 @@ movableDBoxProc = 5 zoomDocProc = 8 zoomNoGrow = 12 rDocProc = 16 +floatProc = 1985 +floatGrowProc = 1987 +floatZoomProc = 1989 +floatZoomGrowProc = 1991 +floatSideProc = 1993 +floatSideGrowProc = 1995 +floatSideZoomProc = 1997 +floatSideZoomGrowProc = 1999 dialogKind = 2 userKind = 8 inDesk = 0 @@ -27,6 +35,12 @@ wNew = 3 wDispose = 4 wGrow = 5 wDrawGIcon = 6 +deskPatID = 16 +wContentColor = 0 +wFrameColor = 1 +wTextColor = 2 +wHiliteColor = 3 +wTitleBarColor = 4 wNoHit = 0 wInContent = 1 wInDrag = 2 @@ -34,9 +48,3 @@ wInGrow = 3 wInGoAway = 4 wInZoomIn = 5 wInZoomOut = 6 -deskPatID = 16 -wContentColor = 0 -wFrameColor = 1 -wTextColor = 2 -wHiliteColor = 3 -wTitleBarColor = 4 diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c index 42d55b4..7169b59 100644 --- a/Mac/Modules/evt/Evtmodule.c +++ b/Mac/Modules/evt/Evtmodule.c @@ -39,6 +39,49 @@ extern PyObject *WinObj_WhichWindow(WindowPtr); static PyObject *Evt_Error; +static PyObject *Evt_GetDblTime(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetDblTime(); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Evt_GetCaretTime(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetCaretTime(); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Evt_SetEventMask(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short value; + if (!PyArg_ParseTuple(_args, "h", + &value)) + return NULL; + SetEventMask(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Evt_GetNextEvent(_self, _args) PyObject *_self; PyObject *_args; @@ -171,6 +214,96 @@ static PyObject *Evt_GetKeys(_self, _args) return _res; } +static PyObject *Evt_TickCount(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + unsigned long _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = TickCount(); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Evt_PostEvent(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + short eventNum; + long eventMsg; + if (!PyArg_ParseTuple(_args, "hl", + &eventNum, + &eventMsg)) + return NULL; + _err = PostEvent(eventNum, + eventMsg); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Evt_OSEventAvail(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + short mask; + EventRecord theEvent; + if (!PyArg_ParseTuple(_args, "h", + &mask)) + return NULL; + _rv = OSEventAvail(mask, + &theEvent); + _res = Py_BuildValue("bO&", + _rv, + PyMac_BuildEventRecord, &theEvent); + return _res; +} + +static PyObject *Evt_GetOSEvent(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + short mask; + EventRecord theEvent; + if (!PyArg_ParseTuple(_args, "h", + &mask)) + return NULL; + _rv = GetOSEvent(mask, + &theEvent); + _res = Py_BuildValue("bO&", + _rv, + PyMac_BuildEventRecord, &theEvent); + return _res; +} + +static PyObject *Evt_FlushEvents(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short whichMask; + short stopMask; + if (!PyArg_ParseTuple(_args, "hh", + &whichMask, + &stopMask)) + return NULL; + FlushEvents(whichMask, + stopMask); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Evt_SystemClick(_self, _args) PyObject *_self; PyObject *_args; @@ -189,7 +322,42 @@ static PyObject *Evt_SystemClick(_self, _args) return _res; } +static PyObject *Evt_SystemTask(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + SystemTask(); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Evt_SystemEvent(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + EventRecord theEvent; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetEventRecord, &theEvent)) + return NULL; + _rv = SystemEvent(&theEvent); + _res = Py_BuildValue("b", + _rv); + return _res; +} + static PyMethodDef Evt_methods[] = { + {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1, + "() -> (long _rv)"}, + {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1, + "() -> (long _rv)"}, + {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1, + "(short value) -> None"}, {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1, "(short eventMask) -> (Boolean _rv, EventRecord theEvent)"}, {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1, @@ -206,8 +374,22 @@ static PyMethodDef Evt_methods[] = { "() -> (Boolean _rv)"}, {"GetKeys", (PyCFunction)Evt_GetKeys, 1, "() -> (KeyMap theKeys)"}, + {"TickCount", (PyCFunction)Evt_TickCount, 1, + "() -> (unsigned long _rv)"}, + {"PostEvent", (PyCFunction)Evt_PostEvent, 1, + "(short eventNum, long eventMsg) -> None"}, + {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1, + "(short mask) -> (Boolean _rv, EventRecord theEvent)"}, + {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1, + "(short mask) -> (Boolean _rv, EventRecord theEvent)"}, + {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1, + "(short whichMask, short stopMask) -> None"}, {"SystemClick", (PyCFunction)Evt_SystemClick, 1, "(EventRecord theEvent, WindowPtr theWindow) -> None"}, + {"SystemTask", (PyCFunction)Evt_SystemTask, 1, + "() -> None"}, + {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1, + "(EventRecord theEvent) -> (Boolean _rv)"}, {NULL, NULL, 0} }; @@ -232,4 +414,3 @@ void initEvt() /* ========================= End module Evt ========================= */ - diff --git a/Mac/Modules/evt/evtgen.py b/Mac/Modules/evt/evtgen.py index fd61c4d..deac64e 100644 --- a/Mac/Modules/evt/evtgen.py +++ b/Mac/Modules/evt/evtgen.py @@ -1,4 +1,17 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Events.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Events.h' + +f = Function(long, 'GetDblTime', +) +functions.append(f) + +f = Function(long, 'GetCaretTime', +) +functions.append(f) + +f = Function(void, 'SetEventMask', + (short, 'value', InMode), +) +functions.append(f) f = Function(Boolean, 'GetNextEvent', (short, 'eventMask', InMode), @@ -42,3 +55,46 @@ f = Function(void, 'GetKeys', ) functions.append(f) +f = Function(unsigned_long, 'TickCount', +) +functions.append(f) + +f = Function(OSErr, 'PostEvent', + (short, 'eventNum', InMode), + (long, 'eventMsg', InMode), +) +functions.append(f) + +f = Function(Boolean, 'OSEventAvail', + (short, 'mask', InMode), + (EventRecord, 'theEvent', OutMode), +) +functions.append(f) + +f = Function(Boolean, 'GetOSEvent', + (short, 'mask', InMode), + (EventRecord, 'theEvent', OutMode), +) +functions.append(f) + +f = Function(void, 'FlushEvents', + (short, 'whichMask', InMode), + (short, 'stopMask', InMode), +) +functions.append(f) + +f = Function(void, 'SystemClick', + (EventRecord_ptr, 'theEvent', InMode), + (WindowPtr, 'theWindow', InMode), +) +functions.append(f) + +f = Function(void, 'SystemTask', +) +functions.append(f) + +f = Function(Boolean, 'SystemEvent', + (EventRecord_ptr, 'theEvent', InMode), +) +functions.append(f) + diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py index 517db71..70a9df9 100644 --- a/Mac/Modules/evt/evtscan.py +++ b/Mac/Modules/evt/evtscan.py @@ -1,5 +1,7 @@ # Scan an Apple header file, generating a Python file of generator calls. +import addpack +addpack.addpack(':tools:bgen:bgen') from scantools import Scanner LONG = "Events" @@ -32,10 +34,12 @@ class MyScanner(Scanner): def makeblacklistnames(self): return [ + "KeyTranslate" ] def makeblacklisttypes(self): return [ + "EvQElPtr", "QHdrPtr" ] def makerepairinstructions(self): @@ -53,7 +57,11 @@ class MyScanner(Scanner): # GetKeys ([('KeyMap', 'theKeys', 'InMode')], [('*', '*', 'OutMode')]), + + # GetTicker + ([('unsigned long', '*', '*')], + [('unsigned_long', '*', '*')]), ] - + if __name__ == "__main__": main() diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py index 6f59b8b..0a6950b 100644 --- a/Mac/Modules/evt/evtsupport.py +++ b/Mac/Modules/evt/evtsupport.py @@ -63,7 +63,6 @@ Function = OSErrFunctionGenerator functions = [] ##methods = [] execfile(INPUTFILE) -execfile("evtedit.py") # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c index 84289a3..bb1cb79 100644 --- a/Mac/Modules/menu/Menumodule.c +++ b/Mac/Modules/menu/Menumodule.c @@ -109,7 +109,7 @@ static PyObject *MenuObj_AppendMenu(_self, _args) return _res; } -static PyObject *MenuObj_AddResMenu(_self, _args) +static PyObject *MenuObj_AppendResMenu(_self, _args) MenuObject *_self; PyObject *_args; { @@ -118,8 +118,8 @@ static PyObject *MenuObj_AddResMenu(_self, _args) if (!PyArg_ParseTuple(_args, "O&", PyMac_GetOSType, &theType)) return NULL; - AddResMenu(_self->ob_itself, - theType); + AppendResMenu(_self->ob_itself, + theType); Py_INCREF(Py_None); _res = Py_None; return _res; @@ -160,7 +160,7 @@ static PyObject *MenuObj_InsertMenu(_self, _args) return _res; } -static PyObject *MenuObj_InsMenuItem(_self, _args) +static PyObject *MenuObj_InsertMenuItem(_self, _args) MenuObject *_self; PyObject *_args; { @@ -171,15 +171,15 @@ static PyObject *MenuObj_InsMenuItem(_self, _args) PyMac_GetStr255, itemString, &afterItem)) return NULL; - InsMenuItem(_self->ob_itself, - itemString, - afterItem); + InsertMenuItem(_self->ob_itself, + itemString, + afterItem); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *MenuObj_DelMenuItem(_self, _args) +static PyObject *MenuObj_DeleteMenuItem(_self, _args) MenuObject *_self; PyObject *_args; { @@ -188,14 +188,14 @@ static PyObject *MenuObj_DelMenuItem(_self, _args) if (!PyArg_ParseTuple(_args, "h", &item)) return NULL; - DelMenuItem(_self->ob_itself, - item); + DeleteMenuItem(_self->ob_itself, + item); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *MenuObj_SetItem(_self, _args) +static PyObject *MenuObj_SetMenuItemText(_self, _args) MenuObject *_self; PyObject *_args; { @@ -206,15 +206,15 @@ static PyObject *MenuObj_SetItem(_self, _args) &item, PyMac_GetStr255, itemString)) return NULL; - SetItem(_self->ob_itself, - item, - itemString); + SetMenuItemText(_self->ob_itself, + item, + itemString); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *MenuObj_GetItem(_self, _args) +static PyObject *MenuObj_GetMenuItemText(_self, _args) MenuObject *_self; PyObject *_args; { @@ -224,9 +224,9 @@ static PyObject *MenuObj_GetItem(_self, _args) if (!PyArg_ParseTuple(_args, "h", &item)) return NULL; - GetItem(_self->ob_itself, - item, - itemString); + GetMenuItemText(_self->ob_itself, + item, + itemString); _res = Py_BuildValue("O&", PyMac_BuildStr255, itemString); return _res; @@ -382,7 +382,7 @@ static PyObject *MenuObj_GetItemStyle(_self, _args) { PyObject *_res = NULL; short item; - Style chStyle; + unsigned char chStyle; if (!PyArg_ParseTuple(_args, "h", &item)) return NULL; @@ -481,24 +481,65 @@ static PyObject *MenuObj_PopUpMenuSelect(_self, _args) return _res; } +static PyObject *MenuObj_InsertFontResMenu(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short afterItem; + short scriptFilter; + if (!PyArg_ParseTuple(_args, "hh", + &afterItem, + &scriptFilter)) + return NULL; + InsertFontResMenu(_self->ob_itself, + afterItem, + scriptFilter); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_InsertIntlResMenu(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ResType theType; + short afterItem; + short scriptFilter; + if (!PyArg_ParseTuple(_args, "O&hh", + PyMac_GetOSType, &theType, + &afterItem, + &scriptFilter)) + return NULL; + InsertIntlResMenu(_self->ob_itself, + theType, + afterItem, + scriptFilter); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyMethodDef MenuObj_methods[] = { {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1, "() -> None"}, {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1, "(Str255 data) -> None"}, - {"AddResMenu", (PyCFunction)MenuObj_AddResMenu, 1, + {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1, "(ResType theType) -> None"}, {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1, "(ResType theType, short afterItem) -> None"}, {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1, "(short beforeID) -> None"}, - {"InsMenuItem", (PyCFunction)MenuObj_InsMenuItem, 1, + {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1, "(Str255 itemString, short afterItem) -> None"}, - {"DelMenuItem", (PyCFunction)MenuObj_DelMenuItem, 1, + {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1, "(short item) -> None"}, - {"SetItem", (PyCFunction)MenuObj_SetItem, 1, + {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1, "(short item, Str255 itemString) -> None"}, - {"GetItem", (PyCFunction)MenuObj_GetItem, 1, + {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1, "(short item) -> (Str255 itemString)"}, {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1, "(short item) -> None"}, @@ -517,7 +558,7 @@ static PyMethodDef MenuObj_methods[] = { {"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1, "(short item, short chStyle) -> None"}, {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1, - "(short item) -> (Style chStyle)"}, + "(short item) -> (unsigned char chStyle)"}, {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, "() -> None"}, {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1, @@ -528,6 +569,10 @@ static PyMethodDef MenuObj_methods[] = { "(short item, short cmdChar) -> None"}, {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1, "(short top, short left, short popUpItem) -> (long _rv)"}, + {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1, + "(short afterItem, short scriptFilter) -> None"}, + {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1, + "(ResType theType, short afterItem, short scriptFilter) -> None"}, {NULL, NULL, 0} }; @@ -558,6 +603,20 @@ PyTypeObject Menu_Type = { /* ---------------------- End object type Menu ---------------------- */ +static PyObject *Menu_GetMBarHeight(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetMBarHeight(); + _res = Py_BuildValue("h", + _rv); + return _res; +} + static PyObject *Menu_InitMenus(_self, _args) PyObject *_self; PyObject *_args; @@ -736,7 +795,7 @@ static PyObject *Menu_HiliteMenu(_self, _args) return _res; } -static PyObject *Menu_GetMHandle(_self, _args) +static PyObject *Menu_GetMenuHandle(_self, _args) PyObject *_self; PyObject *_args; { @@ -746,7 +805,7 @@ static PyObject *Menu_GetMHandle(_self, _args) if (!PyArg_ParseTuple(_args, "h", &menuID)) return NULL; - _rv = GetMHandle(menuID); + _rv = GetMenuHandle(menuID); _res = Py_BuildValue("O&", MenuObj_New, _rv); return _res; @@ -827,7 +886,7 @@ static PyObject *Menu_MenuChoice(_self, _args) return _res; } -static PyObject *Menu_DelMCEntries(_self, _args) +static PyObject *Menu_DeleteMCEntries(_self, _args) PyObject *_self; PyObject *_args; { @@ -838,8 +897,39 @@ static PyObject *Menu_DelMCEntries(_self, _args) &menuID, &menuItem)) return NULL; - DelMCEntries(menuID, - menuItem); + DeleteMCEntries(menuID, + menuItem); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Menu_SystemEdit(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + short editCmd; + if (!PyArg_ParseTuple(_args, "h", + &editCmd)) + return NULL; + _rv = SystemEdit(editCmd); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Menu_SystemMenu(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long menuResult; + if (!PyArg_ParseTuple(_args, "l", + &menuResult)) + return NULL; + SystemMenu(menuResult); Py_INCREF(Py_None); _res = Py_None; return _res; @@ -861,6 +951,8 @@ static PyObject *Menu_OpenDeskAcc(_self, _args) } static PyMethodDef Menu_methods[] = { + {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1, + "() -> (short _rv)"}, {"InitMenus", (PyCFunction)Menu_InitMenus, 1, "() -> None"}, {"NewMenu", (PyCFunction)Menu_NewMenu, 1, @@ -885,7 +977,7 @@ static PyMethodDef Menu_methods[] = { "(short ch) -> (long _rv)"}, {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1, "(short menuID) -> None"}, - {"GetMHandle", (PyCFunction)Menu_GetMHandle, 1, + {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1, "(short menuID) -> (MenuHandle _rv)"}, {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1, "(short menuID) -> None"}, @@ -897,8 +989,12 @@ static PyMethodDef Menu_methods[] = { "(short resID) -> None"}, {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1, "() -> (long _rv)"}, - {"DelMCEntries", (PyCFunction)Menu_DelMCEntries, 1, + {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1, "(short menuID, short menuItem) -> None"}, + {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1, + "(short editCmd) -> (Boolean _rv)"}, + {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1, + "(long menuResult) -> None"}, {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1, "(Str255 name) -> None"}, {NULL, NULL, 0} diff --git a/Mac/Modules/menu/menugen.py b/Mac/Modules/menu/menugen.py index 2be4504..c3f9636 100644 --- a/Mac/Modules/menu/menugen.py +++ b/Mac/Modules/menu/menugen.py @@ -1,46 +1,50 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Menus.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Menus.h' + +f = Function(short, 'GetMBarHeight', +) +functions.append(f) f = Function(void, 'InitMenus', ) functions.append(f) -f = Function(MenuHandle, 'NewMenu', +f = Function(MenuRef, 'NewMenu', (short, 'menuID', InMode), - (Str255, 'menuTitle', InMode), + (ConstStr255Param, 'menuTitle', InMode), ) functions.append(f) -f = Function(MenuHandle, 'GetMenu', +f = Function(MenuRef, 'GetMenu', (short, 'resourceID', InMode), ) functions.append(f) f = Method(void, 'DisposeMenu', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), ) methods.append(f) f = Method(void, 'AppendMenu', - (MenuHandle, 'menu', InMode), + (MenuRef, 'menu', InMode), (ConstStr255Param, 'data', InMode), ) methods.append(f) -f = Method(void, 'AddResMenu', - (MenuHandle, 'theMenu', InMode), +f = Method(void, 'AppendResMenu', + (MenuRef, 'theMenu', InMode), (ResType, 'theType', InMode), ) methods.append(f) f = Method(void, 'InsertResMenu', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (ResType, 'theType', InMode), (short, 'afterItem', InMode), ) methods.append(f) f = Method(void, 'InsertMenu', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'beforeID', InMode), ) methods.append(f) @@ -76,15 +80,15 @@ f = Function(void, 'SetMenuBar', ) functions.append(f) -f = Method(void, 'InsMenuItem', - (MenuHandle, 'theMenu', InMode), +f = Method(void, 'InsertMenuItem', + (MenuRef, 'theMenu', InMode), (ConstStr255Param, 'itemString', InMode), (short, 'afterItem', InMode), ) methods.append(f) -f = Method(void, 'DelMenuItem', - (MenuHandle, 'theMenu', InMode), +f = Method(void, 'DeleteMenuItem', + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), ) methods.append(f) @@ -99,92 +103,92 @@ f = Function(void, 'HiliteMenu', ) functions.append(f) -f = Method(void, 'SetItem', - (MenuHandle, 'theMenu', InMode), +f = Method(void, 'SetMenuItemText', + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (ConstStr255Param, 'itemString', InMode), ) methods.append(f) -f = Method(void, 'GetItem', - (MenuHandle, 'theMenu', InMode), +f = Method(void, 'GetMenuItemText', + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (Str255, 'itemString', OutMode), ) methods.append(f) f = Method(void, 'DisableItem', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), ) methods.append(f) f = Method(void, 'EnableItem', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), ) methods.append(f) f = Method(void, 'CheckItem', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (Boolean, 'checked', InMode), ) methods.append(f) f = Method(void, 'SetItemMark', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'markChar', InMode), ) methods.append(f) f = Method(void, 'GetItemMark', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'markChar', OutMode), ) methods.append(f) f = Method(void, 'SetItemIcon', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'iconIndex', InMode), ) methods.append(f) f = Method(void, 'GetItemIcon', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'iconIndex', OutMode), ) methods.append(f) f = Method(void, 'SetItemStyle', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'chStyle', InMode), ) methods.append(f) f = Method(void, 'GetItemStyle', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), - (Style, 'chStyle', OutMode), + (unsigned_char, 'chStyle', OutMode), ) methods.append(f) f = Method(void, 'CalcMenuSize', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), ) methods.append(f) f = Method(short, 'CountMItems', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), ) methods.append(f) -f = Function(MenuHandle, 'GetMHandle', +f = Function(MenuRef, 'GetMenuHandle', (short, 'menuID', InMode), ) functions.append(f) @@ -210,21 +214,21 @@ f = Function(void, 'InitProcMenu', functions.append(f) f = Method(void, 'GetItemCmd', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'cmdChar', OutMode), ) methods.append(f) f = Method(void, 'SetItemCmd', - (MenuHandle, 'theMenu', InMode), + (MenuRef, 'theMenu', InMode), (short, 'item', InMode), (short, 'cmdChar', InMode), ) methods.append(f) f = Method(long, 'PopUpMenuSelect', - (MenuHandle, 'menu', InMode), + (MenuRef, 'menu', InMode), (short, 'top', InMode), (short, 'left', InMode), (short, 'popUpItem', InMode), @@ -235,9 +239,34 @@ f = Function(long, 'MenuChoice', ) functions.append(f) -f = Function(void, 'DelMCEntries', +f = Function(void, 'DeleteMCEntries', (short, 'menuID', InMode), (short, 'menuItem', InMode), ) functions.append(f) +f = Method(void, 'InsertFontResMenu', + (MenuRef, 'theMenu', InMode), + (short, 'afterItem', InMode), + (short, 'scriptFilter', InMode), +) +methods.append(f) + +f = Method(void, 'InsertIntlResMenu', + (MenuRef, 'theMenu', InMode), + (ResType, 'theType', InMode), + (short, 'afterItem', InMode), + (short, 'scriptFilter', InMode), +) +methods.append(f) + +f = Function(Boolean, 'SystemEdit', + (short, 'editCmd', InMode), +) +functions.append(f) + +f = Function(void, 'SystemMenu', + (long, 'menuResult', InMode), +) +functions.append(f) + diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py index b120052..08a6a04 100644 --- a/Mac/Modules/menu/menuscan.py +++ b/Mac/Modules/menu/menuscan.py @@ -1,4 +1,6 @@ # Scan , generating menugen.py. +import addpack +addpack.addpack(':Tools:bgen:bgen') from scantools import Scanner @@ -20,7 +22,7 @@ class MyScanner(Scanner): listname = "functions" if arglist: t, n, m = arglist[0] - if t == "MenuHandle" and m == "InMode": + if t in ("MenuHandle", "MenuRef") and m == "InMode": classname = "Method" listname = "methods" return classname, listname diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py index 95e52f0..2c7c7c0 100644 --- a/Mac/Modules/menu/menusupport.py +++ b/Mac/Modules/menu/menusupport.py @@ -6,7 +6,7 @@ import string import addpack -addpack.addpack('D:python:Tools:bgen:bgen') +addpack.addpack(':Tools:bgen:bgen') # Declarations that change for each manager MACHEADERFILE = 'Menus.h' # The Apple header file @@ -26,6 +26,9 @@ from macsupport import * # Create the type objects MenuHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) +MenuRef = MenuHandle + +unsigned_char = Type('unsigned char', 'b') includestuff = includestuff + """ #include /* Defines OpenDeskAcc in universal headers */ diff --git a/Mac/Modules/qd/Qdmodule.c b/Mac/Modules/qd/Qdmodule.c index 959df31..c1e5c8e 100644 --- a/Mac/Modules/qd/Qdmodule.c +++ b/Mac/Modules/qd/Qdmodule.c @@ -438,192 +438,6 @@ static PyObject *Qd_Line(_self, _args) return _res; } -static PyObject *Qd_TextFont(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short font; - if (!PyArg_ParseTuple(_args, "h", - &font)) - return NULL; - TextFont(font); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_TextFace(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short face; - if (!PyArg_ParseTuple(_args, "h", - &face)) - return NULL; - TextFace(face); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_TextMode(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short mode; - if (!PyArg_ParseTuple(_args, "h", - &mode)) - return NULL; - TextMode(mode); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_TextSize(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short size; - if (!PyArg_ParseTuple(_args, "h", - &size)) - return NULL; - TextSize(size); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_SpaceExtra(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - long extra; - if (!PyArg_ParseTuple(_args, "l", - &extra)) - return NULL; - SpaceExtra(extra); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_DrawChar(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short ch; - if (!PyArg_ParseTuple(_args, "h", - &ch)) - return NULL; - DrawChar(ch); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_DrawString(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - Str255 s; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetStr255, s)) - return NULL; - DrawString(s); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Qd_DrawText(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - char *textBuf__in__; - int textBuf__len__; - int textBuf__in_len__; - short firstByte; - short byteCount; - if (!PyArg_ParseTuple(_args, "s#hh", - &textBuf__in__, &textBuf__in_len__, - &firstByte, - &byteCount)) - return NULL; - DrawText(textBuf__in__, - firstByte, - byteCount); - Py_INCREF(Py_None); - _res = Py_None; - textBuf__error__: ; - return _res; -} - -static PyObject *Qd_CharWidth(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short _rv; - short ch; - if (!PyArg_ParseTuple(_args, "h", - &ch)) - return NULL; - _rv = CharWidth(ch); - _res = Py_BuildValue("h", - _rv); - return _res; -} - -static PyObject *Qd_StringWidth(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short _rv; - Str255 s; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetStr255, s)) - return NULL; - _rv = StringWidth(s); - _res = Py_BuildValue("h", - _rv); - return _res; -} - -static PyObject *Qd_TextWidth(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short _rv; - char *textBuf__in__; - int textBuf__len__; - int textBuf__in_len__; - short firstByte; - short byteCount; - if (!PyArg_ParseTuple(_args, "s#hh", - &textBuf__in__, &textBuf__in_len__, - &firstByte, - &byteCount)) - return NULL; - _rv = TextWidth(textBuf__in__, - firstByte, - byteCount); - _res = Py_BuildValue("h", - _rv); - textBuf__error__: ; - return _res; -} - static PyObject *Qd_ForeColor(_self, _args) PyObject *_self; PyObject *_args; @@ -1989,6 +1803,24 @@ static PyObject *Qd_PtToAngle(_self, _args) return _res; } +static PyObject *Qd_SubPt(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Point src; + Point dst; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetPoint, &src, + PyMac_GetPoint, &dst)) + return NULL; + SubPt(src, + &dst); + _res = Py_BuildValue("O&", + PyMac_BuildPoint, dst); + return _res; +} + static PyObject *Qd_PtInRgn(_self, _args) PyObject *_self; PyObject *_args; @@ -2022,21 +1854,6 @@ static PyObject *Qd_NewPixMap(_self, _args) return _res; } -static PyObject *Qd_DisposPixMap(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - PixMapHandle pm; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &pm)) - return NULL; - DisposPixMap(pm); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *Qd_DisposePixMap(_self, _args) PyObject *_self; PyObject *_args; @@ -2084,21 +1901,6 @@ static PyObject *Qd_NewPixPat(_self, _args) return _res; } -static PyObject *Qd_DisposPixPat(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - PixPatHandle pp; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &pp)) - return NULL; - DisposPixPat(pp); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *Qd_DisposePixPat(_self, _args) PyObject *_self; PyObject *_args; @@ -2326,21 +2128,6 @@ static PyObject *Qd_AllocCursor(_self, _args) return _res; } -static PyObject *Qd_CharExtra(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - long extra; - if (!PyArg_ParseTuple(_args, "l", - &extra)) - return NULL; - CharExtra(extra); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *Qd_GetCTSeed(_self, _args) PyObject *_self; PyObject *_args; @@ -2355,32 +2142,14 @@ static PyObject *Qd_GetCTSeed(_self, _args) return _res; } -static PyObject *Qd_SubPt(_self, _args) +static PyObject *Qd_SetClientID(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - Point src; - Point dst; - if (!PyArg_ParseTuple(_args, "O&O&", - PyMac_GetPoint, &src, - PyMac_GetPoint, &dst)) - return NULL; - SubPt(src, - &dst); - _res = Py_BuildValue("O&", - PyMac_BuildPoint, dst); - return _res; -} - -static PyObject *Qd_SetClientID(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short id; - if (!PyArg_ParseTuple(_args, "h", - &id)) + short id; + if (!PyArg_ParseTuple(_args, "h", + &id)) return NULL; SetClientID(id); Py_INCREF(Py_None); @@ -2438,6 +2207,207 @@ static PyObject *Qd_QDError(_self, _args) return _res; } +static PyObject *Qd_TextFont(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short font; + if (!PyArg_ParseTuple(_args, "h", + &font)) + return NULL; + TextFont(font); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_TextFace(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short face; + if (!PyArg_ParseTuple(_args, "h", + &face)) + return NULL; + TextFace(face); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_TextMode(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short mode; + if (!PyArg_ParseTuple(_args, "h", + &mode)) + return NULL; + TextMode(mode); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_TextSize(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short size; + if (!PyArg_ParseTuple(_args, "h", + &size)) + return NULL; + TextSize(size); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_SpaceExtra(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long extra; + if (!PyArg_ParseTuple(_args, "l", + &extra)) + return NULL; + SpaceExtra(extra); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_DrawChar(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short ch; + if (!PyArg_ParseTuple(_args, "h", + &ch)) + return NULL; + DrawChar(ch); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_DrawString(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Str255 s; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetStr255, s)) + return NULL; + DrawString(s); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_DrawText(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + char *textBuf__in__; + int textBuf__len__; + int textBuf__in_len__; + short firstByte; + short byteCount; + if (!PyArg_ParseTuple(_args, "s#hh", + &textBuf__in__, &textBuf__in_len__, + &firstByte, + &byteCount)) + return NULL; + DrawText(textBuf__in__, + firstByte, + byteCount); + Py_INCREF(Py_None); + _res = Py_None; + textBuf__error__: ; + return _res; +} + +static PyObject *Qd_CharWidth(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short _rv; + short ch; + if (!PyArg_ParseTuple(_args, "h", + &ch)) + return NULL; + _rv = CharWidth(ch); + _res = Py_BuildValue("h", + _rv); + return _res; +} + +static PyObject *Qd_StringWidth(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short _rv; + Str255 s; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetStr255, s)) + return NULL; + _rv = StringWidth(s); + _res = Py_BuildValue("h", + _rv); + return _res; +} + +static PyObject *Qd_TextWidth(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short _rv; + char *textBuf__in__; + int textBuf__len__; + int textBuf__in_len__; + short firstByte; + short byteCount; + if (!PyArg_ParseTuple(_args, "s#hh", + &textBuf__in__, &textBuf__in_len__, + &firstByte, + &byteCount)) + return NULL; + _rv = TextWidth(textBuf__in__, + firstByte, + byteCount); + _res = Py_BuildValue("h", + _rv); + textBuf__error__: ; + return _res; +} + +static PyObject *Qd_CharExtra(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long extra; + if (!PyArg_ParseTuple(_args, "l", + &extra)) + return NULL; + CharExtra(extra); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyMethodDef Qd_methods[] = { {"OpenPort", (PyCFunction)Qd_OpenPort, 1, "(WindowPtr port) -> None"}, @@ -2491,28 +2461,6 @@ static PyMethodDef Qd_methods[] = { "(short h, short v) -> None"}, {"Line", (PyCFunction)Qd_Line, 1, "(short dh, short dv) -> None"}, - {"TextFont", (PyCFunction)Qd_TextFont, 1, - "(short font) -> None"}, - {"TextFace", (PyCFunction)Qd_TextFace, 1, - "(short face) -> None"}, - {"TextMode", (PyCFunction)Qd_TextMode, 1, - "(short mode) -> None"}, - {"TextSize", (PyCFunction)Qd_TextSize, 1, - "(short size) -> None"}, - {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1, - "(long extra) -> None"}, - {"DrawChar", (PyCFunction)Qd_DrawChar, 1, - "(short ch) -> None"}, - {"DrawString", (PyCFunction)Qd_DrawString, 1, - "(Str255 s) -> None"}, - {"DrawText", (PyCFunction)Qd_DrawText, 1, - "(Buffer textBuf, short firstByte, short byteCount) -> None"}, - {"CharWidth", (PyCFunction)Qd_CharWidth, 1, - "(short ch) -> (short _rv)"}, - {"StringWidth", (PyCFunction)Qd_StringWidth, 1, - "(Str255 s) -> (short _rv)"}, - {"TextWidth", (PyCFunction)Qd_TextWidth, 1, - "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"}, {"ForeColor", (PyCFunction)Qd_ForeColor, 1, "(long color) -> None"}, {"BackColor", (PyCFunction)Qd_BackColor, 1, @@ -2665,20 +2613,18 @@ static PyMethodDef Qd_methods[] = { "(Point pt1, Point pt2) -> (Rect dstRect)"}, {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1, "(Rect r, Point pt) -> (short angle)"}, + {"SubPt", (PyCFunction)Qd_SubPt, 1, + "(Point src, Point dst) -> (Point dst)"}, {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1, "(Point pt, RgnHandle rgn) -> (Boolean _rv)"}, {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1, "() -> (PixMapHandle _rv)"}, - {"DisposPixMap", (PyCFunction)Qd_DisposPixMap, 1, - "(PixMapHandle pm) -> None"}, {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1, "(PixMapHandle pm) -> None"}, {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1, "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"}, {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1, "() -> (PixPatHandle _rv)"}, - {"DisposPixPat", (PyCFunction)Qd_DisposPixPat, 1, - "(PixPatHandle pp) -> None"}, {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1, "(PixPatHandle pp) -> None"}, {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1, @@ -2705,12 +2651,8 @@ static PyMethodDef Qd_methods[] = { "(PixMapHandle pm) -> None"}, {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1, "() -> None"}, - {"CharExtra", (PyCFunction)Qd_CharExtra, 1, - "(long extra) -> None"}, {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1, "() -> (long _rv)"}, - {"SubPt", (PyCFunction)Qd_SubPt, 1, - "(Point src, Point dst) -> (Point dst)"}, {"SetClientID", (PyCFunction)Qd_SetClientID, 1, "(short id) -> None"}, {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1, @@ -2719,6 +2661,30 @@ static PyMethodDef Qd_methods[] = { "(short index, Boolean reserve) -> None"}, {"QDError", (PyCFunction)Qd_QDError, 1, "() -> (short _rv)"}, + {"TextFont", (PyCFunction)Qd_TextFont, 1, + "(short font) -> None"}, + {"TextFace", (PyCFunction)Qd_TextFace, 1, + "(short face) -> None"}, + {"TextMode", (PyCFunction)Qd_TextMode, 1, + "(short mode) -> None"}, + {"TextSize", (PyCFunction)Qd_TextSize, 1, + "(short size) -> None"}, + {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1, + "(long extra) -> None"}, + {"DrawChar", (PyCFunction)Qd_DrawChar, 1, + "(short ch) -> None"}, + {"DrawString", (PyCFunction)Qd_DrawString, 1, + "(Str255 s) -> None"}, + {"DrawText", (PyCFunction)Qd_DrawText, 1, + "(Buffer textBuf, short firstByte, short byteCount) -> None"}, + {"CharWidth", (PyCFunction)Qd_CharWidth, 1, + "(short ch) -> (short _rv)"}, + {"StringWidth", (PyCFunction)Qd_StringWidth, 1, + "(Str255 s) -> (short _rv)"}, + {"TextWidth", (PyCFunction)Qd_TextWidth, 1, + "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"}, + {"CharExtra", (PyCFunction)Qd_CharExtra, 1, + "(long extra) -> None"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/qd/qdgen.py b/Mac/Modules/qd/qdgen.py index 975e438..612b9e7 100644 --- a/Mac/Modules/qd/qdgen.py +++ b/Mac/Modules/qd/qdgen.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:QuickDraw.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:QuickDraw.h' f = Function(void, 'OpenPort', (GrafPtr, 'port', InMode), @@ -131,65 +131,6 @@ f = Function(void, 'Line', ) functions.append(f) -f = Function(void, 'TextFont', - (short, 'font', InMode), -) -functions.append(f) - -f = Function(void, 'TextFace', - (short, 'face', InMode), -) -functions.append(f) - -f = Function(void, 'TextMode', - (short, 'mode', InMode), -) -functions.append(f) - -f = Function(void, 'TextSize', - (short, 'size', InMode), -) -functions.append(f) - -f = Function(void, 'SpaceExtra', - (Fixed, 'extra', InMode), -) -functions.append(f) - -f = Function(void, 'DrawChar', - (short, 'ch', InMode), -) -functions.append(f) - -f = Function(void, 'DrawString', - (ConstStr255Param, 's', InMode), -) -functions.append(f) - -f = Function(void, 'DrawText', - (TextThingie, 'textBuf', InMode), - (short, 'firstByte', InMode), - (short, 'byteCount', InMode), -) -functions.append(f) - -f = Function(short, 'CharWidth', - (short, 'ch', InMode), -) -functions.append(f) - -f = Function(short, 'StringWidth', - (ConstStr255Param, 's', InMode), -) -functions.append(f) - -f = Function(short, 'TextWidth', - (TextThingie, 'textBuf', InMode), - (short, 'firstByte', InMode), - (short, 'byteCount', InMode), -) -functions.append(f) - f = Function(void, 'ForeColor', (long, 'color', InMode), ) @@ -641,6 +582,12 @@ f = Function(void, 'PtToAngle', ) functions.append(f) +f = Function(void, 'SubPt', + (Point, 'src', InMode), + (Point, 'dst', InOutMode), +) +functions.append(f) + f = Function(Boolean, 'PtInRgn', (Point, 'pt', InMode), (RgnHandle, 'rgn', InMode), @@ -651,11 +598,6 @@ f = Function(PixMapHandle, 'NewPixMap', ) functions.append(f) -f = Function(void, 'DisposPixMap', - (PixMapHandle, 'pm', InMode), -) -functions.append(f) - f = Function(void, 'DisposePixMap', (PixMapHandle, 'pm', InMode), ) @@ -671,11 +613,6 @@ f = Function(PixPatHandle, 'NewPixPat', ) functions.append(f) -f = Function(void, 'DisposPixPat', - (PixPatHandle, 'pp', InMode), -) -functions.append(f) - f = Function(void, 'DisposePixPat', (PixPatHandle, 'pp', InMode), ) @@ -751,21 +688,10 @@ f = Function(void, 'AllocCursor', ) functions.append(f) -f = Function(void, 'CharExtra', - (Fixed, 'extra', InMode), -) -functions.append(f) - f = Function(long, 'GetCTSeed', ) functions.append(f) -f = Function(void, 'SubPt', - (Point, 'src', InMode), - (Point, 'dst', InOutMode), -) -functions.append(f) - f = Function(void, 'SetClientID', (short, 'id', InMode), ) @@ -787,3 +713,69 @@ f = Function(short, 'QDError', ) functions.append(f) +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:QuickDrawText.h' + +f = Function(void, 'TextFont', + (short, 'font', InMode), +) +functions.append(f) + +f = Function(void, 'TextFace', + (short, 'face', InMode), +) +functions.append(f) + +f = Function(void, 'TextMode', + (short, 'mode', InMode), +) +functions.append(f) + +f = Function(void, 'TextSize', + (short, 'size', InMode), +) +functions.append(f) + +f = Function(void, 'SpaceExtra', + (Fixed, 'extra', InMode), +) +functions.append(f) + +f = Function(void, 'DrawChar', + (short, 'ch', InMode), +) +functions.append(f) + +f = Function(void, 'DrawString', + (ConstStr255Param, 's', InMode), +) +functions.append(f) + +f = Function(void, 'DrawText', + (TextThingie, 'textBuf', InMode), + (short, 'firstByte', InMode), + (short, 'byteCount', InMode), +) +functions.append(f) + +f = Function(short, 'CharWidth', + (short, 'ch', InMode), +) +functions.append(f) + +f = Function(short, 'StringWidth', + (ConstStr255Param, 's', InMode), +) +functions.append(f) + +f = Function(short, 'TextWidth', + (TextThingie, 'textBuf', InMode), + (short, 'firstByte', InMode), + (short, 'byteCount', InMode), +) +functions.append(f) + +f = Function(void, 'CharExtra', + (Fixed, 'extra', InMode), +) +functions.append(f) + diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py index 057db6d..48766f2 100644 --- a/Mac/Modules/qd/qdscan.py +++ b/Mac/Modules/qd/qdscan.py @@ -1,7 +1,7 @@ # Scan an Apple header file, generating a Python file of generator calls. import addpack -addpack.addpack('D:python:Tools:bgen:bgen') +addpack.addpack(':Tools:bgen:bgen') from scantools import Scanner @@ -12,6 +12,32 @@ def main(): scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() + + # Grmpf. Universal Headers have Text-stuff in a different include file... + input = "QuickDrawText.h" + output = "@qdgentext.py" + defsoutput = "@QuickDrawText.py" + have_extra = 0 + try: + scanner = MyScanner(input, output, defsoutput) + scanner.scan() + scanner.close() + have_extra = 1 + except IOError: + pass + if have_extra: + print "=== Copying QuickDrawText stuff into main files... ===" + ifp = open("@qdgentext.py") + ofp = open("qdgen.py", "a") + ofp.write(ifp.read()) + ifp.close() + ofp.close() + ifp = open("@QuickDrawText.py") + ofp = open("QuickDraw.py", "a") + ofp.write(ifp.read()) + ifp.close() + ofp.close() + print "=== Done scanning and generating, now importing the generated code... ===" import qdsupport print "=== Done. It's up to you to compile it now! ===" @@ -23,7 +49,7 @@ class MyScanner(Scanner): listname = "functions" if arglist: t, n, m = arglist[0] - if t in ("WindowPtr", "WindowPeek") and m == "InMode": + if t in ("WindowPtr", "WindowPeek", "WindowRef") and m == "InMode": classname = "Method" listname = "methods" return classname, listname @@ -48,7 +74,9 @@ class MyScanner(Scanner): 'CSpecArray', 'CTabHandle', 'ColorComplementProcPtr', + 'ColorComplementUPP', 'ColorSearchProcPtr', + 'ColorSearchUPP', 'ConstPatternParam', 'Cursor_ptr', 'DeviceLoopDrawingProcPtr', diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py index 0aa439c..f3e7a9a 100644 --- a/Mac/Modules/qd/qdsupport.py +++ b/Mac/Modules/qd/qdsupport.py @@ -6,7 +6,7 @@ import string import addpack -addpack.addpack('D:python:Tools:bgen:bgen') +addpack.addpack(':Tools:bgen:bgen') # Declarations that change for each manager MACHEADERFILE = 'QuickDraw.h' # The Apple header file diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c index aeb7958..024d4d2 100644 --- a/Mac/Modules/res/Resmodule.c +++ b/Mac/Modules/res/Resmodule.c @@ -240,7 +240,7 @@ static PyObject *ResObj_AddResource(_self, _args) return _res; } -static PyObject *ResObj_SizeResource(_self, _args) +static PyObject *ResObj_GetResourceSizeOnDisk(_self, _args) ResourceObject *_self; PyObject *_args; { @@ -248,7 +248,7 @@ static PyObject *ResObj_SizeResource(_self, _args) long _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = SizeResource(_self->ob_itself); + _rv = GetResourceSizeOnDisk(_self->ob_itself); { OSErr _err = ResError(); if (_err != noErr) return PyMac_Error(_err); @@ -258,7 +258,7 @@ static PyObject *ResObj_SizeResource(_self, _args) return _res; } -static PyObject *ResObj_MaxSizeRsrc(_self, _args) +static PyObject *ResObj_GetMaxResourceSize(_self, _args) ResourceObject *_self; PyObject *_args; { @@ -266,7 +266,7 @@ static PyObject *ResObj_MaxSizeRsrc(_self, _args) long _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = MaxSizeRsrc(_self->ob_itself); + _rv = GetMaxResourceSize(_self->ob_itself); { OSErr _err = ResError(); if (_err != noErr) return PyMac_Error(_err); @@ -331,14 +331,14 @@ static PyObject *ResObj_ChangedResource(_self, _args) return _res; } -static PyObject *ResObj_RmveResource(_self, _args) +static PyObject *ResObj_RemoveResource(_self, _args) ResourceObject *_self; PyObject *_args; { PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - RmveResource(_self->ob_itself); + RemoveResource(_self->ob_itself); { OSErr _err = ResError(); if (_err != noErr) return PyMac_Error(_err); @@ -385,6 +385,24 @@ static PyObject *ResObj_SetResourceSize(_self, _args) return _res; } +static PyObject *ResObj_GetNextFOND(_self, _args) + ResourceObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetNextFOND(_self->ob_itself); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + static PyMethodDef ResObj_methods[] = { {"HomeResFile", (PyCFunction)ResObj_HomeResFile, 1, "() -> (short _rv)"}, @@ -402,9 +420,9 @@ static PyMethodDef ResObj_methods[] = { "(short theID, Str255 name) -> None"}, {"AddResource", (PyCFunction)ResObj_AddResource, 1, "(ResType theType, short theID, Str255 name) -> None"}, - {"SizeResource", (PyCFunction)ResObj_SizeResource, 1, + {"GetResourceSizeOnDisk", (PyCFunction)ResObj_GetResourceSizeOnDisk, 1, "() -> (long _rv)"}, - {"MaxSizeRsrc", (PyCFunction)ResObj_MaxSizeRsrc, 1, + {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1, "() -> (long _rv)"}, {"RsrcMapEntry", (PyCFunction)ResObj_RsrcMapEntry, 1, "() -> (long _rv)"}, @@ -412,12 +430,14 @@ static PyMethodDef ResObj_methods[] = { "(short attrs) -> None"}, {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1, "() -> None"}, - {"RmveResource", (PyCFunction)ResObj_RmveResource, 1, + {"RemoveResource", (PyCFunction)ResObj_RemoveResource, 1, "() -> None"}, {"WriteResource", (PyCFunction)ResObj_WriteResource, 1, "() -> None"}, {"SetResourceSize", (PyCFunction)ResObj_SetResourceSize, 1, "(long newSize) -> None"}, + {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1, + "() -> (Handle _rv)"}, {NULL, NULL, 0} }; @@ -1017,8 +1037,8 @@ static PyObject *Res_OpenRFPerm(_self, _args) short _rv; Str255 fileName; short vRefNum; - char permission; - if (!PyArg_ParseTuple(_args, "O&hc", + SignedByte permission; + if (!PyArg_ParseTuple(_args, "O&hb", PyMac_GetStr255, fileName, &vRefNum, &permission)) @@ -1067,8 +1087,8 @@ static PyObject *Res_HOpenResFile(_self, _args) short vRefNum; long dirID; Str255 fileName; - char permission; - if (!PyArg_ParseTuple(_args, "hlO&c", + SignedByte permission; + if (!PyArg_ParseTuple(_args, "hlO&b", &vRefNum, &dirID, PyMac_GetStr255, fileName, @@ -1163,6 +1183,25 @@ static PyObject *Res_FSpCreateResFile(_self, _args) return _res; } +static PyObject *Res_TempInsertROMMap(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean tempResLoad; + if (!PyArg_ParseTuple(_args, "b", + &tempResLoad)) + return NULL; + TempInsertROMMap(tempResLoad); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Res_Resource(_self, _args) PyObject *_self; PyObject *_args; @@ -1243,17 +1282,19 @@ static PyMethodDef Res_methods[] = { {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1, "(short refNum, short attrs) -> None"}, {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1, - "(Str255 fileName, short vRefNum, char permission) -> (short _rv)"}, + "(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)"}, {"RGetResource", (PyCFunction)Res_RGetResource, 1, "(ResType theType, short theID) -> (Handle _rv)"}, {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1, - "(short vRefNum, long dirID, Str255 fileName, char permission) -> (short _rv)"}, + "(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)"}, {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1, "(short vRefNum, long dirID, Str255 fileName) -> None"}, {"FSpOpenResFile", (PyCFunction)Res_FSpOpenResFile, 1, "(FSSpec spec, SignedByte permission) -> (short _rv)"}, {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1, "(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None"}, + {"TempInsertROMMap", (PyCFunction)Res_TempInsertROMMap, 1, + "(Boolean tempResLoad) -> None"}, {"Resource", (PyCFunction)Res_Resource, 1, "Convert a string to a resource object.\n\nThe created resource object is actually just a handle.\nApply AddResource() to write it to a resource file.\n"}, {NULL, NULL, 0} diff --git a/Mac/Modules/res/resgen.py b/Mac/Modules/res/resgen.py index 9d817a3..b5e15de 100644 --- a/Mac/Modules/res/resgen.py +++ b/Mac/Modules/res/resgen.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Resources.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Resources.h' f = ResFunction(short, 'InitResources', ) @@ -158,19 +158,19 @@ f = ResMethod(void, 'SetResInfo', resmethods.append(f) f = ResMethod(void, 'AddResource', - (Handle, 'theResource', InMode), + (Handle, 'theData', InMode), (ResType, 'theType', InMode), (short, 'theID', InMode), (ConstStr255Param, 'name', InMode), ) resmethods.append(f) -f = ResMethod(long, 'SizeResource', +f = ResMethod(long, 'GetResourceSizeOnDisk', (Handle, 'theResource', InMode), ) resmethods.append(f) -f = ResMethod(long, 'MaxSizeRsrc', +f = ResMethod(long, 'GetMaxResourceSize', (Handle, 'theResource', InMode), ) resmethods.append(f) @@ -191,7 +191,7 @@ f = ResMethod(void, 'ChangedResource', ) resmethods.append(f) -f = ResMethod(void, 'RmveResource', +f = ResMethod(void, 'RemoveResource', (Handle, 'theResource', InMode), ) resmethods.append(f) @@ -225,7 +225,7 @@ functions.append(f) f = ResFunction(short, 'OpenRFPerm', (ConstStr255Param, 'fileName', InMode), (short, 'vRefNum', InMode), - (char, 'permission', InMode), + (SignedByte, 'permission', InMode), ) functions.append(f) @@ -239,7 +239,7 @@ f = ResFunction(short, 'HOpenResFile', (short, 'vRefNum', InMode), (long, 'dirID', InMode), (ConstStr255Param, 'fileName', InMode), - (char, 'permission', InMode), + (SignedByte, 'permission', InMode), ) functions.append(f) @@ -270,3 +270,13 @@ f = ResMethod(void, 'SetResourceSize', ) resmethods.append(f) +f = ResMethod(Handle, 'GetNextFOND', + (Handle, 'fondHandle', InMode), +) +resmethods.append(f) + +f = ResFunction(void, 'TempInsertROMMap', + (Boolean, 'tempResLoad', InMode), +) +functions.append(f) + diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py index d45d69e..ba860b4 100644 --- a/Mac/Modules/res/resscan.py +++ b/Mac/Modules/res/resscan.py @@ -8,6 +8,8 @@ import string import regex import regsub import MacOS +import addpack +addpack.addpack(':Tools:bgen:bgen') from scantools import Scanner @@ -57,6 +59,9 @@ class ResourcesScanner(Scanner): ([("void", "*", "OutMode"), ("long", "*", "InMode"), ("long", "*", "OutMode")], [("OutBuffer", "*", "InOutMode")]), + + ([("SInt8", "*", "*")], + [("SignedByte", "*", "*")]) ] if __name__ == "__main__": diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py index a44af09..efc7571 100644 --- a/Mac/Modules/res/ressupport.py +++ b/Mac/Modules/res/ressupport.py @@ -3,6 +3,9 @@ # It execs the file resgen.py which contain the function definitions # (resgen.py was generated by resscan.py, scanning the header file). +import addpack +addpack.addpack(':Tools:bgen:bgen') + from macsupport import * diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c index 9f5c24d..62e9d85 100644 --- a/Mac/Modules/snd/Sndmodule.c +++ b/Mac/Modules/snd/Sndmodule.c @@ -244,12 +244,12 @@ static PyObject *SndCh_SndStopFilePlay(_self, _args) { PyObject *_res = NULL; OSErr _err; - Boolean async; + Boolean quietNow; if (!PyArg_ParseTuple(_args, "b", - &async)) + &quietNow)) return NULL; _err = SndStopFilePlay(_self->ob_itself, - async); + quietNow); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; @@ -289,7 +289,7 @@ static PyMethodDef SndCh_methods[] = { {"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1, "() -> None"}, {"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1, - "(Boolean async) -> None"}, + "(Boolean quietNow) -> None"}, {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1, "(short theLength) -> (SCStatus theStatus)"}, {NULL, NULL, 0} @@ -322,6 +322,35 @@ staticforward PyTypeObject SndChannel_Type = { /* ------------------- End object type SndChannel ------------------- */ +static PyObject *Snd_SetSoundVol(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short level; + if (!PyArg_ParseTuple(_args, "h", + &level)) + return NULL; + SetSoundVol(level); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Snd_GetSoundVol(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short level; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + GetSoundVol(&level); + _res = Py_BuildValue("h", + level); + return _res; +} + static PyObject *Snd_SndNewChannel(_self, _args) PyObject *_self; PyObject *_args; @@ -642,7 +671,96 @@ static PyObject *Snd_Exp1to6(_self, _args) return _res; } +static PyObject *Snd_GetSysBeepVolume(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + long level; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetSysBeepVolume(&level); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + level); + return _res; +} + +static PyObject *Snd_SetSysBeepVolume(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + long level; + if (!PyArg_ParseTuple(_args, "l", + &level)) + return NULL; + _err = SetSysBeepVolume(level); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Snd_GetDefaultOutputVolume(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + long level; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetDefaultOutputVolume(&level); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + level); + return _res; +} + +static PyObject *Snd_SetDefaultOutputVolume(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + long level; + if (!PyArg_ParseTuple(_args, "l", + &level)) + return NULL; + _err = SetDefaultOutputVolume(level); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Snd_GetSoundHeaderOffset(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SndListHandle sndHandle; + long offset; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &sndHandle)) + return NULL; + _err = GetSoundHeaderOffset(sndHandle, + &offset); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + offset); + return _res; +} + static PyMethodDef Snd_methods[] = { + {"SetSoundVol", (PyCFunction)Snd_SetSoundVol, 1, + "(short level) -> None"}, + {"GetSoundVol", (PyCFunction)Snd_GetSoundVol, 1, + "() -> (short level)"}, {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1, "(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"}, {"SndControl", (PyCFunction)Snd_SndControl, 1, @@ -665,6 +783,16 @@ static PyMethodDef Snd_methods[] = { "(Buffer buffer, Buffer state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, Buffer state)"}, {"Exp1to6", (PyCFunction)Snd_Exp1to6, 1, "(Buffer buffer, Buffer state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, Buffer state)"}, + {"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1, + "() -> (long level)"}, + {"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1, + "(long level) -> None"}, + {"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1, + "() -> (long level)"}, + {"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1, + "(long level) -> None"}, + {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1, + "(SndListHandle sndHandle) -> (long offset)"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/snd/sndgen.py b/Mac/Modules/snd/sndgen.py index 8e02f29..a980338 100644 --- a/Mac/Modules/snd/sndgen.py +++ b/Mac/Modules/snd/sndgen.py @@ -1,4 +1,14 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Sound.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Sound.h' + +f = SndFunction(void, 'SetSoundVol', + (short, 'level', InMode), +) +functions.append(f) + +f = SndFunction(void, 'GetSoundVol', + (short, 'level', OutMode), +) +functions.append(f) f = SndMethod(OSErr, 'SndDoCommand', (SndChannelPtr, 'chan', InMode), @@ -17,7 +27,7 @@ f = SndFunction(OSErr, 'SndNewChannel', (SndChannelPtr, 'chan', OutMode), (short, 'synth', InMode), (long, 'init', InMode), - (SndCallBackProcPtr, 'userRoutine', InMode), + (SndCallBackUPP, 'userRoutine', InMode), ) functions.append(f) @@ -34,16 +44,6 @@ f = SndFunction(OSErr, 'SndControl', ) functions.append(f) -f = SndFunction(void, 'SetSoundVol', - (short, 'level', InMode), -) -functions.append(f) - -f = SndFunction(void, 'GetSoundVol', - (short, 'level', OutMode), -) -functions.append(f) - f = SndFunction(NumVersion, 'SndSoundManagerVersion', ) functions.append(f) @@ -55,7 +55,7 @@ f = SndMethod(OSErr, 'SndStartFilePlay', (long, 'bufferSize', InMode), (FakeType('0'), 'theBuffer', InMode), (AudioSelectionPtr, 'theSelection', InMode), - (ProcPtr, 'theCompletion', InMode), + (FilePlayCompletionUPP, 'theCompletion', InMode), (Boolean, 'async', InMode), ) sndmethods.append(f) @@ -67,7 +67,7 @@ sndmethods.append(f) f = SndMethod(OSErr, 'SndStopFilePlay', (SndChannelPtr, 'chan', InMode), - (Boolean, 'async', InMode), + (Boolean, 'quietNow', InMode), ) sndmethods.append(f) @@ -130,3 +130,29 @@ f = SndFunction(void, 'Exp1to6', ) functions.append(f) +f = SndFunction(OSErr, 'GetSysBeepVolume', + (long, 'level', OutMode), +) +functions.append(f) + +f = SndFunction(OSErr, 'SetSysBeepVolume', + (long, 'level', InMode), +) +functions.append(f) + +f = SndFunction(OSErr, 'GetDefaultOutputVolume', + (long, 'level', OutMode), +) +functions.append(f) + +f = SndFunction(OSErr, 'SetDefaultOutputVolume', + (long, 'level', InMode), +) +functions.append(f) + +f = SndFunction(OSErr, 'GetSoundHeaderOffset', + (SndListHandle, 'sndHandle', InMode), + (long, 'offset', OutMode), +) +functions.append(f) + diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py index 02c9177..8201b2c 100644 --- a/Mac/Modules/snd/sndscan.py +++ b/Mac/Modules/snd/sndscan.py @@ -2,6 +2,9 @@ # Then import sndsupport (which execs sndgen.py) to generate Sndmodule.c. # (Should learn how to tell the compiler to compile it as well.) +import addpack +addpack.addpack(':Tools:bgen:bgen') + from scantools import Scanner def main(): @@ -36,6 +39,10 @@ class SoundScanner(Scanner): 'StartSound', 'StopSound', 'SoundDone', + # These are soundMgr 3.0 routines that I can't seem to find... + 'GetSoundPreference', + 'SetSoundPreference', + 'GetCompressionInfo', ] @@ -43,6 +50,7 @@ class SoundScanner(Scanner): return [ "GetSoundVol", "SetSoundVol", + "UnsignedFixed", ] def makerepairinstructions(self): @@ -62,6 +70,9 @@ class SoundScanner(Scanner): ([("SMStatusPtr", "*", "InMode")], [("SMStatus", "*", "OutMode")]), + + ([("CompressionInfoPtr", "*", "InMode")], + [("CompressionInfo", "*", "OutMode")]), # For SndPlay's SndListHandle argument ([("Handle", "sndHdl", "InMode")], diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py index fb561e8..af1908a 100644 --- a/Mac/Modules/snd/sndsupport.py +++ b/Mac/Modules/snd/sndsupport.py @@ -3,6 +3,9 @@ # It execs the file sndgen.py which contain the function definitions # (sndgen.py was generated by sndscan.py, scanning the header file). +import addpack +addpack.addpack(':Tools:bgen:bgen') + from macsupport import * @@ -71,8 +74,10 @@ class SndCallBackType(InputOnlyType): IndentLevel() SndCallBackProcPtr = SndCallBackType() +SndCallBackUPP = SndCallBackProcPtr SndCompletionProcPtr = FakeType('(SndCompletionProcPtr)0') # XXX +SndCompletionUPP = SndCompletionProcPtr NumVersion = OpaqueByValueType('NumVersion', 'NumVer') @@ -81,9 +86,11 @@ InOutBuf128 = FixedInputOutputBufferType(128) AudioSelectionPtr = FakeType('0') # XXX ProcPtr = FakeType('0') # XXX +FilePlayCompletionUPP = FakeType('0') # XXX SCStatus = StructOutputBufferType('SCStatus') SMStatus = StructOutputBufferType('SMStatus') +CompressionInfo = StructOutputBufferType('CompressionInfo') includestuff = includestuff + """ #include /* for Set(Current)A5 */ diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c index fc89803..7d6de73 100644 --- a/Mac/Modules/win/Winmodule.c +++ b/Mac/Modules/win/Winmodule.c @@ -346,7 +346,7 @@ static PyObject *WinObj_ClipAbove(_self, _args) PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - ClipAbove((WindowPeek)(_self->ob_itself)); + ClipAbove(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; @@ -359,7 +359,7 @@ static PyObject *WinObj_SaveOld(_self, _args) PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - SaveOld((WindowPeek)(_self->ob_itself)); + SaveOld(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; @@ -374,7 +374,7 @@ static PyObject *WinObj_DrawNew(_self, _args) if (!PyArg_ParseTuple(_args, "b", &update)) return NULL; - DrawNew((WindowPeek)(_self->ob_itself), + DrawNew(_self->ob_itself, update); Py_INCREF(Py_None); _res = Py_None; @@ -388,7 +388,7 @@ static PyObject *WinObj_CalcVis(_self, _args) PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - CalcVis((WindowPeek)(_self->ob_itself)); + CalcVis(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; @@ -871,4 +871,3 @@ void initWin() /* ========================= End module Win ========================= */ - diff --git a/Mac/Modules/win/wingen.py b/Mac/Modules/win/wingen.py index 0abf6e0..f0f7633 100644 --- a/Mac/Modules/win/wingen.py +++ b/Mac/Modules/win/wingen.py @@ -1,69 +1,69 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Windows.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Windows.h' f = Function(void, 'InitWindows', ) functions.append(f) -f = Function(WindowPtr, 'NewWindow', +f = Function(WindowRef, 'NewWindow', (NullStorage, 'wStorage', InMode), (Rect_ptr, 'boundsRect', InMode), (ConstStr255Param, 'title', InMode), (Boolean, 'visible', InMode), (short, 'theProc', InMode), - (WindowPtr, 'behind', InMode), + (WindowRef, 'behind', InMode), (Boolean, 'goAwayFlag', InMode), (long, 'refCon', InMode), ) functions.append(f) -f = Function(WindowPtr, 'GetNewWindow', +f = Function(WindowRef, 'GetNewWindow', (short, 'windowID', InMode), (NullStorage, 'wStorage', InMode), - (WindowPtr, 'behind', InMode), + (WindowRef, 'behind', InMode), ) functions.append(f) f = Method(void, 'GetWTitle', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Str255, 'title', OutMode), ) methods.append(f) f = Method(void, 'SelectWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'HideWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'ShowWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'ShowHide', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Boolean, 'showFlag', InMode), ) methods.append(f) f = Method(void, 'HiliteWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Boolean, 'fHilite', InMode), ) methods.append(f) f = Method(void, 'BringToFront', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'SendBehind', - (WindowPtr, 'theWindow', InMode), - (WindowPtr, 'behindWindow', InMode), + (WindowRef, 'theWindow', InMode), + (WindowRef, 'behindWindow', InMode), ) methods.append(f) @@ -72,12 +72,12 @@ f = Function(ExistingWindowPtr, 'FrontWindow', functions.append(f) f = Method(void, 'DrawGrowIcon', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'MoveWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (short, 'hGlobal', InMode), (short, 'vGlobal', InMode), (Boolean, 'front', InMode), @@ -85,7 +85,7 @@ f = Method(void, 'MoveWindow', methods.append(f) f = Method(void, 'SizeWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (short, 'w', InMode), (short, 'h', InMode), (Boolean, 'fUpdate', InMode), @@ -93,7 +93,7 @@ f = Method(void, 'SizeWindow', methods.append(f) f = Method(void, 'ZoomWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (short, 'partCode', InMode), (Boolean, 'front', InMode), ) @@ -110,23 +110,23 @@ f = Function(void, 'ValidRect', functions.append(f) f = Method(void, 'BeginUpdate', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'EndUpdate', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'SetWRefCon', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (long, 'data', InMode), ) methods.append(f) f = Method(long, 'GetWRefCon', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) @@ -136,28 +136,28 @@ f = Function(Boolean, 'CheckUpdate', functions.append(f) f = Method(void, 'ClipAbove', - (WindowPeek, 'window', InMode), + (WindowRef, 'window', InMode), ) methods.append(f) f = Method(void, 'SaveOld', - (WindowPeek, 'window', InMode), + (WindowRef, 'window', InMode), ) methods.append(f) f = Method(void, 'DrawNew', - (WindowPeek, 'window', InMode), + (WindowRef, 'window', InMode), (Boolean, 'update', InMode), ) methods.append(f) f = Method(void, 'CalcVis', - (WindowPeek, 'window', InMode), + (WindowRef, 'window', InMode), ) methods.append(f) f = Method(long, 'GrowWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Point, 'startPt', InMode), (Rect_ptr, 'bBox', InMode), ) @@ -176,53 +176,52 @@ f = Function(long, 'PinRect', functions.append(f) f = Method(Boolean, 'TrackBox', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Point, 'thePt', InMode), (short, 'partCode', InMode), ) methods.append(f) -f = Function(WindowPtr, 'NewCWindow', +f = Function(WindowRef, 'NewCWindow', (NullStorage, 'wStorage', InMode), (Rect_ptr, 'boundsRect', InMode), (ConstStr255Param, 'title', InMode), (Boolean, 'visible', InMode), (short, 'procID', InMode), - (WindowPtr, 'behind', InMode), + (WindowRef, 'behind', InMode), (Boolean, 'goAwayFlag', InMode), (long, 'refCon', InMode), ) functions.append(f) -f = Function(WindowPtr, 'GetNewCWindow', +f = Function(WindowRef, 'GetNewCWindow', (short, 'windowID', InMode), (NullStorage, 'wStorage', InMode), - (WindowPtr, 'behind', InMode), + (WindowRef, 'behind', InMode), ) functions.append(f) f = Method(short, 'GetWVariant', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), ) methods.append(f) f = Method(void, 'SetWTitle', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (ConstStr255Param, 'title', InMode), ) methods.append(f) f = Method(Boolean, 'TrackGoAway', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Point, 'thePt', InMode), ) methods.append(f) f = Method(void, 'DragWindow', - (WindowPtr, 'theWindow', InMode), + (WindowRef, 'theWindow', InMode), (Point, 'startPt', InMode), (Rect_ptr, 'boundsRect', InMode), ) methods.append(f) - diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py index 8d089a3..e9ac5af 100644 --- a/Mac/Modules/win/winscan.py +++ b/Mac/Modules/win/winscan.py @@ -1,4 +1,6 @@ # Scan an Apple header file, generating a Python file of generator calls. +import addpack +addpack.addpack(':Tools:bgen:bgen') from scantools import Scanner @@ -20,7 +22,7 @@ class MyScanner(Scanner): listname = "functions" if arglist: t, n, m = arglist[0] - if t in ("WindowPtr", "WindowPeek") and m == "InMode": + if t in ("WindowPtr", "WindowPeek", "WindowRef") and m == "InMode": classname = "Method" listname = "methods" return classname, listname @@ -62,9 +64,13 @@ class MyScanner(Scanner): ([("WindowPtr", "*", "OutMode")], [("ExistingWindowPtr", "*", "*")]), + ([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles + [("ExistingWindowPtr", "*", "*")]), ([("WindowPtr", "FrontWindow", "ReturnMode")], [("ExistingWindowPtr", "*", "*")]), + ([("WindowRef", "FrontWindow", "ReturnMode")], # Ditto + [("ExistingWindowPtr", "*", "*")]), ] if __name__ == "__main__": diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py index a7f1ebd..6f085f7 100644 --- a/Mac/Modules/win/winsupport.py +++ b/Mac/Modules/win/winsupport.py @@ -5,6 +5,9 @@ import string +import addpack +addpack.addpack(':Tools:bgen:bgen') + # Declarations that change for each manager MACHEADERFILE = 'Windows.h' # The Apple header file MODNAME = 'Win' # The name of the module @@ -22,6 +25,7 @@ from macsupport import * # Create the type objects WindowPtr = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) +WindowRef = WindowPtr WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) WindowPeek.passInput = lambda name: "(WindowPeek)(%s)" % name -- cgit v0.12