Ditched '_find_SET()', since it was a no-value-added wrapper around
[python/dscho.git] / Mac / mwerks / macuseshlstart.c
blob32b808a50a7cb3c84bbecb14da13ccb7abce741c
1 /*
2 ** mac __start for python-with-shared-library.
3 **
4 ** Partially stolen from MW Startup.c, which is
5 ** Copyright © 1993 metrowerks inc. All Rights Reserved.
6 */
8 #include <setjmp.h>
10 #ifdef PRE_CW8
11 extern jmp_buf __program_exit; /* exit() does a longjmp() to here */
12 extern void (*__atexit_hook)(void); /* atexit() sets this up if it is ever called */
13 extern void (*___atexit_hook)(void); /* _atexit() sets this up if it is ever called */
14 extern int __aborting; /* abort() sets this and longjmps to __program_exit */
15 #endif
18 * clear_stackframe_backlink - set 0(SP) to 0
22 static asm void clear_stackframe_backlink(void)
24 li r3,0
25 stw r3,0(SP)
26 blr
29 void __start(void)
31 char *argv = 0;
33 #ifdef PRE_CW8
34 if (setjmp(__program_exit) == 0) { // set up jmp_buf for exit()
35 main(0, &argv); // call main(argc, argv)
36 if (__atexit_hook)
37 __atexit_hook(); // call atexit() procs
39 if (!__aborting) {
40 if (___atexit_hook)
41 ___atexit_hook(); // call _atexit() procs
43 // ExitToShell();
44 #else
45 clear_stackframe_backlink();
46 main(0, &argv);
47 exit(0);
48 #endif