home *** CD-ROM | disk | FTP | other *** search
- /*
- Little Smalltalk, version 3
- Main Driver
- written By Tim Budd, September 1988
- Oregon State University
- */
- # include <stdio.h>
- # include <stdlib.h>
- # include <string.h>
- # include "env.h"
- # include "memory.h"
- # include "names.h"
-
- #ifdef THINKC
- # ifdef TCL
- # include "macio.h"
- # include "glue.h"
- # include "tclprim.proto.h"
- # else
- # include "winprim.proto.h"
- # include "unixio.proto.h"
- # endif
- # include "st.proto.h"
- # include "interp.proto.h"
- # include "memory.proto.h"
- # include "names.proto.h"
- #endif
-
- int initial = 0; /* not making initial image */
-
- extern int objectCount();
-
- # ifdef NOARGC
-
-
- main (void)
- # endif
- {
- #ifdef TCL
- FILE fp;
- #else
- FILE *fp;
- #endif
- object firstProcess;
- char *p, buffer[120];
- #ifdef STDWIN /* also TCL */
- short yncResponse; /* JRB - 5/94 */
- long errNo; /* JRB - 5/94 */
- CURSOR *csr; /* JRB - 5/94 */
- #endif
-
- initMemoryManager();
-
- strcpy(buffer,"systemImage");
- p = buffer;
-
- # ifdef STDWIN /* also TCL */
- /* initialize the standard windows package */
- winit();
- wmenusetdeflocal(1);
-
- # ifdef NOARGC
- # ifdef TCL /* Deal with any initial OpenDocument AppleEvents JRB - 7/94 */
- if (processStartUpEvent (buffer) )
- p = buffer;
- else
- #endif
- /* ======================== JRB - 7/94 */
- {
- yncResponse = waskync ("use default initial object image?", 1);
- switch (yncResponse) {
- case 0: /* No */
- # ifdef TCL
- waskfile("Image file name:", buffer, 120, 0, 2);
- # else
- waskfile("Image file name:", buffer, 120, 0);
- # endif
- p = buffer;
- break;
- case -1: /* Cancel */
- sysError ("Image load cancelled", " - Aborting start-up.");
- break;
- default: /* Yes */
- p = "systemImage";
- }
- }
- /* =================================== */
- # endif
- # endif
-
- # ifndef NOARGC
- if (argc != 1) p = argv[1];
- # endif
-
- #ifndef TCL
- # ifdef BINREADWRITE
- fp = fopen(p, "rb");
- # endif
- # ifndef BINREADWRITE
- fp = fopen(p, "r");
- # endif
- if (fp == NULL) {
- sysError("cannot open image", p);
- exit(1);
- }
- imageRead(fp);
- #else /* ======================== Mac-specific image read JRB - 5/94 */
- errNo = openFile (&fp, p, "r", 0);
- if (errNo != 0) {
- sysError ("cannot open image: ", p);
- exit (1);
- }
- csr = wfetchcursor ("watch");
- wsetwincursor ((WINDOW *)0L, csr);
- imageRead (fp.fileRef);
- closeFile (&fp, p);
- #endif
-
- initCommonSymbols();
-
- firstProcess = globalSymbol("systemProcess");
- if (firstProcess == nilobj) {
- sysError("no initial process","in image");
- exit(1); return 1;
- }
-
- /* execute the main system process loop repeatedly */
- /*debugging = true;*/
-
- # ifndef STDWIN
- /* not using windowing interface, safe to print out message */
- printf("Little Smalltalk, Version 3.04\n");
- printf("Written by Tim Budd, Oregon State University\n");
- # endif
-
- while (execute(firstProcess, 15000)) ;
-
- # ifdef STDWIN
- wdone();
- # endif
-
- /* exit and return - belt and suspenders, but it keeps lint happy */
- exit(0); return 0;
- }
-