home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol083 / ice-main.pli < prev    next >
Text File  |  1984-04-29  |  4KB  |  113 lines

  1. ICE : procedure options(main);
  2.    
  3. /**************************************************/
  4. /*                                                */
  5. /*       IN CONTEXT EDITOR                        */
  6. /*                                                */
  7. /*        Re-implementation of ICE written by     */
  8. /*        P. G. Main in Ratfor.                   */
  9. /*                                                */
  10. /*        Paul Tilden  Aug 1981                   */
  11. /*                                                */
  12. /*  IMPORTANT:  To avoid confusion, the word      */
  13. /*  LINE is used exclusively to refer to lines    */
  14. /*  on the VDU screen, and ROW to refer to data   */
  15. /*  in the working buffer BUF.                    */
  16. /*                                                */
  17. /**************************************************/
  18.    
  19. %replace
  20.     true      by '1'b,
  21.     false     by '0'b;
  22. %replace
  23.     huge      by 32000,
  24.     linelen   by 100,    /* screen width */
  25.     scrlen    by 16,     /* screen length */
  26.     size      by 100;    /* nr. of rows in buf */
  27. %replace
  28.     escape    by 27,
  29.     line_feed by 10;
  30.    
  31. declare
  32.     (edt_in, edt_out, sysin, sysprint) file;
  33. declare
  34.     nextout   fixed,     /* next row to be output from buf */
  35.     lastin    fixed,     /* last row input to buf */
  36.     posn      fixed,     /* equal to rmod(crow - lastin) */
  37.     crow      fixed,     /* current row */
  38.     delrows   fixed,     /* nr. of rows to be deleted but
  39.                            not yet read */
  40.     inrow     fixed,     /* infile row nr. of lastin */
  41.     inopen    bit(1),    /* flag saying an input file is open */
  42.     file_end  bit(1),    /* eof on edt_in */
  43.     abort     bit(1),    /* abort edit */
  44.     scr_row   fixed,     /* screen row */
  45.     scr_col   fixed;     /* screen column */
  46. declare
  47.     1 buf(size),
  48.         2 buf_row character(linelen) varying;
  49. declare
  50.     upper character(26) static initial
  51.           ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
  52.     lower character(26) static initial
  53.           ('abcdefghijklmnopqrstuvwxyz'),
  54.     digit character(10) static initial ('0123456789'),
  55.     blanks character(linelen) varying static;
  56.    
  57.    
  58. /********************************************************/
  59. /*                                                      */
  60. /*                MAIN PROCEDURE                        */
  61. /*                                                      */
  62. /********************************************************/
  63.    
  64.         /* initialization */
  65.     open file(sysprint) print pagesize(0) 
  66.          linesize(255)
  67.          title('$CON');
  68.         begin;
  69.         declare i fixed;
  70.         do i = 1 to size;
  71.             buf_row(i) = '';
  72.         end;
  73.         blanks = '';
  74.         do i = 1 to linelen;
  75.             blanks = blanks !! ' ';
  76.         end;
  77.         end;
  78.     call home_cursor;
  79.     call clear_screen;
  80.     nextout = 1;
  81.     lastin = size;
  82.     crow = lastin;
  83.     posn = size;
  84.     inrow = 0;
  85.     delrows = 0;
  86.     on undefinedfile(edt_in)
  87.         begin;
  88.         call diag('new file');
  89.         inopen = false;
  90.         file_end = true;
  91.         goto edtin_cont;
  92.         end;
  93.     open file(edt_in) input stream env(b(2048)) title('$1.$1');
  94.     inopen = true;
  95.     file_end = false;
  96.     revert undefinedfile(edt_in);
  97.     edtin_cont: ;
  98.     open file(edt_out) output stream pagesize(0) env(b(2048))
  99.          title('$1.%%%');
  100.     call get_row(lastin);
  101.     call spray(scrlen-2,scrlen-2);
  102.    
  103.         /* edit file */
  104.     call edit_file;
  105.    
  106.         /* file cleanup */
  107.     close file(edt_in);
  108.     close file(edt_out);
  109.    
  110.         /* end */
  111.     call diag('done');
  112.    
  113.