blob: 4bf193e85e3447e5f5b3f55ab64158b70daece4f [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 Jansenbac428d1994-12-14 13:47:30 +000044char *fileargument;
45
Guido van Rossumb0f3c821994-08-23 13:34:25 +000046main(argc, argv)
47 int argc;
48 char **argv;
49{
50#ifdef USE_STDWIN
Guido van Rossumc02311b1995-01-22 18:38:12 +000051#ifdef THINK_C
52 /* This is done to initialize the Think console I/O library before stdwin.
53 If we don't do this, the console I/O library will only be usable for
54 output, and the interactive version of the interpreter will quit
55 immediately because it sees an EOF from stdin.
56 The disadvantage is that when using STDWIN, your stdwin menus will
57 appear next to the console I/O's File and Edit menus, and you will have
58 an empty console window in your application (though it can be removed
59 by clever use of console library I believe).
60 Remove this line if you want to be able to double-click Python scripts
61 that use STDWIN and never use stdin for input.
62 (A more dynamic solution may be possible e.g. based on bits in the
63 SIZE resource or whatever... Have fun, and let me know if you find
64 a better way!) */
65 printf("\n");
66#endif
Guido van Rossumb0f3c821994-08-23 13:34:25 +000067 /* Use STDWIN's wargs() to set argc/argv to list of files to open */
68 wargs(&argc, &argv);
69 /* Put About Python... in Apple menu */
70 {
71 extern char *about_message;
72 extern char *about_item;
73 extern char *getversion(), *getcopyright();
Jack Jansenbac428d1994-12-14 13:47:30 +000074 static char buf[1024];
Guido van Rossumb0f3c821994-08-23 13:34:25 +000075 sprintf(buf, "Python %s\r\
76\r\
77%s\r\
78\r\
79Author: Guido van Rossum <guido@cwi.nl>\r\
80FTP: host ftp.cwi.nl, directory pub/python\r\
81Newsgroup: comp.lang.python\r\
82\r\
83Motto: \"Nobody expects the Spanish Inquisition!\"",
84 getversion(), getcopyright());
85 about_message = buf;
86 about_item = "About Python...";
87 }
88#endif /* USE_STDWIN */
89#ifdef CONSOLE_IO
90 if (argc >= 1 && argv[0][0] != '\0') {
91 static char buf[256];
92 buf[0] = strlen(argv[0]);
93 strncpy(buf+1, argv[0], buf[0]);
94 console_options.title = (unsigned char *)buf;
95 }
96 else
97 console_options.title = "\pPython";
98#endif /* CONSOLE_IO */
Jack Jansenbac428d1994-12-14 13:47:30 +000099 if ( argc > 1 )
100 fileargument = argv[1]; /* Mod by Jack to do chdir */
Guido van Rossumb0f3c821994-08-23 13:34:25 +0000101 realmain(argc, argv);
102}