home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 116.lha / SmallTalk / Sources / COMP.C < prev    next >
C/C++ Source or Header  |  1986-11-20  |  1KB  |  60 lines

  1. /*
  2.     Little Smalltalk, version 2
  3.     Written by Tim Budd, Oregon State University, July 1987
  4.  
  5.     Unix specific front end for the initial object image maker
  6.     (parse utility)
  7. */
  8.  
  9. # include <stdio.h>
  10. # include "env.h"
  11. # include "memory.h"
  12. # include "names.h"
  13.  
  14. main(argc, argv) 
  15. int argc;
  16. char **argv;
  17. { FILE *fp;
  18.     int i;
  19.     boolean printit = true;
  20.  
  21.     initMemoryManager();
  22.  
  23.     buildInitialNameTables();
  24.  
  25.     if (argc == 1)
  26.         readFile(stdin, printit);
  27.     else
  28.         for (i = 1; i < argc; i++) {
  29.             if (argv[i][0] == '-') {
  30.                 switch(argv[i][1]) {
  31.                     case 's': printit = false; break;
  32.                     case 'v': printit = true; break;
  33.                     }
  34.                 }
  35.             else {
  36.                 fp = fopen(argv[i], "r");
  37.                 if (fp == NULL) {
  38.                     ignore fprintf(stderr,
  39.                         "can't open file %s", argv[i]);
  40.                     exit(1);
  41.                     }
  42.                 else {
  43.                     readFile(fp, printit);
  44.                     ignore fclose(fp);
  45.                     }
  46.                 }
  47.             }
  48.  
  49. # ifndef BINREADWRITE
  50.     fp = fopen(INITIALIMAGE, "w");
  51. # endif
  52. # ifdef BINREADWRITE
  53.     fp = fopen(INITIALIMAGE, "wb");
  54. # endif
  55.     if (fp == NULL) sysError("error during image file open",INITIALIMAGE);
  56.     imageWrite(fp);
  57.     ignore fclose(fp);
  58.     exit(0);
  59. }
  60.