home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / smalltk / src / st.c < prev    next >
C/C++ Source or Header  |  1991-10-12  |  2KB  |  87 lines

  1. /*
  2.     Little Smalltalk, version 3
  3.     Main Driver
  4.     written By Tim Budd, September 1988
  5.     Oregon State University
  6. */
  7. # include <stdio.h>
  8. # include "env.h"
  9. # include "memory.h"
  10. # include "names.h"
  11.  
  12. int initial = 0;    /* not making initial image */
  13.  
  14. extern int objectCount();
  15.  
  16. # ifdef NOARGC
  17. main()
  18. # endif
  19. # ifndef NOARGC
  20. main(argc, argv)
  21. int argc;
  22. char **argv;
  23. # endif
  24. {
  25. FILE *fp;
  26. object firstProcess;
  27. char *p, buffer[120];
  28.  
  29. initMemoryManager();
  30.  
  31. strcpy(buffer,"systemImage");
  32. p = buffer;
  33.  
  34. # ifdef STDWIN
  35. /* initialize the standard windows package */
  36. winit();
  37. wmenusetdeflocal(1);
  38.  
  39. # ifdef NOARGC
  40. if (! waskync("use default initial object image?", 1))
  41.     waskfile("image file name", buffer, 120, 0);
  42. # endif
  43. # endif
  44.  
  45. # ifndef NOARGC
  46. if (argc != 1) p = argv[1];
  47. # endif
  48.  
  49. # ifdef BINREADWRITE
  50. fp = fopen(p, "rb");
  51. # endif
  52. # ifndef BINREADWRITE
  53. fp = fopen(p, "r");
  54. # endif
  55.  
  56. if (fp == NULL) {
  57.     sysError("cannot open image", p);
  58.     exit(1);
  59.     }
  60. imageRead(fp);
  61. initCommonSymbols();
  62.  
  63. firstProcess = globalSymbol("systemProcess");
  64. if (firstProcess == nilobj) {
  65.     sysError("no initial process","in image");
  66.     exit(1); return 1;
  67.     }
  68.  
  69. /* execute the main system process loop repeatedly */
  70. /*debugging = true;*/
  71.  
  72. # ifndef STDWIN
  73. /* not using windowing interface, safe to print out message */
  74. printf("Little Smalltalk, Version 3.04\n");
  75. printf("Written by Tim Budd, Oregon State University\n");
  76. # endif
  77.  
  78. while (execute(firstProcess, 15000)) ;
  79.  
  80. # ifdef STDWIN
  81. wdone();
  82. # endif
  83.  
  84. /* exit and return - belt and suspenders, but it keeps lint happy */
  85. exit(0); return 0;
  86. }
  87.