Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/util/makhlp.sim
There is 1 other file named makhlp.sim in the archive. Click here to see a list.
COMMENT - MAKHLP - VERSION 1.0
See MAKHLP.HLP and DAHELP.HLP.
Author: Mats Ohlin, FOA 1, FACK, S-104 50 STOCKHOLM, SWEDEN.
Date: 76-01-17.
;
OPTIONS(/C/-Q/-A/-I/-D);
BEGIN   EXTERNAL TEXT PROCEDURE upcase;
    EXTERNAL REF (Infile) PROCEDURE findinfile;
    EXTERNAL INTEGER PROCEDURE lastloc;
    EXTERNAL TEXT PROCEDURE rest,conc,checkextension;
    EXTERNAL CHARACTER PROCEDURE findtrigger;
    TEXT inname,outname,numfield,col1,entry;
    REF (Directfile) df;
    REF (Infile) inf;
    INTEGER max,records,startrec;

    Outtext("Output(DA):");  Breakoutimage;
    IF Sysin.Lastitem THEN GO TO quit;
    outname:- Sysin.Intext(Sysin.Length-Sysin.Pos+1).Strip;
    outname:- checkextension(outname,".HLP");
    INSPECT NEW Directfile(outname) DO
    BEGIN   Open(Blanks(73));
	col1:- Image.Sub(1,1);
	numfield:- Image.Sub(2,7);
	max:= lastloc(THIS Directfile);
	startrec:= max + 1;
	IF max > 0 THEN
	BEGIN
	    Locate(1);   Inimage;
	    FOR records:= numfield.Getint WHILE records NE -1 DO
	    BEGIN   Locate(records);   Inimage   END;
	    numfield.Putint(startrec);   Locate(Location-1);
	    Outimage;
	END init loop;
	records:= max;
	GO TO start;
	WHILE TRUE DO
	BEGIN
	    startrec:= records;   col1:= "~";
	    reentry:
	    Sysout.Outtext("Entry:");   Sysout.Breakoutimage;
	    Sysin.Inimage;
	    entry:- Sysin.Image.Strip;   Sysin.Setpos(0);
	    IF entry = "?" THEN
	    BEGIN   Sysout.Outtext("Enter text to be used as search key.");
		Sysout.Outimage;   Sysout.Outtext("Default:");
		Sysout.Outtext(inname);
		Sysout.Outimage;   GO TO reentry
	    END;
	    upcase(entry);
	    Image.Sub(10,64):= IF entry == NOTEXT THEN inname ELSE
	    entry.Sub(1,IF entry.Length > 64 THEN 64 ELSE entry.Length);
	    Outimage;
	    inf.Inimage;
	    FOR records:= records + 1
	    WHILE NOT inf.Endfile DO
	    BEGIN
		IF col1 = "~" THEN col1:= " ";
		Outimage;   inf.Inimage
	    END;
	    Outtext("~0");   Outimage;
	    start:
	    Sysout.Outtext("Input:"); Sysout.Breakoutimage;
	    IF inf =/= NONE THEN BEGIN  inf.Close;   inf:- NONE   END;
	    IF Sysin.Lastitem THEN GO TO exit;
	    inname:- Sysin.Intext(Sysin.Length-Sysin.Pos+1).Strip;
	    IF upcase(inname) = "EXIT" THEN GO TO exit;
	    IF inname = "HELP" OR inname = "?" THEN
	    BEGIN   Sysout.Outtext("Enter file spec for sequential file.");
		Sysout.Outimage;
		Sysout.Outtext("End dialogue with EXIT.");
		Sysout.Outimage;
		GO TO start
	    END help;
	    inname:- checkextension(inname,".HLP");
	    inf:- findinfile(inname);
	    IF inf == NONE THEN
	    BEGIN   Sysout.Outtext("?MAKCFF - Can't find file:");
		Sysout.Outtext(inname);   Sysout.Outimage;
		GO TO start
	    END;
	    records:= records + 1;
	    Locate(startrec);   Inimage;
	    numfield.Putint(IF records = 1 THEN -1 ELSE records);
	    Locate(startrec);
	    Outimage;
	    Locate(records);
	    inf.Open(THIS Directfile.Image);
	END loop;
	exit:
	Locate(startrec);   Inimage;   numfield:= "-1";
	Locate(startrec);   Outimage;
	Close;
    END df;
    quit:
END of program