Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/libsim/checke.sim
There is 1 other file named checke.sim in the archive. Click here to see a list.
OPTIONS(/C/E/-Q/-A/-I/-D);
COMMENT
The  text procedure CHECKEXTENSION may be used to add a default extension
to file specifications not containing a dot ('.').
I.e.
! T:- Copy("A");!   T:- CHECKEXTENSION(T,".SIM");
! will give T the value "A.SIM", while
! T:- Copy("A.");!   T:- CHECKEXTENSION(T,".SIM");
! will leave T unaltered.
! T:- Copy("LPT:");!   T:- CHECKEXTENSION(T,".SIM");
! will leave T unaltered.
! T:- Copy("LPT: A");!   T:- CHECKEXTENSION(T,".SIM");
! will give T the value "LPT: A.SIM".
;

EXTERNAL TEXT PROCEDURE conc,rest;
EXTERNAL CHARACTER PROCEDURE findtrigger;

    TEXT PROCEDURE checkextension(t,defaultextension);
    VALUE defaultextension;   TEXT t,defaultextension;
    IF t =/= NOTEXT THEN
    BEGIN   t.Setpos(1);
	IF findtrigger(t,Copy(":")) NE ':' OR
	rest(t).Strip =/= NOTEXT THEN
	BEGIN   t.Setpos(1);
	    IF Findtrigger(t,Copy(".")) NE '.' THEN
	    t:- conc(t,defaultextension) ELSE t.Setpos(1);
	END;
	checkextension:- t
    END of checkextension;