blob: d13c883d95e13e8407ce8a56c1f2bb548d0266e8 [file] [log] [blame]
Guido van Rossumb0f3c821994-08-23 13:34:25 +00001/***********************************************************
Guido van Rossum99546991995-01-08 14:33:34 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Guido van Rossumb0f3c821994-08-23 13:34:25 +00004
5 All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Stichting Mathematisch
12Centrum or CWI not be used in advertising or publicity pertaining to
13distribution of the software without specific, written prior permission.
14
15STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
23******************************************************************/
24
25/* Macintosh Python main program */
26
27#ifdef HAVE_CONFIG_H
28#include "config.h"
29#endif
30
Guido van Rossum5c832521995-01-17 15:57:48 +000031#include "rename2.h"
32
Guido van Rossumb0f3c821994-08-23 13:34:25 +000033#ifdef THINK_C
34#define CONSOLE_IO
35#endif
36
37#include <stdio.h>
38#include <string.h>
39
40#ifdef CONSOLE_IO
41#include <console.h>
42#endif
43
Jack Jansenc76fd391995-02-02 14:27:31 +000044#ifdef __MWERKS__
45#include <SIOUX.h>
46#endif
47
Jack Jansenbac428d1994-12-14 13:47:30 +000048char *fileargument;
49
Guido van Rossumb0f3c821994-08-23 13:34:25 +000050main(argc, argv)
51 int argc;
52 char **argv;
53{
54#ifdef USE_STDWIN
Guido van Rossumc02311b1995-01-22 18:38:12 +000055#ifdef THINK_C
56 /* This is done to initialize the Think console I/O library before stdwin.
57 If we don't do this, the console I/O library will only be usable for
58 output, and the interactive version of the interpreter will quit
59 immediately because it sees an EOF from stdin.
60 The disadvantage is that when using STDWIN, your stdwin menus will
61 appear next to the console I/O's File and Edit menus, and you will have
62 an empty console window in your application (though it can be removed
63 by clever use of console library I believe).
64 Remove this line if you want to be able to double-click Python scripts
65 that use STDWIN and never use stdin for input.
66 (A more dynamic solution may be possible e.g. based on bits in the
67 SIZE resource or whatever... Have fun, and let me know if you find
68 a better way!) */
69 printf("\n");
70#endif
Jack Jansenc76fd391995-02-02 14:27:31 +000071#ifdef __MWERKS__
72 SIOUXSettings.asktosaveonclose = 0;
73 SIOUXSettings.showstatusline = 0;
74 SIOUXSettings.tabspaces = 4;
75#endif
Guido van Rossumb0f3c821994-08-23 13:34:25 +000076 /* Use STDWIN's wargs() to set argc/argv to list of files to open */
77 wargs(&argc, &argv);
78 /* Put About Python... in Apple menu */
79 {
80 extern char *about_message;
81 extern char *about_item;
82 extern char *getversion(), *getcopyright();
Jack Jansenbac428d1994-12-14 13:47:30 +000083 static char buf[1024];
Guido van Rossumb0f3c821994-08-23 13:34:25 +000084 sprintf(buf, "Python %s\r\
85\r\
86%s\r\
87\r\
88Author: Guido van Rossum <guido@cwi.nl>\r\
89FTP: host ftp.cwi.nl, directory pub/python\r\
90Newsgroup: comp.lang.python\r\
91\r\
92Motto: \"Nobody expects the Spanish Inquisition!\"",
93 getversion(), getcopyright());
94 about_message = buf;
95 about_item = "About Python...";
96 }
97#endif /* USE_STDWIN */
98#ifdef CONSOLE_IO
99 if (argc >= 1 && argv[0][0] != '\0') {
100 static char buf[256];
101 buf[0] = strlen(argv[0]);
102 strncpy(buf+1, argv[0], buf[0]);
103 console_options.title = (unsigned char *)buf;
104 }
105 else
106 console_options.title = "\pPython";
107#endif /* CONSOLE_IO */
Jack Jansenbac428d1994-12-14 13:47:30 +0000108 if ( argc > 1 )
109 fileargument = argv[1]; /* Mod by Jack to do chdir */
Guido van Rossumb0f3c821994-08-23 13:34:25 +0000110 realmain(argc, argv);
111}