diff options
author | Guido van Rossum <guido@python.org> | 1991-02-19 12:22:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-02-19 12:22:24 (GMT) |
commit | 59e53a564c3ad6d7787e1626882e069459ff1a79 (patch) | |
tree | a2a718cccd37e6fb2ceb8f4fd42f9afb0d84a01b /Modules | |
parent | 865828d7cfa76371ce1a5f068dac129d04bfa403 (diff) | |
download | cpython-59e53a564c3ad6d7787e1626882e069459ff1a79.zip cpython-59e53a564c3ad6d7787e1626882e069459ff1a79.tar.gz cpython-59e53a564c3ad6d7787e1626882e069459ff1a79.tar.bz2 |
Turned the list of init calls into a table (see import.c).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/config.c.in | 102 |
1 files changed, 77 insertions, 25 deletions
diff --git a/Modules/config.c.in b/Modules/config.c.in index 60e1967..50cca43 100644 --- a/Modules/config.c.in +++ b/Modules/config.c.in @@ -1,5 +1,7 @@ /* Configurable Python configuration file */ +#include <stdio.h> + #ifdef USE_STDWIN #include <stdwin.h> @@ -43,37 +45,13 @@ initargs(p_argc, p_argv) } if (use_stdwin) - winitargs(p_argc, p_argv); + wargs(p_argc, p_argv); #endif } void initcalls() { - inittime(); - initmath(); - initregexp(); - initposix(); - -#ifdef USE_AUDIO - initaudio(); -#endif - -#ifdef USE_AMOEBA - initamoeba(); -#endif - -#ifdef USE_GL - initgl(); -#ifdef USE_PANEL - initpanel(); -#endif -#endif - -#ifdef USE_STDWIN - if (use_stdwin) - initstdwin(); -#endif } void @@ -88,6 +66,18 @@ donecalls() #endif } +#ifdef USE_STDWIN +static void +maybeinitstdwin() +{ + if (use_stdwin) + initstdwin(); + else + fprintf(stderr, + "No $DISPLAY nor -display arg -- stdwin not available\n"); +} +#endif + #ifndef PYTHONPATH #define PYTHONPATH ".:/usr/local/lib/python" #endif @@ -102,3 +92,65 @@ getpythonpath() path = PYTHONPATH; return path; } + + +/* Table of built-in modules. + These are initialized when first imported. */ + +/* Standard modules */ +extern void inittime(); +extern void initmath(); +extern void initregexp(); +extern void initposix(); +#ifdef USE_AUDIO +extern void initaudio(); +#endif +#ifdef USE_AMOEBA +extern void initamoeba(); +#endif +#ifdef USE_GL +extern void initgl(); +#ifdef USE_PANEL +extern void initpanel(); +#endif +#endif +#ifdef USE_STDWIN +extern void maybeinitstdwin(); +#endif + +struct { + char *name; + void (*initfunc)(); +} inittab[] = { + + /* Standard modules */ + + {"time", inittime}, + {"math", initmath}, + {"regexp", initregexp}, + {"posix", initposix}, + + + /* Optional modules */ + +#ifdef USE_AUDIO + {"audio", initaudio}, +#endif + +#ifdef USE_AMOEBA + {"amoeba", initamoeba}, +#endif + +#ifdef USE_GL + {"gl", initgl}, +#ifdef USE_PANEL + {"pnl", initpanel}, +#endif +#endif + +#ifdef USE_STDWIN + {"stdwin", maybeinitstdwin}, +#endif + + {0, 0} /* Sentinel */ +}; |