summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/config.c.in102
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 */
+};