another round... ported to __SC__
diff --git a/Mac/Lib/test/aete.py b/Mac/Lib/test/aete.py
index 205fbdb..21fff61 100644
--- a/Mac/Lib/test/aete.py
+++ b/Mac/Lib/test/aete.py
@@ -11,7 +11,7 @@
from Res import *
def main():
- filename = raw_input("Listing file? (default stdout): ")
+ filename = ""
redirect(filename, realmain)
def redirect(filename, func, *args):
@@ -27,14 +27,14 @@
def realmain():
#list('C:System Folder:Extensions:AppleScript\252')
#list('C:Tao AppleScript:Finder Liaison:Finder Liaison 1.0')
- #list('C:Tao AppleScript:Scriptable Text Editor')
+ list('C:Tao AppleScript:Scriptable Text Editor')
#list('C:Internet:Eudora 1.4.2:Eudora1.4.2')
#list('E:Excel 4.0:Microsoft Excel')
#list('C:Internet:Netscape 1.0N:Netscape 1.0N')
#find('C:')
- find('D:')
- find('E:')
- find('F:')
+ #find('D:')
+ #find('E:')
+ #find('F:')
def find(dir, maxlevel = 5):
hits = []
diff --git a/Mac/Lib/test/echo.py b/Mac/Lib/test/echo.py
index 12fbf92..616f712 100644
--- a/Mac/Lib/test/echo.py
+++ b/Mac/Lib/test/echo.py
@@ -6,14 +6,21 @@
can have (without having to rely on Apple's implementation).
"""
+import addpack
+addpack.addpack('Demo')
+addpack.addpack('bgen')
+addpack.addpack('ae')
+addpack.addpack('evt')
+
+import sys
+sys.stdout = sys.stderr
+import traceback
+import MacOS
import AE
from AppleEvents import *
import Evt
from Events import *
import aetools
-import sys
-import MacOS
-import traceback
kHighLevelEvent = 23 # Not defined anywhere for Python yet?
@@ -49,6 +56,9 @@
def mainloop(self, mask = everyEvent, timeout = 60*60):
while 1:
+ self.dooneevent(mask, timeout)
+
+ def dooneevent(self, mask = everyEvent, timeout = 60*60):
got, event = Evt.WaitNextEvent(mask, timeout)
if got:
self.lowlevelhandler(event)
@@ -116,4 +126,3 @@
if __name__ == '__main__':
main()
-else: main()
diff --git a/Mac/Lib/toolbox/aetools.py b/Mac/Lib/toolbox/aetools.py
index ae8b71a..e91449a 100644
--- a/Mac/Lib/toolbox/aetools.py
+++ b/Mac/Lib/toolbox/aetools.py
@@ -136,8 +136,10 @@
def mkfss(data):
+ print "mkfss data =", `data`
vol, dir, fnlen = struct.unpack('hlb', data[:7])
filename = data[7:7+fnlen]
+ print (vol, dir, fnlen, filename)
return macfs.FSSpec((vol, dir, filename))
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c
index 58b4d13..dc2fc7d 100644
--- a/Mac/Modules/ae/AEmodule.c
+++ b/Mac/Modules/ae/AEmodule.c
@@ -82,7 +82,7 @@
} AEDescObject;
static PyObject *AEDesc_New(itself)
- const AEDesc *itself;
+ AEDesc *itself;
{
AEDescObject *it;
it = PyObject_NEW(AEDescObject, &AEDesc_Type);
@@ -174,11 +174,13 @@
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
+ int dataPtr__in_len__;
if (!PyArg_ParseTuple(_args, "lO&s#",
&index,
PyMac_GetOSType, &typeCode,
- &dataPtr__in__, &dataPtr__len__))
+ &dataPtr__in__, &dataPtr__in_len__))
return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEPutPtr(&_self->ob_itself,
index,
typeCode,
@@ -223,16 +225,18 @@
DescType typeCode;
char *dataPtr__out__;
long dataPtr__len__;
- if (!PyArg_ParseTuple(_args, "lO&l",
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "lO&i",
&index,
PyMac_GetOSType, &desiredType,
- &dataPtr__len__))
+ &dataPtr__in_len__))
return NULL;
- if ((dataPtr__out__ = malloc(dataPtr__len__)) == NULL)
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
{
PyErr_NoMemory();
goto dataPtr__error__;
}
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEGetNthPtr(&_self->ob_itself,
index,
desiredType,
@@ -243,7 +247,7 @@
_res = Py_BuildValue("O&O&s#",
PyMac_BuildOSType, theAEKeyword,
PyMac_BuildOSType, typeCode,
- dataPtr__out__, dataPtr__len__);
+ dataPtr__out__, (int)dataPtr__len__);
free(dataPtr__out__);
dataPtr__error__: ;
return _res;
@@ -326,11 +330,13 @@
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
+ int dataPtr__in_len__;
if (!PyArg_ParseTuple(_args, "O&O&s#",
PyMac_GetOSType, &theAEKeyword,
PyMac_GetOSType, &typeCode,
- &dataPtr__in__, &dataPtr__len__))
+ &dataPtr__in__, &dataPtr__in_len__))
return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEPutKeyPtr(&_self->ob_itself,
theAEKeyword,
typeCode,
@@ -374,16 +380,18 @@
DescType typeCode;
char *dataPtr__out__;
long dataPtr__len__;
- if (!PyArg_ParseTuple(_args, "O&O&l",
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&i",
PyMac_GetOSType, &theAEKeyword,
PyMac_GetOSType, &desiredType,
- &dataPtr__len__))
+ &dataPtr__in_len__))
return NULL;
- if ((dataPtr__out__ = malloc(dataPtr__len__)) == NULL)
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
{
PyErr_NoMemory();
goto dataPtr__error__;
}
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEGetKeyPtr(&_self->ob_itself,
theAEKeyword,
desiredType,
@@ -392,7 +400,7 @@
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&s#",
PyMac_BuildOSType, typeCode,
- dataPtr__out__, dataPtr__len__);
+ dataPtr__out__, (int)dataPtr__len__);
free(dataPtr__out__);
dataPtr__error__: ;
return _res;
@@ -472,11 +480,13 @@
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
+ int dataPtr__in_len__;
if (!PyArg_ParseTuple(_args, "O&O&s#",
PyMac_GetOSType, &theAEKeyword,
PyMac_GetOSType, &typeCode,
- &dataPtr__in__, &dataPtr__len__))
+ &dataPtr__in__, &dataPtr__in_len__))
return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEPutParamPtr(&_self->ob_itself,
theAEKeyword,
typeCode,
@@ -520,16 +530,18 @@
DescType typeCode;
char *dataPtr__out__;
long dataPtr__len__;
- if (!PyArg_ParseTuple(_args, "O&O&l",
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&i",
PyMac_GetOSType, &theAEKeyword,
PyMac_GetOSType, &desiredType,
- &dataPtr__len__))
+ &dataPtr__in_len__))
return NULL;
- if ((dataPtr__out__ = malloc(dataPtr__len__)) == NULL)
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
{
PyErr_NoMemory();
goto dataPtr__error__;
}
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEGetParamPtr(&_self->ob_itself,
theAEKeyword,
desiredType,
@@ -538,7 +550,7 @@
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&s#",
PyMac_BuildOSType, typeCode,
- dataPtr__out__, dataPtr__len__);
+ dataPtr__out__, (int)dataPtr__len__);
free(dataPtr__out__);
dataPtr__error__: ;
return _res;
@@ -619,16 +631,18 @@
DescType typeCode;
char *dataPtr__out__;
long dataPtr__len__;
- if (!PyArg_ParseTuple(_args, "O&O&l",
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&i",
PyMac_GetOSType, &theAEKeyword,
PyMac_GetOSType, &desiredType,
- &dataPtr__len__))
+ &dataPtr__in_len__))
return NULL;
- if ((dataPtr__out__ = malloc(dataPtr__len__)) == NULL)
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
{
PyErr_NoMemory();
goto dataPtr__error__;
}
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEGetAttributePtr(&_self->ob_itself,
theAEKeyword,
desiredType,
@@ -637,7 +651,7 @@
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&s#",
PyMac_BuildOSType, typeCode,
- dataPtr__out__, dataPtr__len__);
+ dataPtr__out__, (int)dataPtr__len__);
free(dataPtr__out__);
dataPtr__error__: ;
return _res;
@@ -699,11 +713,13 @@
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
+ int dataPtr__in_len__;
if (!PyArg_ParseTuple(_args, "O&O&s#",
PyMac_GetOSType, &theAEKeyword,
PyMac_GetOSType, &typeCode,
- &dataPtr__in__, &dataPtr__len__))
+ &dataPtr__in__, &dataPtr__in_len__))
return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
_err = AEPutAttributePtr(&_self->ob_itself,
theAEKeyword,
typeCode,
@@ -927,7 +943,7 @@
#define AEDesc_setattr NULL
-static PyTypeObject AEDesc_Type = {
+staticforward PyTypeObject AEDesc_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
"AEDesc", /*tp_name*/
@@ -952,11 +968,13 @@
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
+ int dataPtr__in_len__;
AEDesc result;
if (!PyArg_ParseTuple(_args, "O&s#",
PyMac_GetOSType, &typeCode,
- &dataPtr__in__, &dataPtr__len__))
+ &dataPtr__in__, &dataPtr__in_len__))
return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
_err = AECreateDesc(typeCode,
dataPtr__in__, dataPtr__len__,
&result);
@@ -976,13 +994,15 @@
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
+ int dataPtr__in_len__;
DescType toType;
AEDesc result;
if (!PyArg_ParseTuple(_args, "O&s#O&",
PyMac_GetOSType, &typeCode,
- &dataPtr__in__, &dataPtr__len__,
+ &dataPtr__in__, &dataPtr__in_len__,
PyMac_GetOSType, &toType))
return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
_err = AECoercePtr(typeCode,
dataPtr__in__, dataPtr__len__,
toType,
@@ -1002,12 +1022,14 @@
OSErr _err;
char *factoringPtr__in__;
long factoringPtr__len__;
+ int factoringPtr__in_len__;
Boolean isRecord;
AEDescList resultList;
if (!PyArg_ParseTuple(_args, "s#b",
- &factoringPtr__in__, &factoringPtr__len__,
+ &factoringPtr__in__, &factoringPtr__in_len__,
&isRecord))
return NULL;
+ factoringPtr__len__ = factoringPtr__in_len__;
_err = AECreateList(factoringPtr__in__, factoringPtr__len__,
isRecord,
&resultList);
@@ -1232,7 +1254,7 @@
static pascal OSErr
-GenericEventHandler(const AppleEvent *request, AppleEvent *reply, long refcon)
+GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon)
{
PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject;
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index 3e63656..7c69f3e 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -115,7 +115,7 @@
finalstuff = finalstuff + """
static pascal OSErr
-GenericEventHandler(const AppleEvent *request, AppleEvent *reply, long refcon)
+GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon)
{
PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject;
diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c
index b03f24f..0cd9dbb 100644
--- a/Mac/Modules/dlg/Dlgmodule.c
+++ b/Mac/Modules/dlg/Dlgmodule.c
@@ -34,6 +34,10 @@
#include <Dialogs.h>
+#ifndef HAVE_UNIVERSAL_HEADERS
+#define NewModalFilterProc(x) (x)
+#endif
+
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
/* XXX Shouldn't this be a stack? */
@@ -51,7 +55,7 @@
if (callback == NULL)
return 0; /* Default behavior */
Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
- args = Py_BuildValue("O&s#", DlgObj_New, dialog, event, sizeof(EventRecord));
+ args = Py_BuildValue("O&s#", DlgObj_New, dialog, event, (int)sizeof(EventRecord));
if (args == NULL)
res = NULL;
else {
@@ -108,7 +112,7 @@
} DialogObject;
PyObject *DlgObj_New(itself)
- const DialogPtr itself;
+ DialogPtr itself;
{
DialogObject *it;
if (itself == NULL) return Py_None;
@@ -154,20 +158,6 @@
return _res;
}
-static PyObject *DlgObj_UpdtDialog(_self, _args)
- DialogObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- UpdtDialog(_self->ob_itself,
- _self->ob_itself->visRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
static PyObject *DlgObj_UpdateDialog(_self, _args)
DialogObject *_self;
PyObject *_args;
@@ -406,8 +396,6 @@
static PyMethodDef DlgObj_methods[] = {
{"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
"() -> None"},
- {"UpdtDialog", (PyCFunction)DlgObj_UpdtDialog, 1,
- "() -> None"},
{"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1,
"() -> None"},
{"GetDItem", (PyCFunction)DlgObj_GetDItem, 1,
@@ -524,36 +512,6 @@
return _res;
}
-static PyObject *Dlg_CouldDialog(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- short dialogID;
- if (!PyArg_ParseTuple(_args, "h",
- &dialogID))
- return NULL;
- CouldDialog(dialogID);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Dlg_FreeDialog(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- short dialogID;
- if (!PyArg_ParseTuple(_args, "h",
- &dialogID))
- return NULL;
- FreeDialog(dialogID);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
static PyObject *Dlg_ParamText(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -588,7 +546,7 @@
if (!PyArg_ParseTuple(_args, "O",
&filterProc))
return NULL;
- ModalDialog(Dlg_PassFilterProc(filterProc),
+ ModalDialog(NewModalFilterProc(Dlg_PassFilterProc(filterProc)),
&itemHit);
_res = Py_BuildValue("h",
itemHit);
@@ -646,7 +604,7 @@
&filterProc))
return NULL;
_rv = Alert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
@@ -665,7 +623,7 @@
&filterProc))
return NULL;
_rv = StopAlert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
@@ -684,7 +642,7 @@
&filterProc))
return NULL;
_rv = NoteAlert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
@@ -703,42 +661,12 @@
&filterProc))
return NULL;
_rv = CautionAlert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
}
-static PyObject *Dlg_CouldAlert(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- short alertID;
- if (!PyArg_ParseTuple(_args, "h",
- &alertID))
- return NULL;
- CouldAlert(alertID);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Dlg_FreeAlert(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- short alertID;
- if (!PyArg_ParseTuple(_args, "h",
- &alertID))
- return NULL;
- FreeAlert(alertID);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
static PyObject *Dlg_GetIText(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -845,10 +773,6 @@
"(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon, Handle itmLstHndl) -> (DialogPtr _rv)"},
{"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1,
"(short dialogID, WindowPtr behind) -> (DialogPtr _rv)"},
- {"CouldDialog", (PyCFunction)Dlg_CouldDialog, 1,
- "(short dialogID) -> None"},
- {"FreeDialog", (PyCFunction)Dlg_FreeDialog, 1,
- "(short dialogID) -> None"},
{"ParamText", (PyCFunction)Dlg_ParamText, 1,
"(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
{"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1,
@@ -865,10 +789,6 @@
"(short alertID, PyObject* filterProc) -> (short _rv)"},
{"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1,
"(short alertID, PyObject* filterProc) -> (short _rv)"},
- {"CouldAlert", (PyCFunction)Dlg_CouldAlert, 1,
- "(short alertID) -> None"},
- {"FreeAlert", (PyCFunction)Dlg_FreeAlert, 1,
- "(short alertID) -> None"},
{"GetIText", (PyCFunction)Dlg_GetIText, 1,
"(Handle item) -> (Str255 text)"},
{"SetIText", (PyCFunction)Dlg_SetIText, 1,
diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py
index 2a410f6..d0cf144 100644
--- a/Mac/Modules/dlg/dlgscan.py
+++ b/Mac/Modules/dlg/dlgscan.py
@@ -37,6 +37,11 @@
'CloseDialog',
'DisposDialog',
'DisposeDialog',
+ 'UpdtDialog',
+ 'CouldAlert',
+ 'FreeAlert',
+ 'CouldDialog',
+ 'FreeDialog',
]
def makeblacklisttypes(self):
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index 85e72bb..1eb5576 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -10,7 +10,7 @@
DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj")
ModalFilterProcPtr = InputOnlyType("PyObject*", "O")
-ModalFilterProcPtr.passInput = lambda name: "Dlg_PassFilterProc(%s)" % name
+ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterProc(%s))" % name
RgnHandle = FakeType("_self->ob_itself->visRgn") # XXX
@@ -19,6 +19,10 @@
includestuff = includestuff + """
#include <Dialogs.h>
+#ifndef HAVE_UNIVERSAL_HEADERS
+#define NewModalFilterProc(x) (x)
+#endif
+
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
/* XXX Shouldn't this be a stack? */
@@ -36,7 +40,7 @@
if (callback == NULL)
return 0; /* Default behavior */
Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
- args = Py_BuildValue("O&s#", DlgObj_New, dialog, event, sizeof(EventRecord));
+ args = Py_BuildValue("O&s#", DlgObj_New, dialog, event, (int)sizeof(EventRecord));
if (args == NULL)
res = NULL;
else {
diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c
index d2511cf..7836cf1 100644
--- a/Mac/Modules/snd/Sndmodule.c
+++ b/Mac/Modules/snd/Sndmodule.c
@@ -30,9 +30,11 @@
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+extern PyObject *WinObj_WhichWindow(WindowPtr);
+
#include <Sound.h>
-#ifndef __MWERKS__
+#ifndef HAVE_UNIVERSAL_HEADERS
#define SndCallBackUPP ProcPtr
#define NewSndCallBackProc(x) (x)
#define SndListHandle Handle
@@ -100,7 +102,7 @@
} SndChannelObject;
static PyObject *SndCh_New(itself)
- const SndChannelPtr itself;
+ SndChannelPtr itself;
{
SndChannelObject *it;
it = PyObject_NEW(SndChannelObject, &SndChannel_Type);
@@ -262,7 +264,6 @@
OSErr _err;
short theLength;
SCStatus theStatus__out__;
- int theStatus__len__;
if (!PyArg_ParseTuple(_args, "h",
&theLength))
return NULL;
@@ -271,7 +272,7 @@
&theStatus__out__);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("s#",
- (char *)&theStatus__out__, sizeof(SCStatus));
+ (char *)&theStatus__out__, (int)sizeof(SCStatus));
theStatus__error__: ;
return _res;
}
@@ -305,7 +306,7 @@
#define SndCh_setattr NULL
-static PyTypeObject SndChannel_Type = {
+staticforward PyTypeObject SndChannel_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
"SndChannel", /*tp_name*/
@@ -344,7 +345,7 @@
_err = SndNewChannel(&chan,
synth,
init,
- (SndCallBackProcPtr)&SndCh_UserRoutine);
+ NewSndCallBackProc(SndCh_UserRoutine));
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
SndCh_New, chan);
@@ -378,35 +379,6 @@
return _res;
}
-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_SndSoundManagerVersion(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -429,7 +401,6 @@
OSErr _err;
short theLength;
SMStatus theStatus__out__;
- int theStatus__len__;
if (!PyArg_ParseTuple(_args, "h",
&theLength))
return NULL;
@@ -437,7 +408,7 @@
&theStatus__out__);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("s#",
- (char *)&theStatus__out__, sizeof(SMStatus));
+ (char *)&theStatus__out__, (int)sizeof(SMStatus));
theStatus__error__: ;
return _res;
}
@@ -495,34 +466,38 @@
char *buffer__in__;
char *buffer__out__;
long buffer__len__;
+ int buffer__in_len__;
char *state__in__;
char state__out__[128];
int state__len__;
+ int state__in_len__;
unsigned long numChannels;
unsigned long whichChannel;
if (!PyArg_ParseTuple(_args, "s#s#ll",
- &buffer__in__, &buffer__len__,
- &state__in__, &state__len__,
+ &buffer__in__, &buffer__in_len__,
+ &state__in__, &state__in_len__,
&numChannels,
&whichChannel))
return NULL;
- if ((buffer__out__ = malloc(buffer__len__)) == NULL)
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
{
PyErr_NoMemory();
goto buffer__error__;
}
- if (state__len__ != 128)
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != 128)
{
PyErr_SetString(PyExc_TypeError, "buffer length should be 128");
goto state__error__;
}
- Comp3to1(buffer__in__, buffer__out__, buffer__len__,
+ state__len__ = state__in_len__;
+ Comp3to1(buffer__in__, buffer__out__, (long)buffer__len__,
state__in__, state__out__,
numChannels,
whichChannel);
_res = Py_BuildValue("s#s#",
- buffer__out__, buffer__len__,
- state__out__, 128);
+ buffer__out__, (int)buffer__len__,
+ state__out__, (int)128);
state__error__: ;
free(buffer__out__);
buffer__error__: ;
@@ -537,34 +512,38 @@
char *buffer__in__;
char *buffer__out__;
long buffer__len__;
+ int buffer__in_len__;
char *state__in__;
char state__out__[128];
int state__len__;
+ int state__in_len__;
unsigned long numChannels;
unsigned long whichChannel;
if (!PyArg_ParseTuple(_args, "s#s#ll",
- &buffer__in__, &buffer__len__,
- &state__in__, &state__len__,
+ &buffer__in__, &buffer__in_len__,
+ &state__in__, &state__in_len__,
&numChannels,
&whichChannel))
return NULL;
- if ((buffer__out__ = malloc(buffer__len__)) == NULL)
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
{
PyErr_NoMemory();
goto buffer__error__;
}
- if (state__len__ != 128)
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != 128)
{
PyErr_SetString(PyExc_TypeError, "buffer length should be 128");
goto state__error__;
}
- Exp1to3(buffer__in__, buffer__out__, buffer__len__,
+ state__len__ = state__in_len__;
+ Exp1to3(buffer__in__, buffer__out__, (long)buffer__len__,
state__in__, state__out__,
numChannels,
whichChannel);
_res = Py_BuildValue("s#s#",
- buffer__out__, buffer__len__,
- state__out__, 128);
+ buffer__out__, (int)buffer__len__,
+ state__out__, (int)128);
state__error__: ;
free(buffer__out__);
buffer__error__: ;
@@ -579,34 +558,38 @@
char *buffer__in__;
char *buffer__out__;
long buffer__len__;
+ int buffer__in_len__;
char *state__in__;
char state__out__[128];
int state__len__;
+ int state__in_len__;
unsigned long numChannels;
unsigned long whichChannel;
if (!PyArg_ParseTuple(_args, "s#s#ll",
- &buffer__in__, &buffer__len__,
- &state__in__, &state__len__,
+ &buffer__in__, &buffer__in_len__,
+ &state__in__, &state__in_len__,
&numChannels,
&whichChannel))
return NULL;
- if ((buffer__out__ = malloc(buffer__len__)) == NULL)
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
{
PyErr_NoMemory();
goto buffer__error__;
}
- if (state__len__ != 128)
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != 128)
{
PyErr_SetString(PyExc_TypeError, "buffer length should be 128");
goto state__error__;
}
- Comp6to1(buffer__in__, buffer__out__, buffer__len__,
+ state__len__ = state__in_len__;
+ Comp6to1(buffer__in__, buffer__out__, (long)buffer__len__,
state__in__, state__out__,
numChannels,
whichChannel);
_res = Py_BuildValue("s#s#",
- buffer__out__, buffer__len__,
- state__out__, 128);
+ buffer__out__, (int)buffer__len__,
+ state__out__, (int)128);
state__error__: ;
free(buffer__out__);
buffer__error__: ;
@@ -621,34 +604,38 @@
char *buffer__in__;
char *buffer__out__;
long buffer__len__;
+ int buffer__in_len__;
char *state__in__;
char state__out__[128];
int state__len__;
+ int state__in_len__;
unsigned long numChannels;
unsigned long whichChannel;
if (!PyArg_ParseTuple(_args, "s#s#ll",
- &buffer__in__, &buffer__len__,
- &state__in__, &state__len__,
+ &buffer__in__, &buffer__in_len__,
+ &state__in__, &state__in_len__,
&numChannels,
&whichChannel))
return NULL;
- if ((buffer__out__ = malloc(buffer__len__)) == NULL)
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
{
PyErr_NoMemory();
goto buffer__error__;
}
- if (state__len__ != 128)
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != 128)
{
PyErr_SetString(PyExc_TypeError, "buffer length should be 128");
goto state__error__;
}
- Exp1to6(buffer__in__, buffer__out__, buffer__len__,
+ state__len__ = state__in_len__;
+ Exp1to6(buffer__in__, buffer__out__, (long)buffer__len__,
state__in__, state__out__,
numChannels,
whichChannel);
_res = Py_BuildValue("s#s#",
- buffer__out__, buffer__len__,
- state__out__, 128);
+ buffer__out__, (int)buffer__len__,
+ state__out__, (int)128);
state__error__: ;
free(buffer__out__);
buffer__error__: ;
@@ -660,10 +647,6 @@
"(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"},
{"SndControl", (PyCFunction)Snd_SndControl, 1,
"(short id) -> (SndCommand cmd)"},
- {"SetSoundVol", (PyCFunction)Snd_SetSoundVol, 1,
- "(short level) -> None"},
- {"GetSoundVol", (PyCFunction)Snd_GetSoundVol, 1,
- "() -> (short level)"},
{"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1,
"() -> (NumVersion _rv)"},
{"SndManagerStatus", (PyCFunction)Snd_SndManagerStatus, 1,
diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py
index b63691b..02c9177 100644
--- a/Mac/Modules/snd/sndscan.py
+++ b/Mac/Modules/snd/sndscan.py
@@ -41,6 +41,8 @@
def makeblacklisttypes(self):
return [
+ "GetSoundVol",
+ "SetSoundVol",
]
def makerepairinstructions(self):
diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py
index 3516fa6..2181cd1 100644
--- a/Mac/Modules/snd/sndsupport.py
+++ b/Mac/Modules/snd/sndsupport.py
@@ -19,7 +19,7 @@
includestuff = includestuff + """
#include <Sound.h>
-#ifndef __MWERKS__
+#ifndef HAVE_UNIVERSAL_HEADERS
#define SndCallBackUPP ProcPtr
#define NewSndCallBackProc(x) (x)
#define SndListHandle Handle
@@ -50,13 +50,13 @@
def __init__(self):
Type.__init__(self, 'PyObject*', 'O')
def getargsCheck(self, name):
- Output("if (%s != Py_None && !callable(%s))", name, name)
+ Output("if (%s != Py_None && !PyCallable_Check(%s))", name, name)
OutLbrace()
Output('PyErr_SetString(PyExc_TypeError, "callback must be callable");')
Output("goto %s__error__;", name)
OutRbrace()
def passInput(self, name):
- return "(SndCallBackProcPtr)&SndCh_UserRoutine"
+ return "NewSndCallBackProc(SndCh_UserRoutine)"
def cleanup(self, name):
# XXX This knows it is executing inside the SndNewChannel wrapper
Output("if (_res != NULL && %s != Py_None)", name)
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c
index 3f60d37..181cf77 100644
--- a/Mac/Modules/win/Winmodule.c
+++ b/Mac/Modules/win/Winmodule.c
@@ -36,12 +36,10 @@
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
-#ifdef __MWERKS__
+#ifdef HAVE_UNIVERSAL_HEADERS
#define WindowPeek WindowPtr
#endif
-extern PyObject *WinObj_WhichWindow(WindowPtr w); /* Forward */
-
static PyObject *Win_Error;
/* ----------------------- Object type Window ----------------------- */
@@ -56,7 +54,7 @@
} WindowObject;
PyObject *WinObj_New(itself)
- const WindowPtr itself;
+ WindowPtr itself;
{
WindowObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
@@ -844,7 +842,10 @@
/* XXX What if we find a stdwin window or a window belonging
to some other package? */
- it = (PyObject *) GetWRefCon(w);
+ if (w == NULL)
+ it = NULL;
+ else
+ it = (PyObject *) GetWRefCon(w);
if (it == NULL || ((WindowObject *)it)->ob_itself != w)
it = Py_None;
Py_INCREF(it);
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index c1057e2..a7f1ebd 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -32,7 +32,7 @@
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
-#ifdef __MWERKS__
+#ifdef HAVE_UNIVERSAL_HEADERS
#define WindowPeek WindowPtr
#endif
"""
diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py
index 2cc7c6d..dd1ad32 100644
--- a/Tools/bgen/bgen/bgenObjectDefinition.py
+++ b/Tools/bgen/bgen/bgenObjectDefinition.py
@@ -76,7 +76,7 @@
Output()
Output("%sPyObject *%s_New(itself)", self.static, self.prefix)
IndentLevel()
- Output("const %s %sitself;", self.itselftype, self.argref)
+ Output("%s %sitself;", self.itselftype, self.argref)
DedentLevel()
OutLbrace()
Output("%s *it;", self.objecttype)
@@ -154,8 +154,9 @@
Output("#define %s_setattr NULL", self.prefix)
def outputTypeObject(self):
+ sf = self.static and "staticforward "
Output()
- Output("%sPyTypeObject %s = {", self.static, self.typename)
+ Output("%sPyTypeObject %s = {", sf, self.typename)
IndentLevel()
Output("PyObject_HEAD_INIT(&PyType_Type)")
Output("0, /*ob_size*/")