Google
 

Trailing-Edge - PDP-10 Archives - tops20tools_v6_9-jan-86_dumper - tools/com/termin.com
There are 3 other files named termin.com in the archive. Click here to see a list.
$ save_verify := 'f$verify(command$debug)'
$!
$! TERMIN.COM
$! Emulate the TOPS-20 TERMINAL command
$! GMU	22-Aug-83 21:04	version 2.02
$!
$! Command syntax is:
$!
$!	TERMINAL keyword {parameters}
$!
$! see the label TERMINAL_HELP for a list of supported keywords
$!
$!
$!
$ on control_y then goto done			! No interrupts
$ no_flag = ""
$ no_switch = ""
START:
$ if p1 .eqs. "" .or. -
     p1 .eqs. "?" then goto terminal_help	! Give help if necessary
$ p1_length = 'f$length(p1)'			! Get size of parameter
$!
$!
$! Check for an argument whose first two characters are "VT", "LA",
$! "LQ", or "VK".  If a match is found, assume that the argument is a
$! terminal type and go directly to the TERMINAL TYPE code.
$!
$ if no_flag .nes. "" then goto decode_command_1
$ two_chars := 'f$extract(0,2,p1)'		! Get first two chars of arg
$ if two_chars .nes. "VT" .and. -
     two_chars .nes. "LA" .and. -
     two_chars .nes. "LQ" .and. -
     two_chars .nes. "VK" then goto decode_command
$ p2 := 'p1'					! Copy parameter
$ goto set_type					! Go directly to code
$!
$!
$! Check the parameters against those that we know about and jump directly
$! to the processing routine when a match is found.  Note that the order
$! of checking is such that "NO" is an illegal parameter for those commands
$! that don't take it.
$!
$!
DECODE_COMMAND:
$ if p1 .eqs. f$extract(0,p1_length,"FULLDUPLEX") then	goto fullduplex
$ if p1 .eqs. f$extract(0,p1_length,"HALFDUPLEX") then	goto halfduplex
$ if p1 .eqs. f$extract(0,p1_length,"LENGTH") then	goto length
$ if p1 .eqs. f$extract(0,p1_length,"SPEED") then	goto speed
$ if p1 .eqs. f$extract(0,p1_length,"TYPE") then	goto type
$ if p1 .eqs. f$extract(0,p1_length,"WIDTH") then	goto width
$ if p1 .eqs. "NO" then					goto no_command
DECODE_COMMAND_1:
$ if p1 .eqs. f$extract(0,p1_length,"FLAG") then	goto flag
$ if p1 .eqs. f$extract(0,p1_length,"FORMFEED") then	goto formfeed
$ if p1 .eqs. f$extract(0,p1_length,"IMMEDIATE") then	goto immediate
$ if p1 .eqs. f$extract(0,p1_length,"INDICATE") then	goto indicate
$ if p1 .eqs. f$extract(0,p1_length,"LOWERCASE") then	goto lowercase
$ if p1 .eqs. f$extract(0,p1_length,"PAGE") then	goto page
$ if p1 .eqs. f$extract(0,p1_length,"PAUSE") then	goto pause
$ if p1 .eqs. f$extract(0,p1_length,"RAISE") then	goto raise
$ if p1 .eqs. f$extract(0,p1_length,"TABS") then	goto tabs
$!
$!
$! Here if there was no match with any of the parameters.  It's either
$! total junk or a valid VMS command.  Assume the latter and execute it.
$!
$ if p2 .nes. "" then p1 = "''p1'=''p2'"
$ set termina/'no_switch''p1'
$ goto done
$!
$!
$! Individual command processors begin here
$!
$!
$! TERMINAL (MODE IS) FLAG (UPPER CASE OUTPUT)
$! TERMINAL (MODE IS) NO FLAG (UPPER CASE OUTPUT)
$!
FLAG:
$ if p2 .eqs. "?" then goto flag_help
$ goto done
$!
FLAG_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'flag (upper case output [no-op]) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'flag (upper case output [no-op]) "
$ goto flag
$!
$!
$! TERMINAL (MODE IS) FORMFEED (EXISTS ON TERMINAL)
$! TERMINAL (MODE IS) NO FORMFEED (EXISTS ON TERMINAL)
$!
FORMFEED:
$ if p2 .eqs. "?" then goto formfeed_help
$ set terminal/'no_switch'formfeed
$ goto done
$!
FORMFEED_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'formfeed (exists on terminal [no-op]) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'formfeed (exists on terminal [no-op]) "
$ goto formfeed
$!
$!
$! TERMINAL (MODE IS) FULLDUPLEX (MODE FOR TERMINAL)
$!
FULLDUPLEX:
$ if p2 .eqs. "?" then goto fullduplex_help
$ set terminal/fulldup
$ goto done
$!
FULLDUPLEX_HELP:
$ write sys$output -
  "$ Terminal (mode is) fullduplex (exists on terminal) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) fullduplex (exists on terminal) "
$ goto fullduplex
$!
$!
$! TERMINAL (MODE IS) HALFDUPLEX (EXISTS ON TERMINAL)
$!
HALFDUPLEX:
$ if p2 .eqs. "?" then goto halfduplex_help
$ set terminal/halfdup
$ goto done
$!
HALFDUPLEX_HELP:
$ write sys$output -
  "$ Terminal (mode is) halfduplex (exists on terminal) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) halfduplex (exists on terminal) "
$ goto halfduplex
$!
$!
$! TERMINAL (MODE IS) IMMEDIATE (ECHO MODE)
$! TERMINAL (MODE IS) NO IMMEDIATE (ECHO MODE)
$!
IMMEDIATE:
$ if p2 .eqs. "?" then goto immediate_help
$ goto done
$!
IMMEDIATE_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'immediate (echo mode [no-op]) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'immediate (echo mode [no-op]) "
$ goto immediate
$!
$!
$! TERMINAL (MODE IS) INDICATE (FORMFEED)
$! TERMINAL (MODE IS) NO INDICATE (FORMFEED)
$!
INDICATE:
$ if p2 .eqs. "?" then goto indicate_help
$ goto done
$!
INDICATE_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'indicate (formfeed [no-op]) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'indicate (formfeed [no-op]) "
$ goto indicate
$!
$!
$! TERMINAL (MODE IS) LENGTH (OF PAGE IS) n
$!
LENGTH:
$ if p2 .eqs. "?" .or. -
     p2 .eqs. "" then goto length_help
$ set terminal/page='p2'
$ goto done
$!
LENGTH_HELP:
$ write sys$output -
  "$ Terminal (mode is) length (of page is) ? Length of page in decimal"
$ inquire/nopunctuation p2 "$ Terminal (mode is) length (of page is) "
$ goto length
$!
$!
$! TERMINAL (MODE IS) LOWERCASE (EXISTS ON TERMINAL)
$!
LOWERCASE:
$ if p2 .eqs. "?" then goto lowercase_help
$ set terminal/'no_switch'lowercase
$ goto done
$!
LOWERCASE_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'lowercase (exists on terminal) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'lowercase (exists on terminal) "
$ goto lowercase
$!
$!
$! TERMINAL (MODE IS) NO xxx
$!
NO_COMMAND:
$ no_flag = "no "
$ no_switch = "no"
$ if p2 .eqs. "?" then goto no_command_help
$ p1 := 'p2'
$ p2 := 'p3'
$ p3 := 'p4'
$ p4 := 'p5'
$ p5 := 'p6'
$ p6 := 'p7'
$ p7 := 'p8'
$ p8 := ""
$ p1_length = 'f$length(p1)'
$ goto decode_command_1
$!
$!
$! TERMINAL (MODE IS) PAGE (MODE) {n}
$! TERMINAL (MODE IS) NO PAGE (MODE)
$!
PAGE:
$ if p2 .eqs. "?" then goto page_help
$ if p2 .nes. "" then -
     set terminal/page='p2'
$ goto done
$!
PAGE_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'page (mode) ? Carriage return or page length"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'page (mode) "
$ goto page
$!
$!
$! TERMINAL (MODE IS) PAUSE (MODE)
$! TERMINAL (MODE IS) NO PAUSE (MODE)
$!
PAUSE:
$ if p2 .eqs. "?" then goto pause_help
$ goto done
$!
PAUSE_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'pause (mode [no-op]) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'pause (mode [no-op]) "
$ goto pause
$!
$!
$! TERMINAL (MODE IS) RAISE (TERMINAL INPUT)
$! TERMINAL (MODE IS) NO RAISE (TERMINAL INPUT)
$!
RAISE:
$ if p2 .eqs. "?" then goto raise_help
$ goto done
$!
RAISE_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'raise (terminal input [no-op]) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'raise (terminal input [no-op]) "
$ goto raise
$!
$!
$! TERMINAL (MODE IS) SPEED (of input and output) n
$!
SPEED:
$ if p2 .eqs. "?" .or. -
     p2 .eqs. "" then goto speed_help
$ set terminal/speed='p2'
$ goto done
$!
SPEED_HELP:
$ write sys$output -
  "$ Terminal (mode is) speed (of input and output) ? Baud rate"
$ inquire/nopunctuation p2 "$ Terminal (mode is) speed (of input and output) "
$ goto speed
$!
$!
$! TERMINAL (MODE IS) TABS (EXIST ON TERMINAL)
$! TERMINAL (MODE IS) NO TABS (EXIST ON TERMINAL)
$!
TABS:
$ if p2 .eqs. "?" then goto tabs_help
$ set terminal/'no_switch'tab
$ goto done
$!
TABS_HELP:
$ write sys$output -
  "$ Terminal (mode is) ''no_flag'tabs (exist on terminal) ? Confirm with carriage return"
$ inquire/nopunctuation p2 "$ Terminal (mode is) ''no_flag'tabs (exist on terminal) "
$ goto tabs
$!
$!
$! TERMINAL (MODE IS) TYPE
$!
TYPE:
$ if p2 .eqs. "?" .or. -
     p2 .eqs. "" then goto type_help
SET_TYPE:
$ set terminal/device_type='p2'
$ goto done
$!
TYPE_HELP:
$ write sys$output -
  "$ Terminal (mode is) type ? Terminal type"
$ inquire/nopunctuation p2 "$ Terminal (mode is) type "
$ goto type
$!
$!
$! TERMINAL (MODE IS) WIDTH (OF LINE IS)
$!
WIDTH:
$ if p2 .eqs. "?" then goto width_help
$ set terminal/width='p2'
$ goto done
$!
WIDTH_HELP:
$ write sys$output -
  "$ Terminal (mode is) width (of line is) ? Terminal line width in decimal"
$ inquire/nopunctuation p2 "$ Terminal (mode is) width (of line is) "
$ goto width
$!
$!
$! Here to clean up and exit
$!
$!
DONE:
$ save_verify := 'f$verify(save_verify)'
$ exit
$!
$!
$! Here to help the user
$!
$!
TERMINAL_HELP:
$ write sys$output "$ Terminal (mode is) ? One of the following:"
$!	!	!	!	!	!	!	!	!	!
$ write sys$output -
 "  FLAG			FORMFEED		FULLDUPLEX"
$ write sys$output -
 "  HALFDUPLEX		IMMEDIATE		INDICATE"
$ write sys$output -
 "  LENGTH		LOWERCASE		NO"
$ write sys$output -
 "  PAGE			PAUSE			RAISE"
$ write sys$output -
 "  SPEED			TABS			TYPE"
$ write sys$output -
 "  WIDTH"
$ write sys$output -
 "  or specific terminal type"
TERMINAL_HELP_1:
$ write sys$output -
 "  or VMS ""set terminal"" switch and optional value"
$ inquire/nopunctuation p1 "$ Terminal (mode is) ''no_flag'"
$!
$ if p1 .eqs. "" then goto done
$ p2 = ""					! Initialize p2
$ p3 = ""					!  and p3
$ space = 'f$locate(" ",p1)'			! Find space in input
$ length = 'f$length(p1)'			! Get length
$ if space .eq. length then goto start		! If only one parameter, continue
$ save_par := 'p1'				! Save original input
$ p1 := 'f$extract(0,space,save_par)'		! Extract just first parameter
$ space = space + 1				! Step past space
$ p2 := 'f$extract(space,length,save_par)	! Extract 2nd parameter
$ space = 'f$locate(" ",p2)'			! Find space in input
$ length = 'f$length(p2)'			! Get length
$ if space .eq. length then goto start		! If only one parameter, continue
$ save_par := 'p2'				! Save original input
$ p2 := 'f$extract(0,space,save_par)'		! Extract just first parameter
$ space = space + 1				! Step past space
$ p3 := 'f$extract(space,length,save_par)	! Extract 3rd parameter
$ goto start
$!
$! Here for help on the NO keyword
$!
NO_COMMAND_HELP:
$ write sys$output "$ Terminal (mode is) no ? One of the following:"
$!	!	!	!	!	!	!	!	!	!
$ write sys$output -
 "  FLAG			FORMFEED		IMMEDIATE"
$ write sys$output -
"  INDICATE		LOWERCASE		PAGE"
$ write sys$output -
"  PAUSE			RAISE			TABS"
$ goto terminal_help_1