📄 slangfun.txt
字号:
SYNOPSIS The number of parameters passed to a function USAGE Integer_Type _NARGS EXAMPLE This example uses the `_NARGS' variable to print the list of values passed to the function: define print_values () { variable arg; if (_NARGS == 0) { message ("Nothing to print"); return; } foreach (__pop_args (_NARGS)) { arg = (); vmessage ("Argument value is: %S", arg.value); } } SEE ALSO __pop_args, __push_args, typeof--------------------------------------------------------------__get_defined_symbols SYNOPSIS Get the symbols defined by the preprocessor USAGE Integer_Type __get_defined_symbols () DESCRIPTION The `__get_defined_symbols' functions is used to get the list of all the symbols defined by the S-Lang preprocessor. It pushes each of the symbols on the stack followed by the number of items pushed. SEE ALSO is_defined, _apropos, _get_namespaces--------------------------------------------------------------__is_initialized SYNOPSIS Determine whether or not a variable has a value USAGE Integer_Type __is_initialized (Ref_Type r) DESCRIPTION This function returns non-zero of the object referenced by `r' is initialized, i.e., whether it has a value. It returns 0 if the referenced object has not been initialized. EXAMPLE For example, the function: define zero () { variable f; return __is_initialized (&f); } will always return zero, but define one () { variable f = 0; return __is_initialized (&f); } will return one. NOTES It is easy to see why a reference to the variable must be passed to `__is_initialized' and not the variable itself; otherwise, the value of the variable would be passed and the variable may have no value if it was not initialized. SEE ALSO __get_reference, __uninitialize, is_defined, typeof, eval--------------------------------------------------------------_apropos SYNOPSIS Generate a list of functions and variables USAGE Array_Type _apropos (String_Type ns, String_Type s, Integer_Type flags) DESCRIPTION The `_apropos' function may be used to get a list of all defined objects in the namespace `ns' whose name matches the regular expression `s' and whose type matches those specified by `flags'. It returns an array of strings representing the matches. The second parameter `flags' is a bit mapped value whose bits are defined according to the following table 1 Intrinsic Function 2 User-defined Function 4 Intrinsic Variable 8 User-defined Variable EXAMPLE define apropos (s) { variable n, name, a; a = _apropos ("Global", s, 0xF); vmessage ("Found %d matches:", length (a)); foreach (a) { name = (); message (name); } } prints a list of all matches. NOTES If the namespace specifier `ns' is the empty string `""', then the namespace will default to the static namespace of the current compilation unit. SEE ALSO is_defined, sprintf, _get_namespaces--------------------------------------------------------------_function_name SYNOPSIS Returns the name of the currently executing function USAGE String_Type _function_name () DESCRIPTION This function returns the name of the currently executing function. If called from top-level, it returns the empty string. SEE ALSO _trace_function, is_defined--------------------------------------------------------------_get_namespaces SYNOPSIS Returns a list of namespace names USAGE String_Type[] _get_namespaces () DESCRIPTION This function returns a string array containing the names of the currently defined namespaces. SEE ALSO _apropos, use_namespace, implements, __get_defined_symbols--------------------------------------------------------------_slang_doc_dir SYNOPSIS Installed documentation directory USAGE String_Type _slang_doc_dir; DESCRIPTION The `_slang_doc_dir' variable is a read-only whose value specifies the installation location of the S-Lang documentation. SEE ALSO get_doc_string_from_file--------------------------------------------------------------_slang_version SYNOPSIS The S-Lang library version number USAGE Integer_Type _slang_version DESCRIPTION The `_slang_version' variable is read-only and whose value represents the number of the S-Lang library. SEE ALSO _slang_version_string--------------------------------------------------------------_slang_version_string SYNOPSIS The S-Lang library version number as a string USAGE String_Type _slang_version_string DESCRIPTION The `_slang_version_string' variable is read-only and whose value represents the version number of the S-Lang library. SEE ALSO _slang_version--------------------------------------------------------------get_doc_string_from_file SYNOPSIS Read documentation from a file USAGE String_Type get_doc_string_from_file (String_Type f, String_Type t) DESCRIPTION `get_doc_string_from_file' opens the documentation file `f' and searches it for topic `t'. It returns the documentation for `t' upon success, otherwise it returns `NULL' upon error. It will fail if `f' could not be opened or does not contain documentation for the topic. SEE ALSO stat_file SEE ALSO _slang_doc_dir--------------------------------------------------------------is_defined SYNOPSIS Indicate whether a variable or function defined. USAGE 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. SEE ALSO typeof, eval, autoload, __get_reference, __is_initialized--------------------------------------------------------------Conj SYNOPSIS Compute the complex conjugate of a number USAGE z1 = Conj (z) DESCRIPTION The `Conj' function returns the complex conjugate of a number. If its argument is an array, the `Conj' function will be applied to each element and the result returned as an array. SEE ALSO Real, Imag, abs--------------------------------------------------------------Imag SYNOPSIS Compute the imaginary part of a number USAGE i = Imag (z) DESCRIPTION The `Imag' function returns the imaginary part of a number. If its argument is an array, the `Imag' function will be applied to each element and the result returned as an array. SEE ALSO Real, Conj, abs--------------------------------------------------------------Real SYNOPSIS Compute the real part of a number USAGE r = Real (z) DESCRIPTION The `Real' function returns the real part of a number. If its argument is an array, the `Real' function will be applied to each element and the result returned as an array. SEE ALSO Imag, Conj, abs--------------------------------------------------------------abs SYNOPSIS Compute the absolute value of a number USAGE y = abs(x) DESCRIPTION The `abs' function returns the absolute value of an arithmetic type. If its argument is a complex number (`Complex_Type'), then it returns the modulus. If the argument is an array, a new array will be created whose elements are obtained from the original array by using the `abs' function. SEE ALSO sign, sqr--------------------------------------------------------------acos SYNOPSIS Compute the arc-cosine of an number USAGE y = acos (x) DESCRIPTION The `acos' function computes the arc-cosine of a number and returns the result as an array. If its argument is an array, the `acos' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------acosh SYNOPSIS Compute the inverse cosh of an number USAGE y = acosh (x) DESCRIPTION The `acosh' function computes the inverse cosh of a number and returns the result as an array. If its argument is an array, the `acosh' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------asin SYNOPSIS Compute the arc-sine of an number USAGE y = asin (x) DESCRIPTION The `asin' function computes the arc-sine of a number and returns the result as an array. If its argument is an array, the `asin' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------asinh SYNOPSIS Compute the inverse-sinh of an number USAGE y = asinh (x) DESCRIPTION The `asinh' function computes the inverse-sinh of a number and returns the result as an array. If its argument is an array, the `asinh' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------atan SYNOPSIS Compute the arc-tangent of an number USAGE y = atan (x) DESCRIPTION The `atan' function computes the arc-tangent of a number and returns the result as an array. If its argument is an array, the `atan' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------atanh SYNOPSIS Compute the inverse-tanh of an number USAGE y = atanh (x) DESCRIPTION The `atanh' function computes the inverse-tanh of a number and returns the result as an array. If its argument is an array, the `atanh' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------cos SYNOPSIS Compute the cosine of an number USAGE y = cos (x) DESCRIPTION The `cos' function computes the cosine of a number and returns the result as an array. If its argument is an array, the `cos' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------cosh SYNOPSIS Compute the hyperbolic cosine of an number USAGE y = cosh (x) DESCRIPTION The `cosh' function computes the hyperbolic cosine of a number and returns the result as an array. If its argument is an array, the `cosh' function will be applied to each element and the result returned as an array. SEE ALSO cos, atan, acosh, cosh--------------------------------------------------------------exp SYNOPSIS Compute the exponential of an number USAGE y = exp (x)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -