From:	CSBVAX::MRGATE!info-vax-RELAY@KL.SRI.COM@SMTP  8-JUL-1988 13:42
To:	ARISIA::EVERHART
Subj:	Re: EDITLIB/LIBEDIT


Received: from CitHex.Caltech.Edu by KL.SRI.COM with TCP; Mon, 4 Jul 88 18:29:25 PDT
Date:     Mon, 4 Jul 88 18:33:36 PDT
From:     carl@CitHex.Caltech.Edu (Carl J Lydick)
Message-Id: <880704180915.1671@CitHex.Caltech.Edu>
Subject:  Re: EDITLIB/LIBEDIT
In-Reply-To: Your message dated  5-May-1988
To:       CHAA006@VAXB.RHBNC.AC.UK, info-vax@CitHex.Caltech.Edu

 > I have an idea floating around in my head which  I'd  like  to  bounce  off
 > fellow INFO-VAXers ...  it's for a program which could be called EDITLIB or
 > LIBEDIT (ex SCOPErs or NOS/BErs will recognise the terms  ...).   Basically
 > it  involves calls to the librarian and callable-editor routines:  the idea
 > is that a user types
 > 
 >         $ EDIT/LIB <libname> {/HELP|TEXT} <modulename>
 > 
 > and the program automatically yanks the module out of the  library  into  a
 > scratch  file, threads the callable-editor routine, and replaces the module
 > when the edit is complete.  Obviously it's only applicable to text and help
 > libraries, at least until there are callable binary editors.
 > 
 > Now, the questions are:  is it worth-while ?  Has it been done before ?  Is
 > it already in V5 ?

How about the following DCL procedure?  It even lets use your favorite editor,
binary editors included.
$!**************************** EDITLIB.COM begins ******************************
$!	EDITLIB.COM -- EDIT a module in a help or text LIBrary
$	ON CONTROL_Y THEN GOTO DELE
$ LBL1:	IF P1 .NES. "" THEN GOTO LBL2
$	READ/PROMPT="Library name: "/ERR=LBL1 SYS$COMMAND P1
$	GOTO LBL1
$ LBL2:	IF P2 .NES. "" THEN GOTO LBL3
$	READ/PROMPT="Library type: "/ERR=LBL2 SYS$COMMAND P2
$	GOTO LBL2
$ LBL3:	IF P3 .NES. "" THEN GOTO LBL4
$	READ/PROMPT="Module name: "/ERR=LBL3 SYS$COMMAND P3
$	GOTO LBL3
$ LBL4:	IF F$EXTRACT(0,1,P2) .NES. "/" THEN P2 = "/" + P2
$	LIBRARY 'P1' 'P2' /EXTRACT='P3'/OUTPUT=SYS$SCRATCH:EDITLIB.TMP
$ EDIT:	EDIT SYS$SCRATCH:EDITLIB.TMP
$ TEST:	READ/PROMPT="Quit, Replace_module, or Edit [Q/R/E]: " SYS$COMMAND P4
$	P4 = F$EXTRACT(0, 1, F$EDIT(P4, "UPCASE"))
$	IF P4 .EQS. "Q" THEN GOTO DELE
$	IF P4 .EQS. "E" THEN GOTO EDIT
$	IF P4 .NES. "R" THEN GOTO TEST
$	LIBRARY 'P1' 'P2' /MODULE='P3' SYS$SCRATCH:EDITLIB.TMP
$ DELE:	DELETE SYS$SCRATCH:EDITLIB.TMP;*
$!***************************** EDITLIB.COM ends *******************************

 > Could it be extended to provide a simple alternative to CMS/MMS,  allowing,
 > for example, an easy edit/compile/link/run system in which only the modules
 > changed are re-compiled ?  Any thoughts/comments ?

Most of the difficulty in writing something like MAKE is involved  in  parsing
the dependencies.  Getting and comparing modification dates is pretty trivial.
For example, consider the files listed in the following directory output:

	Directory $USERS:[CARL.SOURCE]

	FORCEX.C;3            3-MAR-1987 13:37
	FORCEX.OBJ;1          9-FEB-1987 14:16

	Total of 2 files.

To compare the modification dates, we just:
	$ C_REV_DATE = F$CVTIME(F$FILE("$USERS:[CARL.SOURCE]FORCEX.C","RDT"))
	$ O_REV_DATE = F$CVTIME(F$FILE("$USERS:[CARL.SOURCE]FORCEX.OBJ","RDT"))
	$ WRITE SYS$OUTPUT F$FAO("!_C:!_!AS!/!_O:!_!AS", C_REV_DATE, O_REV_DATE)
	$ IF C_REV_DATE .GTS. O_REV_DATE THEN WRITE SYS$OUTPUT -
		"THE MODULE NEEDS TO BE RECOMPILED"
	$ IF C_REV_DATE .LES. O_REV_DATE THEN WRITE SYS$OUTPUT -
		"THE MODULE IS UP TO DATE"
Which results in:
		C:	1987-03-03 13:37:40.56
		O:	1987-02-09 14:16:24.57
	THE MODULE NEEDS TO BE RECOMPILED

The difficulty lies in figuring out that it was the revision  dates  of  those
two  files  that  needed  to  be compared, and then deciding what to do if the
object module is out of date.  So I think the answer  is  no,  something  that
lets  you  easily  edit  libraries  can't  be  extended  to  provide  a SIMPLE
alternative to CMS/MMS.

By the way, please pardon the two-month delay  between  your  posting  and  my
reply; the message just arrived here today.
