Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | /*********************************************************** |
| 2 | Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The |
| 3 | Netherlands. |
| 4 | |
| 5 | All Rights Reserved |
| 6 | |
| 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. |
| 14 | |
| 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. |
| 22 | |
| 23 | ******************************************************************/ |
| 24 | |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 25 | /* Configurable Python configuration file */ |
Guido van Rossum | aec7855 | 1990-12-20 23:03:58 +0000 | [diff] [blame] | 26 | |
Guido van Rossum | aa01141 | 1991-12-16 13:05:20 +0000 | [diff] [blame^] | 27 | #define VERSION "0.9.4 beta" |
| 28 | |
| 29 | #ifdef __DATE__ |
| 30 | #define DATE __DATE__ |
| 31 | #else |
| 32 | #define DATE "Dec 16 1991" |
| 33 | #endif |
Guido van Rossum | 9f462af | 1991-12-10 13:54:12 +0000 | [diff] [blame] | 34 | |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 35 | #include <stdio.h> |
| 36 | |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 37 | #ifdef USE_STDWIN |
| 38 | #include <stdwin.h> |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 39 | #endif |
Guido van Rossum | aec7855 | 1990-12-20 23:03:58 +0000 | [diff] [blame] | 40 | |
Guido van Rossum | aa01141 | 1991-12-16 13:05:20 +0000 | [diff] [blame^] | 41 | char version[80]; |
| 42 | |
Guido van Rossum | aec7855 | 1990-12-20 23:03:58 +0000 | [diff] [blame] | 43 | /*ARGSUSED*/ |
| 44 | void |
| 45 | initargs(p_argc, p_argv) |
| 46 | int *p_argc; |
| 47 | char ***p_argv; |
| 48 | { |
Guido van Rossum | aa01141 | 1991-12-16 13:05:20 +0000 | [diff] [blame^] | 49 | sprintf(version, "%s (%s)", VERSION, DATE); |
| 50 | |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 51 | #ifdef USE_STDWIN |
Guido van Rossum | 5b02dbc | 1991-06-07 13:55:41 +0000 | [diff] [blame] | 52 | wargs(p_argc, p_argv); |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 53 | #endif |
Guido van Rossum | 9f462af | 1991-12-10 13:54:12 +0000 | [diff] [blame] | 54 | if (*p_argc < 2 && isatty(0) && isatty(1)) |
| 55 | { |
| 56 | printf("Python %s.\n", version); |
Guido van Rossum | aa01141 | 1991-12-16 13:05:20 +0000 | [diff] [blame^] | 57 | printf( |
| 58 | "Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam\n"); |
Guido van Rossum | 9f462af | 1991-12-10 13:54:12 +0000 | [diff] [blame] | 59 | } |
Guido van Rossum | aec7855 | 1990-12-20 23:03:58 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | void |
| 63 | initcalls() |
| 64 | { |
Guido van Rossum | aec7855 | 1990-12-20 23:03:58 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | void |
| 68 | donecalls() |
| 69 | { |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 70 | #ifdef USE_STDWIN |
Guido van Rossum | 5b02dbc | 1991-06-07 13:55:41 +0000 | [diff] [blame] | 71 | wdone(); |
Guido van Rossum | 28a83ab | 1991-01-18 15:32:01 +0000 | [diff] [blame] | 72 | #endif |
Guido van Rossum | aec7855 | 1990-12-20 23:03:58 +0000 | [diff] [blame] | 73 | #ifdef USE_AUDIO |
| 74 | asa_done(); |
| 75 | #endif |
| 76 | } |
| 77 | |
| 78 | #ifndef PYTHONPATH |
| 79 | #define PYTHONPATH ".:/usr/local/lib/python" |
| 80 | #endif |
| 81 | |
| 82 | extern char *getenv(); |
| 83 | |
| 84 | char * |
| 85 | getpythonpath() |
| 86 | { |
| 87 | char *path = getenv("PYTHONPATH"); |
| 88 | if (path == 0) |
| 89 | path = PYTHONPATH; |
| 90 | return path; |
| 91 | } |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 92 | |
| 93 | |
| 94 | /* Table of built-in modules. |
| 95 | These are initialized when first imported. */ |
| 96 | |
| 97 | /* Standard modules */ |
| 98 | extern void inittime(); |
| 99 | extern void initmath(); |
| 100 | extern void initregexp(); |
| 101 | extern void initposix(); |
Guido van Rossum | ac02948 | 1991-04-16 08:39:39 +0000 | [diff] [blame] | 102 | extern void initpwd(); |
| 103 | extern void initgrp(); |
Guido van Rossum | 6f7b959 | 1991-06-04 19:47:46 +0000 | [diff] [blame] | 104 | extern void initmarshal(); |
| 105 | |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 106 | #ifdef USE_AUDIO |
| 107 | extern void initaudio(); |
| 108 | #endif |
Guido van Rossum | 188f832 | 1991-09-10 14:55:08 +0000 | [diff] [blame] | 109 | #ifdef USE_AL |
| 110 | extern void inital(); |
| 111 | #endif |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 112 | #ifdef USE_AMOEBA |
| 113 | extern void initamoeba(); |
| 114 | #endif |
| 115 | #ifdef USE_GL |
| 116 | extern void initgl(); |
Guido van Rossum | 2abc7a6 | 1991-04-03 19:01:18 +0000 | [diff] [blame] | 117 | #ifdef USE_FM |
| 118 | extern void initfm(); |
Guido van Rossum | 3fecef7 | 1991-08-16 08:58:56 +0000 | [diff] [blame] | 119 | #ifdef USE_FL |
| 120 | extern void initfl(); |
| 121 | #endif |
Guido van Rossum | 2abc7a6 | 1991-04-03 19:01:18 +0000 | [diff] [blame] | 122 | #endif |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 123 | #ifdef USE_PANEL |
| 124 | extern void initpanel(); |
| 125 | #endif |
| 126 | #endif |
| 127 | #ifdef USE_STDWIN |
Guido van Rossum | 5b02dbc | 1991-06-07 13:55:41 +0000 | [diff] [blame] | 128 | extern void initstdwin(); |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 129 | #endif |
Guido van Rossum | 49955ae | 1991-07-01 18:45:17 +0000 | [diff] [blame] | 130 | #ifdef USE_SOCKET |
| 131 | extern void initsocket(); |
| 132 | #endif |
Guido van Rossum | 56a5afc | 1991-11-12 15:40:36 +0000 | [diff] [blame] | 133 | #ifdef USE_JPEG |
| 134 | extern void initjpeg(); |
| 135 | #endif |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 136 | |
| 137 | struct { |
| 138 | char *name; |
| 139 | void (*initfunc)(); |
| 140 | } inittab[] = { |
| 141 | |
| 142 | /* Standard modules */ |
| 143 | |
| 144 | {"time", inittime}, |
| 145 | {"math", initmath}, |
| 146 | {"regexp", initregexp}, |
| 147 | {"posix", initposix}, |
Guido van Rossum | ac02948 | 1991-04-16 08:39:39 +0000 | [diff] [blame] | 148 | {"pwd", initpwd}, |
| 149 | {"grp", initgrp}, |
Guido van Rossum | 6f7b959 | 1991-06-04 19:47:46 +0000 | [diff] [blame] | 150 | {"marshal", initmarshal}, |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 151 | |
| 152 | |
| 153 | /* Optional modules */ |
| 154 | |
| 155 | #ifdef USE_AUDIO |
| 156 | {"audio", initaudio}, |
| 157 | #endif |
| 158 | |
Guido van Rossum | 188f832 | 1991-09-10 14:55:08 +0000 | [diff] [blame] | 159 | #ifdef USE_AL |
| 160 | {"al", inital}, |
| 161 | #endif |
| 162 | |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 163 | #ifdef USE_AMOEBA |
| 164 | {"amoeba", initamoeba}, |
| 165 | #endif |
| 166 | |
| 167 | #ifdef USE_GL |
| 168 | {"gl", initgl}, |
Guido van Rossum | 2abc7a6 | 1991-04-03 19:01:18 +0000 | [diff] [blame] | 169 | #ifdef USE_FM |
| 170 | {"fm", initfm}, |
Guido van Rossum | 3fecef7 | 1991-08-16 08:58:56 +0000 | [diff] [blame] | 171 | #ifdef USE_FL |
| 172 | {"fl", initfl}, |
| 173 | #endif |
Guido van Rossum | 2abc7a6 | 1991-04-03 19:01:18 +0000 | [diff] [blame] | 174 | #endif |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 175 | #ifdef USE_PANEL |
| 176 | {"pnl", initpanel}, |
| 177 | #endif |
| 178 | #endif |
| 179 | |
| 180 | #ifdef USE_STDWIN |
Guido van Rossum | 5b02dbc | 1991-06-07 13:55:41 +0000 | [diff] [blame] | 181 | {"stdwin", initstdwin}, |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 182 | #endif |
| 183 | |
Guido van Rossum | 49955ae | 1991-07-01 18:45:17 +0000 | [diff] [blame] | 184 | #ifdef USE_SOCKET |
| 185 | {"socket", initsocket}, |
| 186 | #endif |
| 187 | |
Guido van Rossum | 56a5afc | 1991-11-12 15:40:36 +0000 | [diff] [blame] | 188 | #ifdef USE_JPEG |
| 189 | {"jpeg", initjpeg}, |
| 190 | #endif |
| 191 | |
Guido van Rossum | 59e53a5 | 1991-02-19 12:22:24 +0000 | [diff] [blame] | 192 | {0, 0} /* Sentinel */ |
| 193 | }; |