summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-19 15:59:49 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-19 15:59:49 (GMT)
commit9784295b157ac9db30d52708f67d115c397290ab (patch)
tree066d7b16e5515db0de5e13efdde2709d1463140b
parent295d171650758106cd4c24410f5a5c0740b914b2 (diff)
downloadcpython-9784295b157ac9db30d52708f67d115c397290ab.zip
cpython-9784295b157ac9db30d52708f67d115c397290ab.tar.gz
cpython-9784295b157ac9db30d52708f67d115c397290ab.tar.bz2
another round... ported to __SC__
-rw-r--r--Mac/Lib/test/aete.py10
-rw-r--r--Mac/Lib/test/echo.py17
-rw-r--r--Mac/Lib/toolbox/aetools.py2
-rw-r--r--Mac/Modules/ae/AEmodule.c74
-rw-r--r--Mac/Modules/ae/aesupport.py2
-rw-r--r--Mac/Modules/dlg/Dlgmodule.c102
-rw-r--r--Mac/Modules/dlg/dlgscan.py5
-rw-r--r--Mac/Modules/dlg/dlgsupport.py8
-rw-r--r--Mac/Modules/snd/Sndmodule.c121
-rw-r--r--Mac/Modules/snd/sndscan.py2
-rw-r--r--Mac/Modules/snd/sndsupport.py6
-rw-r--r--Mac/Modules/win/Winmodule.c11
-rw-r--r--Mac/Modules/win/winsupport.py2
-rw-r--r--Tools/bgen/bgen/bgenObjectDefinition.py5
14 files changed, 158 insertions, 209 deletions
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 @@ import StringIO
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 redirect(filename, func, *args):
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 @@ especially to figure out all the different forms an object specifier
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 @@ class EchoServer:
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 @@ def code(x):
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 unpack(desc):
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 @@ typedef struct AEDescObject {
} AEDescObject;
static PyObject *AEDesc_New(itself)
- const AEDesc *itself;
+ AEDesc *itself;
{
AEDescObject *it;
it = PyObject_NEW(AEDescObject, &AEDesc_Type);
@@ -174,11 +174,13 @@ static PyObject *AEDesc_AEPutPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetNthPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetNthPtr(_self, _args)
_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 @@ static PyObject *AEDesc_AEPutKeyPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetKeyPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetKeyPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEPutParamPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetParamPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetParamPtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetAttributePtr(_self, _args)
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 @@ static PyObject *AEDesc_AEGetAttributePtr(_self, _args)
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 @@ static PyObject *AEDesc_AEPutAttributePtr(_self, _args)
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 @@ static PyObject *AEDesc_getattr(self, name)
#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 @@ static PyObject *AE_AECreateDesc(_self, _args)
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 @@ static PyObject *AE_AECoercePtr(_self, _args)
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 @@ static PyObject *AE_AECreateList(_self, _args)
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 PyMethodDef AE_methods[] = {
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 @@ AEIdleUPP upp_AEIdleProc;
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 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
#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 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
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 @@ typedef struct DialogObject {
} DialogObject;
PyObject *DlgObj_New(itself)
- const DialogPtr itself;
+ DialogPtr itself;
{
DialogObject *it;
if (itself == NULL) return Py_None;
@@ -154,20 +158,6 @@ static PyObject *DlgObj_DrawDialog(_self, _args)
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 PyObject *DlgObj_ShortenDITL(_self, _args)
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 @@ static PyObject *Dlg_GetNewDialog(_self, _args)
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 @@ static PyObject *Dlg_ModalDialog(_self, _args)
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 @@ static PyObject *Dlg_Alert(_self, _args)
&filterProc))
return NULL;
_rv = Alert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
@@ -665,7 +623,7 @@ static PyObject *Dlg_StopAlert(_self, _args)
&filterProc))
return NULL;
_rv = StopAlert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
@@ -684,7 +642,7 @@ static PyObject *Dlg_NoteAlert(_self, _args)
&filterProc))
return NULL;
_rv = NoteAlert(alertID,
- Dlg_PassFilterProc(filterProc));
+ NewModalFilterProc(Dlg_PassFilterProc(filterProc)));
_res = Py_BuildValue("h",
_rv);
return _res;
@@ -703,42 +661,12 @@ static PyObject *Dlg_CautionAlert(_self, _args)
&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 @@ static PyMethodDef Dlg_methods[] = {
"(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 @@ static PyMethodDef Dlg_methods[] = {
"(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 @@ class MyScanner(Scanner):
'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 @@ from macsupport import *
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 @@ DITLMethod = Type("DITLMethod", "h")
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 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
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 int MenuObj_Convert(PyObject *, MenuHandle *);
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 @@ typedef struct SndChannelObject {
} SndChannelObject;
static PyObject *SndCh_New(itself)
- const SndChannelPtr itself;
+ SndChannelPtr itself;
{
SndChannelObject *it;
it = PyObject_NEW(SndChannelObject, &SndChannel_Type);
@@ -262,7 +264,6 @@ static PyObject *SndCh_SndChannelStatus(_self, _args)
OSErr _err;
short theLength;
SCStatus theStatus__out__;
- int theStatus__len__;
if (!PyArg_ParseTuple(_args, "h",
&theLength))
return NULL;
@@ -271,7 +272,7 @@ static PyObject *SndCh_SndChannelStatus(_self, _args)
&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 @@ static PyObject *SndCh_getattr(self, name)
#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 @@ static PyObject *Snd_SndNewChannel(_self, _args)
_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 @@ static PyObject *Snd_SndControl(_self, _args)
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 @@ static PyObject *Snd_SndManagerStatus(_self, _args)
OSErr _err;
short theLength;
SMStatus theStatus__out__;
- int theStatus__len__;
if (!PyArg_ParseTuple(_args, "h",
&theLength))
return NULL;
@@ -437,7 +408,7 @@ static PyObject *Snd_SndManagerStatus(_self, _args)
&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 @@ static PyObject *Snd_Comp3to1(_self, _args)
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 @@ static PyObject *Snd_Exp1to3(_self, _args)
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 @@ static PyObject *Snd_Comp6to1(_self, _args)
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 @@ static PyObject *Snd_Exp1to6(_self, _args)
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 @@ static PyMethodDef Snd_methods[] = {
"(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 @@ class SoundScanner(Scanner):
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 @@ class SndMethod(SndMixIn, OSErrMethodGenerator): pass
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 @@ class SndCallBackType(InputOnlyType):
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 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
#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 @@ typedef struct WindowObject {
} WindowObject;
PyObject *WinObj_New(itself)
- const WindowPtr itself;
+ WindowPtr itself;
{
WindowObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
@@ -844,7 +842,10 @@ WinObj_WhichWindow(w)
/* 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 @@ includestuff = includestuff + """
#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 @@ class ObjectDefinition(GeneratorGroup):
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 @@ class ObjectDefinition(GeneratorGroup):
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*/")