home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / games / inform / compiler / source / c / files < prev    next >
Encoding:
Text File  |  1994-10-02  |  34.8 KB  |  1,095 lines

  1. /* ------------------------------------------------------------------------- */
  2. /*   "files" : File handling, memory, command-line memory settings,          */
  3. /*             fatal errors (and error throwback on Acorn Archimedes)        */
  4. /*                                                                           */
  5. /*   Part of Inform release 5                                                */
  6. /*                                                                           */
  7. /* ------------------------------------------------------------------------- */
  8.  
  9. #include "header.h"
  10.  
  11. int override_error_line=0;
  12. int32 malloced_bytes=0;
  13. Sourcefile InputFiles[MAX_INCLUSION_DEPTH];
  14. int input_file;
  15. int total_files_read;
  16. int total_sl_count;
  17.  
  18. char Source_Name[100], Code_Name[100];
  19.  
  20. /* ------------------------------------------------------------------------- */
  21. /*   NB: Arguably temporary files should be made using "tmpfile" in          */
  22. /*   the ANSI C libraries, but we do it by hand since tmpfile is unusual.    */
  23. /* ------------------------------------------------------------------------- */
  24.  
  25. #ifdef USE_TEMPORARY_FILES
  26.     FILE *Temp1_fp=NULL, *Temp2_fp=NULL;
  27.  
  28. #ifdef ARCHIMEDES
  29. static char tname_b[128];
  30. char tname_pre[128];
  31. static char *temporary_name(int i)
  32. {   sprintf(tname_b, "%sInfTemp%d", tname_pre, i);
  33.     return(tname_b);
  34. }
  35. #endif
  36.  
  37. #endif
  38.  
  39. /* ------------------------------------------------------------------------- */
  40. /*  Line numbering, fatal errors                                             */
  41. /* ------------------------------------------------------------------------- */
  42.  
  43. extern int current_source_line(void)
  44. {   if (input_file==0) return -1;
  45.     return(InputFiles[input_file-1].source_line);
  46. }
  47.  
  48. extern void advance_line(void)
  49. {   InputFiles[input_file-1].source_line++;
  50.     InputFiles[input_file-1].line_start
  51.         = InputFiles[input_file-1].chars_read;
  52.     total_sl_count++;
  53. }
  54.  
  55. extern void declare_systemfile(void)
  56. {   InputFiles[input_file-1].sys_flag=1;
  57. }
  58.  
  59. extern int is_systemfile(void)
  60. {   return InputFiles[input_file-1].sys_flag;
  61. }
  62.  
  63.  
  64. extern void print_error_line(void)
  65. {   int i=override_error_line;
  66.     if (input_file>1) printf("\"%s\", ",InputFiles[input_file-1].filename);
  67.     if (i==0) i=forerrors_line;
  68.     else override_error_line=0;
  69.     printf("line %d: ",i);
  70. }
  71.  
  72. extern void fatalerror(char *s)
  73. {   print_error_line();
  74.     printf("Fatal error: %s\n",s);
  75. #ifdef ARC_THROWBACK
  76.     throwback(0, s);
  77.     throwback_end();
  78. #endif
  79.     exit(1);
  80. }
  81.  
  82. static void couldntopen(char *m, char *fn)
  83. {   char err_buffer[128];
  84.     sprintf(err_buffer, "%s \"%s\"", m, fn);
  85.     fatalerror(err_buffer);
  86. }
  87.  
  88. /* ------------------------------------------------------------------------- */
  89. /*  The memory manager                                                       */
  90. /* ------------------------------------------------------------------------- */
  91.  
  92. extern void memoryerror(char *s, int size)
  93. {   char fe_buff[128];
  94.     sprintf(fe_buff, "The memory setting %s (which is %d at present) has been \
  95. exceeded.  Try running Inform again with $%s=<some-larger-number> on the \
  96. command line.",s,size,s);
  97.     fatalerror(fe_buff);
  98. }
  99.  
  100. #ifdef PC_QUICKC
  101. extern char *my_malloc(int32 size, char *whatfor)
  102. {   char _huge *c;
  103.     if (memout_mode==1)
  104.         printf("Allocating %ld bytes for %s\n",size,whatfor);
  105.     c=(char _huge *)halloc(size,1); malloced_bytes+=size;
  106.     if (c==0) fatalerror("Couldn't hallocate memory");
  107.     return(c);
  108. }
  109. extern void *my_calloc(int32 size, int32 howmany, char *whatfor)
  110. {   void _huge *c;
  111.     if (memout_mode==1)
  112.         printf("Allocating %d bytes: array (%ld entries size %ld) for %s\n",
  113.             size*howmany,howmany,size,whatfor);
  114.     c=(void _huge *)halloc(howmany*size,1); malloced_bytes+=size*howmany;
  115.     if (c==0) fatalerror("Couldn't hallocate memory for an array");
  116.     return(c);
  117. }
  118. #else
  119. extern char *my_malloc(int32 size, char *whatfor)
  120. {   char *c;
  121.     if (memout_mode==1)
  122.         printf("Allocating %ld bytes for %s\n",(long int) size,whatfor);
  123.     c=malloc((size_t) size); malloced_bytes+=size;
  124.     if (c==0) fatalerror("Couldn't allocate memory");
  125.     return(c);
  126. }
  127. extern void *my_calloc(int32 size, int32 howmany, char *whatfor)
  128. {   void *c;
  129.     if (memout_mode==1)
  130.         printf("Allocating %ld bytes: array (%d entries size %d) for %s\n",
  131.             ((long int)size) * ((long int)howmany),howmany,size,whatfor);
  132.     c=calloc(howmany,(size_t) size); malloced_bytes+=size*howmany;
  133.     if (c==0) fatalerror("Couldn't allocate memory for an array");
  134.     return(c);
  135. }
  136. #endif
  137.  
  138. extern void my_free(void *pointer, char *whatitwas)
  139. {   if (memout_mode==1)
  140.         printf("Freeing memory for %s\n",whatitwas);
  141. #ifdef PC_QUICKC
  142.     hfree(pointer);
  143. #else
  144.     free(pointer);
  145. #endif
  146. }
  147.  
  148. /* ------------------------------------------------------------------------- */
  149. /*   Dealing with source code files                                          */
  150. /* ------------------------------------------------------------------------- */
  151.  
  152. #ifdef ARC_THROWBACK
  153. char throwback_name[128*MAX_INCLUSION_DEPTH];  
  154. #endif
  155.  
  156. extern void load_sourcefile(char *story_name)
  157. {   char name[128]; int i, flag=0;
  158.  
  159.     if (input_file==MAX_INCLUSION_DEPTH)
  160.     {   fatalerror("Too many files have included each other: \
  161. increase #define MAX_INCLUSION_DEPTH");
  162.     }
  163.     strcpy(InputFiles[input_file].filename,story_name);
  164.     InputFiles[input_file].sys_flag=0;
  165.     InputFiles[input_file].chars_read=0;
  166.     InputFiles[input_file].file_no=total_files_read+1;
  167.  
  168.     if (debugging_file==1)
  169.     {   write_debug_byte(1); write_debug_byte(total_files_read+1);
  170.         write_debug_string(story_name);
  171.     }
  172.  
  173.     for (i=0; story_name[i]!=0; i++)
  174.         if ((story_name[i]=='/') || (story_name[i]=='.')) flag=1;
  175.     if (flag==0)
  176.     {   if (input_file>0)
  177.           sprintf(name,"%s%s%s",
  178.             Include_Prefix,story_name,Include_Extension);
  179.         else
  180.           sprintf(name,"%s%s%s",
  181.             Source_Prefix,story_name,Source_Extension);
  182.     }
  183.     else
  184.         strcpy(name,story_name);
  185.  
  186.     if (debugging_file==1) write_debug_string(name);
  187.  
  188. #ifdef ARC_THROWBACK
  189.     strcpy(throwback_name+128*input_file, name);
  190. #endif
  191.  
  192.     InputFiles[input_file].handle = fopen(name,"r");
  193.     if (InputFiles[input_file].handle==NULL)
  194.     {   sprintf(sub_buffer, "Couldn't open input file \"%s\"",name);
  195.         fatalerror(sub_buffer);
  196.     }
  197.     InputFiles[input_file++].source_line = 1;
  198.     total_files_read++;
  199.  
  200.     if ((ltrace_mode!=0)||(trace_mode!=0))
  201.     {   printf("\nOpening file \"%s\"\n",name);
  202.     }
  203. }
  204.  
  205. static int32 chars_kept;
  206. static void write_cr(void)
  207. {   write_debug_address(chars_kept);
  208. }
  209.  
  210. static void close_sourcefile(void)
  211. {   int i;
  212.     if (ferror(InputFiles[input_file-1].handle))
  213.         fatalerror("I/O failure: couldn't read from source file");
  214.     if (debugging_file==1)
  215.     {   write_debug_byte(16);
  216.         write_debug_byte(InputFiles[input_file-1].file_no);
  217.         write_cr();
  218.         i=InputFiles[input_file-1].source_line;
  219.         write_debug_byte(i/256); write_debug_byte(i%256);
  220.     }
  221.     fclose(InputFiles[--input_file].handle);
  222.  
  223.     if ((ltrace_mode!=0)||(trace_mode!=0)) printf("\nClosing file\n");
  224.     if (input_file>=1)
  225.         InputFiles[input_file-1].source_line--;
  226. }
  227.  
  228. extern void close_all_source(void)
  229. {   while (input_file>0) close_sourcefile();
  230. }
  231.  
  232. static int32 last_char_marker= -1;
  233. static int last_char;
  234. extern int file_char(int32 marker)
  235. {   if (marker==last_char_marker) return(last_char);
  236.     last_char_marker=marker;
  237.     if (input_file==0) return(0);
  238.     last_char=fgetc(InputFiles[input_file-1].handle);
  239.     InputFiles[input_file-1].chars_read++;
  240.     if (last_char==EOF)
  241.     {   close_sourcefile();
  242.         if (input_file==0) last_char=0; else last_char='\n';
  243.     }
  244.     return(last_char);
  245. }
  246.  
  247. extern int file_end(int32 marker)
  248. {   int i;
  249.     i=file_char(marker);
  250.     if (i==0) return(1);
  251.     return(0);
  252. }
  253.  
  254. /* ------------------------------------------------------------------------- */
  255. /*  Outputting the final story file, with checksums worked out, from storage */
  256. /*  (and closing of the text transcript file, if present)                    */
  257. /* ------------------------------------------------------------------------- */
  258.  
  259. static int c_low=0, c_high=0;
  260. extern void add_to_checksum(void *address)
  261. {   unsigned char *p;
  262.     p=(unsigned char *) address;
  263.     c_low+=((int) *p);
  264.     if (c_low>=256)
  265.     {   c_low-=256;
  266.         if (++c_high==256) c_high=0;
  267.     }
  268. }
  269.  
  270. extern void output_file(void)
  271. {   FILE *fout; char *actual_name; int i;
  272. #ifdef ARC_THROWBACK
  273.     char *newname;
  274. #endif
  275. #ifdef US_POINTERS
  276.     unsigned char *t;
  277. #else
  278.     char *t;
  279. #endif
  280.     char *t2;
  281.     int32 length, blanks=0, size=0;
  282.  
  283.     if (process_filename_flag==0)
  284.     {   
  285. #ifdef ARC_THROWBACK
  286.         newname=Code_Name;
  287.         for (i=0; Code_Name[i]!=0; i++)
  288.             if ((Code_Name[i]=='.'))
  289.                 newname=Code_Name+i+1;
  290.         if (version_number==3)
  291.             sprintf(sub_buffer,"%s%s%s",
  292.                       Code_Prefix,newname,Code_Extension);
  293.         else
  294.             sprintf(sub_buffer,"%s%s%s",
  295.                       V5Code_Prefix,newname,V5Code_Extension);
  296. #else
  297.         if (version_number==3)
  298.             sprintf(sub_buffer,"%s%s%s",
  299.                       Code_Prefix,Code_Name,Code_Extension);
  300.         else
  301.             sprintf(sub_buffer,"%s%s%s",
  302.                       V5Code_Prefix,Code_Name,V5Code_Extension);
  303. #endif
  304.         actual_name=sub_buffer;
  305.     }
  306.     else actual_name=Code_Name;
  307.  
  308.     fout=fopen(actual_name,"wb");
  309.     if (fout==NULL) couldntopen("Couldn't open output file",actual_name);
  310.  
  311. #ifndef USE_TEMPORARY_FILES
  312.     for (t=zcode; t<zcode_p; t++)
  313.         add_to_checksum((void *) t);
  314.     for (t=strings; t<strings_p; t++)
  315.         add_to_checksum((void *) t);
  316. #endif
  317.  
  318.     for (t=output_p+0x0040; t<output_p+Write_Code_At; t++)
  319.         add_to_checksum((void *) t);
  320.  
  321.     length=((int32) Write_Strings_At)+ subtract_pointers(strings_p,strings);
  322.     while ((length%scale_factor)!=0) { length++; blanks++; }
  323.     length=length/scale_factor;
  324.     output_p[26]=(length & 0xff00)/0x100;
  325.     output_p[27]=(length & 0xff);
  326.  
  327.     while (((scale_factor*length)+blanks-1)%512 != 511) blanks++;
  328.  
  329.     output_p[28]=c_high;
  330.     output_p[29]=c_low;
  331.  
  332.     if (debugging_file==1)
  333.     {   debug_pass=2; write_debug_byte(9);
  334.         for (i=0; i<64; i++) write_debug_byte((int) (output_p[i]));
  335.         debug_pass=1;
  336.     }
  337.  
  338.     for (t=output_p; t<output_p+Write_Code_At; t++) { fputc(*t,fout); size++; }
  339.  
  340. #ifdef USE_TEMPORARY_FILES
  341.     {   FILE *fin;
  342.         fclose(Temp2_fp);
  343.         fin=fopen(Temp2_Name,"rb");
  344.         if (fin==NULL)
  345.             fatalerror("I/O failure: couldn't reopen temporary file 2");
  346.         for (t=zcode; t<zcode_p; t++) { fputc(fgetc(fin),fout); size++; }
  347.         if (ferror(fin))
  348.             fatalerror("I/O failure: couldn't read from temporary file 2");
  349.         fclose(fin);
  350.     }
  351. #else
  352.     for (t=zcode; t<zcode_p; t++) { fputc(*t,fout); size++; }
  353. #endif  
  354.     while (size<Write_Strings_At) { fputc(0,fout); size++; }
  355.  
  356. #ifdef USE_TEMPORARY_FILES
  357.     {   FILE *fin;
  358.         fclose(Temp1_fp);
  359.         fin=fopen(Temp1_Name,"rb");
  360.         if (fin==NULL)
  361.             fatalerror("I/O failure: couldn't reopen temporary file 1");
  362.         for (t=strings; t<strings_p; t++) { fputc(fgetc(fin),fout); }
  363.         if (ferror(fin))
  364.             fatalerror("I/O failure: couldn't read from temporary file 1");
  365.         fclose(fin);
  366.         remove(Temp1_Name); remove(Temp2_Name);
  367.     }
  368. #else
  369.     for (t=strings; t<strings_p; t++) { fputc(*t,fout); }
  370. #endif  
  371.     while (blanks>0) { fputc(0,fout); blanks--; }
  372.  
  373.     if (ferror(fout))
  374.         fatalerror("I/O failure: couldn't write to story file");
  375.     fclose(fout);
  376.     if (statistics_mode==2) 
  377.         printf("%d bytes written to '%s'\n",length,actual_name);
  378. #ifdef ARCHIMEDES
  379.     if (actual_version == 3)
  380.         sprintf(buffer,"settype %s 063",actual_name);
  381.     if (actual_version == 4)
  382.         sprintf(buffer,"settype %s 064",actual_name);
  383.     if (actual_version == 5)
  384.         sprintf(buffer,"settype %s 065",actual_name);
  385.     if (actual_version == 6)
  386.         sprintf(buffer,"settype %s 066",actual_name);
  387.     system(buffer);
  388. #endif
  389.  
  390.     if (transcript_mode==1)
  391.     {
  392.         fout=fopen(Transcript_Name,"wb");
  393.         if (fout==NULL) couldntopen("Couldn't open transcript file",
  394.             Transcript_Name);
  395.         for (t2=all_text; t2<all_text_p; t2++) { fputc(*t2,fout); }
  396.         if (ferror(fout))
  397.             fatalerror("I/O failure: couldn't write to transcript file");
  398.         fclose(fout);
  399. #ifdef ARCHIMEDES
  400.         sprintf(buffer,"settype %s text",Transcript_Name);
  401.         system(buffer);
  402. #endif
  403.     }
  404. }
  405.  
  406. /* ------------------------------------------------------------------------- */
  407. /*  Access to the debugging information file                                 */
  408. /* ------------------------------------------------------------------------- */
  409.  
  410. static FILE *Debug_fp;
  411. int debug_pass = 1;
  412.  
  413. extern void open_debug_file(void)
  414. {
  415.     Debug_fp=fopen(Debugging_Name,"wb");
  416.     if (Debug_fp==NULL)
  417.         couldntopen("Couldn't open debugging information file",
  418.         Debugging_Name);
  419. }
  420.  
  421. extern void write_debug_byte(int i)
  422. {   if (pass_number!=debug_pass) return;
  423.     fputc(i,Debug_fp);
  424.     if (ferror(Debug_fp))
  425.         fatalerror("I/O failure: can't write to debugging info file");
  426. }
  427.  
  428. extern void write_debug_string(char *s)
  429. {   int i;
  430.     for (i=0; s[i]!=0; i++)
  431.         write_debug_byte((int) s[i]);
  432.     write_debug_byte(0);
  433. }
  434.  
  435. typedef struct dbgl_s
  436. {   int b1, b2, b3;
  437. } dbgl;
  438.  
  439. static dbgl b_l, c_l, d_l, e_l;
  440.  
  441. extern void make_debug_linenum(void)
  442. {   int i;
  443.     b_l.b1 = InputFiles[input_file-1].file_no;
  444.     i = forerrors_line;
  445.     if ((b_l.b2!=i/256) || (b_l.b3!=i%256)) line_done_flag=0;
  446.     b_l.b2 = i/256; b_l.b3 = i%256;
  447. }
  448.  
  449. extern void keep_debug_linenum(void)
  450. {   int i;
  451.     c_l.b1 = InputFiles[input_file-1].file_no;
  452.     i = forerrors_line;
  453.     c_l.b2 = i/256; c_l.b3 = i%256;
  454. }
  455.  
  456. extern void keep_routine_linenum(void)
  457. {   int i;
  458.     d_l.b1 = InputFiles[input_file-1].file_no;
  459.     i = InputFiles[input_file-1].source_line;
  460.     d_l.b2 = i/256; d_l.b3 = i%256;
  461. }
  462.  
  463. extern void keep_re_linenum(void)
  464. {   int i;
  465.     e_l.b1 = InputFiles[input_file-1].file_no;
  466.     i = InputFiles[input_file-1].source_line;
  467.     e_l.b2 = i/256; e_l.b3 = i%256;
  468. }
  469.  
  470. extern void write_dbgl(dbgl x)
  471. {   write_debug_byte(x.b1); write_debug_byte(x.b2); write_debug_byte(x.b3);
  472. }
  473.  
  474. extern void write_debug_linenum(void)   { write_dbgl(b_l); }
  475. extern void write_kept_linenum(void)    { write_dbgl(c_l); }
  476. extern void write_routine_linenum(void) { write_dbgl(d_l); }
  477. extern void write_re_linenum(void)      { write_dbgl(e_l); }
  478.  
  479. extern void write_debug_address(int32 i)
  480. {   write_debug_byte((i/256)/256);
  481.     write_debug_byte((i/256)%256);
  482.     write_debug_byte(i%256);
  483. }
  484.  
  485. extern void keep_chars_read(void)
  486. {   chars_kept = InputFiles[input_file-1].line_start;
  487. }
  488.  
  489. extern void write_present_linenum(void)
  490. {   int i;
  491.     write_debug_byte(InputFiles[input_file-1].file_no);
  492.     i = InputFiles[input_file-1].source_line;
  493.     write_debug_byte(i/256); write_debug_byte(i%256);
  494. }
  495.  
  496. extern void write_chars_read(void)
  497. {   write_present_linenum();
  498.     write_debug_address(InputFiles[input_file-1].line_start);
  499. }
  500.  
  501. extern void close_debug_file(void)
  502. {   fputc(0,Debug_fp);
  503.     if (ferror(Debug_fp))
  504.         fatalerror("I/O failure: can't write to debugging info file");
  505.     fclose(Debug_fp);
  506. }
  507.  
  508. /* ------------------------------------------------------------------------- */
  509. /*  Temporary storage files                                                  */
  510. /* ------------------------------------------------------------------------- */
  511.  
  512. #ifdef USE_TEMPORARY_FILES
  513. extern void open_temporary_files(void)
  514. {
  515. #ifdef UNIX
  516.     sprintf(Temp1_Name, "%s.proc%d",Temp1_Hdr,(int)getpid());
  517.     sprintf(Temp2_Name, "%s.proc%d",Temp2_Hdr,(int)getpid());
  518. #endif
  519. #ifdef ATARIST
  520. #ifdef TOSFS
  521.     sprintf(Temp1_Name, "%s.proc%d",Temp1_Hdr,(int)getpid());
  522.     sprintf(Temp2_Name, "%s.proc%d",Temp2_Hdr,(int)getpid());
  523. #endif
  524. #endif
  525. #ifdef AMIGA
  526.     sprintf(Temp1_Name, "%s.proc%08x",Temp1_Hdr,(int)FindTask(NULL));
  527.     sprintf(Temp2_Name, "%s.proc%08x",Temp2_Hdr,(int)FindTask(NULL));
  528. #endif
  529.     Temp1_fp=fopen(Temp1_Name,"wb");
  530.     if (Temp1_fp==NULL) couldntopen("Couldn't open temporary file 1",
  531.         Temp1_Name);
  532.     Temp2_fp=fopen(Temp2_Name,"wb");
  533.     if (Temp2_fp==NULL) couldntopen("Couldn't open temporary file 2",
  534.         Temp2_Name);
  535. }
  536.  
  537. extern void check_temp_files(void)
  538. {
  539.     if (ferror(Temp1_fp))
  540.         fatalerror("I/O failure: couldn't write to temporary file 1");
  541.     if (ferror(Temp2_fp))
  542.         fatalerror("I/O failure: couldn't write to temporary file 2");
  543. }
  544.  
  545. extern void remove_temp_files(void)
  546. {   fclose(Temp1_fp); fclose(Temp2_fp);
  547.     remove(Temp1_Name); remove(Temp2_Name);
  548. }
  549. #endif
  550.  
  551. /* ------------------------------------------------------------------------- */
  552. /*   Code for the Acorn Archimedes (only) contributed by Robin Watts, to     */
  553. /*   provide error throwback under the DDE environment                       */
  554. /* ------------------------------------------------------------------------- */
  555.  
  556. #ifdef ARC_THROWBACK
  557.  
  558. #define DDEUtils_ThrowbackStart 0x42587
  559. #define DDEUtils_ThrowbackSend  0x42588
  560. #define DDEUtils_ThrowbackEnd   0x42589
  561.  
  562. #include "kernel.h"
  563.  
  564. int throwbackflag;
  565.  
  566. void throwback_start(void)
  567. {    _kernel_swi_regs regs;
  568.      if (throwbackflag==1)
  569.          _kernel_swi(DDEUtils_ThrowbackStart, ®s, ®s);
  570. }
  571.  
  572. void throwback_end(void)
  573. {   _kernel_swi_regs regs;
  574.     if (throwbackflag==1)
  575.         _kernel_swi(DDEUtils_ThrowbackEnd, ®s, ®s);
  576. }
  577.  
  578. int throwback_started=0;
  579.  
  580. void throwback(int severity, char * error)
  581. {   _kernel_swi_regs regs;
  582.     if (throwback_started==0)
  583.     {   throwback_started=1;
  584.         throwback_start();
  585.     }
  586.     if (throwbackflag==1)
  587.     {   regs.r[0] = 1;
  588.         regs.r[2] = (int) throwback_name+(input_file-1)*128;
  589.         regs.r[3] = forerrors_line;
  590.         regs.r[4] = (2-severity);
  591.         regs.r[5] = (int) error;
  592.        _kernel_swi(DDEUtils_ThrowbackSend, ®s, ®s);
  593.     }
  594. }
  595.  
  596. #endif
  597.  
  598. /* ------------------------------------------------------------------------- */
  599. /*   Where the memory settings are declared as variables                     */
  600. /* ------------------------------------------------------------------------- */
  601.  
  602. int BUFFER_LENGTH;
  603. int MAX_QTEXT_SIZE;
  604. int MAX_SYMBOLS;
  605. int MAX_BANK_SIZE;
  606. int SYMBOLS_CHUNK_SIZE;
  607. int BANK_CHUNK_SIZE;
  608. int HASH_TAB_SIZE;
  609. int MAX_OBJECTS;
  610. int MAX_ACTIONS;
  611. int MAX_ADJECTIVES;
  612. int MAX_DICT_ENTRIES;
  613. int MAX_STATIC_DATA;
  614. int MAX_TOKENS;
  615. int MAX_OLDEPTH;
  616. int MAX_ROUTINES;
  617. int MAX_GCONSTANTS;
  618. int MAX_PROP_TABLE_SIZE;
  619. int MAX_FORWARD_REFS;
  620. int STACK_SIZE;
  621. int STACK_LONG_SLOTS;
  622. int STACK_SHORT_LENGTH;
  623. int MAX_ABBREVS;
  624. int MAX_EXPRESSION_NODES;
  625. int MAX_VERBS;
  626. int32 MAX_STATIC_STRINGS;
  627. int32 MAX_ZCODE_SIZE;
  628. int MAX_LOW_STRINGS;
  629. int32 MAX_TRANSCRIPT_SIZE;
  630. int MAX_CLASSES;
  631. int MAX_CLASS_TABLE_SIZE;
  632.  
  633. /* ------------------------------------------------------------------------- */
  634. /*   Memory control from the command line                                    */
  635. /* ------------------------------------------------------------------------- */
  636.  
  637. static void list_memory_sizes(void)
  638. {   printf("\n  Current memory settings:\n");
  639.     printf("  ===============================\n");
  640.     printf("  %20s = %d\n","BUFFER_LENGTH",BUFFER_LENGTH);
  641.     printf("  %20s = %d\n","MAX_QTEXT_SIZE",MAX_QTEXT_SIZE);
  642.     printf("  %20s = %d\n","MAX_SYMBOLS",MAX_SYMBOLS);
  643.     printf("  %20s = %d\n","MAX_BANK_SIZE",MAX_BANK_SIZE);
  644.     printf("  %20s = %d\n","SYMBOLS_CHUNK_SIZE",SYMBOLS_CHUNK_SIZE);
  645.     printf("  %20s = %d\n","BANK_CHUNK_SIZE",BANK_CHUNK_SIZE);
  646.     printf("  %20s = %d\n","HASH_TAB_SIZE",HASH_TAB_SIZE);
  647.     printf("  %20s = %d\n","MAX_OBJECTS",MAX_OBJECTS);
  648.     printf("  %20s = %d\n","MAX_ACTIONS",MAX_ACTIONS);
  649.     printf("  %20s = %d\n","MAX_ADJECTIVES",MAX_ADJECTIVES);
  650.     printf("  %20s = %d\n","MAX_DICT_ENTRIES",MAX_DICT_ENTRIES);
  651.     printf("  %20s = %d\n","MAX_STATIC_DATA",MAX_STATIC_DATA);
  652.     printf("  %20s = %d\n","MAX_TOKENS",MAX_TOKENS);
  653.     printf("  %20s = %d\n","MAX_OLDEPTH",MAX_OLDEPTH);
  654.     printf("  %20s = %d\n","MAX_ROUTINES",MAX_ROUTINES);
  655.     printf("  %20s = %d\n","MAX_GCONSTANTS",MAX_GCONSTANTS);
  656.     printf("  %20s = %d\n","MAX_PROP_TABLE_SIZE",MAX_PROP_TABLE_SIZE);
  657.     printf("  %20s = %d\n","MAX_FORWARD_REFS",MAX_FORWARD_REFS);
  658.     printf("  %20s = %d\n","STACK_SIZE",STACK_SIZE);
  659.     printf("  %20s = %d\n","STACK_LONG_SLOTS",STACK_LONG_SLOTS);
  660.     printf("  %20s = %d\n","STACK_SHORT_LENGTH",STACK_SHORT_LENGTH);
  661.     printf("  %20s = %d\n","MAX_ABBREVS",MAX_ABBREVS);
  662.     printf("  %20s = %d\n","MAX_EXPRESSION_NODES",MAX_EXPRESSION_NODES);
  663.     printf("  %20s = %d\n","MAX_VERBS",MAX_VERBS);
  664.     printf("  %20s = %ld\n","MAX_STATIC_STRINGS",
  665.            (long int) MAX_STATIC_STRINGS);
  666.     printf("  %20s = %ld\n","MAX_ZCODE_SIZE",
  667.            (long int) MAX_ZCODE_SIZE);
  668.     printf("  %20s = %d\n","MAX_LOW_STRINGS",MAX_LOW_STRINGS);
  669.     printf("  %20s = %ld\n","MAX_TRANSCRIPT_SIZE",
  670.            (long int) MAX_TRANSCRIPT_SIZE);
  671.     printf("  %20s = %d\n","MAX_CLASSES",MAX_CLASSES);
  672.     printf("  %20s = %d\n","MAX_CLASS_TABLE_SIZE",MAX_CLASS_TABLE_SIZE);
  673.     printf("  ===============================\n");
  674. }
  675.  
  676. extern void set_memory_sizes(int size_flag)
  677. {
  678.     if (size_flag == LARGE_SIZE)
  679.     {
  680.         BUFFER_LENGTH   = 2000;
  681.         MAX_QTEXT_SIZE  = 1995;
  682.         MAX_SYMBOLS     = 6400;
  683.  
  684.         MAX_BANK_SIZE      = 3200;
  685.         SYMBOLS_CHUNK_SIZE = 5000;
  686.         BANK_CHUNK_SIZE    = 512;
  687.         HASH_TAB_SIZE      = 512;
  688.  
  689.         MAX_OBJECTS = 512;
  690.  
  691.         MAX_ACTIONS      = 150;
  692.         MAX_ADJECTIVES   = 50;
  693.         MAX_DICT_ENTRIES = 1300;
  694.         MAX_STATIC_DATA  = 4000;
  695.  
  696.         MAX_TOKENS = 128;
  697.         MAX_OLDEPTH = 8;
  698.         MAX_ROUTINES = 500;
  699.         MAX_GCONSTANTS = 50;
  700.  
  701.         MAX_PROP_TABLE_SIZE = 15000;
  702.  
  703.         MAX_FORWARD_REFS = 2048;
  704.  
  705.         STACK_SIZE = 64;
  706.         STACK_LONG_SLOTS = 5;
  707.         STACK_SHORT_LENGTH = 80;
  708.  
  709.         MAX_ABBREVS = 64;
  710.  
  711.         MAX_EXPRESSION_NODES = 40;
  712.         MAX_VERBS = 140;
  713.  
  714. #ifdef USE_TEMPORARY_FILES
  715.         MAX_STATIC_STRINGS = 2000;
  716.         MAX_ZCODE_SIZE = 2000;
  717. #else
  718.         MAX_STATIC_STRINGS = 150000;
  719.         MAX_ZCODE_SIZE = 150000;
  720. #endif
  721.  
  722.         MAX_LOW_STRINGS = 2048;
  723.  
  724.         MAX_TRANSCRIPT_SIZE = 200000;
  725.  
  726.         MAX_CLASSES = 32;
  727.         MAX_CLASS_TABLE_SIZE = 1000;
  728.     }
  729.     else if (size_flag == SMALL_SIZE)
  730.     {
  731.         BUFFER_LENGTH   = 2000;
  732.         MAX_QTEXT_SIZE  = 1995;
  733.         MAX_SYMBOLS     = 3000;
  734.  
  735.         MAX_BANK_SIZE      = 1000;
  736.         SYMBOLS_CHUNK_SIZE = 2500;
  737.         BANK_CHUNK_SIZE    = 512;
  738.         HASH_TAB_SIZE      = 512;
  739.  
  740.         MAX_OBJECTS = 300;
  741.  
  742.         MAX_ACTIONS      = 150;
  743.         MAX_ADJECTIVES   = 50;
  744.         MAX_DICT_ENTRIES = 700;
  745.         MAX_STATIC_DATA  = 2000;
  746.  
  747.         MAX_TOKENS = 100;
  748.         MAX_OLDEPTH = 8;
  749.         MAX_ROUTINES = 400;
  750.         MAX_GCONSTANTS = 50;
  751.  
  752.         MAX_PROP_TABLE_SIZE = 8000;
  753.  
  754.         MAX_FORWARD_REFS = 2048;
  755.  
  756.         STACK_SIZE = 64;
  757.         STACK_LONG_SLOTS = 5;
  758.         STACK_SHORT_LENGTH = 80;
  759.  
  760.         MAX_ABBREVS = 64;
  761.  
  762.         MAX_EXPRESSION_NODES = 40;
  763.         MAX_VERBS = 110;
  764.  
  765. #ifdef USE_TEMPORARY_FILES
  766.         MAX_STATIC_STRINGS = 1000;
  767.         MAX_ZCODE_SIZE = 1000;
  768. #else
  769.         MAX_STATIC_STRINGS = 50000;
  770.         MAX_ZCODE_SIZE = 100000;
  771. #endif
  772.  
  773.         MAX_LOW_STRINGS = 1024;
  774.  
  775.         MAX_TRANSCRIPT_SIZE = 100000;
  776.  
  777.         MAX_CLASSES = 32;
  778.         MAX_CLASS_TABLE_SIZE = 800;
  779.     }
  780. }
  781.  
  782. static void explain_parameter(char *command)
  783. {   printf("\n");
  784.     if (strcmp(command,"BUFFER_LENGTH")==0)
  785.     {   printf(
  786. "  BUFFER_LENGTH is the maximum length of a line of source code (when white\n\
  787.   space has been removed).  It costs %d bytes to increase it by one.\n",
  788.         5+STACK_LONG_SLOTS);
  789.         return;
  790.     }
  791.     if (strcmp(command,"MAX_QTEXT_SIZE")==0)
  792.     {   printf(
  793. "  MAX_QTEXT_SIZE is the maximum length of a quoted string.  It must not \n\
  794.   exceed BUFFER_LENGTH minus 5.\n");
  795.         return;
  796.     }
  797.     if (strcmp(command,"MAX_SYMBOLS")==0)
  798.     {   printf(
  799. "  MAX_SYMBOLS is the maximum number of symbols - names of variables, \n\
  800.   objects, routines, the many internal Inform-generated names and so on.\n");
  801.         return;
  802.     }
  803.     if (strcmp(command,"MAX_BANK_SIZE")==0)
  804.     {   printf(
  805. "  MAX_BANK_SIZE is the maximum number of symbols in each of the seven \n\
  806.   \"banks\".\n");
  807.         return;
  808.     }
  809.     if (strcmp(command,"SYMBOLS_CHUNK_SIZE")==0)
  810.     {   printf(
  811. "  The symbols names are stored in memory which is allocated in chunks \n\
  812.   of size SYMBOLS_CHUNK_SIZE.\n");
  813.         return;
  814.     }
  815.     if (strcmp(command,"BANK_CHUNK_SIZE")==0)
  816.     {   printf(
  817. "  The symbol banks are stored in memory which is allocated in chunks of \n\
  818.   size BANK_CHUNK_SIZE.\n");
  819.         return;
  820.     }
  821.     if (strcmp(command,"HASH_TAB_SIZE")==0)
  822.     {   printf(
  823. "  HASH_TAB_SIZE is the size of the hash tables used for the heaviest \n\
  824.   symbols banks.\n");
  825.         return;
  826.     }
  827.     if (strcmp(command,"MAX_OBJECTS")==0)
  828.     {   printf(
  829. "  MAX_OBJECTS is the maximum number of objects.  (If compiling a version-3 \n\
  830.   game, 255 is an absolute maximum in any event.)\n");
  831.         return;
  832.     }
  833.     if (strcmp(command,"MAX_ACTIONS")==0)
  834.     {   printf(
  835. "  MAX_ACTIONS is the maximum number of actions - that is, routines such as \n\
  836.   TakeSub which are referenced in the grammar table.\n");
  837.         return;
  838.     }
  839.     if (strcmp(command,"MAX_ADJECTIVES")==0)
  840.     {   printf(
  841. "  MAX_ADJECTIVES is the maximum number of different \"adjectives\" in the \n\
  842.   grammar table.  Adjectives are misleadingly named: they are words such as \n\
  843.   \"in\", \"under\" and the like.\n");
  844.         return;
  845.     }
  846.     if (strcmp(command,"MAX_DICT_ENTRIES")==0)
  847.     {   printf(
  848. "  MAX_DICT_ENTRIES is the maximum number of words which can be entered \n\
  849.   into the game's dictionary.  It costs 29 bytes to increase this by one.\n");
  850.         return;
  851.     }
  852.     if (strcmp(command,"MAX_STATIC_DATA")==0)
  853.     {   printf(
  854. "  MAX_STATIC_DATA is the size of an array of integers holding initial \n\
  855.   values for arrays and strings stored as ASCII inside the Z-machine.  It \n\
  856.   should be at least 1024 but seldom needs much more.\n");
  857.         return;
  858.     }
  859.     if (strcmp(command,"MAX_TOKENS")==0)
  860.     {   printf(
  861. "  The maximum number of tokens (words, strings, separators like an equals \n\
  862.   sign) per line of source code is MAX_TOKENS: it is not expensive to \n\
  863.   increase.\n");
  864.         return;
  865.     }
  866.     if (strcmp(command,"MAX_OLDEPTH")==0)
  867.     {   printf(
  868. "  MAX_OLDEPTH is the maximum depth of objectloop nesting: it only costs \n\
  869.   about 40 bytes to increase it by one.\n");
  870.         return;
  871.     }
  872.     if (strcmp(command,"MAX_ROUTINES")==0)
  873.     {   printf(
  874. "  MAX_ROUTINES is the maximum number of routines of code, including \n\
  875.   routines embedded in object definitions.  Cheap to increase.\n");
  876.         return;
  877.     }
  878.     if (strcmp(command,"MAX_GCONSTANTS")==0)
  879.     {   printf(
  880. "  MAX_GCONSTANTS is too complicated to explain here, but cheap and rare.\n");
  881.         return;
  882.     }
  883.     if (strcmp(command,"MAX_PROP_TABLE_SIZE")==0)
  884.     {   printf(
  885. "  MAX_PROP_TABLE_SIZE is the number of bytes allocated to hold the \n\
  886.   properties table.\n");
  887.         return;
  888.     }
  889.     if (strcmp(command,"MAX_FORWARD_REFS")==0)
  890.     {   printf(
  891. "  MAX_FORWARD_REFS is the maximum number of forward references to constants \n\
  892.   not yet defined in source code.  It costs 4 bytes to increase by one.\n");
  893.         return;
  894.     }
  895.     if ((strcmp(command,"STACK_SIZE")==0)
  896.         || (strcmp(command,"STACK_LONG_SLOTS")==0)
  897.         || (strcmp(command,"STACK_SHORT_LENGTH")==0))
  898.     {   printf(
  899. "  The Inform preprocessor maintains a stack of modified lines and assembly \n\
  900.   code to be processed in due course.  The maximum size is STACK_SIZE \n\
  901.   awaiting processing and needs to be at least 32 or so, but ideally more \n\
  902.   like 64.  The stack can contain at most STACK_LONG_SLOTS entries which \n\
  903.   are longer than STACK_SHORT_LENGTH characters.\n\n");
  904.         printf(
  905. "  Total memory consumption for the preprocessor stack in bytes is\n\n\
  906.     STACK_SIZE * STACK_SHORT_LENGTH + STACK_LONG_SLOTS * BUFFER_LENGTH\n\n\
  907.   and currently amounts to %d bytes.\n",
  908.   STACK_SIZE * STACK_SHORT_LENGTH + STACK_LONG_SLOTS * BUFFER_LENGTH); 
  909.         return;
  910.     }
  911.     if (strcmp(command,"MAX_ABBREVS")==0)
  912.     {   printf(
  913. "  MAX_ABBREVS is the maximum number of declared abbreviations.  It is not \n\
  914.   allowed to exceed 64.\n");
  915.         return;
  916.     }
  917.     if (strcmp(command,"MAX_EXPRESSION_NODES")==0)
  918.     {   printf(
  919. "  MAX_EXPRESSION_NODES is the maximum number of nodes in the expression \n\
  920.   evaluator's tree.  In effect, it measures how complicated algebraic \n\
  921.   expressions are allowed to be.  Increasing it by one costs about 48 \n\
  922.   bytes.\n");
  923.         return;
  924.     }
  925.     if (strcmp(command,"MAX_VERBS")==0)
  926.     {   printf(
  927. "  MAX_VERBS is the maximum number of verbs (such as \"take\") which can be \n\
  928.   defined, each with its own grammar.  To increase it by one costs about\n\
  929.   128 bytes.  A full game will contain at least 100.\n");
  930.         return;
  931.     }
  932.     if (strcmp(command,"MAX_STATIC_STRINGS")==0)
  933.     {
  934. #ifdef USE_TEMPORARY_FILES
  935.         printf(
  936. "  MAX_STATIC_STRINGS is the size in bytes of a buffer to hold compiled\n\
  937.   strings before they're written into a temporary file.  2000 bytes is \n\
  938.   plenty.");
  939. #else
  940.         printf(
  941. "  MAX_STATIC_STRINGS is the size in bytes of a buffer to hold all the \n\
  942.   strings so far compiled.  It needs to be fairly large, typically half to \n\
  943.   three-quarters the size of the final output game.  Recompiling Inform \n\
  944.   with #define USE_TEMPORARY_FILES set will reduce this to only 2000 or \n\
  945.   so by using the filing system to hold caches of strings and code.");
  946. #endif
  947.         return;
  948.  
  949.     }
  950.     if (strcmp(command,"MAX_ZCODE_SIZE")==0)
  951.     {   
  952. #ifdef USE_TEMPORARY_FILES
  953.         printf(
  954. "  MAX_ZCODE_SIZE is the size in bytes of a buffer to hold compiled \n\
  955.   Z-machine code before it's written into a temporary file.  2000 bytes \n\
  956.   is plenty.");
  957. #else
  958.         printf(
  959. "  MAX_ZCODE_SIZE is the size in bytes of a buffer to hold all the \n\
  960.   Z-machine code so far compiled.  It needs to be fairly large, typically \n\
  961.   a quarter to a half of the size of the final output game.  Recompiling \n\
  962.   Inform with #define USE_TEMPORARY_FILES set will reduce this to only 2000 \n\
  963.   or so by using the filing system to hold caches of strings and code.");
  964. #endif
  965.         return;
  966.     }
  967.     if (strcmp(command,"MAX_LOW_STRINGS")==0)
  968.     {   printf(
  969. "  MAX_LOW_STRINGS is the size in bytes of a buffer to hold all the \n\
  970.   compiled \"low strings\" which are to be written above the synonyms table \n\
  971.   in the Z-machine.  1024 is plenty.\n");
  972.         return;
  973.     }
  974.     if (strcmp(command,"MAX_TRANSCRIPT_SIZE")==0)
  975.     {   printf(
  976. "  MAX_TRANSCRIPT_SIZE is only allocated if expressly requested, and would\n\
  977.   the size in bytes of a buffer to hold the entire text of the game being\n\
  978.   compiled: it therefore has to be enormous, say 100000 to 200000.\n");
  979.         return;
  980.     }
  981.     if (strcmp(command,"MAX_CLASSES")==0)
  982.     {   printf(
  983. "  MAX_CLASSES maximum number of object classes which can be defined.  This\n\
  984.   is cheap to increase.\n");
  985.         return;
  986.     }
  987.     if (strcmp(command,"MAX_CLASS_TABLE_SIZE")==0)
  988.     {   printf(
  989. "  MAX_CLASS_TABLE_SIZE is the number of bytes allocated to hold the table \n\
  990.   of properties to inherit from each class.\n");
  991.         return;
  992.     }
  993.  
  994.     printf("No such memory setting as \"%s\"\n",command);
  995.  
  996.     return;
  997. }
  998.  
  999. extern void memory_command(char *command)
  1000. {   int i, k, flag=0; int32 j;
  1001.  
  1002.     for (k=0; command[k]!=0; k++)
  1003.         if (islower(command[k])) command[k]=toupper(command[k]);
  1004.  
  1005.     if (command[0]=='?') { explain_parameter(command+1); return; }
  1006.  
  1007.     if (strcmp(command, "LARGE")==0) { set_memory_sizes(LARGE_SIZE); return; }
  1008.     if (strcmp(command, "SMALL")==0) { set_memory_sizes(SMALL_SIZE); return; }
  1009.     if (strcmp(command, "LIST")==0)  { list_memory_sizes(); return; }
  1010.     for (i=0; command[i]!=0; i++)
  1011.     {   if (command[i]=='=')
  1012.         {   command[i]=0;
  1013. #ifdef ARCHIMEDES
  1014.             if (strcmp(command, "TEMP_FILES")==0)
  1015.             {   strcpy(tname_pre, command+i+1);
  1016.                 return;
  1017.             }
  1018. #endif
  1019.             j=(int32) atoi(command+i+1);
  1020.             if ((j==0) && (command[i+1]!='0'))
  1021.             {   printf("Bad numerical setting in $ command \"%s=%s\"\n",
  1022.                     command,command+i+1);
  1023.                 return;
  1024.             }
  1025.             if (strcmp(command,"BUFFER_LENGTH")==0)
  1026.                 BUFFER_LENGTH=j, flag=1;
  1027.             if (strcmp(command,"MAX_QTEXT_SIZE")==0)
  1028.                 MAX_QTEXT_SIZE=j, flag=1;
  1029.             if (strcmp(command,"MAX_SYMBOLS")==0)
  1030.                 MAX_SYMBOLS=j, flag=1;
  1031.             if (strcmp(command,"MAX_BANK_SIZE")==0)
  1032.                 MAX_BANK_SIZE=j, flag=1;
  1033.             if (strcmp(command,"SYMBOLS_CHUNK_SIZE")==0)
  1034.                 SYMBOLS_CHUNK_SIZE=j, flag=1;
  1035.             if (strcmp(command,"BANK_CHUNK_SIZE")==0)
  1036.                 BANK_CHUNK_SIZE=j, flag=1;
  1037.             if (strcmp(command,"HASH_TAB_SIZE")==0)
  1038.                 HASH_TAB_SIZE=j, flag=1;
  1039.             if (strcmp(command,"MAX_OBJECTS")==0)
  1040.                 MAX_OBJECTS=j, flag=1;
  1041.             if (strcmp(command,"MAX_ACTIONS")==0)
  1042.                 MAX_ACTIONS=j, flag=1;
  1043.             if (strcmp(command,"MAX_ADJECTIVES")==0)
  1044.                 MAX_ADJECTIVES=j, flag=1;
  1045.             if (strcmp(command,"MAX_DICT_ENTRIES")==0)
  1046.                 MAX_DICT_ENTRIES=j, flag=1;
  1047.             if (strcmp(command,"MAX_STATIC_DATA")==0)
  1048.                 MAX_STATIC_DATA=j, flag=1;
  1049.             if (strcmp(command,"MAX_TOKENS")==0)
  1050.                 MAX_TOKENS=j, flag=1;
  1051.             if (strcmp(command,"MAX_OLDEPTH")==0)
  1052.                 MAX_OLDEPTH=j, flag=1;
  1053.             if (strcmp(command,"MAX_ROUTINES")==0)
  1054.                 MAX_ROUTINES=j, flag=1;
  1055.             if (strcmp(command,"MAX_GCONSTANTS")==0)
  1056.                 MAX_GCONSTANTS=j, flag=1;
  1057.             if (strcmp(command,"MAX_PROP_TABLE_SIZE")==0)
  1058.                 MAX_PROP_TABLE_SIZE=j, flag=1;
  1059.             if (strcmp(command,"MAX_FORWARD_REFS")==0)
  1060.                 MAX_FORWARD_REFS=j, flag=1;
  1061.             if (strcmp(command,"STACK_SIZE")==0)
  1062.                 STACK_SIZE=j, flag=1;
  1063.             if (strcmp(command,"STACK_LONG_SLOTS")==0)
  1064.                 STACK_LONG_SLOTS=j, flag=1;
  1065.             if (strcmp(command,"STACK_SHORT_LENGTH")==0)
  1066.                 STACK_SHORT_LENGTH=j, flag=1;
  1067.             if (strcmp(command,"MAX_ABBREVS")==0)
  1068.                 MAX_ABBREVS=j, flag=1;
  1069.             if (strcmp(command,"MAX_EXPRESSION_NODES")==0)
  1070.                 MAX_EXPRESSION_NODES=j, flag=1;
  1071.             if (strcmp(command,"MAX_VERBS")==0)
  1072.                 MAX_VERBS=j, flag=1;
  1073.             if (strcmp(command,"MAX_STATIC_STRINGS")==0)
  1074.                 MAX_STATIC_STRINGS=j, flag=1;
  1075.             if (strcmp(command,"MAX_ZCODE_SIZE")==0)
  1076.                 MAX_ZCODE_SIZE=j, flag=1;
  1077.             if (strcmp(command,"MAX_LOW_STRINGS")==0)
  1078.                 MAX_LOW_STRINGS=j, flag=1;
  1079.             if (strcmp(command,"MAX_TRANSCRIPT_SIZE")==0)
  1080.                 MAX_TRANSCRIPT_SIZE=j, flag=1;
  1081.             if (strcmp(command,"MAX_CLASSES")==0)
  1082.                 MAX_CLASSES=j, flag=1;
  1083.             if (strcmp(command,"MAX_CLASS_TABLE_SIZE")==0)
  1084.                 MAX_CLASS_TABLE_SIZE=j, flag=1;
  1085.  
  1086.             if (flag==0)
  1087.                 printf("No such memory setting as \"%s\"\n",command);
  1088.  
  1089.             return;
  1090.         }
  1091.     }
  1092.     printf("No such memory $ command as \"%s\"\n",command);
  1093. }
  1094.  
  1095.