Commit 21f96872 authored by Jack Jansen's avatar Jack Jansen

Regenerated from Universal Headers 3.0.1. Some new calls are

blacklisted, because they are not available in classic 68k programs,
and bgen doesn't have a way to put #ifdef/#endif in the generated
code. For now we only implement calls that work on all three models.
parent cbe6a53d
This diff is collapsed.
......@@ -19,7 +19,7 @@ def main():
input = "AERegistry.h"
output = "@dummy-registry.py"
defsoutput = TOOLBOXDIR + "AERegistry.py"
scanner = AppleEventsScanner(input, output, defsoutput)
scanner = AppleEventsRegScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
print "=== Scanning AEObjects.h for defines ==="
......@@ -32,11 +32,19 @@ def main():
scanner = AppleEventsScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
print "=== Scanning AppleEvents.py ==="
print "=== Scanning AEDataModel.h ==="
input = "AEDataModel.h"
output = "aedatamodelgen.py"
defsoutput = TOOLBOXDIR + "AEDataModel.py"
scanner = AppleEventsScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
print "=== Scanning AppleEvents.h ==="
input = "AppleEvents.h"
output = "aegen.py"
defsoutput = TOOLBOXDIR + "AppleEvents.py"
scanner = AppleEventsScanner(input, output, defsoutput)
scanner = AppleEventsRegScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
print "=== Done Scanning and Generating, now doing 'import aesupport' ==="
......@@ -102,5 +110,13 @@ class AppleEventsScanner(Scanner):
[("AEDescList_ptr", "*", "InMode")]),
]
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
class AppleEventsRegScanner(AppleEventsScanner):
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
self.defsfile.write("from AEDataModel import *\n")
if __name__ == "__main__":
main()
......@@ -13,6 +13,9 @@ AEArrayType = Type("AEArrayType", "c")
AESendMode = Type("AESendMode", "l")
AESendPriority = Type("AESendPriority", "h")
AEInteractAllowed = Type("AEInteractAllowed", "b")
AEReturnID = Type("AEReturnID", "h")
AETransactionID = Type("AETransactionID", "h")
AEEventClass = OSTypeType('AEEventClass')
......@@ -199,6 +202,7 @@ functions = []
aedescmethods = []
execfile('aegen.py')
execfile('aedatamodelgen.py')
for f in functions: module.add(f)
for f in aedescmethods: aedescobject.add(f)
......
......@@ -6,7 +6,7 @@ from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Components"
SHORT = "Cm"
SHORT = "cm"
def main():
input = "Components.h"
......@@ -38,6 +38,9 @@ class MyScanner(Scanner):
listname = "ci_methods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def makeblacklistnames(self):
return [
"OpenADefaultComponent",
......
This diff is collapsed.
......@@ -28,17 +28,39 @@ class MyScanner(Scanner):
listname = "methods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
self.defsfile.write("from TextEdit import *\n")
self.defsfile.write("from QuickDraw import *\n")
self.defsfile.write("\n")
def makeblacklistnames(self):
return [
'DisposeControl', # Generated manually
'KillControls', # Implied by close of dialog
'SetCtlAction',
'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition
'kControlProgressBarIndeterminateTag', # ditto
# The following are unavailable for static 68k (appearance manager)
'GetBevelButtonMenuValue',
'SetBevelButtonMenuValue',
'GetBevelButtonMenuHandle',
'SetBevelButtonTransform',
'SetBevelButtonGraphicAlignment',
'SetBevelButtonTextAlignment',
'SetBevelButtonTextPlacement',
'SetImageWellTransform',
'GetTabContentRect',
'SetTabEnabled',
'SetDisclosureTriangleLastValue',
]
def makeblacklisttypes(self):
return [
'ProcPtr',
'ControlActionUPP',
'ControlButtonContentInfoPtr',
'Ptr',
]
def makerepairinstructions(self):
......
......@@ -33,6 +33,16 @@ CCTabHandle = OpaqueByValueType("CCTabHandle", "ResObj")
AuxCtlHandle = OpaqueByValueType("AuxCtlHandle", "ResObj")
ControlPartCode = Type("ControlPartCode", "h")
DragConstraint = Type("DragConstraint", "h")
ControlVariant = Type("ControlVariant", "h")
IconTransformType = Type("IconTransformType", "h")
ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h")
ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h")
ControlButtonTextPlacement = Type("ControlButtonTextPlacement", "h")
ControlContentType = Type("ControlContentType", "h")
ControlFocusPart = Type("ControlFocusPart", "h")
ControlFontStyleRec = OpaqueType('ControlFontStyleRec', 'ControlFontStyle')
ControlFontStyleRec_ptr = ControlFontStyleRec
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
......@@ -40,10 +50,36 @@ includestuff = includestuff + """
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
extern PyObject *QdRGB_New(RGBColorPtr);
extern QdRGB_Convert(PyObject *, RGBColorPtr);
#ifdef THINK_C
#define ControlActionUPP ProcPtr
#endif
/*
** Parse/generate ControlFontStyleRec records
*/
#if 0 /* Not needed */
PyObject *ControlFontStyle_New(itself)
ControlFontStyleRec *itself;
{
return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
itself->size, itself->style, itself->mode, itself->just,
QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
}
#endif
ControlFontStyle_Convert(v, itself)
PyObject *v;
ControlFontStyleRec *itself;
{
return PyArg_ParseTuple(v, "hhhhhhO&O&", &itself->flags,
&itself->font, &itself->size, &itself->style, &itself->mode,
&itself->just, QdRGB_Convert, &itself->foreColor,
QdRGB_Convert, &itself->backColor);
}
"""
finalstuff = finalstuff + """
......
This diff is collapsed.
......@@ -51,6 +51,7 @@ class MyScanner(Scanner):
def makeblacklisttypes(self):
return [
"AlertStdAlertParamPtr", # Too much work, for now
]
def makerepairinstructions(self):
......
......@@ -24,6 +24,11 @@ ModalFilterUPP = ModalFilterProcPtr
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
DITLMethod = Type("DITLMethod", "h")
DialogItemIndex = Type("DialogItemIndex", "h")
DialogItemType = Type("DialogItemType", "h")
DialogItemIndexZeroBased = Type("DialogItemIndexZeroBased", "h")
AlertType = Type("AlertType", "h")
StringPtr = Str255
includestuff = includestuff + """
#include <Dialogs.h>
......
......@@ -48,192 +48,192 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
static PyObject *Evt_Error;
static PyObject *Evt_GetCaretTime(_self, _args)
static PyObject *Evt_GetMouse(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
Point mouseLoc;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCaretTime();
_res = Py_BuildValue("l",
_rv);
GetMouse(&mouseLoc);
_res = Py_BuildValue("O&",
PyMac_BuildPoint, mouseLoc);
return _res;
}
static PyObject *Evt_SetEventMask(_self, _args)
static PyObject *Evt_Button(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
EventMask value;
if (!PyArg_ParseTuple(_args, "h",
&value))
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
SetEventMask(value);
Py_INCREF(Py_None);
_res = Py_None;
_rv = Button();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_GetDblTime(_self, _args)
static PyObject *Evt_StillDown(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetDblTime();
_res = Py_BuildValue("l",
_rv = StillDown();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_GetNextEvent(_self, _args)
static PyObject *Evt_WaitMouseUp(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
EventMask eventMask;
EventRecord theEvent;
if (!PyArg_ParseTuple(_args, "h",
&eventMask))
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetNextEvent(eventMask,
&theEvent);
_res = Py_BuildValue("bO&",
_rv,
PyMac_BuildEventRecord, &theEvent);
_rv = WaitMouseUp();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_WaitNextEvent(_self, _args)
static PyObject *Evt_TickCount(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
EventMask eventMask;
EventRecord theEvent;
UInt32 sleep;
if (!PyArg_ParseTuple(_args, "hl",
&eventMask,
&sleep))
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = WaitNextEvent(eventMask,
&theEvent,
sleep,
(RgnHandle)0);
_res = Py_BuildValue("bO&",
_rv,
PyMac_BuildEventRecord, &theEvent);
_rv = TickCount();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_EventAvail(_self, _args)
static PyObject *Evt_GetCaretTime(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
EventMask eventMask;
EventRecord theEvent;
if (!PyArg_ParseTuple(_args, "h",
&eventMask))
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = EventAvail(eventMask,
&theEvent);
_res = Py_BuildValue("bO&",
_rv,
PyMac_BuildEventRecord, &theEvent);
_rv = GetCaretTime();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_GetMouse(_self, _args)
static PyObject *Evt_GetKeys(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Point mouseLoc;
KeyMap theKeys__out__;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
GetMouse(&mouseLoc);
_res = Py_BuildValue("O&",
PyMac_BuildPoint, mouseLoc);
GetKeys(theKeys__out__);
_res = Py_BuildValue("s#",
(char *)&theKeys__out__, (int)sizeof(KeyMap));
theKeys__error__: ;
return _res;
}
static PyObject *Evt_Button(_self, _args)
static PyObject *Evt_GetDblTime(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = Button();
_res = Py_BuildValue("b",
_rv = GetDblTime();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_StillDown(_self, _args)
static PyObject *Evt_SetEventMask(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
EventMask value;
if (!PyArg_ParseTuple(_args, "h",
&value))
return NULL;
_rv = StillDown();
_res = Py_BuildValue("b",
_rv);
SetEventMask(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Evt_WaitMouseUp(_self, _args)
static PyObject *Evt_GetNextEvent(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
EventMask eventMask;
EventRecord theEvent;
if (!PyArg_ParseTuple(_args, "h",
&eventMask))
return NULL;
_rv = WaitMouseUp();
_res = Py_BuildValue("b",
_rv);
_rv = GetNextEvent(eventMask,
&theEvent);
_res = Py_BuildValue("bO&",
_rv,
PyMac_BuildEventRecord, &theEvent);
return _res;
}
static PyObject *Evt_GetKeys(_self, _args)
static PyObject *Evt_WaitNextEvent(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
KeyMap theKeys__out__;
if (!PyArg_ParseTuple(_args, ""))
Boolean _rv;
EventMask eventMask;
EventRecord theEvent;
UInt32 sleep;
if (!PyArg_ParseTuple(_args, "hl",
&eventMask,
&sleep))
return NULL;
GetKeys(theKeys__out__);
_res = Py_BuildValue("s#",
(char *)&theKeys__out__, (int)sizeof(KeyMap));
theKeys__error__: ;
_rv = WaitNextEvent(eventMask,
&theEvent,
sleep,
(RgnHandle)0);
_res = Py_BuildValue("bO&",
_rv,
PyMac_BuildEventRecord, &theEvent);
return _res;
}
static PyObject *Evt_TickCount(_self, _args)
static PyObject *Evt_EventAvail(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
Boolean _rv;
EventMask eventMask;
EventRecord theEvent;
if (!PyArg_ParseTuple(_args, "h",
&eventMask))
return NULL;
_rv = TickCount();
_res = Py_BuildValue("l",
_rv);
_rv = EventAvail(eventMask,
&theEvent);
_res = Py_BuildValue("bO&",
_rv,
PyMac_BuildEventRecord, &theEvent);
return _res;
}
......@@ -361,18 +361,6 @@ static PyObject *Evt_SystemEvent(_self, _args)
}
static PyMethodDef Evt_methods[] = {
{"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
"() -> (UInt32 _rv)"},
{"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
"(EventMask value) -> None"},
{"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
"() -> (UInt32 _rv)"},
{"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
"(EventMask eventMask, UInt32 sleep) -> (Boolean _rv, EventRecord theEvent)"},
{"EventAvail", (PyCFunction)Evt_EventAvail, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"GetMouse", (PyCFunction)Evt_GetMouse, 1,
"() -> (Point mouseLoc)"},
{"Button", (PyCFunction)Evt_Button, 1,
......@@ -381,10 +369,22 @@ static PyMethodDef Evt_methods[] = {
"() -> (Boolean _rv)"},
{"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1,
"() -> (Boolean _rv)"},
{"TickCount", (PyCFunction)Evt_TickCount, 1,
"() -> (UInt32 _rv)"},
{"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
"() -> (UInt32 _rv)"},
{"GetKeys", (PyCFunction)Evt_GetKeys, 1,
"() -> (KeyMap theKeys)"},
{"TickCount", (PyCFunction)Evt_TickCount, 1,
{"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
"() -> (UInt32 _rv)"},
{"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
"(EventMask value) -> None"},
{"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
"(EventMask eventMask, UInt32 sleep) -> (Boolean _rv, EventRecord theEvent)"},
{"EventAvail", (PyCFunction)Evt_EventAvail, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"PostEvent", (PyCFunction)Evt_PostEvent, 1,
"(EventKind eventNum, UInt32 eventMsg) -> None"},
{"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1,
......
......@@ -6,7 +6,7 @@ from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Fonts"
SHORT = "Fm"
SHORT = "fm"
def main():
input = "Fonts.h"
......@@ -29,6 +29,11 @@ class MyScanner(Scanner):
def makeblacklistnames(self):
return [
"OutlineMetrics", # Too complicated
"AntiTextIsAntiAliased", # XXXX Missing from library...
"AntiTextGetEnabled",
"AntiTextSetEnabled",
"AntiTextGetApplicationAware",
"AntiTextSetApplicationAware",
]
def makeblacklisttypes(self):
......
......@@ -54,7 +54,7 @@ static PyObject *Help_HMGetHelpMenuHandle(_self, _args)
{
PyObject *_res = NULL;
OSErr _err;
MenuRef mh;
MenuHandle mh;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = HMGetHelpMenuHandle(&mh);
......@@ -79,6 +79,20 @@ static PyObject *Help_HMRemoveBalloon(_self, _args)
return _res;
}
static PyObject *Help_HMIsBalloon(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = HMIsBalloon();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Help_HMGetBalloons(_self, _args)
PyObject *_self;
PyObject *_args;
......@@ -110,20 +124,6 @@ static PyObject *Help_HMSetBalloons(_self, _args)
return _res;
}
static PyObject *Help_HMIsBalloon(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = HMIsBalloon();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Help_HMSetFont(_self, _args)
PyObject *_self;
PyObject *_args;
......@@ -303,15 +303,15 @@ static PyObject *Help_HMGetBalloonWindow(_self, _args)
static PyMethodDef Help_methods[] = {
{"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1,
"() -> (MenuRef mh)"},
"() -> (MenuHandle mh)"},
{"HMRemoveBalloon", (PyCFunction)Help_HMRemoveBalloon, 1,
"() -> None"},
{"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1,
"() -> (Boolean _rv)"},
{"HMGetBalloons", (PyCFunction)Help_HMGetBalloons, 1,
"() -> (Boolean _rv)"},
{"HMSetBalloons", (PyCFunction)Help_HMSetBalloons, 1,
"(Boolean flag) -> None"},
{"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1,
"() -> (Boolean _rv)"},
{"HMSetFont", (PyCFunction)Help_HMSetFont, 1,
"(SInt16 font) -> None"},
{"HMSetFontSize", (PyCFunction)Help_HMSetFontSize, 1,
......
......@@ -33,6 +33,9 @@ class MyScanner(Scanner):
listname = "methods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def makeblacklistnames(self):
return [
]
......
......@@ -54,11 +54,11 @@ PyTypeObject List_Type;
typedef struct ListObject {
PyObject_HEAD
ListRef ob_itself;
ListHandle ob_itself;
} ListObject;
PyObject *ListObj_New(itself)
ListRef itself;
ListHandle itself;
{
ListObject *it;
if (itself == NULL) {
......@@ -72,7 +72,7 @@ PyObject *ListObj_New(itself)
}
ListObj_Convert(v, p_itself)
PyObject *v;
ListRef *p_itself;
ListHandle *p_itself;
{
if (!ListObj_Check(v))
{
......@@ -615,7 +615,7 @@ static PyObject *List_LNew(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
ListRef _rv;
ListHandle _rv;
Rect rView;
Rect dataBounds;
Point cSize;
......@@ -652,7 +652,7 @@ static PyObject *List_LNew(_self, _args)
static PyMethodDef List_methods[] = {
{"LNew", (PyCFunction)List_LNew, 1,
"(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListRef _rv)"},
"(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)"},
{NULL, NULL, 0}
};
......
......@@ -7,7 +7,7 @@ from bgenlocations import TOOLBOXDIR
LONG = "Lists"
SHORT = "list"
OBJECT = "ListRef"
OBJECT = "ListHandle"
def main():
input = LONG + ".h"
......
......@@ -13,7 +13,7 @@ KIND = 'Handle' # Usually 'Ptr' or 'Handle'
# The following is *usually* unchanged but may still require tuning
MODPREFIX = MODNAME # The prefix for module-wide routines
OBJECTTYPE = "ListRef" # The C type used to represent them
OBJECTTYPE = "ListHandle" # The C type used to represent them
OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
......@@ -21,7 +21,7 @@ OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
from macsupport import *
# Create the type objects
ListRef = OpaqueByValueType("ListRef", "ListObj")
ListHandle = OpaqueByValueType("ListHandle", "ListObj")
Cell = Point
VarOutBufferShortsize = VarHeapOutputBufferType('char', 'short', 's') # (buf, &len)
InBufferShortsize = VarInputBufferType('char', 'short', 's') # (buf, len)
......
This diff is collapsed.
......@@ -3586,6 +3586,38 @@ static PyObject *Qd_GetIndPattern(_self, _args)
return _res;
}
static PyObject *Qd_SlopeFromAngle(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Fixed _rv;
short angle;
if (!PyArg_ParseTuple(_args, "h",
&angle))
return NULL;
_rv = SlopeFromAngle(angle);
_res = Py_BuildValue("O&",
PyMac_BuildFixed, _rv);
return _res;
}
static PyObject *Qd_AngleFromSlope(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
Fixed slope;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetFixed, &slope))
return NULL;
_rv = AngleFromSlope(slope);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *Qd_TextFont(_self, _args)
PyObject *_self;
PyObject *_args;
......@@ -3606,7 +3638,7 @@ static PyObject *Qd_TextFace(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
short face;
Style face;
if (!PyArg_ParseTuple(_args, "h",
&face))
return NULL;
......@@ -3666,8 +3698,8 @@ static PyObject *Qd_DrawChar(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
short ch;
if (!PyArg_ParseTuple(_args, "h",
CharParameter ch;
if (!PyArg_ParseTuple(_args, "c",
&ch))
return NULL;
DrawChar(ch);
......@@ -3721,8 +3753,8 @@ static PyObject *Qd_CharWidth(_self, _args)
{
PyObject *_res = NULL;
short _rv;
short ch;
if (!PyArg_ParseTuple(_args, "h",
CharParameter ch;
if (!PyArg_ParseTuple(_args, "c",
&ch))
return NULL;
_rv = CharWidth(ch);
......@@ -4215,10 +4247,14 @@ static PyMethodDef Qd_methods[] = {
"() -> (short scrnHRes, short scrnVRes)"},
{"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
"(short patternListID, short index) -> (Pattern thePat)"},
{"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
"(short angle) -> (Fixed _rv)"},
{"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
"(Fixed slope) -> (short _rv)"},
{"TextFont", (PyCFunction)Qd_TextFont, 1,
"(short font) -> None"},
{"TextFace", (PyCFunction)Qd_TextFace, 1,
"(short face) -> None"},
"(Style face) -> None"},
{"TextMode", (PyCFunction)Qd_TextMode, 1,
"(short mode) -> None"},
{"TextSize", (PyCFunction)Qd_TextSize, 1,
......@@ -4226,13 +4262,13 @@ static PyMethodDef Qd_methods[] = {
{"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
"(Fixed extra) -> None"},
{"DrawChar", (PyCFunction)Qd_DrawChar, 1,
"(short ch) -> None"},
"(CharParameter 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)"},
"(CharParameter ch) -> (short _rv)"},
{"StringWidth", (PyCFunction)Qd_StringWidth, 1,
"(Str255 s) -> (short _rv)"},
{"TextWidth", (PyCFunction)Qd_TextWidth, 1,
......
......@@ -72,6 +72,8 @@ class MyScanner(Scanner):
'InitCPort',
'CloseCPort',
'BitMapToRegionGlue',
'StdOpcode', # XXXX Missing from library...
]
def makeblacklisttypes(self):
......
......@@ -32,6 +32,9 @@ class MyScanner(Scanner):
listname = t + "_methods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def makeblacklistnames(self):
return [
"DisposeMovie", # Done on python-object disposal
......
......@@ -605,7 +605,7 @@ static PyObject *Res_ResError(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
OSErr _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = ResError();
......@@ -1275,7 +1275,7 @@ static PyMethodDef Res_methods[] = {
{"CloseResFile", (PyCFunction)Res_CloseResFile, 1,
"(short refNum) -> None"},
{"ResError", (PyCFunction)Res_ResError, 1,
"() -> (short _rv)"},
"() -> (OSErr _rv)"},
{"CurResFile", (PyCFunction)Res_CurResFile, 1,
"() -> (short _rv)"},
{"CreateResFile", (PyCFunction)Res_CreateResFile, 1,
......
......@@ -171,14 +171,14 @@ static PyObject *SndCh_SndPlay(_self, _args)
{
PyObject *_res = NULL;
OSErr _err;
SndListHandle sndHdl;
SndListHandle sndHandle;
Boolean async;
if (!PyArg_ParseTuple(_args, "O&b",
ResObj_Convert, &sndHdl,
ResObj_Convert, &sndHandle,
&async))
return NULL;
_err = SndPlay(_self->ob_itself,
sndHdl,
sndHandle,
async);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
......@@ -276,7 +276,7 @@ static PyMethodDef SndCh_methods[] = {
{"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1,
"(SndCommand cmd) -> None"},
{"SndPlay", (PyCFunction)SndCh_SndPlay, 1,
"(SndListHandle sndHdl, Boolean async) -> None"},
"(SndListHandle sndHandle, Boolean async) -> None"},
{"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1,
"(short fRefNum, short resNum, long bufferSize, Boolean async) -> None"},
{"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1,
......@@ -315,6 +315,21 @@ staticforward PyTypeObject SndChannel_Type = {
/* ------------------- End object type SndChannel ------------------- */
static PyObject *Snd_SysBeep(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short duration;
if (!PyArg_ParseTuple(_args, "h",
&duration))
return NULL;
SysBeep(duration);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SndNewChannel(_self, _args)
PyObject *_self;
PyObject *_args;
......@@ -712,7 +727,244 @@ static PyObject *Snd_GetSoundHeaderOffset(_self, _args)
return _res;
}
static PyObject *Snd_SPBVersion(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
NumVersion _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = SPBVersion();
_res = Py_BuildValue("O&",
PyMac_BuildNumVersion, _rv);
return _res;
}
static PyObject *Snd_SPBSignInDevice(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
short deviceRefNum;
Str255 deviceName;
if (!PyArg_ParseTuple(_args, "hO&",
&deviceRefNum,
PyMac_GetStr255, deviceName))
return NULL;
_err = SPBSignInDevice(deviceRefNum,
deviceName);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SPBSignOutDevice(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
short deviceRefNum;
if (!PyArg_ParseTuple(_args, "h",
&deviceRefNum))
return NULL;
_err = SPBSignOutDevice(deviceRefNum);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SPBGetIndexedDevice(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
short count;
Str255 deviceName;
Handle deviceIconHandle;
if (!PyArg_ParseTuple(_args, "h",
&count))
return NULL;
_err = SPBGetIndexedDevice(count,
deviceName,
&deviceIconHandle);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&O&",
PyMac_BuildStr255, deviceName,
ResObj_New, deviceIconHandle);
return _res;
}
static PyObject *Snd_SPBOpenDevice(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
Str255 deviceName;
short permission;
long inRefNum;
if (!PyArg_ParseTuple(_args, "O&h",
PyMac_GetStr255, deviceName,
&permission))
return NULL;
_err = SPBOpenDevice(deviceName,
permission,
&inRefNum);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("l",
inRefNum);
return _res;
}
static PyObject *Snd_SPBCloseDevice(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBCloseDevice(inRefNum);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SPBPauseRecording(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBPauseRecording(inRefNum);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SPBResumeRecording(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBResumeRecording(inRefNum);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SPBStopRecording(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBStopRecording(inRefNum);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Snd_SPBGetRecordingStatus(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
short recordingStatus;
short meterLevel;
unsigned long totalSamplesToRecord;
unsigned long numberOfSamplesRecorded;
unsigned long totalMsecsToRecord;
unsigned long numberOfMsecsRecorded;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBGetRecordingStatus(inRefNum,
&recordingStatus,
&meterLevel,
&totalSamplesToRecord,
&numberOfSamplesRecorded,
&totalMsecsToRecord,
&numberOfMsecsRecorded);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("hhllll",
recordingStatus,
meterLevel,
totalSamplesToRecord,
numberOfSamplesRecorded,
totalMsecsToRecord,
numberOfMsecsRecorded);
return _res;
}
static PyObject *Snd_SPBMillisecondsToBytes(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
long milliseconds;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBMillisecondsToBytes(inRefNum,
&milliseconds);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("l",
milliseconds);
return _res;
}
static PyObject *Snd_SPBBytesToMilliseconds(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
long inRefNum;
long byteCount;
if (!PyArg_ParseTuple(_args, "l",
&inRefNum))
return NULL;
_err = SPBBytesToMilliseconds(inRefNum,
&byteCount);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("l",
byteCount);
return _res;
}
static PyMethodDef Snd_methods[] = {
{"SysBeep", (PyCFunction)Snd_SysBeep, 1,
"(short duration) -> None"},
{"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1,
"(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"},
{"SndControl", (PyCFunction)Snd_SndControl, 1,
......@@ -745,6 +997,30 @@ static PyMethodDef Snd_methods[] = {
"(long level) -> None"},
{"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1,
"(SndListHandle sndHandle) -> (long offset)"},
{"SPBVersion", (PyCFunction)Snd_SPBVersion, 1,
"() -> (NumVersion _rv)"},
{"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1,
"(short deviceRefNum, Str255 deviceName) -> None"},
{"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1,
"(short deviceRefNum) -> None"},
{"SPBGetIndexedDevice", (PyCFunction)Snd_SPBGetIndexedDevice, 1,
"(short count) -> (Str255 deviceName, Handle deviceIconHandle)"},
{"SPBOpenDevice", (PyCFunction)Snd_SPBOpenDevice, 1,
"(Str255 deviceName, short permission) -> (long inRefNum)"},
{"SPBCloseDevice", (PyCFunction)Snd_SPBCloseDevice, 1,
"(long inRefNum) -> None"},
{"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1,
"(long inRefNum) -> None"},
{"SPBResumeRecording", (PyCFunction)Snd_SPBResumeRecording, 1,
"(long inRefNum) -> None"},
{"SPBStopRecording", (PyCFunction)Snd_SPBStopRecording, 1,
"(long inRefNum) -> None"},
{"SPBGetRecordingStatus", (PyCFunction)Snd_SPBGetRecordingStatus, 1,
"(long inRefNum) -> (short recordingStatus, short meterLevel, unsigned long totalSamplesToRecord, unsigned long numberOfSamplesRecorded, unsigned long totalMsecsToRecord, unsigned long numberOfMsecsRecorded)"},
{"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1,
"(long inRefNum) -> (long milliseconds)"},
{"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1,
"(long inRefNum) -> (long byteCount)"},
{NULL, NULL, 0}
};
......
......@@ -31,6 +31,9 @@ class SoundScanner(Scanner):
listname = "sndmethods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def makeblacklistnames(self):
return [
'SndDisposeChannel', # automatic on deallocation
......@@ -44,9 +47,12 @@ class SoundScanner(Scanner):
'GetSoundPreference',
'SetSoundPreference',
'GetCompressionInfo',
'GetCompressionName',
# Calls with void_ptr arguments (to be done).
'SndGetInfo',
'SndSetInfo',
'SPBGetDeviceInfo',
'SPBSetDeviceInfo',
# And old calls that are no longer supported
'SetSoundVol',
'GetSoundVol',
......@@ -60,6 +66,13 @@ class SoundScanner(Scanner):
"UnsignedFixed",
# Don't have the time to dig into this...
"Component",
"ComponentInstance",
"SoundComponentDataPtr",
"SoundComponentData",
"SoundComponentData_ptr",
"SoundConverter",
"ModalFilterUPP",
"SPBPtr",
]
def makerepairinstructions(self):
......
......@@ -216,8 +216,8 @@ static PyObject *TEObj_TEKey(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
short key;
if (!PyArg_ParseTuple(_args, "h",
CharParameter key;
if (!PyArg_ParseTuple(_args, "c",
&key))
return NULL;
TEKey(key,
......@@ -736,7 +736,7 @@ static PyMethodDef TEObj_methods[] = {
{"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1,
"() -> None"},
{"TEKey", (PyCFunction)TEObj_TEKey, 1,
"(short key) -> None"},
"(CharParameter key) -> None"},
{"TECut", (PyCFunction)TEObj_TECut, 1,
"() -> None"},
{"TECopy", (PyCFunction)TEObj_TECopy, 1,
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ from bgenlocations import TOOLBOXDIR
from scantools import Scanner
def main():
input = "Windows.h"
input = "MacWindows.h"
output = "wingen.py"
defsoutput = TOOLBOXDIR + "Windows.py"
scanner = MyScanner(input, output, defsoutput)
......@@ -28,6 +28,9 @@ class MyScanner(Scanner):
listname = "methods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def makeblacklistnames(self):
return [
'DisposeWindow', # Implied when the object is deleted
......
......@@ -38,6 +38,8 @@ WCTabHandle = OpaqueByValueType("WCTabHandle", "ResObj")
AuxWinHandle = OpaqueByValueType("AuxWinHandle", "ResObj")
PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
WindowRegionCode = Type("WindowRegionCode", "h")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment