From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 26-APR-1992 20:48:50.52
To:	info-vax@kl.sri.com
CC:	
Subj:	TPU Long Startup Time. Workaround. DCL Program Included.

SH> Have you ever noticed however how long it takes TPU to fire up though?
SH> It's pathetic - of course once it gets going it's a lot faster than EDT
SH> in negotiating it's way around especially on big files. Problem is you
SH> frequently want to edit small files, quickly - you know short command
SH> prodedures etc. and who wants to wait while TPU gets it's act together.
SH> All you want to do is get in quick try to fix the problem, get out again
SH> and see whether it worked! THE choice every time in this case has to be EDT.
SH> Stephen Hirsch

Stephen

You did not leave a NET address, so I am positng this to INFO-VAX.
First of all, most of the startup time in TPU is used to load the file in
virtual memory, and loading any SECTION files you/sys$manager have defined. 
This would not be a big deal for relatively small files. It is
noticeable only for larger files. As you have stated, this does have its
benifits once the file is loaded in virtual memory.

I am posting to reply to your statement regarding frequent editing of small
files, and having to wait for the editor to load. There is a way to work around
this. That is through executing your editing session in a subprocess and
switching back and forth between your parent and subproces. This way, you will
have to execute TPU only once at startup. Everytime you go back to your
subprocess (running TPU) you will retain the current settings, current location
in the file, and get access to the recall buffer (a BIG plus).

I wrote a quick and dirty program a year ago to do just that. I have been using
it since to develop BASIC and DCL programs with no problems. I even use it to
write reports where access to DCL is frequent. This is much faster than
SPAWNing a TPU subprocess each time you need to execut a DCL command.

Below my signature please find DEVELOP.COM and DO.COM. 

DEVELOP accepts a filename and set_screen_flag at command line. It will
        prompt for either if missing.

        filename         Filename to edit in subprocess. Default ext is .TXT. 
                         The file to be edited/create must be in your current
                         subdirectory. I am sure it is easy to get around that
                         limitation.
        Set_Screen_Flag  Y: Set Screen to 80 columns upon exiting TPU
                            subprocess.
                         N: Leave screen width as it was in subprocess.

        DEVELOP will setup the following symbols to aid in subprocess-based 
        editing, switching, compile, link and RUN of your programs:

        A1     Attaches to editing subprocess username_1
        A2     Attaches to editing subprocess username_2
        T      Spawns a TPU subprocess editing Filename
        DO     Execute a compile/link cycle for Filename. The program invokes
               the proper compiler based on file extention. Currently suppoerted
               compilers are PAS, BAS, COB, FOR.
        R      Runs filename after successful compile/link.

DO      Executes a Compile/Link cycle automatically based on the file extention
        you defined in DEVELOP. DO will delete filename.EXE and filename.OBJ
        before compiling. You may need to remove that if it is undesirable.

NOTES: To achieve maximum benifit, I suggest you include definitions in your TPU
       INITIALIZATION file to define WRITE and ATTACH so you can switch between
       parent and subprocess with one keystroke. Here is the relavent fragment
       of my TPU INIT file:
       Def Key=F17 Write
       Def Key=F20 Attach

       These two procedures might produce undesirable side effects Please read
       carefully before usig them. Feel free to modify them to your own
       specifications.

       If you SET PROC/NAME your subprocesses, you will need to hardcode the
       subprocess names in A1 and A2 definitions.

       I realize much could be re-written more efficiently, etc. But these
       procedures work well for me. I dont have much time to re-do old
       software. :)
 
       Run at your own risk, blah blah blah....

       I hope you will find this helpful.

.-Saleh A Kabalani----------------------+-Internet : SK9221A @ Acad.Drake.Edu-.
| Supervisor of Operations/Data Systems | Bitnet   : SK9221A @ DRAKE          |
| Iowa Network Services                 | WWIV-link: 12 @ 25555               |
| 4201 Corporate Drive                  | Fax-Net  : (515) 830-0123/0124      |
| Des Moines, Iowa 50265                | Phone-Net: (515) 830-0436/0110      |
| Disclaimer: My opinions are not mine. I dont even know this Saleh person.   |
`----------------------- Programmers Do It With a Byte -----------------------'

----------------------------Cut here, DEVELOP.COM-------------------------------
$ Set Noverify
$ Goto Begin         ! Skip Documentation
$ !*****************************************************************************
$ ! Program   : Develop.Com
$ ! Purpose   : Set up symbols for program development.
$ ! Author    : Saleh Kabalani, Iowa Network Services
$ ! Date      : 12-APR-1991
$ ! Revisions : <I>  <   Date  >  < Description >
$ ! Notes     : This program accepts filename.ext optionally at the command
$ !             Line and sets up the following Symbols:
$ !             T  :== Edit/Tpu filename.ext.
$ !             Do :== Execute a Compile/Link filename, or execute DCL proc.
$ !             R  :== Run filename
$ !             A1 :== Attach 'username'_1
$ !             A2 :== Attach 'username'_2
$ !             *** This program run in conjunction with DO.COM ***
$ !             The compiler chosen will depend on extention.
$ !		        This procedure supports BAS, PAS, COB, and FOR compilers, in
$ !             addition to DCL.
$ ! Usage     : DEVELOP [filename.ext] [set_screen_flag]
$ !             Set Screen Flag: N=Keep screen setting when exiting TPU.
$ !                              Y=Set 80 column when exiting TPU.            
$ ! ****************************************************************************
$ Begin:
$   A1 :== Attach 'f$getjpi ("","USERNAME")'_1
$   A2 :== Attach 'f$getjpi ("","USERNAME")'_2
$   Say := Write Sys$Output
$   ! Remove current symbol refinitions for T, DO and R. Supress DCL messages.
$   Set Message/NoID/NoText/NoSeverity/NoFacility
$	t :== ""                     
$	do:== ""                     
$	r :== ""
$   Set Message/ID/Text/Severity/Facility
$	If p1 .eqs. ""
$   then
$ 	    Say " "
$	    Ask p1 " -- Enter Filename.Ext <RET = Exit> "
$	    p1 = f$edit (p1,"COMPRESS,UPCASE")                                   
$	    if p1 .eqs. "" then $ Exit                                           
$   else
$       if p2 .eqs. ""
$       then
$    	    Say " "
$	        Ask p2 " -- Set Screen to 80 Colomns ? <RET = Exit> "
$	        p2 = f$edit (p2,"COMPRESS,UPCASE")                               
$   	    if p2 .eqs. "" then $ Exit                                        
$       endif
$   endif
$   if (p2 .nes. "N") .and. (p2 .nes. "Y") then $ P2 = "N"
$   len = f$len (p1)
$   Device = f$element (0, ":", f$parse ("*.*",,,, "syntax_only"))
$   if f$locate (":", p1) .ne. len then $ device = f$element (0, ":", p1)  
$   p1 = p1 - device - ":"
$   dir = f$dir()   
$   if (f$locate ("[", p1) .ne. len) .and. (f$locate ("]", p1) .ne. len) then -
        dir = f$element (0, "]", p1) + "]"
$   p1 = p1 - dir
$	p1 = f$element (0,";",p1)               ! discard version number if present
$	if (f$loc ("*",p1) .ne. f$len (p1)) .or.  -  ! disallow wild cards
	   (f$loc ("%",p1) .ne. f$len (p1)) .or.  -
       (f$loc ("?",p1) .ne. f$len (p1)) 
$   then 
$	    Say " "
$	    Say " -- Wildcard not supported. No symbols set."
$	    Say " "
$       Exit
$   endif
$	Fname  = f$element (0,".",p1)                ! isolate filename
$	Ext    = f$element (1,".",p1)                ! isolate extention     
$   if Ext .eqs. "." then $ Ext = "TXT"          ! default extention is .TXT
$	filename = device + ":" + dir + fname        ! Rebuild filename, this time
$                                                ! add full directory specs.
$	T :== spawn edit/tpu 'filename'.'ext' 
$	If Ext .eqs. "COM" 
$  	then 
$ 		do :== @'filename'                   ! For COM files, no COMPILE/LINK is necessary. Define DO as
$		goto Exit_procedure                  ! @filename then exit.
$	endif
$	Ext_list ="BAS COB PAS FOR " 
$  ! This is the list of compilers currently supported. To add another compiler
$  ! simply include the file extention to this list. NOTE: for this program to
$  ! work properly, file extention MUST be same as the command that invokes
$  ! the compiler.
$	if f$locate (ext, ext_list) .ne. f$len (ext_list) ! compiler is supported..
$	then
$       ! get compiler from list.
$		compiler = f$ext (f$loc (ext, ext_list), 3, ext_list)  
$       ! make sure you replace disk:[path] with the location of DO.COM. Remove
$       ! the SAY statement, then activate the DO:== statement.
$       Say "**** Make Sure you replace Disk:[path] with location of DO.COM"
$!		DO:==@Disk:[Path]DO 'compiler' 'filename' 'p2' ! define DO
$		R :== Run 'f$elem (0, ".", fname)'                         ! define R
$		gosub Exit_procedure                                       ! Done.
$	endif	
$	Say " "
$	if ext .nes. "TXT" then $ Say " -- Extention ''ext' Not Supported."  
$									       ! compiler is not supported
$	Say " -- Symbols T = ''t' has been defined."  
$ exit
$ !----------------------------------------------------------------------------!
$ Exit_procedure:                                                            
$		Say " "                                                        
$		Say " -- Symbols
$		Say "      T  = ''t'" 
$		Say "      DO = ''do'" 
$		if ext .nes. "COM" then $ Say "      R  = ''r'"            
$		Say " -- have been defined."
$		Say " "
$ 		Exit                                                           ! Done
$ return
$ !----------------------------------------------------------------------------!
-------------------------------Cut Here, DO.COM---------------------------------
$ Set Noverify
$ Goto Begin         ! Skip Documnetation
$ !*****************************************************************************
$ ! Program   : Do.Com
$ ! Purpose   : Execute a COMPILE and LINK for a particular compiler.
$ ! Author    : Saleh Kabalani, Iowa Network Services
$ ! Date      : 12-APR-1991
$ ! Revisions : <I>  <   Date  >  < Description >
$ !             SAK  12-JUL-1991  If P3=Y then Set terminal to 80 colomns.
$ ! Notes     : This program accepts a Compiler (3 characters) and filename 
$ !		EXPLICITLY at the command Line. Compile and Link are executed
$ !		on a filename. COBOL source compilation produces a filename.LIS
$ !		listing file. This program also deletes all previous .EXE and
$ !		.OBJ of current file. All extentions are ignored. Use this 
$ !		procedure in conjunction with DEVELOP.COM.
$ ! Useage    : @ DO compiler filename
$ ! ****************************************************************************
$ Begin:
$   Say := Write sys$output
$   if p3 .eqs. "Y" then $ Set term/width=80
$	if f$search ("''p2'.Obj") .nes. "" then $ delete/nocon 'p2'.Obj;*   
$	if f$search ("''p2'.Exe") .nes. "" then $ delete/nocon 'p2'.Exe;*   
$	if f$search ("''p2'.Lis") .nes. "" then $ delete/nocon 'p2'.Lis;*   
$	Error_flag = ""                                     ! Reset Error flag
$	on error then $ goto Exit_procedure
$	Error_flag = "Compile"
$	Say " "
$	Say " ---- Compiling ''p2'.''p1'"
$	'p1' 'p2'/Lis='p2'.lis                            ! Compile
$ 	Say " Compilation Successful." 
$	Say " "
$	Say " ---- Linking ''p2'.OBJ" 
$	Error_flag = "Link"                                               
$	Link 'p2'                                         ! Link
$ ! Include any object libraries to link here.
$ !                LIB$:saleh/lib,                      -
$ !             disk:[path]my_lib/lib       
$	Say " Link Successful."
$	Error_flag = ""
$ Exit_procedure:
$	Say " "
$	if error_flag .nes. "" then $ say "*** Error During ''error_flag'.Aborting."
$ 	Exit

