home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / ucsdappleii / kermsetshw.text < prev    next >
Text File  |  1986-04-07  |  10KB  |  315 lines

  1. (* >>>> KERMSETSHW.TEXT ************************************************)
  2.  
  3. (*$I-*)
  4. (*$R-*)
  5. (*$S+*)
  6. (*$V-*)
  7.  
  8. UNIT KERMSETSHW;         INTRINSIC CODE   27;
  9.  
  10. INTERFACE
  11.  
  12. USES kermglob, kermacia, kermutil;
  13.  
  14.  
  15. PROCEDURE  show_parms;
  16.  
  17. PROCEDURE  set_parms;
  18.  
  19.  
  20. IMPLEMENTATION
  21.  
  22.  
  23. PROCEDURE show_dir( list_device : integer );
  24.  
  25.  lists all the files in the directory from the requested diskunit number  
  26.  
  27. var space   : packed array[1..15] of char;
  28.     fil_type ,file_count, file_num : integer;
  29.  
  30.  
  31. PROCEDURE list_names ( start, quit : integer );
  32.  
  33. var   len : integer;
  34.  
  35. begin
  36.   while (filecount < filenum) and (start < quit) do
  37.     begin
  38.       len := ord( filebuf[start-1] );
  39.       fil_type := ord( filebuf[start-3] );
  40.       if (len > 0) and (len < 16) and (fil_type < 6) then
  41.         begin
  42.           unitwrite( list_device, filebuf[start], len );
  43.           unitwrite( list_device, space[1], 16-len );
  44.           file_count := file_count + 1;
  45.         end;
  46.       start := start + 26;
  47.     end;
  48. end;  { list_names}
  49.  
  50. begin  { show_dir }
  51.   space := '               ';
  52.   if (volnum=4) or (volnum=5) or ((volnum>8) and (volnum<13))
  53.     then begin
  54.            unitread( vol_num, filebuf[1], page_size, 2 );
  55.            if ioresult <> 0 then begin
  56.                                    writeln('not on line');
  57.                                    writeln;
  58.                                    exit( show_dir );
  59.                                  end;
  60.            writeln(p); write(p,'Volume name is : ');
  61.            unitwrite( list_device, filebuf[8], ord( filebuf[7] ) );
  62.            file_num := ord( filebuf[17] );
  63.            file_count := 0;
  64.            writeln(p); writeln(p);
  65.            list_names(34, pagesize-27);
  66.            if (filecount < filenum) then
  67.              begin
  68.                moveleft( filebuf[pagesize-9], filebuf[1], 10 );
  69.                unitread( vol_num, filebuf[11], page_size - 10, 4 );
  70.                list_names( 8, pagesize-27);
  71.              end;
  72.            writeln(p);
  73.            writeln(p);
  74.          end
  75.     else begin
  76.            writeln('not a disk volume');
  77.            writeln;
  78.          end;
  79.  end;    { show_dir }
  80.  
  81.  
  82. PROCEDURE show_p1;
  83.  
  84. (* shows the various settable parameters *)
  85.  
  86. var list_device : integer;
  87.  
  88. begin
  89.   close( p );
  90.   if pr_out and print_enable
  91.     then begin
  92.            reset(p, pr_file);
  93.            list_device := line_printer;
  94.          end
  95.     else begin
  96.            reset(p, cs_file);
  97.            list_device := consol;
  98.          end;
  99.   writeln;
  100.   if (verb = dirsym) or (verb = pdirsym)
  101.     then begin
  102.            show_dir( list_device );
  103.            pr_out := false;
  104.            exit( show_parms )
  105.          end;
  106.   if noun = allsym then
  107.     begin
  108.       page(output);
  109.       writeln(p,'SERIAL PORT SETTINGS');
  110.       writeln(p);
  111.     end;
  112.   if (noun=allsym) or (noun=baudsym) then
  113.     writeln(p,'   BAUD rate is ', baud );
  114.   if (noun=allsym) or (noun=paritysym) then
  115.     begin
  116.       case parity of
  117.         evenpar  : write(p,'   EVEN');
  118.         markpar  : write(p,'   MARK');
  119.         nopar    : write(p,'   NONE');
  120.         oddpar   : write(p,'   ODD');
  121.         spacepar : write(p,'   SPACE');
  122.       end; { case }
  123.       writeln(p,' PARITY');
  124.     end; { if }
  125.   if (noun=allsym) or (noun=wordlensym) then
  126.     writeln(p,'   WORD-LENGTH is ', data_bit ,' bits');
  127.   if (noun=allsym) or (noun=stopbsym) then
  128.     begin
  129.       write(p,'   Number of STOPBITs is ');
  130.       if stopbit = 15 then writeln(p,'1.5') else writeln(p, stopbit );
  131.     end; { if }
  132.   if (noun=allsym) or (noun=localsym) then
  133.     write_bool('   LOCAL-ECHO is ', halfduplex );
  134. end; { show_p1 }
  135.  
  136.  
  137. PROCEDURE show_p2;
  138.  
  139. begin
  140.   if (noun=allsym) then
  141.     begin
  142.       writeln(p);
  143.       writeln(p,'TERMINAL MODE RELATED SETTINGS');
  144.       writeln(p);
  145.     end;
  146.   if (noun=allsym) or (noun=emulatesym) then
  147.     writeln(p,'   EMULATE  is not implemented.' );
  148.   if (noun=allsym) or (noun=escsym) then
  149.     begin
  150.       write(p,'   Terminal ESCAPE key is ');
  151.       write_ctl( esc_char );
  152.       writeln(p);
  153.     end;
  154.   if (noun=allsym) or (noun=rejectsym) then
  155.     write_bool('   REJECT incoming control characters is ', reject_cntrl_char);
  156.   if (noun=allsym) or (noun=delsym) then
  157.     begin
  158.       write(p,'   DELKEY (backspace key code send to host = ');
  159.       write_ctl( bs_to_del ); write(p,' ) is ');
  160.       if bs_to_del = chr(del) then writeln(p,'ON') else writeln(p,'OFF');
  161.     end;
  162.   if (noun=allsym) or (noun=xonsym) then
  163.     begin
  164.       write(p,'   XON-CHAR is ');
  165.       write_ctl( xon_char );
  166.       writeln(p,' ( screendump and ibm = on only )');
  167.     end;
  168.   if (noun=allsym) or (noun=xoffsym) then
  169.     begin
  170.       write(p,'   XOFF-CHAR is ');
  171.       write_ctl( xoff_char );
  172.       writeln(p,' ( screendump only )');
  173.     end;
  174.   if (noun=allsym) or (noun=xoffwaitsym) then
  175.     writeln(p,'   XOFF-WAIT-COUNT is ', xoffwtime ,'   ( screendump only )');
  176.   if (noun=allsym) or (noun=nofeedsym) then
  177.     write_bool('   NOFEED (form-feed during screendump) is ', no_ffeed );
  178.   if (noun=allsym) or (noun=ibmsym) then
  179.     write_bool('   IBM vm/cms settings are ', ibm );
  180.   if (noun=allsym) then
  181.     begin
  182.       if not ( pr_out and print_enable ) then
  183.         begin
  184.           writeln;
  185.           write('>>> PRESS <RETURN> FOR MORE <<<');
  186.           readln;
  187.         end;
  188.       writeln(p);
  189.       writeln(p,'FILE TRANSFER RELATED SETTINGS');
  190.       writeln(p);
  191.     end;
  192. end;  { show_p2 }
  193.  
  194.  
  195. PROCEDURE  show_p3;
  196.  
  197. begin
  198.   if (noun=allsym) or (noun=debugsym) then
  199.     write_bool('   DEBUGging is ', debug );
  200.   if (noun=allsym) or (noun=filewarnsym) then
  201.     write_bool('   FILE-WARNING is ', fwarn );
  202.   if (noun=allsym) or (noun=textfsym) then
  203.     write_bool('   TEXTFILE send & receive is ', text_file );
  204.   if (noun=allsym) or (noun=prefixsym) then
  205.     writeln(p, '   PREFIX volume for received files is ', prefix_vol );
  206.   if (noun=allsym) or (noun=timeoutsym) then
  207.     writeln(p, '   TIMEOUT period specified to host is about ',mytime,' sec');
  208.   if (noun=allsym) or (noun=maxtrysym) then
  209.     begin
  210.     writeln(p,'   MAXTRY ( number of retries before breaking off ) is ',maxtry);
  211.     writeln(p,'          ( Initial retries =  5 * maxtry )');
  212.     end;
  213.   if (noun=allsym) or (noun=eolnsym) then
  214.     begin
  215.       write(p,'   END-OF-LINE character send after each package is ');
  216.       write_ctl( xeol_char );
  217.       writeln(p);
  218.     end;
  219.   if (noun=allsym) or (noun=maxpsym) then
  220.       writeln(p,'   MAXPACK: packetsize (20..', def_maxpack,
  221.                                                ') I can receive is ', maxpack );
  222.   if (noun=allsym) then
  223.     begin
  224.       write(p,'   Kermit packet starts with '); write_ctl( soh_char );
  225.       writeln(p);
  226.       write(p,'   My padding character is '); write_ctl( my_pchar );
  227.       writeln(p);
  228.       writeln(p,'   Number of padding char''s  I need is ', my_pad );
  229.       writeln(p,'   My quote char for control char''s is ', my_quote );
  230.     end;
  231.   writeln(p);
  232.    close( p ); reset( p, cs_file );
  233. end; { show_p3 }
  234.  
  235.  
  236. PROCEDURE  show_parms;
  237.  
  238. begin
  239.   show_p1;
  240.   show_p2;
  241.   show_p3;
  242.   pr_out := false;
  243. end;  { show_parms }
  244.  
  245.  
  246.  
  247. PROCEDURE set_parms;
  248.  
  249. (* sets the parameters *)
  250.  
  251. begin
  252.   case noun of
  253.     debugsym   : debug := ( adj = onsym );
  254.     emulatesym : ;
  255.     textfsym   : textfile := ( adj = onsym );
  256.     prefixsym  : prefix_vol := newprefix_vol;
  257.     rejectsym  : reject_cntrl_char := ( adj = onsym );
  258.     nofeedsym  : no_ffeed := ( adj = onsym );
  259.     xonsym     : xonchar := newxonchar;
  260.     xoffsym    : xoffchar := newxoffchar;
  261.     eolnsym    : xeol_char := new_xeol_char;
  262.     escsym     : esc_char := new_esc_char;
  263.     delsym     : case adj of
  264.                    onsym  : bs_to_del := chr(del);
  265.                    offsym : bs_to_del := backsp;
  266.                  end;
  267.     filewarnsym: fwarn := (adj = onsym);
  268.     xoffwaitsym: if newxoffwait < 256 then xoffwtime := newxoffwait;
  269.     maxtrysym  : begin
  270.                    maxtry := newmaxtry;
  271.                    inittry := 5 * maxtry;
  272.                  end;
  273.     maxpsym    : if (new_maxpack <= def_maxpack ) and (new_maxpack >= 20)
  274.                    then maxpack := new_maxpack;
  275.     timeoutsym : if newtimeout < 32  then begin
  276.                                             my_time := newtimeout;
  277.                                             xtime := my_time;
  278.                                           end;
  279.     ibmsym     : case adj of
  280.                    onsym : begin
  281.                              set_acia_parms(markpar,databit,stopbit,baud);
  282.                              get_acia_parms(parity,databit,stopbit,baud);
  283.                              if parity = mark_par
  284.                                then begin
  285.                                       ibm := true;
  286.                                       half_duplex := true;
  287.                                     end;
  288.                            end; (* onsym *)
  289.                    offsym: begin
  290.                              ibm := false;
  291.                              half_duplex := false;
  292.                            end; (* offsym *)
  293.                  end; (* case adj *)
  294.     localsym   : if not ibm then halfduplex := (adj = onsym);
  295.     paritysym  : if not ibm then
  296.                  case adj of
  297.                    evensym: new_par:= evenpar;
  298.                    marksym: new_par:= markpar;
  299.                    nonesym: new_par:= nopar;
  300.                    oddsym:  new_par:= oddpar;
  301.                    spacesym:new_par:= spacepar;
  302.                  end; (* case *)
  303.   end; (* case noun *)
  304.   case noun of
  305.     paritysym  : set_acia_parms( new_par,data_bit, stop_bit, baud );
  306.     baudsym    : set_acia_parms( parity, data_bit, stop_bit, new_baud );
  307.     wordlensym : set_acia_parms( parity, new_dbit, stop_bit, baud );
  308.     stopbsym   : set_acia_parms( parity, data_bit, new_stopbit, baud );
  309.   end; { case }
  310.     get_acia_parms( parity,  data_bit, stop_bit,    baud     );
  311. end; (* set_parms *)
  312.  
  313. begin
  314. end.     {  kermsetshw }
  315.