; ========================     Start-ARexx     ==========================
; Loads the libraries required by ARexx and starts the ARexx server.
; This could be placed in your startup-sequence to activate ARexx.

 Assign RexxC: D0H1:RexxC

; N.B. The double-precision math library mathieeedoubbas.library must
; be in the LIBS: directory.  If this is not convenient, copy it into
; this disk's :libs directory and uncomment the following line ...

 RexxC:loadlib Libs:mathieeedoubbas.library

 RexxC:loadlib Libs:rexxsyslib.library
 if error
     echo "Couldn't load rexxsyslib.library"
     quit 20
 endif
 RexxC:loadlib Libs:rexxsupport.library
 if error
     echo "Couldn't load rexxsupport.library"
     quit 20
 endif
 Set REXXDOS TRUE
 RexxC:loadlib Libs:RexxDosSupport.library
 if error
     echo "Couldn't load RexxDosSupport.library"
     Set RexxDos FALSE
 endif
 Set HGREXX TRUE
 RexxC:loadlib Libs:hGRexxSupport.library
 if error
     echo "Couldn't load hGRexxSupport.library"
     Set HGREXX FALSE
 endif

; Start the ARexx server if it's not already active
  RexxC:waitforport -i REXX
  if warn
     RexxC:rexxmast >nil:
     RexxC:waitforport REXX
     endif

; Make the support library available
  RexxC:rxlib rexxsupport.library 0 -30 0

 if ${REXXDOS} EQ TRUE
; Make the WB2 DOS support library available
  RexxC:rxlib RexxDosSupport.library 0 -30 0
 ENDIF

 if ${HGREXX} EQ TRUE
; Make the WB2 DOS support library available
  RexxC:rxlib hGRexxSupport.library 0 -30 0
 ENDIF

; Assign the REXX: directory if appropriate
  Assign REXX: OS2:rexx

; Start up RexxPlus server
 IF EXISTS REXXP:RPstart
  Run RexxP:RPstart
  RexxC:waitforport -i RPREXX
 ENDIF
