! This macro uses features supplied in V35 or later of TECO INPUT.TEC March 23, 1980 By Robin Miller Common input routine. Q-Register usage: Inputs: $1 - Contains message to print. %2 - -1 = String input. 0 = Numeric input. >0 = Yes/No input ( defaults to No). Outputs: %3 - On String input, if asterisk (*) entered, Yes = -1 / No = 0 On Yes/No answers, Yes = -1 / No = 0 On numeric input, contains packed numeric value. %4 - Contains terminating character or . $4 - Contains text entered for both String and Numeric input. %5 - Contains ASCII code of first character input. Other Q-Register Usage: %0 - Used to save end of buffer position. %I - Used to save current buffer position. $5 - Contains characters. ! 13@^U5// 10@:^U5// ! for echoing ! @^U0_ Q2"L @:^U1% ? % ' ! Set up for String input ! Q2"E @:^U1% [D R:0.-32767. D:0.] % ' ! Set up for Numeric input ! Q2"G @:^U1%? [Y/N]: % ' ! Set up for Yes/No input ! ET#32768ET ! Catch Control C's ! <:G1 ! Issue prompt ! 0U3 0,0X4 ! Initialize save buffers ! !R1! ^TU4 ! Get next character ! ET&32768"F EX ' ! Exit if control C typed ! :Q4"E Q4U5 ' ! Save ASCII of first character ! Q4-13"E ^T^[ 0; ' ! If eat the line feed ! Q4-18"E ! Control R (^R) ? ! :G5 :G1 :G4 ! Yes, reprint prompt & string ! @O!R1! ! and go get next character ! ' Q4-21"E ! Control U (^U) ? ! ET&2"E :G5 ! Hardcopy, position on next line ! | 13^T 155^T ^^K^T ! else, clear line (VT52) ! ' F< ! and print prompt again ! ' Q4-26"E :G5 EX ' ! Exit if control Z typed ! Q4-27"E :G5 0; ' ! Exit if escape input ! Q4-127"E :Q4"G ! Delete or rubout ? ! .UI ZJ .U0 G4 ! Save dot and insert string ! ET&2"E -1A^T ! Hardcopy, echo character ! | 8^T 32^T 8^T ! Erase character from sceen ! -1A-32"L ! Control character ? ! 8^T 32^T 8^T ! Yes, erase one more char ! ' ' -D Q0,ZX4 Q0,ZK QIJ ' ! Remove from save buffer, ! @O!R1! ! and go get next character. ! ' ! Dispatch to appropriate subroutine. ! Q2"L @O!STRING! ' Q2"E @O!NUMBER! ' Q2"G @O!YESNO! ' !STRING! Q4-^^*"E -1U3 ' ! Indicate * was input ! Q4@:^U4// ! Save character ! @O!R1! !NUMBER! Q4"D | @O!ERROR! ' ! Ensure we have a number ! Q4-48U4 ! Subtract out bias ! :Q4"G (Q3*10)U3 ' ! Set placement (tenths, etc) ! (Q4+Q3)U3 ! Add in units ! Q4@:^U4// ! Save number ! Q3"L ! If negative, number too big ! @^A/Maximum number exceeded, please try again. / F< ' @O!R1! !YESNO! :Q4"G @O!R1! ' ! Skip all but first character ! Q4@^U4// ! Show first character received ! Q5&95-^^Y"E -1U3 @O!R1! ' ! Set indicator if "Y" ! Q5&95-^^N"E 0U3 @O!R1! | @O!ERROR! ' ! Error if not "N" ! !ERROR! @^A/ Invalid answer or terminator, please try again. / F< ' >_