blob: abb5296205fe0094065806a1864e930361724fcb [file] [log] [blame]
Guido van Rossumd4d77281994-08-19 10:51:31 +00001/* Generated automatically from ../../Modules/config.c.in by makesetup. */
2/* -*- C -*- ***********************************************
3Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Guido van Rossumce9739b1994-01-05 16:17:15 +00004Amsterdam, The Netherlands.
5
6 All Rights Reserved
7
8Permission to use, copy, modify, and distribute this software and its
9documentation for any purpose and without fee is hereby granted,
10provided that the above copyright notice appear in all copies and that
11both that copyright notice and this permission notice appear in
12supporting documentation, and that the names of Stichting Mathematisch
13Centrum or CWI not be used in advertising or publicity pertaining to
14distribution of the software without specific, written prior permission.
15
16STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
17THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
19FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
22OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
24******************************************************************/
25
26/* Universal Python configuration file */
27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include <stdio.h>
33#include <string.h>
34
35#include "myproto.h"
36#include "mymalloc.h"
37#include "osdefs.h"
Guido van Rossumd4d77281994-08-19 10:51:31 +000038#include "intrcheck.h"
Guido van Rossumce9739b1994-01-05 16:17:15 +000039
40
41#ifndef NO_MAIN
42
43/* Normally, the main program is called from here (so everything else
44 can be in libPython.a). We save a pointer to argv[0] because it
45 may be needed for dynamic loading of modules in import.c. If you
46 have your own main program and want to use non-SunOS dynamic
47 loading, you will have to provide your own version of
48 getprogramname(). */
49
50static char *argv0;
51
52main(argc, argv)
53 int argc;
54 char **argv;
55{
56#ifdef macintosh
Guido van Rossumd4d77281994-08-19 10:51:31 +000057 /* Macs always support stdwin */
58// wargs(&argc, &argv);
Guido van Rossumce9739b1994-01-05 16:17:15 +000059#endif
Guido van Rossumce9739b1994-01-05 16:17:15 +000060 argv0 = argv[0];
61 realmain(argc, argv);
62}
63
64char *
65getprogramname()
66{
67 return argv0;
68}
69
70#endif
71
72
Guido van Rossumd4d77281994-08-19 10:51:31 +000073/* Python version information */
74
75#include "patchlevel.h"
76
77/* Return the version string. This is constructed from the official
78 version number (from patchlevel.h), and the current date (if known
79 to the compiler, else a manually inserted date). */
80
81#define VERSION "%s (%s)"
82
83#ifdef __DATE__
84#define DATE __DATE__
85#else
86#define DATE "Aug 17 1994"
87#endif
88
89char *
90getversion()
91{
92 static char version[80];
93 sprintf(version, VERSION, PATCHLEVEL, DATE);
94 return version;
95}
96
97
98/* Return the copyright string. This is updated manually. */
99
100char *
101getcopyright()
102{
103 return "Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam";
104}
105
106
Guido van Rossumce9739b1994-01-05 16:17:15 +0000107/* Return the initial python search path. This is called once from
108 initsys() to initialize sys.path.
109 The environment variable PYTHONPATH is fetched and the default path
110 appended. (The Mac has no environment variables, so there the
111 default path is always returned.) The default path may be passed
112 to the preprocessor; if not, a system-dependent default is used. */
113
114#ifndef PYTHONPATH
115#ifdef macintosh
Guido van Rossumd4d77281994-08-19 10:51:31 +0000116#define PYTHONPATH ": :Lib :Lib:stdwin :Lib:test :Lib:mac"
Guido van Rossumce9739b1994-01-05 16:17:15 +0000117#endif /* macintosh */
118#endif /* !PYTHONPATH */
119
120#ifndef PYTHONPATH
Guido van Rossumd4d77281994-08-19 10:51:31 +0000121#if defined(MSDOS) || defined(NT)
Guido van Rossumce9739b1994-01-05 16:17:15 +0000122#define PYTHONPATH ".;..\\lib;\\python\\lib"
Guido van Rossumd4d77281994-08-19 10:51:31 +0000123#endif /* MSDOS || NT */
Guido van Rossumce9739b1994-01-05 16:17:15 +0000124#endif /* !PYTHONPATH */
125
126#ifndef PYTHONPATH
127#define PYTHONPATH ".:/usr/local/lib/python"
128#endif /* !PYTHONPATH */
129
130extern char *getenv();
131
132char *
133getpythonpath()
134{
135#ifdef macintosh
136 return PYTHONPATH;
137#else /* !macintosh */
138 char *path = getenv("PYTHONPATH");
139 char *defpath = PYTHONPATH;
140 char *buf;
141 char *p;
142 int n;
143
144 if (path == 0 || *path == '\0')
145 return defpath;
146 n = strlen(path) + strlen(defpath) + 2;
147 buf = malloc(n);
148 if (buf == NULL)
149 return path; /* XXX too bad -- but not likely */
150 strcpy(buf, path);
151 p = buf + strlen(buf);
152 *p++ = DELIM;
153 strcpy(p, defpath);
154 return buf;
155#endif /* !macintosh */
156}
157
158
159/* Table of built-in modules.
160 These are initialized when first imported.
161 Note: selection of optional extensions is now generally done by the
162 makesetup script. */
163
164extern void initarray();
165extern void initmath();
166extern void initparser();
167extern void initmac();
168extern void initregex();
169extern void initstrop();
170extern void initstruct();
171extern void inittime();
172extern void initdbm();
173extern void initfcntl();
174extern void initnis();
175extern void initpwd();
176extern void initgrp();
Guido van Rossumd4d77281994-08-19 10:51:31 +0000177extern void initcrypt();
Guido van Rossumce9739b1994-01-05 16:17:15 +0000178extern void initselect();
179extern void initsocket();
180extern void initaudioop();
181extern void initimageop();
182extern void initrgbimg();
183extern void initstdwin();
184extern void initmd5();
185extern void initmpz();
186extern void initrotor();
187extern void inital();
188extern void initcd();
189extern void initcl();
190extern void initfm();
191extern void initgl();
192extern void initimgfile();
193extern void initsgi();
194extern void initsv();
195extern void initfl();
196extern void initthread();
197extern void inittiming();
Guido van Rossumd4d77281994-08-19 10:51:31 +0000198extern void initsignal();
199extern void initnew();
200extern void initdl();
201extern void initsyslog();
Guido van Rossumce9739b1994-01-05 16:17:15 +0000202
203/* -- ADDMODULE MARKER 1 -- */
204
205extern void initmarshal();
206
207struct {
208 char *name;
209 void (*initfunc)();
210} inittab[] = {
211
212 {"array", initarray},
213 {"math", initmath},
214 {"parser", initparser},
215 {"mac", initmac},
216 {"regex", initregex},
217 {"strop", initstrop},
218 {"struct", initstruct},
219 {"time", inittime},
220 {"audioop", initaudioop},
221 {"imageop", initimageop},
222 {"rgbimg", initrgbimg},
Guido van Rossumd4d77281994-08-19 10:51:31 +0000223// {"stdwin", initstdwin},
Guido van Rossumce9739b1994-01-05 16:17:15 +0000224 {"md5", initmd5},
225 {"rotor", initrotor},
Guido van Rossumd4d77281994-08-19 10:51:31 +0000226// {"signal", initsignal},
227 {"new", initnew},
Guido van Rossumce9739b1994-01-05 16:17:15 +0000228
229/* -- ADDMODULE MARKER 2 -- */
230
231 /* This module "lives in" with marshal.c */
232 {"marshal", initmarshal},
233
234 /* These entries are here for sys.builtin_module_names */
235 {"__main__", NULL},
236 {"__builtin__", NULL},
237 {"sys", NULL},
238
239 /* Sentinel */
240 {0, 0}
241};
242
243#ifdef USE_FROZEN
244#include "frozen.c"
245#else
246struct frozen {
247 char *name;
248 char *code;
249 int size;
250} frozen_modules[] = {
251 {0, 0, 0}
252};
253#endif