home *** CD-ROM | disk | FTP | other *** search
Text File | 1985-07-20 | 36.6 KB | 1,180 lines |
- (****************************************************************************)
- (* CHANGE COMMUNICATION PARAMETERS *)
- (****************************************************************************)
- procedure
- change_comm_params;
- begin
- mkwin(13,7,64,18,'Change Parameters');
- writeln;
- write(' Current Setting: ',baud:4);
- case par of
- 0 : write(' N');
- 1 : write(' E');
- 2 : write(' O');
- end;
- writeln(databits:2,stopbits:2);
- writeln;
- writeln(' Enter New Parameters.');
- writeln(' ---------------------');
- write(' Baud Rate, 300,1200,2400,4800,9600 : ');
- readln(baud_ch);
- if length(baud_ch)>0 then begin
- baud:=bval(baud_ch);
- case baud of
- 300 : ;
- 1200 : ;
- 2400 : ;
- 4800 : ;
- 9600 : ;
- else
- baud := default_baud;
- end;
- end;
- write(' Parity, (N)one, (E)ven, (O)dd : ');
- readln(parity_ch);
- if length(parity_ch)>0 then begin
- parity_ch := upcase(parity_ch[1]);
- case parity_ch of
- 'N' : par:=0;
- 'E' : par:=1;
- 'O' : par:=2;
- else
- par:=0;
- end;
- end;
- write(' Data Bits, 7 or 8 : ');
- readln(data_ch);
- if length(data_ch)>0 then begin
- databits := bval(data_ch);
- case databits of
- 7 : ;
- 8 : ;
- else
- databits := 8;
- end;
- end;
- write(' Stop Bits, 1 or 2 : ');
- readln(stop_ch);
- if length(stop_ch)>0 then begin
- stopbits := bval(stop_ch);
- case stopbits of
- 1 : ;
- 2 : ;
- else
- stopbits := 1;
- end;
- end;
- setserial(baud,stopbits,databits,par);
- rmwin;
- end;
-
- (****************************************************************************)
- (* PAINT DIRECTORY SCREEN *)
- (****************************************************************************)
- procedure
- paint_directory_screen(en : integer);
- var
- i : integer;
- row : integer;
- num : integer;
- begin
- for i:=en to max_dial_entries do begin
- row := i + 3;
- num := ( dialarray_number * max_dial_entries ) + i;
- gotoxy(1,row);
- write(num:3,' ');
- clreol;
- with dial_dir do begin
- if i <= no_of_dial_entries then begin
- with dir_entries[i] do begin
- gotoxy(5,row);
- write(bbs_name);
- gotoxy(36,row);
- write(bbs_number);
- gotoxy(67,row);
- write(bbs_baud:4);
- gotoxy(72,row);
- case bbs_parity of
- 0 : write('N ');
- 1 : write('E ');
- 2 : write('O ');
- end;
- write(bbs_databits,' ',bbs_stopbits);
- end;
- end;
- end;
- writeln;
- end;
- end;
-
- (****************************************************************************)
- (* GET DIRECTORY INFO *)
- (****************************************************************************)
- procedure
- get_info(i : integer);
- var
- entry_no : integer;
- begin
- entry_no := i - 3;
- with dial_dir.dir_entries[entry_no] do begin
- gotoxy(5,i);
- str_input(bbs_name);
- gotoxy(36,i);
- str_input(bbs_number);
- gotoxy(67,i);
- if bbs_baud = 0 then begin
- baud_ch := '';
- parity_ch := '';
- data_ch := '';
- stop_ch := '';
- end
- else begin
- str(bbs_baud:4,baud_ch);
- case bbs_parity of
- 0 : parity_ch := 'N';
- 1 : parity_ch := 'E';
- 2 : parity_ch := 'O';
- else
- parity_ch := ' ';
- end;
- str(bbs_databits:1,data_ch);
- str(bbs_stopbits:1,stop_ch);
- end;
- str_input(baud_ch);
- bbs_baud := bval(baud_ch);
- case bbs_baud of
- 300 : ;
- 1200 : ;
- 2400 : ;
- 4800 : ;
- 9600 : ;
- else
- bbs_baud := default_baud;
- end;
- gotoxy(72,i);
- str_input(parity_ch);
- parity_ch := upcase(parity_ch[1]);
- case parity_ch of
- 'N' : bbs_parity := 0;
- 'E' : bbs_parity := 1;
- 'O' : bbs_parity := 2;
- else
- bbs_parity := 0;
- end;
- gotoxy(73,i);
- write(' ');
- str_input(data_ch);
- bbs_databits := bval(data_ch);
- case bbs_databits of
- 7 : ;
- 8 : ;
- else
- bbs_databits := 8;
- end;
- gotoxy(76,i);
- str_input(stop_ch);
- bbs_stopbits := bval(stop_ch);
- case bbs_stopbits of
- 1 : ;
- 2 : ;
- else
- bbs_stopbits := 1;
- end;
- end;
- end;
-
- (****************************************************************************)
- (* ADD DIRECTORY ENTRY *)
- (****************************************************************************)
- procedure
- add_dial_entry;
- var
- row : integer;
- ch : char;
- begin
- with dial_dir do begin
- while no_of_dial_entries = max_dial_entries do begin
- dialarray_number := succ(dialarray_number);
- {$I-}
- seek(dialfile,dialarray_number);
- read(dialfile,dial_dir);
- {$I+}
- ok := (ioresult=0);
- if not ok then begin
- seek(dialfile,dialarray_number);
- no_of_dial_entries := 0;
- write(dialfile,dial_dir);
- end;
- end;
- paint_directory_screen(1);
- no_of_dial_entries := succ(no_of_dial_entries);
- row := no_of_dial_entries + 3;
- with dir_entries[no_of_dial_entries] do begin
- bbs_name := '';
- bbs_number := '';
- bbs_baud := 0;
- bbs_parity := 0;
- bbs_databits := 8;
- bbs_stopbits := 1;
- end;
- get_info(row);
- seek(dialfile,dialarray_number);
- write(dialfile,dial_dir);
- end;
- end;
-
- (****************************************************************************)
- (* CHANGE DIRECTORY ENTRY *)
- (****************************************************************************)
- procedure
- change_dial_entry;
- var
- i : integer;
- row : integer;
- begin
- mkwin(41,1,71,5,'Update');
- writeln;
- write(' Enter the # to change: ');
- readln(i);
- rmwin;
- i := i - (dialarray_number * max_dial_entries);
- if ( i > 0 ) and ( i <= max_dial_entries ) then begin
- row := i + 3;
- get_info(row);
- seek(dialfile,dialarray_number);
- write(dialfile,dial_dir);
- end;
- end;
-
- (****************************************************************************)
- (* DELETE DIRECTORY ENTRY *)
- (****************************************************************************)
- procedure
- delete_dial_entry;
- var
- i,j : integer;
- begin
- mkwin(41,1,71,5,'Delete');
- writeln;
- write(' Enter the # to delete: ');
- readln(i);
- rmwin;
- j := i - (dialarray_number * max_dial_entries);
- i := j;
- if ( i > 0 ) and ( i <= max_dial_entries ) then begin
- with dial_dir do begin
- while i < no_of_dial_entries do begin
- dir_entries[i] := dir_entries[ succ( i ) ];
- i := succ( i );
- end;
- no_of_dial_entries := pred(no_of_dial_entries);
- paint_directory_screen(j);
- seek(dialfile,dialarray_number);
- write(dialfile,dial_dir);
- end;
- end;
- end;
-
- (****************************************************************************)
- (* DIALER *)
- (****************************************************************************)
- procedure
- dialer;
- var
- i : byte;
- begin
- for i:=1 to length( dial_str ) do begin
- case dial_str[i] of
- '|' : store_sout_buffer( CR );
- '~' : delay( a_second );
- else
- store_sout_buffer( dial_str[i] );
- end;
- delay( wait_increment div 11 );
- end;
- delay( wait_increment );
- end;
-
- (****************************************************************************)
- (* MANUAL DIAL MODEM *)
- (****************************************************************************)
- procedure
- manual_dial;
- begin
- mkwin(25,1,71,5,'Manual Dial');
- writeln;
- write(' Enter Phone Number: ');
- readln(dial_str);
- dial_str := dial_pre_str + dial_str + dial_post_str;
- redial_number := dial_str;
- change_comm_params;
- redial_name := '';
- dialer;
- dial_time := time;
- initialize_music;
- rmwin;
- end;
-
- (****************************************************************************)
- (* AUTO DIAL MODEM *)
- (****************************************************************************)
- procedure
- auto_dial;
- var
- i : integer;
- begin
- mkwin(41,1,71,5,'Auto Dial');
- writeln;
- write(' Enter the # to dial: ');
- i := 0;
- num_input(i);
- writeln;
- i := i - (dialarray_number * max_dial_entries);
- if ( I > 0 ) and ( i <= max_dial_entries ) then begin
- with dial_dir.dir_entries[i] do begin
- baud := bbs_baud;
- stopbits := bbs_stopbits;
- databits := bbs_databits;
- par := bbs_parity;
- setserial(baud,stopbits,databits,par);
- dial_str := dial_pre_str + bbs_number + dial_post_str;
- redial_number := dial_str;
- redial_name := bbs_name;
- dialer;
- dial_time := time;
- initialize_music;
- end;
- end
- else begin
- writeln(' Number must be on screen.');
- wait_for_key;
- end;
- rmwin;
- end;
-
- (****************************************************************************)
- (* PAGE FORWARD *)
- (****************************************************************************)
- procedure
- page_forward;
- var
- fsize : integer;
- begin
- fsize := filesize(dialfile) - 1;
- if dialarray_number = fsize then exit;
- dialarray_number := succ(dialarray_number);
- seek(dialfile,dialarray_number);
- read(dialfile,dial_dir);
- paint_directory_screen(1);
- end;
-
- (****************************************************************************)
- (* PAGE BACKWARD *)
- (****************************************************************************)
- procedure
- page_backward;
- begin
- if dialarray_number = 0 then exit;
- dialarray_number := pred(dialarray_number);
- seek(dialfile,dialarray_number);
- read(dialfile,dial_dir);
- paint_directory_screen(1);
- end;
-
- (****************************************************************************)
- (* DIRECTORY MANAGER *)
- (****************************************************************************)
- procedure
- directory_manager;
- begin
- gotoxy(30,1);
- writeln('Phone Directory');
- writeln(' # BBS Name Phone Number Baud P D S');
- writeln(' -- ------------------------------ ------------------------------ ---- - - -');
- paint_directory_screen(1);
- writeln;
- write(' A=Add, C=Chg, K=Kill, M=M.Dial, D=A.Dial, S=Stop, F=PgFwd, B=PgBak, Q=Quit');
- delay( a_second );
- repeat
- gotoxy(77,21);
- kbd_char := ' ';
- if keypressed then begin
- read(kbd,kbd_char);
- kbd_char := upcase(kbd_char);
- case kbd_char of
- 'A' : add_dial_entry;
- 'C' : change_dial_entry;
- 'K' : delete_dial_entry;
- 'M' : manual_dial;
- 'G','D'
- : auto_dial;
- 'S' : store_sout_buffer(' ');
- 'F' : page_forward;
- 'B' : page_backward;
- 'Q' : ;
- end;
- end;
- if (( port[modem_status_reg] and $80 ) <> 0)
- and (forced_carrier[1] = 'F') then
- kbd_char := 'Q';
- until kbd_char = 'Q';
- end;
-
- (****************************************************************************)
- (* MODEM DIALER *)
- (****************************************************************************)
- procedure
- dial_modem;
- begin
- dial_str := speaker_on;
- dialer;
- mkwin(1,1,80,23,'');
- assign(dialfile,dial_PATH+'TMODEM.DIR');
- {$I-};
- reset(dialfile);
- {$I+}
- ok := (ioresult = 0);
- dialarray_number := 0;
- with dial_dir do begin
- if ok then
- read(dialfile,dial_dir)
- else begin
- no_of_dial_entries := 0;
- rewrite(dialfile);
- write(dialfile,dial_dir);
- close(dialfile);
- assign(dialfile,dial_PATH+'TMODEM.DIR');
- reset(dialfile);
- read(dialfile,dial_dir);
- end;
- directory_manager;
- close(dialfile);
- end;
- rmwin;
- end;
-
- (****************************************************************************)
- (* HANG UP THE MODEM *)
- (****************************************************************************)
- procedure
- hang_up;
- begin
- mkwin(10,8,71,14,'');
- gotoxy(23,3);
- write('Hanging Up');
- gotoxy(60,5);
- port[modem_control_reg] := 0;
- ascii_mode := false;
- delay( a_second * 4 );
- setserial(baud,stopbits,databits,par);
- initialize_music;
- flush_sin_buff;
- sout_store_ptr := sout_read_ptr;
- dial_str := modem_init_str;
- dialer;
- rmwin;
- writeln;
- end;
-
- (****************************************************************************)
- (* REDIAL THE MODEM *)
- (****************************************************************************)
- procedure
- redial_modem;
- var
- m : integer;
- i,j : integer;
- dt : integer;
- stop_dialing : boolean;
- begin
- if redial_number = '' then exit;
- mkwin(10,6,71,16,'');
- if forced_carrier[1] = 'T' then begin
- gotoxy(26,3);
- write('Redialing');
- end
- else begin
- gotoxy(18,3);
- write('Redialing Every ',redial_time,' Seconds');
- end;
- m := ( 60 - length( redial_name ) ) div 2 + 1;
- gotoxy(m,5);
- write( redial_name );
- gotoxy(16,9);
- write('Press any key to stop dialing... ');
- dt := a_second div 20;
- if forced_carrier[1] = 'T' then
- stop_dialing := true
- else begin
- stop_dialing := false;
- dial_str := speaker_off;
- dialer;
- end;
- delay( a_second );
- initialize_music;
- dial_str := redial_number;
- repeat
- dialer;
- dial_time := time;
- i := redial_time + succ(carrier_timeout);
- while ( i > 1 ) and ( not stop_dialing ) do begin
- i := pred( i );
- gotoxy(55,9);
- if i <= redial_time then
- write(i:4)
- else
- clreol;
- j := 0;
- while ( j < 20 ) and ( not stop_dialing ) do begin
- j := succ( j );
- if keypressed then begin
- stop_dialing := true;
- read(kbd,kbd_char);
- store_sout_buffer(' ');
- delay( a_second );
- flush_sin_buff;
- end;
- if ( port[modem_status_reg] and $80 ) <> 0 then begin
- delay( a_second );
- rmwin;
- flush_sin_buff;
- writeln(CR+'CONNECT'^G);
- exit;
- end
- else
- delay( dt );
- end;
- end;
- until stop_dialing;
- rmwin;
- end;
-
- (****************************************************************************)
- (* ASCII FILE TRANSMISSION *)
- (****************************************************************************)
- procedure
- ascii_transmission;
- var
- image_cnt : integer;
- begin
- mkwin(15,4,62,13,'Transmit ASCII File');
- image_cnt := 0;
- continue_transfer := true;
- repeat
- write(' Enter Filename to Transmit: ');
- readln(filename);
- if length(filename)=0 then begin
- rmwin;
- exit;
- end;
- assign(textfile,filename);
- {$I-}
- reset(textfile);
- {$I+}
- ok:=(ioresult = 0);
- if not ok then
- writeln(' Cannot find file: ',filename);
- until ok;
- ascii_mode := true;
- gotoxy(1,2);
- clreol;
- writeln;
- writeln(' Lines Transmitted');
- writeln(' -----------------');
- clreol;
- while ( not eof(textfile) ) and continue_transfer do begin
- readln(textfile,textimage);
- image_cnt := succ(image_cnt);
- gotoxy(19,5);
- writeln(image_cnt:5);
- xmit_data(textimage+CRLF);
- end;
- xmit_data(^Z^K);
- close(textfile);
- writeln;
- write(' Waiting for buffer to drain...');
- repeat until sout_store_ptr = sout_read_ptr;
- ascii_mode := false;
- flush_sin_buff;
- rmwin;
- end;
-
- (****************************************************************************)
- (* VIEW FILE *)
- (****************************************************************************)
- procedure
- view_file;
- var
- cnt : byte;
- wlabel : labeltype;
- begin
- mkwin(33,4,77,10,'View File');
- gotoxy(1,3);
- repeat
- write(' Enter Filename to View: ');
- readln(filename);
- if length(filename)=0 then begin
- rmwin;
- exit;
- end;
- assign(textfile,filename);
- {$I-}
- reset(textfile);
- {$I+}
- ok:=(ioresult = 0);
- if not ok then
- writeln(' Cannot find file: ',filename);
- until ok;
- rmwin;
- wlabel := 'View File [' + filename + '], <End> To Stop.';
- mkwin(1,1,80,24,wlabel);
- cnt := -5;
- a_key := ' ';
- while ( not eof(textfile) )
- and ( a_key[1] <> #207 )
- do begin
- readln(textfile,textimage);
- if length(textimage) <= 77 then
- writeln(textimage)
- else
- write(copy(textimage,1,78));
- cnt := succ(cnt);
- if cnt = 16 then begin
- cnt:=0;
- write(' <<< MORE >>> ');
- repeat
- a_key := inkey;
- until a_key <> '';
- if length(a_key)>1 then
- a_key := chr(ord(a_key[2])+128);
- gotoxy(1,wherey);
- clreol;
- end;
- end;
- close(textfile);
- if ( cnt > 0 )
- and ( a_key[1] <> #207 )
- then begin
- writeln;
- wait_for_key;
- end;
- rmwin;
- end;
-
- (****************************************************************************)
- (* PRINT FILE *)
- (****************************************************************************)
- procedure
- page_heading;
- var
- i : byte;
- begin
- for i:=1 to 3 do writeln(lst);
- end;
-
- procedure
- print_file;
- var
- cnt : byte;
- begin
- mkwin(33,4,77,10,'Print File');
- gotoxy(1,3);
- repeat
- write(' Enter Filename to Print: ');
- readln(filename);
- if length(filename)=0 then begin
- rmwin;
- exit;
- end;
- assign(textfile,filename);
- {$I-}
- reset(textfile);
- {$I+}
- ok:=(ioresult = 0);
- if not ok then
- writeln(' Cannot find file: ',filename);
- until ok;
- writeln;
- writeln(' Make Printer Ready.');
- wait_for_key;
- writeln;
- writeln;
- write(' Printing... ');
- cnt := 0;
- page_heading;
- while not eof(textfile) do begin
- readln(textfile,textimage);
- writeln(lst,textimage);
- cnt := succ(cnt);
- if cnt = 60 then begin
- cnt:=0;
- write(lst,FF);
- page_heading;
- end;
- end;
- close(textfile);
- write(lst,FF);
- rmwin;
- end;
-
- (****************************************************************************)
- (* ENTER / LEAVE HALF DUPLEX *)
- (****************************************************************************)
- procedure
- toggle_duplex;
- begin
- if half_duplex then begin
- half_duplex := false;
- clear_pos(79,25);
- end
- else begin
- escape_win;
- half_duplex := true;
- gotoxy(79,25);
- write('H');
- reset_win;
- end;
- end;
-
- (****************************************************************************)
- (* CHANGE DIRECTORY AND DISK DRIVE *)
- (****************************************************************************)
- procedure
- new_directory_drive;
- var
- dd : char;
- dn : integer;
- curdir : string40;
- dstr : string10;
- begin
- mkwin(12,4,69,12,'Change Directory\Drive');
- dd:=default_drive;
- dn:=ord(dd) - pred( ord('A') );
- getdir(dn,curdir);
- writeln;
- writeln(' Current Drive\Directory: ',curdir);
- writeln;
- write(' Enter New Drive Letter : ');
- readln(dstr);
- if length(dstr)>0 then begin
- dd:=upcase(dstr[1]);
- if not (dd in [ 'A'..'D' ]) then
- dd:='A';
- change_drive(dd);
- end;
- repeat
- write(' Enter New Directory: ');
- readln(curdir);
- {$I-}
- if length(curdir)>0 then begin
- chdir(curdir);
- ok:=(ioresult = 0);
- if not ok then
- writeln(' Can''t access that directory!');
- end;
- {$I+}
- until ( ok ) or ( length( curdir ) = 0 );
- rmwin;
- end;
-
- (****************************************************************************)
- (* KILL FILE *)
- (****************************************************************************)
- procedure
- kill_file;
- begin
- mkwin(33,4,77,10,'Kill File');
- gotoxy(1,3);
- repeat
- write(' Enter Filename to Kill: ');
- readln(filename);
- if length(filename)=0 then begin
- rmwin;
- exit;
- end;
- assign(textfile,filename);
- {$I-}
- erase(textfile);
- {$I+}
- ok:=(ioresult = 0);
- if not ok then
- writeln(' Cannot kill file: ',filename);
- until ok;
- rmwin;
- end;
-
- (****************************************************************************)
- (* REWRITE DIAL ENTRIES *)
- (****************************************************************************)
- procedure
- rewrite_dial_entries;
- begin
- rewrite(dialfile);
- sort_curr := sort_first;
- dial_dir.no_of_dial_entries := 0;
- while sort_curr <> nil do begin
- dial_dir.no_of_dial_entries := succ(dial_dir.no_of_dial_entries);
- dial_dir.dir_entries[dial_dir.no_of_dial_entries] := sort_curr^.sort_rec;
- if dial_dir.no_of_dial_entries = max_dial_entries then begin
- write(dialfile,dial_dir);
- dial_dir.no_of_dial_entries := 0;
- end;
- sort_first := sort_curr;
- sort_curr := sort_curr^.sort_next;
- dispose(sort_first);
- end;
- if dial_dir.no_of_dial_entries > 0 then
- write(dialfile,dial_dir);
- end;
-
- (****************************************************************************)
- (* SORT DIAL ENTRIES *)
- (****************************************************************************)
- procedure
- sort_dial_entries( typ : integer );
- var
- flg : boolean;
- hold_rec : dialrec;
- swap : boolean;
- begin
- repeat
- flg := false;
- sort_curr := sort_first;
- sort_prev := sort_curr^.sort_next;
- while sort_prev <> nil do begin
- swap := false;
- case typ of
- 1 : begin
- if sort_curr^.sort_rec.bbs_name > sort_prev^.sort_rec.bbs_name then
- swap := true;
- end;
- 2 : begin
- if sort_curr^.sort_rec.bbs_number > sort_prev^.sort_rec.bbs_number then
- swap := true;
- end;
- end;
- if swap then begin
- flg := true;
- hold_rec := sort_prev^.sort_rec;
- sort_prev^.sort_rec := sort_curr^.sort_rec;
- sort_curr^.sort_rec := hold_rec;
- end;
- sort_curr := sort_curr^.sort_next;
- sort_prev := sort_prev^.sort_next;
- end;
- until not flg;
- end;
-
- (****************************************************************************)
- (* LOAD DIAL ENTRIES *)
- (****************************************************************************)
- procedure
- load_dial_entries( fs : integer );
- var
- i,j : integer;
- begin
- new(sort_first);
- sort_curr := sort_first;
- for i:=0 to fs do begin
- seek(dialfile,i);
- read(dialfile,dial_dir);
- for j:=1 to dial_dir.no_of_dial_entries do begin
- sort_curr^.sort_rec := dial_dir.dir_entries[j];
- new(sort_curr^.sort_next);
- sort_prev := sort_curr;
- sort_curr := sort_curr^.sort_next;
- end;
- end;
- dispose(sort_curr);
- sort_prev^.sort_next := nil;
- end;
-
- (****************************************************************************)
- (* SORT DIALING DIRECTORY *)
- (****************************************************************************)
- procedure
- sort_dialing_directory;
- var
- fsize : integer;
- typ : integer;
- begin
- mkwin(8,4,73,12,'Phone Directory Sort Type');
- gotoxy(10,2);
- write('1. Sort Into Ascending Sequence By Name.');
- gotoxy(10,4);
- write('2. Sort Into Ascending Sequence By Number.');
- gotoxy(10,7);
- write('Which do you want? ');
- typ := 0;
- read(typ);
- if not (typ in [ 1..2 ]) then
- typ := 1;
- rmwin;
- mkwin(10,5,71,11,'');
- gotoxy(23,3);
- write('S O R T I N G ');
- assign(dialfile,dial_PATH+'TMODEM.DIR');
- {$I-}
- reset(dialfile);
- {$I+}
- ok := (ioresult = 0);
- if ok then begin
- fsize := filesize(dialfile);
- if fsize > 0 then begin
- load_dial_entries( pred(fsize) );
- sort_dial_entries(typ);
- rewrite_dial_entries;
- close(dialfile);
- end;
- end;
- rmwin;
- end;
-
- (****************************************************************************)
- (* SEND FUNCTION KEY *)
- (****************************************************************************)
- procedure
- send_func_key( j : integer );
- var
- i : byte;
- c : char;
- begin
- i := 0;
- while i < length(func_key^[j]) do begin
- i := succ( i );
- c := func_key^[j][i];
- if c = comment_ch then
- exit;
- case c of
- '|' : store_sout_buffer( CR );
- '~' : delay( a_second );
- else
- store_sout_buffer( c );
- end;
- end;
- end;
-
- (****************************************************************************)
- (* MACRO KEY MAINTENANCE *)
- (****************************************************************************)
- procedure
- display_keys( Fn : integer );
- var
- i : byte;
- begin
- gotoxy(2,2);
- clreol;
- case Fn of
- 1 : writeln('< Unshifted >');
- 11 : writeln('< Shifted >');
- 21 : writeln('< Ctrl >');
- 31 : writeln('< Alt >');
- end;
- writeln;
- for i:=1 to 10 do begin
- clreol;
- writeln(i:3,'. ',func_key^[i+Fn-1]);
- end;
- end;
-
- procedure
- page_func_fwd(var Fn : integer);
- begin
- Fn := Fn + 10;
- if Fn > 40 then Fn := Fn - 40;
- display_keys(Fn);
- end;
-
- procedure
- page_func_bak(var Fn : integer);
- begin
- Fn := Fn - 10;
- if Fn < 1 then Fn := Fn + 40;
- display_keys(Fn);
- end;
-
- procedure
- macro_keys;
- var
- i : integer;
- flg : boolean;
- Fn : integer;
- begin
- flg := false;
- mkwin(1,3,80,20,'Function Keys. Use: | for CR, ~ for delay, '+comment_ch+' for comment.');
- Fn := 1;
- display_keys(Fn);
- gotoxy(1,16);
- write(' Enter: C=Chg, F=PgFwd, B=PgBak, Q=Quit. ');
- repeat
- gotoxy(42,16);
- clreol;
- repeat
- a_key := inkey;
- until a_key <> '';
- kbd_char := upcase( a_key[1] );
- case kbd_char of
- 'C' : begin
- write(' Which One? ');
- read(i);
- if ( i > 0 ) and ( i < 11 ) then begin
- flg := true;
- gotoxy(7,i+3);
- str_input(func_key^[i+Fn-1]);
- end;
- end;
- 'F' : page_func_fwd(Fn);
- 'B' : page_func_bak(Fn);
- end;
- until kbd_char = 'Q';
- if flg then begin
- assign(textfile,cnf_PATH+'TMODEM.KEY');
- rewrite(textfile);
- for i:=1 to 40 do writeln(textfile,func_key^[i]);
- close(textfile);
- end;
- rmwin;
- end;
-
- (****************************************************************************)
- (* EXECUTE KEYBOARD COMMAND *)
- (****************************************************************************)
- procedure
- underscore;
- begin
- gotoxy(13,wherey);
- write('--------');
- gotoxy(24,wherey);
- writeln('--------');
- end;
- procedure
- exec_command;
- begin
- case ch of
- #46 : toggle_capture_mode;
- #20 : begin
- mkwin(57,18,78,22,'');
- writeln;
- write(' Exit Program? ');
- yes_no := ' ';
- readln(yes_no);
- yes_no := upcase( yes_no[1] );
- if yes_no = 'Y' then exit_program := true;
- rmwin;
- end;
- #31 : change_comm_params;
- #19 : receive_file;
- #45 : transmit_file;
- #32 : dial_modem;
- #18 : toggle_duplex;
- #35 : give_help;
- #23 : reconfigure_defaults;
- #30 : ascii_transmission;
- #16 : hang_up;
- #38 : dir_list;
- #49 : new_directory_drive;
- #47 : view_file;
- #37 : kill_file;
- #34 : redial_modem;
- #50 : macro_keys;
- #24 : sort_dialing_directory;
- #17 : begin
- if split_screen[1]='T' then
- setup_split
- else
- clrscr;
- end;
- #21 : copy_file;
- #25 : print_file;
- #71 : send_str( ^['[H' ); { Home Key }
- #82 : send_str( ^['On' ); { Ins Key }
- #72 : begin
- if keypad_mode then
- send_str( ^['OA' )
- else
- send_str( ^['[A' );
- end;
- #80 : begin
- if keypad_mode then
- send_str( ^['OB' )
- else
- send_str( ^['[B' );
- end;
- #77 : begin
- if keypad_mode then
- send_str( ^['OC' )
- else
- send_str( ^['[C' );
- end;
- #75 : begin
- if keypad_mode then
- send_str( ^['OD' )
- else
- send_str( ^['[D' );
- end;
- #117 : send_str( ^['OS' ); { ^End }
- #79 : send_str( ^['OR' ); { End }
- #73 : send_str( ^['Or' ); { PgUp }
- #81 : send_str( ^['Oq' ); { PgDn }
- #15 : send_str( ^['Ox' ); { Shift Tab }
- #83 : store_sout_buffer( DEL );
- #44 : begin
- if monitor_mode then
- monitor_mode := false
- else
- monitor_mode := true;
- end;
- #114 : begin
- if printer_on then
- printer_on:=false
- else
- printer_on:=true;
- end;
- #33 : begin
- time_fix := time+' ';
- writeln(CRLF+'Time Fix : ',time_fix);
- end;
- #22 : begin
- writeln;
- gotoxy(13,wherey);
- write('Time Fix');
- gotoxy(24,wherey);
- writeln('Session');
- underscore;
- write('Starting : ',time_fix);
- gotoxy(24,wherey);
- writeln(dial_time);
- curr_time := time+' ';
- write('Current : ',curr_time);
- gotoxy(24,wherey);
- writeln(curr_time);
- underscore;
- write('Used : ',delta_time(time_fix,curr_time));
- gotoxy(24,wherey);
- writeln(delta_time(dial_time,curr_time));
- end;
- #48 : begin { Send Break }
- mkwin(15,8,66,14,'');
- gotoxy(21,3);
- write('Break');
- gotoxy(50,5);
- port[line_control_reg] := port[line_control_reg] or $40;
- delay( wait_increment );
- port[line_control_reg] := port[line_control_reg] and $BF;
- rmwin;
- end;
- #36 : begin; { ID Program }
- mkwin(15,8,66,14,'TMODEM, ver '+version);
- gotoxy(10,3);
- wait_for_key;
- rmwin;
- end;
- else
- if ch in [ #59..#68 ] then
- send_func_key( ord(ch) - 58 )
- else
- if ch in [ #84..#113 ] then
- send_func_key( ord(ch) - 73 );
- end;
- end;