Trailing-Edge
-
PDP-10 Archives
-
decuslib10-08
-
43,50463/11/marg.sim
There are 2 other files named marg.sim in the archive.  Click here to see a list.
00040	BEGIN COMMENT sets margin, TABS on GNT, DIABLO; OPTIONS(/L);
  00080	EXTERNAL PROCEDURE outchr, exit, outstring, outche, forceout;
 00120	EXTERNAL INTEGER PROCEDURE trmop, iondx;
  00160	EXTERNAL TEXT PROCEDURE inline, scanto, rest;
  00200	EXTERNAL BOOLEAN PROCEDURE rescan;
   00240	EXTERNAL REF (infile) PROCEDURE findinfile;
    00280	
  00320	CHARACTER terminaltype, gnt, diablo, escape, fill, backspace, hmi
  00360	, afyrchar;
 00400	INTEGER marg, right, i, crlf, fillcount, clears, ioindex;
00440	BOOLEAN eventabs, afyra;
   00480	TEXT tabs, sysinimage;
00520	
  00560	gnt:= 'G'; diablo:= 'D'; afyrchar:= 'A'; eventabs:= TRUE;
00600	escape:= char(27); fill:= char(127); backspace:= char(8);
00640	hmi:= char(31); ! horizontal motion index for diablos;
   00680	sysinimage:- sysin.image; sysinimage.setpos(1);
00720	ioindex:= iondx(sysout);
   00760	
  00800	IF rescan THEN
   00840	BEGIN
  00880	  inimage;
  00920	  scanto(sysinimage,'-');
  00960	  IF sysinimage.more THEN
  01000	  BEGIN
01040	    INSPECT findinfile(rest(sysinimage)) DO
    01080	    BEGIN eventabs:= FALSE;
01120	      open(blanks(300)); inimage;
    01160	      tabs:- copy(image.strip);
 01200	      close;
01240	    END OTHERWISE
01280	    BEGIN outtext("Cannot find file: ");
  01320	      outtext(sysinimage.strip); outimage;
01360	      exit(0);
   01400	    END;
    01440	  END;
 01480	END;
   01520	start:
 01560	terminaltype:= inline("Answer GNT, DIABLO, A4 or ? for help: "
01600	,sysin).getchar;
 01640	IF terminaltype = '?' THEN
 01680	BEGIN
  01720	  outtext("This program will on a GNT or DIABLO terminal:");
  01760	  outimage;
 01800	  outtext("1) Set wanted left margin and succeeding tab stops");
   01840	  outimage;
 01880	  outtext("2) Make .TTY GAG, .TTY TAB, .TTY NO CRLF, .TTY WIDTH,");
01920	  outimage;
 01960	  outtext("   .TTY BLANKS och .TTY FORM");
02000	  outimage;
 02040	  outtext("3) For diablo make .TTY NO FILL");
  02080	  outimage;
 02120	  outtext("Answer A4 for Diablo terminal with A4 paper.");
    02160	  outimage; GOTO start;
    02200	END;
   02240	IF terminaltype > 'Z' THEN
 02280	terminaltype:= char(rank(terminaltype)-32);
    02320	IF terminaltype = afyrchar THEN
 02360	BEGIN afyra:= TRUE; terminaltype:= diablo;
02400	END;
   02440	
  02480	IF terminaltype = diablo
   02520	THEN trmop(8R2017,sysout,0) ! .TTY NO FILL;
    02560	ELSE IF terminaltype NE gnt THEN
02600	BEGIN
  02640	  outtext("?MARG - You answered neither GNT, A4 nor DIABLO.");
02680	  outimage; GOTO start;
    02720	END;
   02760	right:= IF terminaltype = gnt THEN 120
    02800	ELSE IF afyra THEN 103 ELSE 140;
02840	marg:= inline("Input wanted left margin: ",sysin).getint;
02880	IF marg < 1 THEN
 02920	BEGIN outtext("Marginal cannot be to the left of 1");
    02960	  outimage; GOTO start;
    03000	END ELSE IF marg > right THEN
   03040	BEGIN outtext("Too large left margin");
   03080	  outimage; GOTO start;
    03120	END;
   03160	
  03200	trmop(8R2013,sysout,0); ! .TTY GAG;
  03240	trmop(8R2025,sysout,0); ! .TTY BLANKS;
    03280	trmop(8R2006,sysout,1); ! .TTY FORM;
 03320	trmop(8R2005,sysout,1); ! .TTY TAB;
  03360	trmop(8R2012,sysout,right-marg+1); ! .TTY WIDTH;
    03440	trmop(8R2010,sysout,1); ! .TTY NO CRLF;
   03480	outchr(sysout,escape,1); outchr(sysout,'2',1);
 03520	outimage;
   03540	clears:= 140/12+1;
    03560	IF terminaltype = diablo THEN
   03600	BEGIN
  03640	  ! Set maximum character width;
03680	  outchr(sysout,escape,1); forceout(sysout);
   03720	  outche(ioindex,hmi); outche(ioindex,'~');
    03760	  ! Backspace to start of line;
 03800	  outchr(sysout,backspace,clears);
   03840	  ! Restore normal character width;
  03880	  outchr(sysout,escape,1); forceout(sysout);
   03920	  outche(ioindex,hmi); outche(ioindex,char(11));
    03960	  ! Backspace last inch;
   04000	  outchr(sysout,backspace,14);
  04040	END;
   04080	
  04120	outchr(sysout,' ',marg-1);
 04160	outchr(sysout,escape,1);
   04200	IF terminaltype = diablo THEN outchr(sysout,'9',1)
  04240	ELSE outchr(sysout,'1',1);
 04280	IF eventabs THEN
 04320	BEGIN
  04360	  FOR i:= marg+9 STEP 8 UNTIL right DO
    04400	  BEGIN
04440	    outchr(sysout,' ',7);
  04480	    outchr(sysout,'+',1);
  04520	    outchr(sysout,escape,1);
    04560	    outchr(sysout,'1',1);
  04600	  END;
 04640	END ELSE
    04680	BEGIN
  04720	  WHILE tabs.more DO
  04760	  BEGIN outstring(sysout,scanto(tabs,' '));
    04800	    IF tabs.more THEN
 04840	    BEGIN
   04880	      outchr(sysout,'+',1); outchr(sysout,escape,1);
04920	      outchr(sysout,'1',1);
04960	    END;
    05000	  END;
 05040	END;
   05080	outimage; outtext("Ready!");
    05120	outimage; exit(0);
    05160	END;