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

Skip to content

Commit 9d8b96c

Browse files
committed
pymactoolbox.h contains protoypes for all externally visible toolbox module
functions. Include it in stead of duplicating the declarations everywhere. Also cleaned up toolbox module exports, and got rid of resNotFound error.
1 parent 41e25cc commit 9d8b96c

45 files changed

Lines changed: 244 additions & 916 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Mac/Include/pymactoolbox.h

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
** pymactoolbox.h - global routines exported by the toolbox modules
3+
*/
4+
5+
#ifdef __cplusplus
6+
extern "C" {
7+
#endif
8+
9+
#include <Memory.h>
10+
#include <Dialogs.h>
11+
#include <Menus.h>
12+
#include <Controls.h>
13+
#include <Components.h>
14+
#include <Lists.h>
15+
#include <Movies.h>
16+
#include <Errors.h>
17+
18+
/* AE exports */
19+
extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */
20+
extern int AEDesc_Convert(PyObject *, AppleEvent *);
21+
22+
/* Cm exports */
23+
extern PyObject *CmpObj_New(Component);
24+
extern int CmpObj_Convert(PyObject *, Component *);
25+
extern PyObject *CmpInstObj_New(ComponentInstance);
26+
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
27+
28+
/* Ctl exports */
29+
extern PyObject *CtlObj_New(ControlHandle);
30+
extern int CtlObj_Convert(PyObject *, ControlHandle *);
31+
32+
/* Dlg exports */
33+
extern PyObject *DlgObj_New(DialogPtr);
34+
extern int DlgObj_Convert(PyObject *, DialogPtr *);
35+
extern PyTypeObject Dialog_Type;
36+
#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
37+
38+
/* Drag exports */
39+
extern PyObject *DragObj_New(DragReference);
40+
extern int DragObj_Convert(PyObject *, DragReference *);
41+
42+
/* List exports */
43+
extern PyObject *ListObj_New(ListHandle);
44+
extern int ListObj_Convert(PyObject *, ListHandle *);
45+
46+
/* Menu exports */
47+
extern PyObject *MenuObj_New(MenuHandle);
48+
extern int MenuObj_Convert(PyObject *, MenuHandle *);
49+
50+
/* Qd exports */
51+
extern PyObject *GrafObj_New(GrafPtr);
52+
extern int GrafObj_Convert(PyObject *, GrafPtr *);
53+
extern PyObject *BMObj_New(BitMapPtr);
54+
extern int BMObj_Convert(PyObject *, BitMapPtr *);
55+
extern PyObject *QdRGB_New(RGBColor *);
56+
extern int QdRGB_Convert(PyObject *, RGBColor *);
57+
58+
/* Qt exports */
59+
extern PyObject *TrackObj_New(Track);
60+
extern int TrackObj_Convert(PyObject *, Track *);
61+
extern PyObject *MovieObj_New(Movie);
62+
extern int MovieObj_Convert(PyObject *, Movie *);
63+
extern PyObject *MovieCtlObj_New(MovieController);
64+
extern int MovieCtlObj_Convert(PyObject *, TimeBase *);
65+
extern PyObject *TimeBaseObj_New(TimeBase);
66+
extern int TimeBaseObj_Convert(PyObject *, TimeBase *);
67+
extern PyObject *UserDataObj_New(UserData);
68+
extern int UserDataObj_Convert(PyObject *, UserData *);
69+
extern PyObject *MediaObj_New(Media);
70+
extern int MediaObj_Convert(PyObject *, Media *);
71+
72+
/* Res exports */
73+
extern PyObject *ResObj_New(Handle);
74+
extern int ResObj_Convert(PyObject *, Handle *);
75+
extern PyObject *OptResObj_New(Handle);
76+
extern int OptResObj_Convert(PyObject *, Handle *);
77+
78+
/* TE exports */
79+
extern PyObject *TEObj_New(TEHandle);
80+
extern int TEObj_Convert(PyObject *, TEHandle *);
81+
82+
/* Win exports */
83+
extern PyObject *WinObj_New(WindowPtr);
84+
extern int WinObj_Convert(PyObject *, WindowPtr *);
85+
extern PyObject *WinObj_WhichWindow(WindowPtr);
86+
extern PyTypeObject Window_Type;
87+
#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
88+
89+
90+
#ifdef __cplusplus
91+
}
92+
#endif

Mac/Modules/ColorPickermodule.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ PERFORMANCE OF THIS SOFTWARE.
2424
#include <ColorPicker.h>
2525
#include "Python.h"
2626
#include "macglue.h"
27+
#include "pymactoolbox.h"
2728

2829
/* ----------------------------------------------------- */
2930

30-
extern QdRGB_Convert(PyObject *v, RGBColorPtr p_itself);
31-
extern PyObject *QdRGB_New(RGBColorPtr itself);
32-
3331
static char cp_GetColor__doc__[] =
3432
"GetColor(prompt, (r, g, b)) -> (r, g, b), ok"
3533
;

Mac/Modules/Nav.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,9 @@ PERFORMANCE OF THIS SOFTWARE.
3131

3232
#include "Python.h"
3333
#include "macglue.h"
34+
#include "pymactoolbox.h"
3435
#include <Navigation.h>
3536

36-
/* Exported by AEModule.c: */
37-
extern PyObject *AEDesc_New(AppleEvent *);
38-
extern int AEDesc_Convert(PyObject *, AppleEvent *);
39-
/* Exported by Resmodule.c */
40-
extern PyObject *ResObj_New(Handle);
41-
extern PyObject *OptResObj_New(Handle);
42-
extern int ResObj_Convert(PyObject *, Handle *);
43-
4437
static PyObject *ErrorObject;
4538

4639
static NavEventUPP my_eventProcUPP;

Mac/Modules/Printingmodule.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,9 @@ PERFORMANCE OF THIS SOFTWARE.
2323

2424
#include "Python.h"
2525
#include "macglue.h"
26+
#include "pymactoolbox.h"
2627
#include <Printing.h>
2728

28-
extern int ResObj_Convert(PyObject *, Handle *);
29-
extern PyObject *DlgObj_New(DialogPtr);
30-
extern PyObject *GrafObj_New(GrafPtr);
31-
extern int GrafObj_Convert(PyObject *, GrafPtr *);
32-
extern PyObject *ResObj_New(Handle);
33-
34-
3529
static PyObject *ErrorObject;
3630

3731
/* ----------------------------------------------------- */

Mac/Modules/ae/AEmodule.c

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,8 @@
55

66

77

8-
#define SystemSevenOrLater 1
9-
108
#include "macglue.h"
11-
#include <Memory.h>
12-
#include <Dialogs.h>
13-
#include <Menus.h>
14-
#include <Controls.h>
15-
16-
extern PyObject *ResObj_New(Handle);
17-
extern int ResObj_Convert(PyObject *, Handle *);
18-
extern PyObject *OptResObj_New(Handle);
19-
extern int OptResObj_Convert(PyObject *, Handle *);
20-
21-
extern PyObject *WinObj_New(WindowPtr);
22-
extern int WinObj_Convert(PyObject *, WindowPtr *);
23-
extern PyTypeObject Window_Type;
24-
#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
25-
26-
extern PyObject *DlgObj_New(DialogPtr);
27-
extern int DlgObj_Convert(PyObject *, DialogPtr *);
28-
extern PyTypeObject Dialog_Type;
29-
#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
30-
31-
extern PyObject *MenuObj_New(MenuHandle);
32-
extern int MenuObj_Convert(PyObject *, MenuHandle *);
33-
34-
extern PyObject *CtlObj_New(ControlHandle);
35-
extern int CtlObj_Convert(PyObject *, ControlHandle *);
36-
37-
extern PyObject *GrafObj_New(GrafPtr);
38-
extern int GrafObj_Convert(PyObject *, GrafPtr *);
39-
40-
extern PyObject *BMObj_New(BitMapPtr);
41-
extern int BMObj_Convert(PyObject *, BitMapPtr *);
42-
43-
extern PyObject *WinObj_WhichWindow(WindowPtr);
9+
#include "pymactoolbox.h"
4410

4511
#include <AppleEvents.h>
4612

@@ -1164,7 +1130,7 @@ GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long
11641130
PyObject *handler = (PyObject *)refcon;
11651131
AEDescObject *requestObject, *replyObject;
11661132
PyObject *args, *res;
1167-
if ((requestObject = (AEDescObject *)AEDesc_New(request)) == NULL) {
1133+
if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
11681134
return -1;
11691135
}
11701136
if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {

Mac/Modules/ae/aesupport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def passInput(self, name):
131131
PyObject *handler = (PyObject *)refcon;
132132
AEDescObject *requestObject, *replyObject;
133133
PyObject *args, *res;
134-
if ((requestObject = (AEDescObject *)AEDesc_New(request)) == NULL) {
134+
if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
135135
return -1;
136136
}
137137
if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {

Mac/Modules/app/Appmodule.c

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,11 @@
55

66

77

8-
#define SystemSevenOrLater 1
9-
108
#include "macglue.h"
11-
#include <Memory.h>
12-
#include <Dialogs.h>
13-
#include <Menus.h>
14-
#include <Controls.h>
15-
16-
extern PyObject *ResObj_New(Handle);
17-
extern int ResObj_Convert(PyObject *, Handle *);
18-
extern PyObject *OptResObj_New(Handle);
19-
extern int OptResObj_Convert(PyObject *, Handle *);
20-
21-
extern PyObject *WinObj_New(WindowPtr);
22-
extern int WinObj_Convert(PyObject *, WindowPtr *);
23-
extern PyTypeObject Window_Type;
24-
#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
25-
26-
extern PyObject *DlgObj_New(DialogPtr);
27-
extern int DlgObj_Convert(PyObject *, DialogPtr *);
28-
extern PyTypeObject Dialog_Type;
29-
#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
30-
31-
extern PyObject *MenuObj_New(MenuHandle);
32-
extern int MenuObj_Convert(PyObject *, MenuHandle *);
33-
34-
extern PyObject *CtlObj_New(ControlHandle);
35-
extern int CtlObj_Convert(PyObject *, ControlHandle *);
36-
37-
extern PyObject *GrafObj_New(GrafPtr);
38-
extern int GrafObj_Convert(PyObject *, GrafPtr *);
39-
40-
extern PyObject *BMObj_New(BitMapPtr);
41-
extern int BMObj_Convert(PyObject *, BitMapPtr *);
42-
43-
extern PyObject *WinObj_WhichWindow(WindowPtr);
9+
#include "pymactoolbox.h"
4410

4511
#include <Appearance.h>
4612

47-
/* Exported by Qdmodule.c: */
48-
extern PyObject *QdRGB_New(RGBColor *);
49-
extern int QdRGB_Convert(PyObject *, RGBColor *);
50-
51-
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
52-
5313
static PyObject *App_Error;
5414

5515
static PyObject *App_RegisterAppearanceClient(_self, _args)

Mac/Modules/app/appsupport.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@
6969

7070
includestuff = includestuff + """
7171
#include <%s>""" % MACHEADERFILE + """
72-
73-
/* Exported by Qdmodule.c: */
74-
extern PyObject *QdRGB_New(RGBColor *);
75-
extern int QdRGB_Convert(PyObject *, RGBColor *);
76-
77-
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
7872
"""
7973

8074
## class MyObjectDefinition(GlobalObjectDefinition):

Mac/Modules/cm/Cmmodule.c

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,16 @@
55

66

77

8-
#define SystemSevenOrLater 1
9-
108
#include "macglue.h"
11-
#include <Memory.h>
12-
#include <Dialogs.h>
13-
#include <Menus.h>
14-
#include <Controls.h>
15-
16-
extern PyObject *ResObj_New(Handle);
17-
extern int ResObj_Convert(PyObject *, Handle *);
18-
extern PyObject *OptResObj_New(Handle);
19-
extern int OptResObj_Convert(PyObject *, Handle *);
20-
21-
extern PyObject *WinObj_New(WindowPtr);
22-
extern int WinObj_Convert(PyObject *, WindowPtr *);
23-
extern PyTypeObject Window_Type;
24-
#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
25-
26-
extern PyObject *DlgObj_New(DialogPtr);
27-
extern int DlgObj_Convert(PyObject *, DialogPtr *);
28-
extern PyTypeObject Dialog_Type;
29-
#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
30-
31-
extern PyObject *MenuObj_New(MenuHandle);
32-
extern int MenuObj_Convert(PyObject *, MenuHandle *);
33-
34-
extern PyObject *CtlObj_New(ControlHandle);
35-
extern int CtlObj_Convert(PyObject *, ControlHandle *);
36-
37-
extern PyObject *GrafObj_New(GrafPtr);
38-
extern int GrafObj_Convert(PyObject *, GrafPtr *);
39-
40-
extern PyObject *BMObj_New(BitMapPtr);
41-
extern int BMObj_Convert(PyObject *, BitMapPtr *);
42-
43-
extern PyObject *WinObj_WhichWindow(WindowPtr);
9+
#include "pymactoolbox.h"
4410

4511
#include <Components.h>
4612

4713
/*
4814
** Parse/generate ComponentDescriptor records
4915
*/
50-
PyObject *CmpDesc_New(itself)
16+
static PyObject *
17+
CmpDesc_New(itself)
5118
ComponentDescription *itself;
5219
{
5320

@@ -58,6 +25,7 @@ PyObject *CmpDesc_New(itself)
5825
itself->componentFlags, itself->componentFlagsMask);
5926
}
6027

28+
static int
6129
CmpDesc_Convert(v, p_itself)
6230
PyObject *v;
6331
ComponentDescription *p_itself;

Mac/Modules/cm/cmsupport.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
/*
2727
** Parse/generate ComponentDescriptor records
2828
*/
29-
PyObject *CmpDesc_New(itself)
29+
static PyObject *
30+
CmpDesc_New(itself)
3031
ComponentDescription *itself;
3132
{
3233
@@ -37,6 +38,7 @@
3738
itself->componentFlags, itself->componentFlagsMask);
3839
}
3940
41+
static int
4042
CmpDesc_Convert(v, p_itself)
4143
PyObject *v;
4244
ComponentDescription *p_itself;

0 commit comments

Comments
 (0)