Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/23/getvis.sim
There are 4 other files named getvis.sim in the archive. Click here to see a list.
00010	! written by Mats Wallin, FOA 142, 78-07-25 ;
00020	OPTIONS(/e);
00030	EXTERNAL BOOLEAN PROCEDURE meny, rescan, tmpout;
00040	EXTERNAL INTEGER PROCEDURE checkint, search, sscan;
00050	EXTERNAL TEXT PROCEDURE compress, conc, scanto, storbokstav, tmpin;
00060	EXTERNAL REF (Infile) PROCEDURE findinfile;
00070	EXTERNAL CLASS termty;
00080	
00090	! This procedure is used to get values for some of the parameters
00100	! before a call of the (external) class vista. The procedure tries
00110	! to determine the TTY-type by looking in the following places:
00120	! (in ascending priority order)
00130	!
00140	! 1. File SWITCH.INI on user ppn, line labeled TERMINAL
00150	! 2. TMPCORE file TMP:TRM
00160	! 3. The monitorcommand starting the program, using rescan.
00170	! 4. If not yet found, or false info, ask the user.
00180	!
00190	! In addition, if there is no info on TMP:TRM or info is provided
00200	! by the user via rescan or directly by this procedure the procedure
00210	! creates TMP:TRM and writes on it the info found.
00220	!
00230	! NOTE: If you would like to use rescan in your program,
00240	! instead of the expression: IF rescan THEN ...
00250	! you should use the expression:
00260	! IF Sysin.Image.Strip =/= NOTEXT THEN ...
00270	! and then NOT call Inimage, as that is already done by this procedure.
00280	! That is possible only if info was found according to 1-3 above.
00290	!
00300	!  Example of use:
00310	!
00320	!  .
00330	!  .
00340	!  INTEGER a, b, c;
00350	!  TEXT t;
00360	!  getvistaparameters(a, b, c, t);
00370	!  vista (a, b, Sysin, Sysout, FALSE, c, t, NOTEXT) BEGIN
00380	!  .
00390	!  .
00400	!
00410	!  Extra external procedures required: (not in vista)
00420	!  boolean rescan, integer search, sscan,
00430	!  text compress, conc, ref (infile) findinfile;
     
00440	PROCEDURE getvistaparameters(chars, lines, termnr, message);
00450	NAME chars, lines, termnr, message;
00460	INTEGER chars, lines, termnr; TEXT message;
00470	INSPECT NEW termty DO BEGIN
00480	    TEXT ARRAY arg, key[1:7];
00490	    INTEGER i, position, cc, ll, tt, alf, dca;
00500	    BOOLEAN writetmp;
00510	    TEXT txt;
00520	
00530	    TEXT PROCEDURE taltext(i); INTEGER i;
00540	    BEGIN
00550	        TEXT t;
00560	        t:- Blanks(IF i < 10 THEN 1
00570	        ELSE IF i < 100 THEN 2 ELSE 3);
00580	        t.Putint(i);
00590	        taltext:- t;
00600	    END;
00610	
00620	    PROCEDURE kontroll(bool); BOOLEAN bool;
00630	    BEGIN
00640		PROCEDURE testa_nytt_v{rde(minne, num);
00650		NAME minne; INTEGER minne, num;
00660		IF arg[num] =/= NOTEXT THEN BEGIN
00670		    minne:= num;
00680		    arg[num]:- NOTEXT;
00690		END;
00700	
00710	        writetmp:= bool;
00720		FOR i:= 4, 5 DO testa_nytt_v{rde(alf, i);
00730		FOR i:= 6, 7 DO testa_nytt_v{rde(dca, i);
00740	    END;
00750	
00760	    key[1]:- Copy("/T:/L:/C:/ALF/-ALF/DCA/-DCA");
00770	    key[2]:- key[1].Sub(4, 3);
00780	    key[3]:- key[1].Sub(7, 3);
00790	    key[4]:- key[1].Sub(10, 4);
00800	    key[5]:- key[1].Sub(14, 5);
00810	    key[6]:- key[1].Sub(19, 4);
00820	    key[7]:- key[1].Sub(23, 5);
00830	    key[1]:- key[1].Sub(1, 3);
     
00840	    ! unders`k filen SWITCH.INI ;
00850	    INSPECT findinfile("SWITCH.INI") DO BEGIN
00860	        Open(Blanks(80));
00870	        txt:- Image.Sub(1, 5);
00880	        Inimage;
00890	        WHILE NOT (Endfile OR storbokstav(txt) = "TERMI") DO Inimage;
00900	        IF NOT Endfile THEN BEGIN
00910	            txt:- Image.Strip;
00920	            scanto(txt, ' ');
00930	            txt:- txt.Sub(txt.Pos, txt.Length - txt.Pos + 1);
00940	            sscan(txt, 7, arg, key, 1);
00950	            kontroll(TRUE);
00960	        END;
00970	    END;
00980	
00990	    ! unders`k TMP:TRM ;
01000	    txt:- tmpin("TRM", FALSE);
01010	    IF txt.Strip =/= NOTEXT THEN BEGIN
01020	        txt:- scanto(txt, Char(13));
01030	        sscan(txt, 7, arg, key, 1);
01040	        kontroll(FALSE);
01050	    END;
01060	
01070	    ! unders`k kommandoraden ;
01080	    IF rescan THEN BEGIN
01090	        Inimage;
01100	        txt:- Sysin.Image.Strip;
01110	        scanto(txt, '-');
01120	        IF txt.Pos > 1 THEN BEGIN
01130	            txt:- txt.Sub(txt.Pos, txt.Length - txt.Pos + 1);
01140	            sscan(txt, 7, arg, key, 0);
01150	            kontroll(TRUE);
01160	        END;
01170	    END;
01180	
01190	    IF arg[1].Strip == NOTEXT THEN arg[1]:- Copy("Mats Wallin");
01200	    ! so that meny shall not yeild TRUE when arg[1] == NOTEXT ;
01210	    IF meny(arg[1], tt, tr, 21) THEN txt:- arg[1] ELSE tt:= 0;
01220	    IF checkint(arg[2]) = 1 THEN ll:= arg[2].Getint;
01230	    IF checkint(arg[3]) = 1 THEN cc:= arg[3].Getint;
     
01240	    WHILE tt <= 0 DO BEGIN
01250	        type_menu;
01260	        Outtext("(Other) display.");
01270	        Outimage;
01280	        Outtext("Switches: /DCA or /-DCA = Direct Cursor Adressing,"
01290	        "/ALF or /-ALF = Auto LF"); Outimage;
01300	        Inimage;
01310	        txt:- Sysin.Image.Strip;
01320	        IF txt =/= NOTEXT THEN BEGIN
01330	            sscan(txt, 7, arg, key, 1);
01340	            kontroll(TRUE);
01350	        END;
01360	        txt.Setpos(1); txt:- scanto(txt, '/');
01370	        IF txt == NOTEXT THEN txt:- Copy("Mats Wallin");
01380	        IF NOT meny(txt, tt, tr, 21) THEN BEGIN
01390	            Outtext(IF tt = -1 THEN "Your answer was ambiguous!"
01400	            ELSE "The computer did not understand!"); Outimage;
01410	            Outtext("Please give another answer:"); Outimage;
01420	        END;
01430	    END;
01440	    IF ll = 0 THEN ll:= ldefault(tt);
01450	    WHILE ll = 0 DO BEGIN
01460	        Outtext("Give screen height (that you want): "); Breakoutimage;
01470	        Inimage;
01480	        IF checkint(Sysin.Image) = 1 THEN ll:= Inint;
01490	    END;
01500	    IF cc = 0 THEN cc:= cdefault(tt);
01510	    WHILE cc <= 0 DO BEGIN
01520	        Outtext("Give screen width: "); Breakoutimage;
01530	        Inimage;
01540	        IF checkint(Sysin.Image) = 1 THEN cc:= Inint - 1;
01550	    END;
01560	    txt:- conc(tr[tt], key[2], taltext(ll), key[3], taltext(cc));
01570	    position:= txt.Length;
01580	    FOR i:= alf, dca DO IF i > 0 THEN txt:- conc(txt, key[i]);
01590	    IF txt.Length > position THEN
01600	    message:- txt.Sub(position + 1, txt.Length - position);
01610	    IF writetmp THEN tmpout("TRM", txt);
01620	    chars:= cc; lines:= ll; termnr:= tt;
01630	END;