Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-04 - decus/20-0135/10/getvis.sim
There are 4 other files named getvis.sim in the archive. Click here to see a list.
00100	! GETVISTAPARAMETERS, written by Mats Wallin, FOA 142, 78-07-25 ;
00200	OPTIONS(/E/-A/-D/-I);
00300	EXTERNAL BOOLEAN PROCEDURE meny, rescan, tmpout;
00400	EXTERNAL INTEGER PROCEDURE checkint, search, sscan;
00500	EXTERNAL TEXT PROCEDURE compress, conc, scanto, storbokstav, tmpin;
00600	EXTERNAL REF (Infile) PROCEDURE findinfile;
00700	EXTERNAL CLASS termty;
00800	
00900	! This procedure is used to get values for some of the parameters
01000	! before a call of the (external) class VISTA. The procedure tries
01100	! to determine the TTY type by looking in the following places:
01200	! (in ascending priority order)
01300	!
01400	! 1. File SWITCH.INI on user ppn, line labeled TERMINAL
01500	! 2. TMPCORE file TMP:TRM
01600	! 3. The monitor command starting the program, using RESCAN.
01700	! 4. If not yet found, or false info, ask the user.
01800	!
01900	! In addition, if there is no info on TMP:TRM or info is provided
02000	! by the user via RESCAN or directly by this procedure. The procedure
02100	! creates TMP:TRM and writes on it the info found.
02200	!
02300	! NOTE: If you would like to use RESCAN in your program,
02400	! instead of the expression: IF rescan THEN ...
02500	! you should use the expression:
02600	! IF Sysin.Image.Strip =/= NOTEXT THEN ...
02700	! and then NOT call Inimage, as that is already done by this procedure.
02800	! That is possible only if info was found according to 1-3 above.
02900	!
03000	!  Example of use:
03100	!
03200	!  .
03300	!  .
03400	!  INTEGER a, b, c;
03500	!  TEXT t;
03600	!  getvistaparameters(a, b, c, t);
03700	!  vista (a, b, Sysin, Sysout, FALSE, c, t, NOTEXT) BEGIN
03800	!  .
03900	!  .
04000	!
04100	!  Extra external procedures required: (not in vista)
04200	!  BOOLEAN rescan, INTEGER search, sscan,
04300	!  TEXT compress, conc, REF (Infile) findinfile;
     
04400	PROCEDURE getvistaparameters(chars, lines, termnr, message);
04500	NAME chars, lines, termnr, message;
04600	INTEGER chars, lines, termnr; TEXT message;
04700	INSPECT NEW termty DO BEGIN
04800	    TEXT ARRAY arg, key[1:7];
04900	    INTEGER i, position, cc, ll, tt, alf, dca;
05000	    BOOLEAN writetmp;
05100	    TEXT txt;
05200	
05300	    TEXT PROCEDURE numbertext(i); INTEGER i;
05400	    BEGIN
05500	        TEXT t;
05600	        t:- Blanks(IF i < 10 THEN 1
05700	        ELSE IF i < 100 THEN 2 ELSE 3);
05800	        t.Putint(i);
05900	        numbertext:- t;
06000	    END;
06100	
06200	    PROCEDURE check(bool); BOOLEAN bool;
06300	    BEGIN
06400	        PROCEDURE test_new_value(mem, num);
06500	        NAME mem; INTEGER mem, num;
06600	        IF arg[num] =/= NOTEXT THEN BEGIN
06700	            mem:= num;
06800	            arg[num]:- NOTEXT;
06900	        END;
07000	
07100	        writetmp:= bool;
07200	        FOR i:= 4, 5 DO test_new_value(alf, i);
07300	        FOR i:= 6, 7 DO test_new_value(dca, i);
07400	    END;
07500	
07600	    txt:- Copy("/T:/L:/C:/ALF/-ALF/DCA/-DCA");
07700	    key[1]:- txt.Sub(1, 3);
07800	    key[2]:- txt.Sub(4, 3);
07900	    key[3]:- txt.Sub(7, 3);
08000	    key[4]:- txt.Sub(10, 4);
08100	    key[5]:- txt.Sub(14, 5);
08200	    key[6]:- txt.Sub(19, 4);
08300	    key[7]:- txt.Sub(23, 5);
     
08400	    ! Check file SWITCH.INI ;
08500	    INSPECT findinfile("SWITCH.INI") DO BEGIN
08600	        Open(Blanks(80));
08700	        txt:- Image.Sub(1, 5);
08800	        Inimage;
08900	        WHILE NOT (Endfile OR storbokstav(txt) = "TERMI") DO Inimage;
09000	        IF NOT Endfile THEN BEGIN
09100	            txt:- Image.Strip;
09200	            scanto(txt, ' ');
09300	            txt:- txt.Sub(txt.Pos, txt.Length - txt.Pos + 1);
09400	            sscan(txt, 7, arg, key, 1);
09500	            check(TRUE);
09600	        END;
09700	    END;
09800	
09900	    ! Check TMP:TRM ;
10000	    txt:- tmpin("TRM", FALSE);
10100	    IF txt.Strip =/= NOTEXT THEN BEGIN
10200	        txt:- scanto(txt, Char(13));
10300	        sscan(txt, 7, arg, key, 1);
10400	        check(FALSE);
10500	    END;
10600	
10700	    ! Check command line ;
10800	    IF rescan THEN BEGIN
10900	        Inimage;
11000	        txt:- Sysin.Image.Strip;
11100	        scanto(txt, '-');
11200	        IF txt.Pos > 1 THEN BEGIN
11300	            txt:- txt.Sub(txt.Pos, txt.Length - txt.Pos + 1);
11400	            sscan(txt, 7, arg, key, 0);
11500	            check(TRUE);
11600	        END;
11700	    END;
11800	
11900	    IF arg[1].Strip == NOTEXT THEN arg[1]:- Copy("Mats Wallin");
12000	    ! so that MENY will not yield TRUE when arg[1] == NOTEXT ;
12100	    IF meny(arg[1], tt, tr, 21) THEN txt:- arg[1] ELSE tt:= 0;
12200	    IF checkint(arg[2]) = 1 THEN ll:= arg[2].Getint;
12300	    IF checkint(arg[3]) = 1 THEN cc:= arg[3].Getint;
     
12400	    WHILE tt <= 0 DO BEGIN
12500	        type_menu(sysout);
12600	        Outtext("(Other) display.");
12700	        Outimage;
12800	        Outtext("Switches: /DCA or /-DCA = Direct Cursor Adressing,"
12900	        "/ALF or /-ALF = Auto LF"); Outimage;
13000	        Inimage;
13100	        txt:- Sysin.Image.Strip;
13200	        IF txt =/= NOTEXT THEN BEGIN
13300	            sscan(txt, 7, arg, key, 1);
13400	            check(TRUE);
13500	        END;
13600	        txt.Setpos(1); txt:- scanto(txt, '/');
13700	        IF txt == NOTEXT THEN txt:- Copy("Mats Wallin");
13800	        IF NOT meny(txt, tt, tr, 21) THEN BEGIN
13900	            Outtext(IF tt = -1 THEN "Your answer was ambiguous!"
14000	            ELSE "The computer did not understand!"); Outimage;
14100	            Outtext("Please give another answer:"); Outimage;
14200	        END;
14300	    END;
14400	    IF ll = 0 THEN ll:= ldefault(tt);
14500	    WHILE ll = 0 DO BEGIN
14600	        Outtext("Give screen height wanted: "); Breakoutimage;
14700	        Inimage;
14800	        IF checkint(Sysin.Image) = 1 THEN ll:= Inint;
14900	    END;
15000	    IF cc = 0 THEN cc:= cdefault(tt);
15100	    WHILE cc <= 0 DO BEGIN
15200	        Outtext("Give screen width: "); Breakoutimage;
15300	        Inimage;
15400	        IF checkint(Sysin.Image) = 1 THEN cc:= Inint - 1;
15500	    END;
15600	    txt:- conc(tr[tt], key[2], numbertext(ll), key[3], numbertext(cc));
15700	    position:= txt.Length;
15800	    FOR i:= alf, dca DO IF i > 0 THEN txt:- conc(txt, key[i]);
15900	    IF txt.Length > position THEN
16000	    message:- txt.Sub(position + 1, txt.Length - position);
16100	    IF writetmp THEN tmpout("TRM", txt);
16200	    chars:= cc; lines:= ll; termnr:= tt;
16300	END;