Don't reference removed files in Makefile
[python/dscho.git] / Mac / Python / macmain.c
blobc32365e1c19f88c17726d1ebdee5e8b41cef9aa4
1 /***********************************************************
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3 The Netherlands.
5 All Rights Reserved
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the names of Stichting Mathematisch
12 Centrum or CWI not be used in advertising or publicity pertaining to
13 distribution of the software without specific, written prior permission.
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ******************************************************************/
25 /* Macintosh Python main program */
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
31 #include "rename2.h"
32 #include "mymalloc.h"
34 #ifdef THINK_C
35 #define CONSOLE_IO
36 #endif
38 #include <stdio.h>
39 #include <string.h>
41 #ifdef CONSOLE_IO
42 #include <console.h>
43 #endif
45 #ifdef __MWERKS__
46 #include <SIOUX.h>
47 #endif
49 extern char *fileargument;
51 main(argc, argv)
52 int argc;
53 char **argv;
55 #ifdef USE_MAC_SHARED_LIBRARY
56 PyMac_AddLibResources();
57 #endif
58 #ifdef __MWERKS__
59 SIOUXSettings.asktosaveonclose = 0;
60 SIOUXSettings.showstatusline = 0;
61 SIOUXSettings.tabspaces = 4;
62 #endif
63 #ifdef USE_STDWIN
64 #ifdef THINK_C
65 /* This is done to initialize the Think console I/O library before stdwin.
66 If we don't do this, the console I/O library will only be usable for
67 output, and the interactive version of the interpreter will quit
68 immediately because it sees an EOF from stdin.
69 The disadvantage is that when using STDWIN, your stdwin menus will
70 appear next to the console I/O's File and Edit menus, and you will have
71 an empty console window in your application (though it can be removed
72 by clever use of console library I believe).
73 Remove this line if you want to be able to double-click Python scripts
74 that use STDWIN and never use stdin for input.
75 (A more dynamic solution may be possible e.g. based on bits in the
76 SIZE resource or whatever... Have fun, and let me know if you find
77 a better way!) */
78 printf("\n");
79 #endif
80 #ifdef BUILD_APPLET_TEMPLATE
81 /* Make argv[0] and [1] be application name. The "argument" will later
82 ** be recognized as APPL type and interpreted as being a .pyc file.
83 ** XXXX Should be changed. Argv[0] should be the shared lib location or
84 ** something, so we can find our Lib directory, etc.
87 char *progname;
88 extern char *getappname();
90 progname = getappname();
91 if ( (argv = (char **)malloc(3*sizeof(char *))) == NULL ) {
92 fprintf(stderr, "No memory\n");
93 exit(1);
95 argv[0] = malloc(strlen(progname)+1);
96 argv[1] = malloc(strlen(progname)+1);
97 argv[2] = NULL;
98 if ( argv[0] == NULL || argv[1] == NULL ) {
99 fprintf(stderr, "No memory\n");
100 exit(1);
102 strcpy(argv[0], progname);
103 strcpy(argv[1], progname);
104 argc = 2;
106 #else
107 /* Use STDWIN's wargs() to set argc/argv to list of files to open */
108 wargs(&argc, &argv);
109 #endif
110 /* Put About Python... in Apple menu */
112 extern char *about_message;
113 extern char *about_item;
114 extern char *getversion(), *getcopyright();
115 static char buf[1024];
116 sprintf(buf, "Python %s\r\
118 %s\r\
120 Author: Guido van Rossum <guido@cwi.nl>\r\
121 FTP: host ftp.cwi.nl, directory pub/python\r\
122 Newsgroup: comp.lang.python\r\
124 Motto: \"Nobody expects the Spanish Inquisition!\"",
125 getversion(), getcopyright());
126 about_message = buf;
127 about_item = "About Python...";
129 #endif /* USE_STDWIN */
130 #ifdef CONSOLE_IO
131 if (argc >= 1 && argv[0][0] != '\0') {
132 static char buf[256];
133 buf[0] = strlen(argv[0]);
134 strncpy(buf+1, argv[0], buf[0]);
135 console_options.title = (unsigned char *)buf;
137 else
138 console_options.title = "\pPython";
139 #endif /* CONSOLE_IO */
140 if ( argc > 1 )
141 fileargument = argv[1]; /* Mod by Jack to do chdir */
142 realmain(argc, argv);