/****************************************************************/ /* Signals a global event semaphore to tell Weasel to reset */ (* the hammer list. */ /* */ /* Programmer: P. Moylan */ /* Last modified: 24 July 2023 */ /* */ /* Prerequisite: for this to work you must have RXU.DLL in */ /* your LIBPATH. RXU, a Rexx library written by Dave Boll, is */ /* available from Hobbes with the name rxu1a.zip. */ /* */ /****************************************************************/ parse upper arg ourarg call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs CALL CheckPrerequisites rxu call rxfuncadd 'rxuinit','rxu','rxuinit' call rxuinit /* Post the semaphore. */ SemName = "\SEM32\WEASEL\HAMMERRESET" if RxOpenEventSem(hev, SemName) \= 0 then rc = RxCreateEventSem( hev ,'Shared', SemName, 'Reset') call RxPostEventSem hev say "Have posted HAMMERRESET semaphore" call RxResetEventSem hev call RxCloseEventSem hev exit /****************************************************************/ /* CHECKING PREREQUISITES */ /****************************************************************/ CheckPrerequisites: PROCEDURE /* The argument is a space-separated list of prerequisite */ /* functions, for example */ /* CALL CheckPrerequisites rxu SelectTNI INI_get */ /* where (at least in this version) each list item is */ /* either 'rxu' or a function from my TNItools package. */ /* If any is missing then we exit with an error message. */ PARSE UPPER ARG funclist funclist = STRIP(funclist) needrxu = 0 needtools = 0 DO WHILE funclist \= '' PARSE VAR funclist func funclist funclist = STRIP(funclist) IF func = 'RXU' THEN DO /* Initialise RXU if not already available, fail if */ /* the RxFuncAdd operation fails. We must */ /* RxFuncQuery RxuTerm because RxuTerm does not */ /* deregister RxuInit. The RxFuncDrop is needed */ /* because RxFuncAdd seems to report failure if the */ /* function is already registered. */ IF RxFuncQuery('RxuTerm') THEN DO CALL RxFuncDrop('RxuInit') CALL RxFuncAdd 'RxuInit','RXU','RxuInit' IF result THEN DO SAY 'Cannot load RXU' needrxu = 1 END ELSE CALL RxuInit END END ELSE DO func = func||'.CMD' IF SysSearchPath('PATH', func) = '' THEN DO SAY 'ERROR: 'func' must be in your PATH' needtools = 1 END END END IF needrxu THEN SAY 'You can find RXU1a.zip at Hobbes' IF needtools THEN SAY 'Please install the GenINI package' IF needrxu | needtools THEN EXIT 1 RETURN /****************************************************************/