PROGRAM Signs; {$c-} {$i signs0.pas} PROCEDURE GOTORC(R,C : INTEGER); BEGIN GOTOXY(C,R); {I prefer Row,Column over Column, Row} END; PROCEDURE main; LABEL finis,restrt; VAR ans2,ans : CHAR; {entered char} text_input : S80; {to build line into} hex_string : S80; {hex builder} done,ff_open : BOOLEAN; {flags} i : INTEGER; {loop control} output_err : BOOLEAN; {if can't output correctly} BEGIN done := FALSE; ff_open := FALSE; text_input := ''; parm_menu(ff_open); ask_parm(ff_open); input_menu; WHILE NOT done DO BEGIN restrt: READ(kbd,ans); CLREOL; CASE ans OF ^P : BEGIN {change parameters} ask_parm(ff_open); GOTORC(19,42); CLREOL; input_menu; WRITE(text_input); END; ^D,^C : done := TRUE; {done program} ^A : BEGIN inp_hex(hex_string); text_input := text_input + hex_string; GOTORC(19,14+LENGTH(text_input)) END; ^L,^F : BEGIN {formfeed to printer} GOTORC(19,42); IF output_device = printer THEN BEGIN WRITE(lst,^L); WRITE('Formfeed sent to printer.') END ELSE WRITE('Output is not directed to printer!'^G); {end} GOTORC(19,14+LENGTH(text_input)) END; ^R,^T : BEGIN {move back to TOF (reverse formfeed)} GOTORC(19,42); IF output_device = printer THEN BEGIN WRITE(lst,CHR(27),'G0$',CHR(27),'H0$'); WRITE('Moving print-head back to TOF.') END ELSE WRITE('Output is not directed to printer!'^G); {end} GOTORC(19,14+LENGTH(text_input)) END; ^H,#127 : BEGIN {backspace once} IF LENGTH(text_input) > 0 THEN BEGIN DELETE(text_input,LENGTH(text_input),1); WRITE(^H,' ',^H) END END; ^X : BEGIN {cancel line, start over} FOR i := 1 TO LENGTH(text_input) DO WRITE(^H,' ',^H); text_input := '' END; ^M : BEGIN {go ahead, process input line} output_err := FALSE; IF (LENGTH(text_input) = 0) AND (input_device <> text_file) THEN BEGIN GOTORC(19,42); CLREOL; WRITE('Do you want to quit? (Y/N) -> '^G); READ(kbd,ans2); GOTORC(19,42); CLREOL; GOTORC(19,14+LENGTH(text_input)); IF ans2 IN ['y','Y'] THEN GOTO finis ELSE GOTO restrt END; GOTORC(1,48); WRITE('Processing'); IF output_device = printer THEN set_up_prt(FALSE); IF block_type = bit THEN FOR i := 1 TO Max_Length DO gout_line[i] := CHR(0); IF input_device = text_file THEN BEGIN FOR i := 1 TO num_copies DO BEGIN WHILE NOT EOF(in_file) DO BEGIN READLN(in_file,text_input); IF output_device <> screen THEN BEGIN GOTORC(19,1); lowvideo; WRITE('Reading from file -> '); normvideo; CLREOL; WRITE(text_input) END; IF sign_type = sign THEN out_sign(text_input,output_err) ELSE out_banner(text_input); {end if sign} IF block_type = bit THEN FOR i := 1 TO Max_Length DO gout_line[i] := CHR(0) END; {while not eof} IF output_device = printer THEN WRITE(lst,^L); RESET(in_file) END {for each copy wanted} END ELSE IF sign_type = sign THEN out_sign(text_input,output_err) ELSE out_banner(text_input); {end if sign} {end if input from file} IF (NOT output_err) OR (input_device = text_file) THEN IF output_device = screen THEN BEGIN GOTORC(24,1); CLREOL; WRITE('Strike any key to continue ...'); READ(kbd,ans); parm_menu(ff_open) END ELSE BEGIN GOTORC(19,1); CLREOL; GOTORC(24,1); CLREOL END; {end if err} input_menu; WRITE(text_input) END {process line} ELSE BEGIN {otherwise put entry into input line} text_input := text_input + ans; WRITE(ans) END END {case} END; {while not done} finis: {all done, close appropriate files} GOTORC(19,42); WRITE(''); IF output_device = printer THEN set_up_prt(TRUE); IF output_device = recd_file THEN CLOSE(out_file); IF ff_open THEN CLOSE(font_file); IF input_device = text_file THEN CLOSE(in_file) END; {PROCEDURE main} {$i signs1.pas} {$i signs2.pas} {$i signs3.pas} {$i signs4.pas} PROCEDURE parm_menu; {font_f_open : BOOLEAN} BEGIN CLRSCR; WRITE('Signs'); lowvideo; WRITE(' Version: ',Date); GOTORC(1,42); WRITE('Mode:'); GOTORC(3,1); WRITE(' Options and I/O Parameters'); IF font_f_open THEN disp_fs; normvideo; disp := FALSE; disp_f; disp_t; disp_b; disp_w; disp_h; disp_m; disp_g; disp_v; disp_x; disp_y; disp_i; disp_o; disp_q; disp := TRUE; avail_space END; {Procedure parm_menu} PROCEDURE ask_parm; { (VAR font_f_open : BOOLEAN) } VAR ans : CHAR; {used for single char inut} done,out_f_open : BOOLEAN; {flags} old_ff,old_of : STRING[14]; {old filenames upon input or procedure} BEGIN GOTORC(1,48); WRITE('Change Parms'); GOTORC(16,42); CLREOL; GOTORC(17,42); CLREOL; GOTORC(20,1); CLREOL; GOTORC(21,1); CLREOL; GOTORC(22,1); CLREOL; GOTORC(5,1); WRITE('F'); GOTORC(6,1); WRITE('T'); GOTORC(7,1); WRITE('B'); GOTORC(8,1); WRITE('W'); GOTORC(9,1); WRITE('H'); GOTORC(10,1); WRITE('M'); GOTORC(11,1); WRITE('G'); GOTORC(12,1); IF given_offset = 0 THEN WRITE('A'); GOTORC(13,1); WRITE('V'); GOTORC(14,1); WRITE('X,'); GOTORC(4,42); WRITE('Y'); GOTORC(5,42); WRITE('I'); IF input_device = text_file THEN BEGIN GOTORC(6,42); WRITE('R'); GOTORC(7,42); WRITE('N') END; GOTORC(8,42); IF given_width = 0 THEN WRITE('S'); GOTORC(9,42); WRITE('O'); GOTORC(10,42); IF output_device = recd_file THEN WRITE('E'); IF output_device = printer THEN BEGIN GOTORC(10,42); WRITE('P'); GOTORC(11,42); WRITE('L'); GOTORC(12,42); WRITE('C'); GOTORC(13,42); WRITE('D') END; GOTORC(14,42); WRITE('Q'); IF output_device = recd_file THEN out_f_open := TRUE ELSE out_f_open := FALSE; old_of := out_fn; old_ff := font_fn; done := FALSE; WHILE NOT done DO BEGIN GOTORC(20,1); lowvideo; WRITE('Enter option letter -> '); normvideo; READ(kbd,ans); GOTORC(20,1); CLREOL; lowvideo; CASE ans OF ^M,'x','X' : ask_x(done,font_f_open,out_f_open,old_ff,old_of); {check if done and if so, return to input} 'F','f' : ask_f; {change font filename} 'T','t' : ask_t; {change sign type} 'B','b' : ask_b; {change block/letter type} 'W','w' : ask_w; {change width of output graphic characters} 'H','h' : ask_h; {change height of output graphic characters} 'M','m' : ask_m; {enter a given left margin to use} 'A','a' : ask_a; {change auto-centering on/off} 'V','v' : ask_v; {change inverse video on/off} 'Y','y' : ask_y; {change intercharacter spacing} 'G','g' : ask_g; {change the maximum width of output line in characters} 'I','i' : ask_i; {change input device} 'R','r' : ask_r; {change read from input filename} 'N','n' : ask_n; {change number of copyies desired} 'O','o' : ask_o; {change output device} 'E','e' : ask_e; {change output record filename} 'S','s' : ask_s; {change output device size} 'P','p' : ask_p; {change printer characters/inch} 'L','l' : ask_l; {change printer lines/inch} 'C','c' : ask_c; {change printer color} 'D','d' : ask_d; {change dumb printer on/off} 'Q','q' : ask_q; {abort exit} ELSE BEGIN {not a menu option} GOTORC(19,42); WRITE('Unrecognized code entered ->',ans,'<-'^G); END END; {case} GOTORC(20,1); CLREOL; GOTORC(21,1); CLREOL; GOTORC(22,1); CLREOL END; {while not done} normvideo END; {procedure ask_parm} BEGIN main; GOTORC(24,1); WRITE('<<< Signs completed >>>') END.