summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-18 14:56:09 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-18 14:56:09 (GMT)
commite5df96295835610814f50207f2cd0f0c9e7332d1 (patch)
tree3dccb45e246e8fc8584e88d8d1b5ec4c8a35b16b
parent8bdd33386d041265010e803b5b45313a48ab4ace (diff)
downloadcpython-e5df96295835610814f50207f2cd0f0c9e7332d1.zip
cpython-e5df96295835610814f50207f2cd0f0c9e7332d1.tar.gz
cpython-e5df96295835610814f50207f2cd0f0c9e7332d1.tar.bz2
moved most of it to macglue.c
-rw-r--r--Mac/Python/macapplet.c73
1 files changed, 6 insertions, 67 deletions
diff --git a/Mac/Python/macapplet.c b/Mac/Python/macapplet.c
index 0414327..47f3b02 100644
--- a/Mac/Python/macapplet.c
+++ b/Mac/Python/macapplet.c
@@ -24,73 +24,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Macintosh Applet Python main program */
-#include "Python.h"
-#include "marshal.h"
-#include "import.h"
+#ifdef __CFM68K__
+#pragma lib_export on
+#endif
-#include <Memory.h>
-#include <Resources.h>
-#include <QuickDraw.h>
-#include <Fonts.h>
-#include <Windows.h>
-#include <TextEdit.h>
-#include <Dialogs.h>
-#include <Menus.h>
+extern void PyMac_InitApplet();
-static void
-init_mac_world()
-{
- MaxApplZone();
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- TEInit();
- InitDialogs((long)0);
- InitMenus();
- InitCursor();
-}
-
-static int
-run_main_resource()
-{
- Handle h;
- long size;
- PyObject *code;
- PyObject *result;
-
- h = GetNamedResource('PYC ', "\p__main__");
- if (h == NULL) {
- fprintf(stderr, "No 'PYC ' resource named __main__ found\n");
- return 1;
- }
- size = GetResourceSizeOnDisk(h);
- HLock(h);
- code = PyMarshal_ReadObjectFromString(*h + 8, (int)(size - 8));
- HUnlock(h);
- ReleaseResource(h);
- if (code == NULL) {
- PyErr_Print();
- return 1;
- }
- result = PyImport_ExecCodeModule("__main__", code);
- Py_DECREF(code);
- if (result == NULL) {
- PyErr_Print();
- return 1;
- }
- Py_DECREF(result);
- return 0;
-}
-
-main()
-{
- static char *argv[] = {"__main__", NULL};
-
- init_mac_world();
- Py_Initialize();
- PySys_SetArgv((sizeof argv / sizeof argv[0]) - 1, argv);
- run_main_resource();
- fflush(stderr);
- fflush(stdout);
- /* XXX Should we bother to Py_Exit(sts)? */
+main() {
+ PyMac_InitApplet();
}