About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/is_defined.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 is_defined Context: slangrtl

Synopsis

Indicate whether a variable or function defined.

Syntax

Integer_Type is_defined (String_Type obj)

Description

This function is used to determine whether or not a function or variable whose name is obj has been defined. If obj is not defined, the function returns 0. Otherwise, it returns a non-zero value that defpends on the type of object obj represents. Specifically, it returns one of the following values:

     +1 if an intrinsic function
     +2 if user defined function
     -1 if intrinsic variable
     -2 if user defined variable
      0 if undefined

Example

For example, consider the function:

    define runhooks (hook)
    {
       if (2 == is_defined(hook)) eval(hook);
    }

This function could be called from another S-Lang function to allow customization of that function, e.g., if the function represents a mode, the hook could be called to setup keybindings for the mode.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.