home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / skeleton.zip / FuncReg.cmd < prev    next >
OS/2 REXX Batch file  |  1995-08-03  |  5KB  |  118 lines

  1. /*****************************************************************************\
  2. | Register all RexxUtil and RexxLib external function libraries.              |
  3. |                                                                             |
  4. | $Revision:   1.0  $
  5. |     $Date:   03 Aug 1995 20:10:20  $                                        |
  6. | Libraries:   REXXSAA, [REXXLIB]                                             |
  7. |  Category:   Utility                                                        |
  8. |     Class:   General                                                        |
  9. |      Type:   System                                                         |
  10. |    Author:   Bob Rice - CompuServe: 72421,3016                              |
  11. |                                                                             |
  12. | Copyright (c) 1995 Empirical Heuristics                                     |
  13. \**************************************************************************r4*/
  14. /*  !tr! = value('TRACE',,'OS2ENVIRONMENT'); parse source . . !who!          */
  15. /*  if !tr! \= '' then say '--> Entering' !who!; trace value !tr!; nop       */
  16.   if left(arg(1),1) = '?' then do
  17.     parse source . . !pgm!; call TellHelp arg(1), !pgm!; exit 2; end
  18.  
  19.   parse version EH.REXX .
  20.   parse source . . pgm
  21.   parse value filespec('N',pgm) with EH.pgm_fn '.'
  22.   if translate(arg(1)) = '/VOCAL' then vocal = 1; else vocal = 0
  23.  
  24.   /*=========================================================================*\
  25.   | Register external function routines.                                      |
  26.   \*=========================================================================*/
  27.  
  28.   /*----------------------------------------*\
  29.   |  Load RexxUtil External Function Module  |
  30.   \*----------------------------------------*/
  31.   if RxFuncQuery('SysLoadFuncs') \= 0 then do
  32.     ok = RxFuncAdd('SysLoadFuncs','RexxUtil','SysLoadFuncs')
  33.     if ok = 0 then do                           /* Registration okay         */
  34.       if vocal then say EH.pgm_fn': SysLoadFuncs now registered.'
  35.       call SysLoadFuncs
  36.       if result \= '' then do
  37.         say EH.pgm_fn 'ERROR: SysLoadFuncs returned' result,
  38.             'instead of the expected null.'
  39.         exit 1
  40.       end
  41.       else if vocal then say EH.pgm_fn': SysLoadFuncs executed.'
  42.     end
  43.     else do                                     /* Registration error        */
  44.       say EH.pgm_fn 'ERROR: RxFuncAdd returned' ok,
  45.           'when registering SysLoadFuncs.'
  46.       exit 1
  47.     end
  48.   end
  49.   else if vocal then say EH.pgm_fn': SysLoadFuncs already registered.'
  50.  
  51.   /*-----------------------------------*\
  52.   |  Load the RexxLib Function Package  |
  53.   \*-----------------------------------*/
  54.   if EH.REXX = 'REXX/Personal' then module = 'qrexxlib'
  55.                                else module = 'rexxlib'
  56.   if RxFuncQuery('RexxLibRegister') \= 0 then do
  57.     ok = RxFuncAdd('RexxLibRegister',module,'rexxlibregister')
  58.     if ok = 0 then do                           /* Registration okay         */
  59.       if vocal then say EH.pgm_fn': RexxLibRegister now registered.'
  60.       call RexxLibRegister
  61.       if result \= 1 then do
  62.         say EH.pgm_fn 'ERROR: RexxLibRegister returned' result,
  63.             'instead of the expected 1.'
  64.         exit 1
  65.       end
  66.       else do
  67.         if vocal then say EH.pgm_fn': RexxLibRegister executed.'
  68.         exit 0
  69.       end
  70.     end
  71.     else do                                     /* Registration error        */
  72.       say EH.pgm_fn 'ERROR: RxFuncAdd returned' ok,
  73.           'when registering' module'.'
  74.       exit 1
  75.     end
  76.   end
  77.   else do
  78.     if vocal then say EH.pgm_fn': RexxLibRegister already registered.'
  79.     exit 0
  80.   end
  81. /*--Begin Help-----------------------------------------------------------------
  82. Register all RexxUtil and RexxLib external function libraries.
  83.  
  84. Params: [ /VOCAL ]
  85.  
  86. where:
  87.  
  88.   /VOCAL       reports the progress of the program.
  89.  
  90. Routine returns 0 if successful, 1 otherwise.
  91.  
  92. ________________
  93. Alternate Params: [ ? | ?? | ??? | ???? ]
  94.  
  95. where:
  96.  
  97.   ?     Displays up to the "Syntax:" or "Params:" portion of this help text.
  98.  
  99.   ??    Displays this entire help text except for the technical information.
  100.  
  101.   ???   Displays this entire help text.
  102.  
  103.   ????  Puts this help text into a file whose name is the same as the name of
  104.         this program and whose extent is .ABS.  The file is written to the same
  105.         directory as that in which this program resides.
  106.  
  107. _______________
  108. Technical Notes
  109.  
  110. ___________________
  111. Development History
  112.  
  113. $Log:   Q:/rxdv/skeleton/vcs/funcreg.cm!  $
  114.   
  115.      Rev 1.0   03 Aug 1995 20:10:20
  116.   Initial revision.
  117. --End Help-------------------------------------------------------------------*/
  118.