.; FILE:  MK:[11,45]QUIKEXT.CMD
.;
.; HISTORY:  CREATED  21-SEP-82  PHIL HANNAY
.;           MOVED TO LB:[11,44] FROM LB:[22,10]  11-JAN-83  PHIL HANNAY
.;
.;	15-Jan-83 JMB modified to support /HELP switch, also command line
.;		parameters, <ESC> question reply.
.;
.;      23-Nov-83  Phil Hannay - Converted command file from QUIKP2EXT to
.;                   use P3EXT.

.;
.; GENERIC EXTERNAL (INCLUDE FILE) BUILD PROCEDURE
.;
.ENABLE SUBSTITUTION
.enable escape
.setn nparam <STRLEN>
.if nparam <> 4 .goto 1
.;we have parameters, p1=filespec, p2=entrypoint, p3=extUIC
.sets MODULE P1
.sets ENTRY P2
.sets EXTDEV P3
.goto 10
.; check if he asked for help
.1:.sets sp1 P1[1:3]
.if SP1 <> "/HE" .goto 5
;
;
;  This command file will extract out the procedure line (entry point) of
;  a specified procedure in a specified source file.  It will tack on an
;  "EXTERNAL;" keyword and then extract the first comment that follows the
;  procedure line.  All of this will be then written out to a text file
;  with the procedure's name (entry point name) with an extention of ".EXT".
;  ie.  STEFN.EXT will contain the external call for linking to STEFN.PAS.
;  By calling this command file in the beginning of a complete assembling of
;  a job, we will be assured of getting the latest external links exactly as
;  they appear in the source file and so eliminate problems with parameter
;  mismatch.
;
;  Use this command file for single .EXT file creations for testing or
;  immediate update without running through an entire creation command
;  file.  Note that
;  some syntax errors will be detected.  However, since only simple parsing
;  in used, misplaced key characters (like ";","{") will satisfy the parser,
;  but result in a badly constucted external call.  Thus when in doubt, 
;  even if a successful extraction occurred, examine the resulting .EXT file
;  itselt to verify its correctness.
;
;  This command file may be invoked with parameters as follows:
;  @quikP3EXT sourcefile.ext entrypoint outaccount
;  (outaccount is the optional device, and required uic to receive the 
;  external file.
;
.5:
.ASKS MODULE ENTER NAME OF MODULE
.iff <escape> .goto 6
;
;  Enter the name of the source module containing the desired procedure call
;  using normal file syntax.  Be sure to include device and uic if required.
;
.goto 5
.6:.ASKS ENTRY ENTER PROCEDURE (FUNCTION) NAME (1-6 CHAR)
.iff <escape> .goto 7
;
;  Enter the name of the procedure or function (entry point) to be extracted
;  into an .EXT file.  The procedure (function) header will be extracted with
;  arguments, an EXTERNAL keyword added, and the first comment following
;  included.  Semi-colon characters in the first column of the source file
;  are ignored so .MAC source file with the procedure (function) call
;  and comment in Pascal syntax stored as a macro comment will be 
;  extracted correctly.  Enter up to the first 6 characters of the 
;  procedure (function) name containing no special characters (like hyphen
;  or underline).  This entry will be used for unique identification of
;  the procedure in the module, and will be used as the name of the
;  .EXT file.  Even though you enter only the first 6 characters, the
;  entire procedure (function) name will be extracted including any
;  special characters.
;
.goto 6
.7:.ASKS EXTDEV ENTER DEVICE AND UIC FOR CREATING EXT FILE
.iff <escape> .goto 10
;
;  Finally, you must specify where the .EXT header file should be
;  placed.  Enter the device and uic using normal system syntax. There
;  is no need for entering the file name, extention and version as they
;  are already determined ('ENTRY'.EXT;1).  If you wish to
;  use the defaults for device and uic, just enter <CR>.
;
.goto 7
.10:
.GOSUB CREATE
;
.GOTO 990
;
.CREATE:
.OPEN TRANEXT.DAT;1
.DATA 'MODULE'
.DATA 'ENTRY'
.DATA 'EXTDEV'
.CLOSE
RUN LB:[22,310]P3EXT
.IF <EXSTAT> EQ 1 .GOTO 950
;
; Error in creating external file on 'EXTDEV' 
;   for 'ENTRY' in 'MODULE'
.RETURN
.950:
; External call to 'ENTRY' in 'MODULE'
;    extracted on 'EXTDEV''ENTRY'.EXT;1
.RETURN
;
.990:
;
