REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Check if a program is in the macro space





 
/* check if this program is executed from within the macrospace       */
/* (see also LoadMac.cmd)                                             */

  if InMacroSpace() = 1 then
    say "This program is executed from within the macro space"
  else
    say "This program is NOT executed from within the macro space"

exit 0

/* ------------------------------------------------------------------ */
/* function: Check if the program is in the macrospace                */
/*                                                                    */
/* call:     InMacroSpace                                             */
/*                                                                    */
/* returns:  1 - yes                                                  */
/*           0 - no                                                   */
/*                                                                    */
InMacroSpace: PROCEDURE

  SIGNAL ON SYNTAX   NAME NotInMacroSpace
  inMacroSpace = 1

  dummy = sourceLine( 1 )
  inMacroSpace = 0

NotInMacroSpace:

  if inMacroSpace = 1 then
  do
                        /* program seems to be in the macro space     */
                        /* do a second check to be sure               */
    parse source . . thisFile
    if fileSpec( "drive", thisFile ) <> '' then
      inMacroSpace = 0  /* Oops, we are not in the macro space        */
  end /* if inMacroSpace = 1 */

RETURN inMacroSpace

  

Inf-HTML End Run - Successful