Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/libsim/rescan.mac
There is 1 other file named rescan.mac in the archive. Click here to see a list.
COMMENT | SIMULA specification;
OPTIONS(/E:QUICK,rescan);
BOOLEAN PROCEDURE rescan;
COMMENT A SIMULA program is normally started by some monitor command.
RESCAN backs up the TTY input buffer, if possible, so that the invoking
command can be reread.
If the command line can be reread, RESCAN returns TRUE, else FALSE.
The next input (of a line or a character) from the controlling TTY
(normally SYSIN) will return the command line which started the SIMULA
program, e g:
	RUN prog-<parameters>
The monitor command scanner allows command lines which contain extra
information not expected by the monitor itself. The extra information should be
preceded by a character which is not in the command syntax, like '-', '('.

RESCAN must be called BEFORE the first input from the terminal.
If RESCAN is to be used, file specifications cannot be taken from the terminal.
Any error dialogue before RESCAN is called will render it useless.
Also, you cannot expect RESCAN to work if you start the program directly
after loading by an EXECUTE or DEBUG command.
If you do not have the program in executable form, you should use
LOAD, then START <some info>.
Programs using RESCAN should always provide an alternative way of getting the
information.
Example (from SIMED):
! EXTERNAL BOOLEAN PROCEDURE rescan;
! EXTERNAL TEXT PROCEDURE scanto,rest,inline;
! TEXT initcommand,t;
! IF rescan THEN
! BEGIN Inimage;
!   t:-Sysin.Image.Strip;
!   IF t=/=NOTEXT THEN t:-Copy(t);
!   scanto('-'); ! t.Pos = 1 or after '-' in command line;
!   IF t.Pos > 1 THEN initcommand:- rest(t);
! END scanning command line;
! ...
! TEXT command;
! command:- IF initcommand =/= NOTEXT THEN initcommand
!           ELSE inline("*",Sysin);
! ...
! The command R SIMED-X.SIM[100,101]
! will yield initcommand = "X.SIM[100,101]", and
! just R SIMED will yield initcommand == NOTEXT, causing a
! prompting "*" to be output to show that a command is expected.
;

!|;! MACRO-10 code !|;!

	TITLE	rescan
	ENTRY	rescan
	SUBTTL	SIMULA utility, Lars Enderin Nov 1976

;!*** Copyright 1976 by the Swedish Defence Research Institute. ***
;!*** Copying is allowed.					***

	sall
	search	simmac,simmcr,simrpa

rescan:	PROC
	SETOM	(XTAC)	;! Initially TRUE result
	TTCALL	10,1	;! Cannot use the name RESCAN here
	CAIA		;! "Error" return if buffer contains command
	SETZM	(XTAC)	;! FALSE return if not
	RETURN
	EPROC
	LIT
	END;