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

Skip to content

Commit 5daef31

Browse files
committed
Adapted for Universal Headers 3.4: refcon type has changed (sigh) and use modern (UPP in stead of Proc) names for callback object creation.
1 parent d700d79 commit 5daef31

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

Mac/Python/macgetargv.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4141
#include <Dialogs.h>
4242
#include <Windows.h>
4343

44+
#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
45+
typedef long refcontype;
46+
#else
47+
typedef unsigned long refcontype;
48+
#endif
49+
4450
#include "Python.h"
4551
#include "macglue.h"
4652

@@ -109,7 +115,7 @@ static int got_one; /* Flag that we can stop getting events */
109115
/* Handle the Print or Quit events (by failing) */
110116

111117
static pascal OSErr
112-
handle_not(const AppleEvent *theAppleEvent, AppleEvent *reply, unsigned long refCon)
118+
handle_not(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon)
113119
{
114120
#pragma unused (reply, refCon)
115121
got_one = 1;
@@ -119,7 +125,7 @@ handle_not(const AppleEvent *theAppleEvent, AppleEvent *reply, unsigned long ref
119125
/* Handle the Open Application event (by ignoring it) */
120126

121127
static pascal OSErr
122-
handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, unsigned long refCon)
128+
handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon)
123129
{
124130
#pragma unused (reply, refCon)
125131
#if 0
@@ -132,7 +138,7 @@ handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, unsigned lon
132138
/* Handle the Open Document event, by adding an argument */
133139

134140
static pascal OSErr
135-
handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, unsigned long refCon)
141+
handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon)
136142
{
137143
#pragma unused (reply, refCon)
138144
OSErr err;
@@ -170,9 +176,9 @@ AEEventHandlerUPP not_upp;
170176
static void
171177
set_ae_handlers()
172178
{
173-
open_doc_upp = NewAEEventHandlerProc(handle_open_doc);
174-
open_app_upp = NewAEEventHandlerProc(handle_open_app);
175-
not_upp = NewAEEventHandlerProc(handle_not);
179+
open_doc_upp = NewAEEventHandlerUPP(&handle_open_doc);
180+
open_app_upp = NewAEEventHandlerUPP(&handle_open_app);
181+
not_upp = NewAEEventHandlerUPP(&handle_not);
176182

177183
AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
178184
open_app_upp, 0L, false);

0 commit comments

Comments
 (0)