Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/libsim/dahelp.sim
There is 1 other file named dahelp.sim in the archive. Click here to see a list.
OPTIONS(/E/C/-Q/-A/-I/-D);
EXTERNAL TEXT PROCEDURE conc,upcase,rest,checkextension;
EXTERNAL CHARACTER PROCEDURE findtrigger;
EXTERNAL INTEGER PROCEDURE scanint;
EXTERNAL REF (Directfile) PROCEDURE finddirectfile;
COMMENT Information in DAHELP.HLP ;
CLASS dahelp(helpfilespec); VALUE helpfilespec; TEXT helpfilespec;
! DAHELP = Direct Access (file) helper ;
HIDDEN PROTECTED tilde,col1,col2,entryfield,locfield,
globitem,savesysout,tempimage,scan,helpinit,getloc;
BEGIN
REF (Directfile) helpfile;
TEXT tilde,col1,col2,entryfield,locfield,
globitem,savesysout,tempimage,promptline,dirline;
INTEGER screenlines;
BOOLEAN autoclose,scan;
PROCEDURE stop;
INSPECT helpfile DO
BEGIN Close; helpfile:- NONE END of stop;
PROCEDURE helpinit(skip); LABEL skip;
BEGIN
savesysout:- Sysout.Image;
Sysout.Image:- tempimage;
Sysout.Linesperpage(-1);
IF helpfile == NONE THEN
BEGIN helpfile:- finddirectfile(helpfilespec,FALSE);
IF helpfile == NONE THEN
BEGIN Outtext("?DAFCFF - Can't Find File:");
Outtext(helpfilespec.Sub(1,helpfilespec.Length-18));
Outimage; GO TO skip
END no file;
helpfile.Open(tempimage);
col1:- helpfile.Image.Sub(1,1);
col2:- helpfile.Image.Sub(1,2);
locfield:- helpfile.Image.Sub(2,8);
END none;
END of helpinit;
INTEGER PROCEDURE getloc(exit); LABEL exit;
BEGIN INTEGER nextloc;
IF col1 NE tilde THEN
BEGIN Outtext("? DAHERR Error in DAHELP.");
GO TO exit
END error ??;
locfield.Setpos(1);
nextloc:= scanint(locfield);
IF nextloc < -100000000 THEN
BEGIN Outtext("?DAHENF - Erroneous Number Field:");
Outtext(locfield); Outimage; GO TO exit;
END error;
IF nextloc <= 0 AND NOT scan THEN
BEGIN
IF nextloc < 0 THEN
BEGIN
Image:= NOTEXT; Outtext("%DAHCFE - Can't Find Entry:");
Outtext(globitem); Outimage
END;
GO TO exit;
END <= 0;
getloc:= nextloc
END of getloc;
BOOLEAN PROCEDURE helpdir;
BEGIN INTEGER l;
scan:= TRUE;
helpinit(skip); helpdir:= TRUE;
helpfile.Locate(1);
entryfield:- helpfile.Image.Sub(10,64);
Outtext(dirline); Outimage;
helpfile.Inimage;
l:= getloc(exit);
GO TO start;
WHILE l > 0 DO
BEGIN
helpfile.Locate(l); helpfile.Inimage;
l:= getloc(exit);
start: locfield:= col1:= NOTEXT;
Outimage;
END loop;
exit: helpfile.Image:= NOTEXT;
IF autoclose THEN stop;
skip: Sysout.Image:- savesysout;
END of helpdir;
BOOLEAN PROCEDURE helplist(item); VALUE item; TEXT item;
IF item = "?" THEN helplist:= helpdir ELSE
IF item =/= NOTEXT THEN
BEGIN INTEGER lines; CHARACTER inputchar;
helpinit(skip); helplist:= TRUE;
IF item.Length > helpfile.Length - 9 THEN
item:- item.Sub(1,helpfile.Length - 9);
globitem:- item; scan:= FALSE;
upcase(item);
INSPECT helpfile DO
BEGIN Locate(1); Inimage;
lines:= 1;
entryfield:- upcase(Image.Sub(10,item.Length));
WHILE entryfield NE item AND NOT Endfile DO
BEGIN Locate(getloc(exit)); Inimage;
upcase(entryfield);
END;
WHILE TRUE DO
BEGIN Inimage;
WHILE col1 NE tilde DO
BEGIN Sysout.Outimage;
lines:= lines + 1;
IF lines = screenlines THEN
INSPECT Sysout DO
BEGIN lines:= 1;
stopagain:
Outtext(promptline); Breakoutimage;
Sysin.Inimage;
IF Sysin.Endfile THEN GO TO exit;
inputchar:= Sysin.Inchar;
IF inputchar = Char(27) THEN
BEGIN Outimage; GO TO exit END ELSE
IF inputchar NE ' ' THEN
BEGIN
Outtext("Press RETURN key for continuation.");
Outimage;
Outtext("Answer ESCAPE (ALTMODE) to Skip.");
Outimage;
GO TO stopagain;
END of help ELSE IF Sysin.Endfile THEN GO TO exit;
Sysin.Setpos(0);
END screen stop;
Inimage
END;
Locate(getloc(exit));
END loop
END inspect;
exit:
helpfile.Image:= NOTEXT;
IF autoclose THEN stop;
skip: Sysout.Image:- savesysout;
END of helplist;
! Promptline may be changed - remotely - if another
! page prompter is preferred.;
promptline:- Blanks(Sysout.Length-20);
WHILE promptline.More DO promptline.Putchar('-');
promptline.Setpos(promptline.Pos-1); promptline.Putchar('>');
tilde:- Blanks(1);
tilde.Putchar('~');
tempimage:- Blanks(73);
helpfilespec:-
conc(checkextension(upcase(helpfilespec),".HLP"),"/I:73/ACCESS:RONLY");
! Dirline may be changed - remotely - if other message is
! preferred.;
dirline:- conc("%DAHDIR - ",
helpfilespec.Sub(1,helpfilespec.Length-18),
" Entries:");
screenlines:= 20;
! May be changed to approprate value
! or set to zero if no stop in typeout.;
END of dahelp;