CHAPTER 2    TESTING NEW SUBROUTINES





            2.1 RUNNING A MIIPS SUBPROGRAM FROM A USER AREA



                 A user may write a new subroutine  for  MIIPS  and  test  it

            without  relinking  or  altering  the  main  program at all.  The

            procedure is as follows:

            The subroutine is written as if it were to be  installed  in  the

            MIIPSOPT's list.  The command @UTEST XXXXX is then run where XXXX

            is the subroutine name.  This edits the subroutine,  converts  it

            to  a  program,  compiles  and  links  it,  and  leaves a version

            USER.EXE  ready  to  run.   This  seperate  program  MAY  be  run

            independently  but  if it is more convenient to run it from MIIPS

            (so that the other options will be available immediately to  look

            at  the  results)  this  can be done by setting up a command file

            USER.COM in the area where MIIPS is to be run.

            The UTEST and USER command files have the following forms:



                STRUCTURE OF THE UTEST.COM FILE:

            $ ON ERROR THEN GOTO END

            $ ON CONTROL_C THEN GOTO END

            $ ON CONTROL_Y THEN GOTO END

            $ IF P1.EQS."" THEN INQUIRE P1 SUBROUTINE

            $ SET VERIFY

            $ COPY 'P1.FOR UTEST.FOR

            $ EDIT UTEST.FOR

            @UTEST.CMD

            $ FOR/DEBUG/NOOPT/CHECK=ALL UTEST

            $ @ULINK.COM UTEST 'P2

            $ SET VERIFY

            $ DELETE UTEST.FOR.*,UTEST.OBJ.*

            $ REN UTEST.EXE USER.EXE

            $ END:

            $ SET NOVERIFY





                STRUCTURE OF THE UTEST.CMD FILE:

                                ! The ^ is used to represent an escape character

                                  See VAX VMS VOL 3A "TEXT EDITING.." p5-57

                                  for an example of how to enter escape

                                  characters into a file.

            FSUBROUTINE 

                PROGRAM USER

            FENTRY                      ! Only necessary if you have (ugh)

                                        entry points.



            SRETURN  ^/1:*/*

                   



                STRUCTURE OF THE USER.COM FILE:

            $ ASSIGN PLOT.PLT FOR079

            $ ASSIGN SYS$OUTPUT FOR078

            $ ASSIGN SYS$INPUT FOR075

            $ ASSIGN RASTER.PLT FOR076


                                                                Page 2





            $ ASSIGN VECT.RPL FOR053

            $ ASSIGN TTC1: TEKTRONIX

            $ ASSIGN USER.LOG FOR007

            $ ASSIGN USR.SVE FOR049

            $ ASSIGN SYS$COMMAND: SYS$INPUT:

            $ RUN/NODEB USER.EXE

            $ LOGOUT



                WARNING!  if you do a  C while in this routine

                ALL IS LOST! - to recover - do several  Y's

                then several LOGOUT's and then LOGIN again.



                STRUCTURE OF THE ULINK.COM FILE

            $ SET VERIFY

            $ IF P2.NES."" THEN P2:='P2'/LIB,

            $ LINK/MAP/DEBUG 'P1,'P2-

            USR$DISK3:[MIIPS.LIB]MIIPS/LIB,-

            PAN/LIB,-

            NONLINFIT/LIB,-

            PAN/LIB,-

            ARITH/LIB,-

            PLOT/LIB,-

            TV/LIB,-

            BSAD/LIB,-

            SAD/LIB,-

            UTILITY/LIB,-

            SYS$INPUT/OPTIONS

            SYS$SYSDISK:[SYSLIB]LBRSHR/SHARE

            $ SET NOVERIFY







            2.2 RUNNING ANY PROGRAM FROM A USER AREA



                 A user may wish to write a program  which  is  not  part  of

            MIIPS  but which calls some of the subroutines and functions used

            in MIIPS.  This is most conviently done by compiling and  linking

            with  P1LINK XXXXX, where XXXXX is the program name.  See Chapter

            2 for this global definition and the command file it calls.

                 A MIIPS subroutine can be tested  in  a  similar  way:   one

            writes  the  program  TEST.FOR  which calls the MIIPS subroutine.

            After compiling TEST, one links with P1LINK TEST.