Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f7d5aa6

Browse files
committed
Adapted to Universal Headers 3.3.2. More to follow.
1 parent c6c2838 commit f7d5aa6

28 files changed

Lines changed: 3034 additions & 546 deletions

Mac/Modules/ae/AEmodule.c

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "pymactoolbox.h"
1010

1111
#include <AppleEvents.h>
12+
#include <AEObjects.h>
1213

1314
static pascal OSErr GenericEventHandler(); /* Forward */
1415

@@ -69,34 +70,6 @@ static void AEDesc_dealloc(self)
6970
PyMem_DEL(self);
7071
}
7172

72-
static PyObject *AEDesc_AESend(_self, _args)
73-
AEDescObject *_self;
74-
PyObject *_args;
75-
{
76-
PyObject *_res = NULL;
77-
OSErr _err;
78-
AppleEvent reply;
79-
AESendMode sendMode;
80-
AESendPriority sendPriority;
81-
long timeOutInTicks;
82-
if (!PyArg_ParseTuple(_args, "lhl",
83-
&sendMode,
84-
&sendPriority,
85-
&timeOutInTicks))
86-
return NULL;
87-
_err = AESend(&_self->ob_itself,
88-
&reply,
89-
sendMode,
90-
sendPriority,
91-
timeOutInTicks,
92-
upp_AEIdleProc,
93-
(AEFilterUPP)0);
94-
if (_err != noErr) return PyMac_Error(_err);
95-
_res = Py_BuildValue("O&",
96-
AEDesc_New, &reply);
97-
return _res;
98-
}
99-
10073
static PyObject *AEDesc_AEResetTimer(_self, _args)
10174
AEDescObject *_self;
10275
PyObject *_args;
@@ -672,9 +645,24 @@ static PyObject *AEDesc_AEPutAttributeDesc(_self, _args)
672645
return _res;
673646
}
674647

648+
#if TARGET_API_MAC_CARBON
649+
650+
static PyObject *AEDesc_AEGetDescDataSize(_self, _args)
651+
AEDescObject *_self;
652+
PyObject *_args;
653+
{
654+
PyObject *_res = NULL;
655+
Size _rv;
656+
if (!PyArg_ParseTuple(_args, ""))
657+
return NULL;
658+
_rv = AEGetDescDataSize(&_self->ob_itself);
659+
_res = Py_BuildValue("l",
660+
_rv);
661+
return _res;
662+
}
663+
#endif
664+
675665
static PyMethodDef AEDesc_methods[] = {
676-
{"AESend", (PyCFunction)AEDesc_AESend, 1,
677-
"(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"},
678666
{"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1,
679667
"() -> None"},
680668
{"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1,
@@ -725,6 +713,11 @@ static PyMethodDef AEDesc_methods[] = {
725713
"(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"},
726714
{"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1,
727715
"(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"},
716+
717+
#if TARGET_API_MAC_CARBON
718+
{"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1,
719+
"() -> (Size _rv)"},
720+
#endif
728721
{NULL, NULL, 0}
729722
};
730723

@@ -941,6 +934,44 @@ static PyObject *AE_AEGetEventHandler(_self, _args)
941934
return _res;
942935
}
943936

937+
static PyObject *AE_AEInstallSpecialHandler(_self, _args)
938+
PyObject *_self;
939+
PyObject *_args;
940+
{
941+
PyObject *_res = NULL;
942+
OSErr _err;
943+
AEKeyword functionClass;
944+
if (!PyArg_ParseTuple(_args, "O&",
945+
PyMac_GetOSType, &functionClass))
946+
return NULL;
947+
_err = AEInstallSpecialHandler(functionClass,
948+
upp_GenericEventHandler,
949+
0);
950+
if (_err != noErr) return PyMac_Error(_err);
951+
Py_INCREF(Py_None);
952+
_res = Py_None;
953+
return _res;
954+
}
955+
956+
static PyObject *AE_AERemoveSpecialHandler(_self, _args)
957+
PyObject *_self;
958+
PyObject *_args;
959+
{
960+
PyObject *_res = NULL;
961+
OSErr _err;
962+
AEKeyword functionClass;
963+
if (!PyArg_ParseTuple(_args, "O&",
964+
PyMac_GetOSType, &functionClass))
965+
return NULL;
966+
_err = AERemoveSpecialHandler(functionClass,
967+
upp_GenericEventHandler,
968+
0);
969+
if (_err != noErr) return PyMac_Error(_err);
970+
Py_INCREF(Py_None);
971+
_res = Py_None;
972+
return _res;
973+
}
974+
944975
static PyObject *AE_AEManagerInfo(_self, _args)
945976
PyObject *_self;
946977
PyObject *_args;
@@ -1072,6 +1103,35 @@ static PyObject *AE_AECreateAppleEvent(_self, _args)
10721103
return _res;
10731104
}
10741105

1106+
#if TARGET_API_MAC_CARBON
1107+
1108+
static PyObject *AE_AEReplaceDescData(_self, _args)
1109+
PyObject *_self;
1110+
PyObject *_args;
1111+
{
1112+
PyObject *_res = NULL;
1113+
OSErr _err;
1114+
DescType typeCode;
1115+
char *dataPtr__in__;
1116+
long dataPtr__len__;
1117+
int dataPtr__in_len__;
1118+
AEDesc theAEDesc;
1119+
if (!PyArg_ParseTuple(_args, "O&s#",
1120+
PyMac_GetOSType, &typeCode,
1121+
&dataPtr__in__, &dataPtr__in_len__))
1122+
return NULL;
1123+
dataPtr__len__ = dataPtr__in_len__;
1124+
_err = AEReplaceDescData(typeCode,
1125+
dataPtr__in__, dataPtr__len__,
1126+
&theAEDesc);
1127+
if (_err != noErr) return PyMac_Error(_err);
1128+
_res = Py_BuildValue("O&",
1129+
AEDesc_New, &theAEDesc);
1130+
dataPtr__error__: ;
1131+
return _res;
1132+
}
1133+
#endif
1134+
10751135
static PyMethodDef AE_methods[] = {
10761136
{"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1,
10771137
"(EventRecord theEventRecord) -> None"},
@@ -1087,6 +1147,10 @@ static PyMethodDef AE_methods[] = {
10871147
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"},
10881148
{"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1,
10891149
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"},
1150+
{"AEInstallSpecialHandler", (PyCFunction)AE_AEInstallSpecialHandler, 1,
1151+
"(AEKeyword functionClass) -> None"},
1152+
{"AERemoveSpecialHandler", (PyCFunction)AE_AERemoveSpecialHandler, 1,
1153+
"(AEKeyword functionClass) -> None"},
10901154
{"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1,
10911155
"(AEKeyword keyWord) -> (long result)"},
10921156
{"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1,
@@ -1097,6 +1161,11 @@ static PyMethodDef AE_methods[] = {
10971161
"(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"},
10981162
{"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1,
10991163
"(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)"},
1164+
1165+
#if TARGET_API_MAC_CARBON
1166+
{"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1,
1167+
"(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)"},
1168+
#endif
11001169
{NULL, NULL, 0}
11011170
};
11021171

@@ -1149,7 +1218,7 @@ void initAE()
11491218
AE_Error = PyMac_GetOSErrException();
11501219
if (AE_Error == NULL ||
11511220
PyDict_SetItemString(d, "Error", AE_Error) != 0)
1152-
Py_FatalError("can't initialize AE.Error");
1221+
return;
11531222
AEDesc_Type.ob_type = &PyType_Type;
11541223
Py_INCREF(&AEDesc_Type);
11551224
if (PyDict_SetItemString(d, "AEDescType", (PyObject *)&AEDesc_Type) != 0)

Mac/Modules/ae/aescan.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,19 @@ def makeblacklistnames(self):
7070
return [
7171
"AEDisposeDesc",
7272
# "AEGetEventHandler",
73+
"AEGetDescData", # Use object.data
74+
"AEGetSpecialHandler",
7375
# Constants with funny definitions
7476
"kAEDontDisposeOnResume",
7577
"kAEUseStandardDispatch",
7678
]
7779

80+
def makegreylist(self):
81+
return [
82+
('#if TARGET_API_MAC_CARBON', [
83+
'AEGetDescDataSize',
84+
'AEReplaceDescData',
85+
])]
7886
def makeblacklisttypes(self):
7987
return [
8088
"ProcPtr",

Mac/Modules/ae/aesupport.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def passInput(self, name):
8383

8484
includestuff = includestuff + """
8585
#include <AppleEvents.h>
86+
#include <AEObjects.h>
8687
8788
static pascal OSErr GenericEventHandler(); /* Forward */
8889

Mac/Modules/app/Appmodule.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,28 @@ static PyObject *App_GetThemeTextColor(_self, _args)
11111111
return _res;
11121112
}
11131113

1114+
#if TARGET_API_MAC_CARBON
1115+
1116+
static PyObject *App_GetThemeMetric(_self, _args)
1117+
PyObject *_self;
1118+
PyObject *_args;
1119+
{
1120+
PyObject *_res = NULL;
1121+
OSStatus _err;
1122+
ThemeMetric inMetric;
1123+
SInt32 outMetric;
1124+
if (!PyArg_ParseTuple(_args, "l",
1125+
&inMetric))
1126+
return NULL;
1127+
_err = GetThemeMetric(inMetric,
1128+
&outMetric);
1129+
if (_err != noErr) return PyMac_Error(_err);
1130+
_res = Py_BuildValue("l",
1131+
outMetric);
1132+
return _res;
1133+
}
1134+
#endif
1135+
11141136
static PyMethodDef App_methods[] = {
11151137
{"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1,
11161138
"() -> None"},
@@ -1218,6 +1240,11 @@ static PyMethodDef App_methods[] = {
12181240
"(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"},
12191241
{"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1,
12201242
"(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"},
1243+
1244+
#if TARGET_API_MAC_CARBON
1245+
{"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1,
1246+
"(ThemeMetric inMetric) -> (SInt32 outMetric)"},
1247+
#endif
12211248
{NULL, NULL, 0}
12221249
};
12231250

@@ -1237,7 +1264,7 @@ void initApp()
12371264
App_Error = PyMac_GetOSErrException();
12381265
if (App_Error == NULL ||
12391266
PyDict_SetItemString(d, "Error", App_Error) != 0)
1240-
Py_FatalError("can't initialize App.Error");
1267+
return;
12411268
}
12421269

12431270
/* ========================= End module App ========================= */

Mac/Modules/app/appscan.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ def makeblacklistnames(self):
4343
"GetThemeFont", # Funny stringbuffer in/out parameter, I think...
4444
]
4545

46+
def makegreylist(self):
47+
return [
48+
('#if TARGET_API_MAC_CARBON', [
49+
'GetThemeMetric',
50+
])]
51+
4652
def makeblacklisttypes(self):
4753
return [
4854
"MenuTitleDrawingUPP",

Mac/Modules/app/appsupport.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
ThemeSoundKind = OSTypeType("ThemeSoundKind")
6666
ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind")
6767
ThemeBackgroundKind = Type("ThemeBackgroundKind", "l")
68+
ThemeMetric = Type("ThemeMetric", "l")
6869
RGBColor = OpaqueType("RGBColor", "QdRGB")
6970

7071
includestuff = includestuff + """

Mac/Modules/cm/Cmmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ void initCm()
831831
Cm_Error = PyMac_GetOSErrException();
832832
if (Cm_Error == NULL ||
833833
PyDict_SetItemString(d, "Error", Cm_Error) != 0)
834-
Py_FatalError("can't initialize Cm.Error");
834+
return;
835835
ComponentInstance_Type.ob_type = &PyType_Type;
836836
Py_INCREF(&ComponentInstance_Type);
837837
if (PyDict_SetItemString(d, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type) != 0)

Mac/Modules/cm/cmscan.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def makeblacklistnames(self):
5656
"CallComponentClose",
5757
"CallComponentOpen",
5858
"OpenAComponent",
59+
"GetComponentPublicResource", # Missing in CW Pro 6
60+
"CallComponentGetPublicResource", # Missing in CW Pro 6
5961
]
6062

6163
def makegreylist(self):
@@ -77,6 +79,8 @@ def makeblacklisttypes(self):
7779

7880
"ComponentRoutineUPP",
7981
"ComponentMPWorkFunctionUPP",
82+
"ComponentFunctionUPP",
83+
"GetMissingComponentResourceUPP",
8084
]
8185

8286
def makerepairinstructions(self):

0 commit comments

Comments
 (0)