Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap4_198111 - decus/20-0109/sqhelp.lst
There is 1 other file named sqhelp.lst in the archive. Click here to see a list.
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    1
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	    1	COMMENT OPTIONS(/C/-Q/-A/-I/-D); OPTIONS(/L/E);
	    2	COMMENT sqhelp will list on SYSOUT the file given in helpfile.
	    3	If no dot ('.') in the string - ".HLP" will be assumed.
	    4	First sqhelp will try to find the file in the user's area.
	    5	If failed then in order at - HLP:  DOC:  and finally the SYS: areas.
	    6	sqhelp will return FALSE if all attempts failed.
	    7	;
	    8	EXTERNAL TEXT PROCEDURE conc,rest,scanto,from,upcase;
	    9	EXTERNAL REF (infile) PROCEDURE findinfile;
	   10	EXTERNAL BOOLEAN PROCEDURE dotypeout;
	   11	EXTERNAL INTEGER PROCEDURE search;
	   12	BOOLEAN PROCEDURE sqhelp(helpfile,selector,height,width);
	   13	VALUE helpfile, selector; TEXT helpfile, selector;
	   14	INTEGER height, width;
B1	   15	BEGIN
	   16	  REF (infile) inf;
	   17	  TEXT ARRAY line[1:height+1], strip_line[1:height+1];
	   18	  INTEGER current_line, max_line, match_line, heightp1, first_line;
	   19	  TEXT sysoutimage, lastline, upcased_line, stripinimage;
	   20	  BOOLEAN matching, some_match, first, full;
	   21	  CHARACTER lastchar, formfeed;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    2
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	   22	
	   23	  PROCEDURE create_file;
B2	   24	  BEGIN
	   25	    formfeed:= char(12);
	   26	    helpfile:- helpfile.strip;
	   27	    IF scanto(helpfile,'.') == helpfile THEN
	   28	    helpfile:- conc(helpfile,".HLP");
	   29	    inf:- findinfile(helpfile);
	   30	    IF inf =/= NONE THEN GO TO list;
	   31	    scanto(helpfile,':');
	   32	    IF helpfile.more THEN helpfile:- rest(helpfile);
	   33	    helpfile:- conc("HLP:",helpfile);
	   34	    inf:- findinfile(helpfile);
	   35	    IF inf =/= NONE THEN GO TO list;
	   36	    helpfile.sub(1,3):= "DOC";
	   37	    inf:- findinfile(helpfile);
	   38	    IF inf =/= NONE THEN GO TO list;
	   39	    helpfile.sub(1,3):= "SYS";
	   40	    inf:- findinfile(helpfile);
	   41	    IF inf =/= NONE THEN GO TO list;
	   42	    outtext("?HLPCFF Cannot find file:");   helpfile.setpos(5);
	   43	    outtext(rest(helpfile));   outimage;
	   44	    list:
E2	   45	  END of procedure create_file;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    3
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	   46	
	   47	  BOOLEAN PROCEDURE user_wants_more;
B3	   48	  BEGIN
	   49	    IF first THEN
B4	   50	    BEGIN first:= FALSE;
	   51	      GOTO out;
E4	   52	    END;
	   53	    dotypeout(sysout); sysout.image:- sysoutimage;
	   54	    outtext("    >>>>>>> Do you want more info");
	   55	    IF selector =/= NOTEXT THEN
B5	   56	    BEGIN
	   57	      outtext(" on """); outtext(selector); outchar('"');
E5	   58	    END;
	   59	    outtext("?/yes/:"); breakoutimage;
	   60	    inimage; lastchar:= ' ';
	   61	    stripinimage:- sysin.image.strip;
	   62	    IF stripinimage =/= NOTEXT THEN
B6	   63	    BEGIN
	   64	      WHILE lastchar EQ ' ' DO lastchar:= inchar;
	   65	      IF lastchar = 'n' THEN lastchar:= 'N'
	   66	      ELSE IF lastchar = '?' THEN
B7	   67	      BEGIN
	   68	        selector:- copy(sysin.image.sub(sysin.pos,
	   69	        stripinimage.length-sysin.pos+1));
	   70	        upcase(selector);
E7	   71	      END;
	   72	      sysin.setpos(-1);
E6	   73	    END;
	   74	    out: user_wants_more:= NOT lastchar = 'N';
E3	   75	  END of user_wants_more;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    4
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	   76	
	   77	  PROCEDURE end_message;
B8	   78	  BEGIN
	   79	    dotypeout(sysout); sysout.image:- sysoutimage;
	   80	    IF lastchar = 'N' THEN outtext("[End of help") ELSE
B9	   81	    BEGIN
	   82	      outtext("[No "); IF some_match OR matching THEN outtext("more ");
	   83	      outtext("help");
E9	   84	    END;
	   85	    IF selector =/= NOTEXT THEN
B10	   86	    BEGIN
	   87	      outtext(" on """); outtext(selector); outchar('"');
E10	   88	    END;
	   89	    outtext(".] "); breakoutimage;
E8	   90	  END of procedure end_message;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    5
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	   91	
	   92	  outimage;
	   93	  sysoutimage:- image;
	   94	  sysoutimage:= NOTEXT;
	   95	  IF selector == NOTEXT THEN
B11	   96	  BEGIN
	   97	    outtext("If you want help on a specific subject,");
	   98	    outimage;
	   99	    outtext("then type ? followed by a word");
	  100	    outimage;
	  101	    outtext("characterizing that subject,"); outimage;
	  102	    outtext("e.g. ?OUTPUT or ?");
	  103	    outtext(helpfile); outchar('.');
	  104	    outimage; outimage;
	  105	    outtext("If you do not do this, you will get complete help");
	  106	    outimage;
	  107	    outtext("on everything available about """);
E11	  108	  END ELSE
B12	  109	  BEGIN
	  110	    outtext("Searching for HELP on """);
	  111	    outtext(selector); outtext(""" in """);
E12	  112	  END;
	  113	  outtext(helpfile); outtext("""."); outimage; outimage;
	  114	  IF selector == NOTEXT THEN
B13	  115	  BEGIN
	  116	    IF NOT user_wants_more THEN GOTO quit;
E13	  117	  END;
	  118	  first:= TRUE;
	  119	  heightp1:= height+1;
	  120	  create_file;
	  121	  upcase(selector);
	  122	  INSPECT inf DO
B14	  123	  BEGIN
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    6
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	  124	
	  125	    PROCEDURE open_file;
B15	  126	    BEGIN
	  127	      sqhelp:= TRUE;
	  128	      open(sysout.image);
	  129	      FOR current_line:= 1 STEP 1 UNTIL heightp1 DO
	  130	      line[current_line]:- blanks(width);
	  131	      lastline:- line[heightp1];
E15	  132	    END;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    7
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	  133	
	  134	    PROCEDURE read_page;
B16	  135	    BEGIN
	  136	      again:
	  137	      matching:= selector == NOTEXT; max_line:= 0; match_line:= 1;
	  138	      full:= FALSE;
	  139	      IF endfile THEN GOTO out;
	  140	      inline: max_line:= max_line+1; image:- line[max_line];
	  141	      inimage;
	  142	      image:- image.strip;
	  143	      IF image = NOTEXT THEN lastchar:= ' ' ELSE
B17	  144	      BEGIN image.setpos(image.length); lastchar:= image.getchar;
E17	  145	      END;
	  146	      IF lastchar = formfeed THEN
B18	  147	      BEGIN
	  148	        image:- image.sub(1,image.length-1);
E18	  149	      END;
	  150	      strip_line[max_line]:- image;
	  151	      IF NOT matching THEN
B19	  152	      BEGIN
	  153	        upcased_line:- lastline.sub(1,image.length);
	  154	        upcased_line:=image; upcase(upcased_line);
	  155	        upcased_line.setpos(1);
	  156	        IF search(upcased_line,selector) < upcased_line.length THEN
B20	  157	        BEGIN
	  158	          some_match:= matching:= TRUE;
	  159	          match_line:= max_line;
E20	  160	        END;
E19	  161	      END;
	  162	      IF max_line > height THEN max_line:= 0;
	  163	      IF max_line >= height THEN full:= TRUE;
	  164	      IF full AND matching THEN
B21	  165	      BEGIN IF mod(max_line-match_line+heightp1,
	  166	      heightp1)*2 > height THEN GOTO found;
E21	  167	      END;
	  168	      IF lastchar NE formfeed AND NOT endfile
	  169	      THEN GOTO inline;
	  170	      found:
	  171	      IF endfile OR image = NOTEXT THEN max_line:= max_line-1;
	  172	      if max_line < 0 then
	  173	      max_line:= max_line+heightp1;
	  174	      first_line:= max_line+2;
	  175	      IF NOT matching THEN GOTO again;
	  176	      IF NOT full AND max_line = 0 THEN GOTO again;
	  177	      out:
E16	  178	    END of read_page;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    8
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	  179	
	  180	    PROCEDURE print_page;
B22	  181	    BEGIN
	  182	      IF full THEN
	  183	      FOR current_line:= first_line STEP 1 UNTIL heightp1 DO
B23	  184	      BEGIN
	  185	        sysout.image:- strip_line[current_line]; outimage;
E23	  186	      END;
	  187	      FOR current_line:= 1 STEP 1 UNTIL max_line DO
B24	  188	      BEGIN
	  189	        sysout.image:- strip_line[current_line]; outimage;
E24	  190	      END;
E22	  191	    END of print_page;
DECsystem-20 SIMULA  %4A(310)                1-FEB-1981  14:50				 PAGE    9
DSK:SQHELP.SIM	   1-MAR-1976  19:00	

	  192	
	  193	    open_file;
	  194	    next_page: read_page;
	  195	    IF max_line NE 0 OR full THEN
B25	  196	    BEGIN
	  197	      IF user_wants_more THEN
B26	  198	      BEGIN print_page; GOTO next_page;
E26	  199	      END;
E25	  200	    END;
	  201	    close; sysout.image:- sysoutimage;
E14	  202	  END inf;
	  203	  quit: end_message;
E1	  204	END of sqhelp;


SWITCHES CHANGED FROM DEFAULT:

   E EXTERNAL CLASS/PROCEDURE

NO ERRORS DETECTED