1\function{__get_reference} 2\synopsis{Get a reference to a global object} 3\usage{Ref_Type __get_reference (String_Type nm)} 4\description 5 This function returns a reference to a global variable or function 6 whose name is specified by \var{nm}. If no such object exists, it 7 returns \var{NULL}, otherwise it returns a reference. 8\example 9 For example, consider the function: 10#v+ 11 define runhooks (hook) 12 { 13 variable f; 14 f = __get_reference (hook); 15 if (f != NULL) 16 @f (); 17 } 18#v- 19 This function could be called from another \slang function to 20 allow customization of that function, e.g., if the function 21 represents a mode, the hook could be called to setup keybindings 22 for the mode. 23\seealso{is_defined, typeof, eval, autoload, __is_initialized, __uninitialize} 24\done 25 26\function{__uninitialize} 27\synopsis{Uninitialize a variable} 28\usage{__uninitialize (Ref_Type x)} 29\description 30 The \var{__uninitialize} function may be used to uninitialize the 31 variable referenced by the parameter \var{x}. 32\example 33 The following two lines are equivalent: 34#v+ 35 () = __tmp(z); 36 __uninitialize (&z); 37#v- 38\seealso{__tmp, __is_initialized} 39\done 40 41\variable{_auto_declare} 42\synopsis{Set automatic variable declaration mode} 43\usage{Integer_Type _auto_declare} 44\description 45 The \var{_auto_declare} may be used to have all undefined variables 46 implicitely declared as \var{static}. If set to zero, any variable 47 must be declared witha \var{variable} declaration before it can be 48 used. If set to one, then any undeclared variabled will be declared 49 as a \var{static} global variable. 50 51 The \var{_auto_declare} variable is is local to each compilation unit and 52 setting its value in one unit has no effect upon its value in other 53 units. The value of this variable has no effect upon the variables 54 in a function. 55\example 56 The following code will not compile if \var{X} not been 57 declared: 58#v+ 59 X = 1; 60#v- 61 However, 62#v+ 63 _auto_declare = 1; % declare variables as static. 64 X = 1; 65#v- 66 is equivalent to 67#v+ 68 static variable X = 1; 69#v- 70\notes 71 This variable should be used sparingly and is intended primarily for 72 interactive applications where one types \slang commands at a prompt. 73\done 74 75\function{getenv} 76\synopsis{Get the value of an environment variable} 77\usage{String_Type getenv(String_Type var)} 78\description 79 The \var{getenv} function returns a string that represents the 80 value of an environment variable \var{var}. It will return 81 \var{NULL} if there is no environment variable whose name is given 82 by \var{var}. 83\example 84#v+ 85 if (NULL != getenv ("USE_COLOR")) 86 { 87 set_color ("normal", "white", "blue"); 88 set_color ("status", "black", "gray"); 89 USE_ANSI_COLORS = 1; 90 } 91#v- 92\seealso{putenv, strlen, is_defined} 93\done 94 95\function{implements} 96\synopsis{Name a private namespace} 97\usage{implements (String_Type name);} 98\description 99 The \var{implements} function may be used to name the private 100 namespace associated with the current compilation unit. Doing so 101 will enable access to the members of the namespace from outside the 102 unit. The name of the global namespace is \exmp{Global}. 103\example 104 Suppose that some file \exmp{t.sl} contains: 105#v+ 106 implements ("Ts_Private"); 107 static define message (x) 108 { 109 Global->vmessage ("Ts_Private message: %s", x); 110 } 111 message ("hello"); 112#v- 113 will produce \exmp{"Ts_Private message: hello"}. This \var{message} 114 function may be accessed from outside via: 115#v+ 116 Ts_Private->message ("hi"); 117#v- 118\notes 119 Since \var{message} is an intrinsic function, it is global and may 120 not be redefined in the global namespace. 121\seealso{use_namespace, current_namespace, import} 122\done 123 124\function{putenv} 125\synopsis{Add or change an environment variable} 126\usage{putenv (String_Type s)} 127\description 128 This functions adds string \var{s} to the environment. Typically, 129 \var{s} should of the form \var{"name=value"}. The function 130 signals a \slang error upon failure. 131\notes 132 This function is not available on all systems. 133\seealso{getenv, sprintf} 134\done 135 136\function{use_namespace} 137\synopsis{Change to another namespace} 138\usage{use_namespace (String_Type name)} 139\description 140 The \var{use_namespace} function changes the current namespace to 141 the one specified by the parameter. If the specified namespace 142 does not exist, an error will be generated. 143\seealso{implements, current_namespace, import} 144\done 145 146\function{current_namespace} 147\synopsis{Get the name of the current namespace} 148\usage{String_Type current_namespace ()} 149\description 150 The \var{current_namespace} function returns the name of the 151 current namespace. If the current namespace is anonymous, that is, 152 has not been given a name via the \var{implements} function, the 153 empty string \exmp{""} will be returned. 154\seealso{implements, use_namespace, import} 155\done 156 157