home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / CON-03A.ZIP / ONELINER.PAS < prev    next >
Pascal/Delphi Source File  |  1995-11-16  |  4KB  |  190 lines

  1. unit oneliner;
  2.  
  3. interface
  4.  
  5. procedure set_options;
  6. procedure init_asc;
  7. procedure read_data_file;
  8. procedure add_oneliner;
  9. procedure menu;
  10. procedure one_liner_run;
  11.  
  12. implementation
  13.  
  14. {$R-}
  15. uses crt,
  16.      mmenu,
  17.      funct;
  18. type
  19.   one_liner = record
  20.   lineswap         : array[1..12] of string[78];
  21. { author           : array[1..12] of string[30];}
  22. end;
  23.  
  24.  
  25. var
  26.   f1               : text;
  27.   f                : file of one_liner;
  28.   one              : one_liner;
  29.   i                : integer;
  30.   i2               : integer;
  31.   option           : integer;
  32.   options          : array[1..3] of string[17];
  33.   choice           : char;
  34.   grid_ref         : byte;
  35.   cows_come_home   : boolean;
  36.   liner            : string;
  37.   tmp11            : string[50];
  38.   len              : integer;
  39.  
  40. procedure set_options;
  41. begin
  42.   options[3]:=' enter oneliner  ';
  43.   options[2]:=' info on line    ';
  44.   options[1]:=' exit groovyLINE ';
  45. end;
  46.  
  47. procedure init_asc;
  48. var
  49.   ch        : char;
  50. begin
  51.   clrscr;
  52.   send_ansi('oneliner.pcb');
  53. end;
  54.  
  55. procedure read_data_file;
  56. begin
  57.   assign(f,'data\oneliner.dat');
  58.   reset(f);
  59.   while not eof(f) do read(f,one);
  60.     gotoxy(4,4);
  61.     write(one.lineswap[1]);
  62.     gotoxy(4,5);
  63.     write(one.lineswap[2]);
  64.     gotoxy(4,6);
  65.     write(one.lineswap[3]);
  66.     gotoxy(4,7);
  67.     write(one.lineswap[4]);
  68.     gotoxy(4,8);
  69.     write(one.lineswap[5]);
  70.     gotoxy(4,9);
  71.     write(one.lineswap[6]);
  72.     gotoxy(4,10);
  73.     write(one.lineswap[7]);
  74.     gotoxy(4,11);
  75.     write(one.lineswap[8]);
  76.     gotoxy(4,12);
  77.     write(one.lineswap[9]);
  78.     gotoxy(4,13);
  79.     write(one.lineswap[10]);
  80.     gotoxy(4,14);
  81.     write(one.lineswap[11]);
  82.     gotoxy(4,15);
  83.     write(one.lineswap[12]);
  84.     close(f);
  85. end;
  86.  
  87. procedure add_oneliner;
  88.  
  89. begin
  90.   i2 :=12;
  91.   textcolor(7);
  92.   textbackground(0);
  93.   gotoxy(2,21);
  94.   write('..%%> ');
  95.   one.lineswap[1]  :=one.lineswap[2];
  96.   one.lineswap[2]  :=one.lineswap[3];
  97.   one.lineswap[3]  :=one.lineswap[4];
  98.   one.lineswap[4]  :=one.lineswap[5];
  99.   one.lineswap[5]  :=one.lineswap[6];
  100.   one.lineswap[6]  :=one.lineswap[7];
  101.   one.lineswap[7]  :=one.lineswap[8];
  102.   one.lineswap[8]  :=one.lineswap[9];
  103.   one.lineswap[9]  :=one.lineswap[10];
  104.   one.lineswap[10] :=one.lineswap[11];
  105.   one.lineswap[11] :=one.lineswap[12];
  106.   {readln(one.lineswap[12]);}
  107.   len:=67;
  108.   one.lineswap[12]:=strupper(lengthstring(len));
  109.   gotoxy(2,21);
  110.   write('                                                                          ');
  111.   assign(f,'data\oneliner.dat');
  112.   filemode:=2;
  113.   rewrite(f);
  114.   write(f,one);
  115.   close(f);
  116.   main_menu;
  117. end;
  118.  
  119. procedure grab_info;
  120. begin
  121. end;
  122.  
  123.  
  124. procedure menu;
  125. var
  126.   first         : integer;
  127. begin
  128.   first:=58;
  129.   gotoxy(first,17);
  130.   textcolor(0);
  131.   textbackground(3);
  132.   write(options[1]);
  133.   option:=1;
  134.   grid_ref:=17;
  135.   repeat
  136.   choice:=readkey;
  137.   case choice of
  138.     #13       : if option=3 then begin
  139.                   add_oneliner;
  140.                 end else
  141.                 if option=2 then begin
  142.                   grab_info;
  143.                 end else
  144.                 if option=1 then begin
  145.                   textcolor(7);
  146.                   textbackground(0);
  147.                   main_menu;
  148.                 end;
  149.  
  150.     #27       : halt;
  151.     #80       : begin
  152.                   if option<3 then begin
  153.                     gotoxy(first,grid_ref);
  154.                     textbackground(0);
  155.                     textcolor(7);
  156.                     write(options[option]);
  157.                     inc(grid_ref);
  158.                     gotoxy(first,grid_ref);
  159.                     textbackground(3);
  160.                     textcolor(0);
  161.                     writeln(options[option+1]);
  162.                     option:=option+1;
  163.                   end else begin
  164.                     gotoxy(first,grid_ref);
  165.                     textcolor(7);
  166.                     textbackground(0);
  167.                     write(options[3]);
  168.                     grid_ref:=grid_ref-2;
  169.                     gotoxy(first,grid_ref);
  170.                     textbackground(3);
  171.                     textcolor(0);
  172.                     write(options[1]);
  173.                     option:=option-2;
  174.                   end;
  175.                 end;
  176.   end;
  177.   cows_come_home:=false;
  178.   until cows_come_home;
  179. end;
  180.  
  181.  
  182. procedure one_liner_run;
  183. begin
  184.    init_asc;
  185.    set_options;
  186.    read_data_file;
  187.    menu;
  188. end;
  189.  
  190. end.