Indicate whether a variable or function defined.
Integer_Type is_defined (String_Type obj)
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
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.
- slangrtl
-
__class_id,
__class_type,
__eqs,
__get_defined_symbols,
__get_reference,
__is_initialized,
__pop_args,
__push_args,
__uninitialize,
_apropos,
_function_name,
_nargs,
_typeof,
array_info,
autoload,
dup,
eval,
evalfile,
getenv,
is_struct_type,
length,
make_printable_string,
set_slang_load_path,
typecast,
typeof
|