void
exit(int
returncode
, void
|string
fmt
, mixed
... extra
)
Exit the whole Pike program with the given returncode
.
Using exit()
with any other value than 0
(zero) indicates
that something went wrong during execution. See your system manuals
for more information about return codes.
The arguments after the returncode
will be used for a call to
werror
to output a message on stderr.
_exit()
void
_exit(int
returncode
)
This function does the same as exit
, but doesn't bother to clean
up the Pike interpreter before exiting. This means that no destructors
will be called, caches will not be flushed, file locks might not be
released, and databases might not be closed properly.
Use with extreme caution.
exit()
void
atexit(function
(:void
) callback
)
This function puts the callback
in a queue of callbacks to
call when pike exits. The call order is reversed, i.e. callbacks
that have been added earlier are called after callback
.
Please note that atexit
callbacks are not called if Pike
exits abnormally.
exit()
, _exit()
int
trace(int
level
, void
|string
facility
, void
|int
all_threads
)
This function changes the trace level for the subsystem identified
by facility
to level
. If facility
is zero or left out, it
changes the global trace level which affects all subsystems.
Enabling tracing causes messages to be printed to stderr. A higher trace level includes the output from all lower levels. The lowest level is zero which disables all trace messages.
See the -t command-line option for more information.
level
If facility
is specified then there is typically only one
trace level for it, i.e. it's an on-or-off toggle. The global
trace levels, when facility
isn't specified, are:
| Trace calls to Pike functions and garbage collector runs. |
| Trace calls to builtin functions. |
| Trace every interpreted opcode. |
| Also trace the opcode arguments. |
facility
Valid facilities are:
| Trace the doings of the garbage collector. The setting is
never thread local.
|
all_threads
Trace levels are normally thread local, so changes affect only the current thread. To change the level in all threads, pass a nonzero value in this argument.
The old trace level in the current thread is returned.
array
(Pike.BacktraceFrame
) backtrace(int
|void
flags
)
Get a description of the current call stack.
flags
A bit mask of flags affecting generation of the backtrace.
Currently a single flag is defined:
| Return Note that since these values are "live", they may change or dissapear at any time unless the corresponding thread has been halted or similar. |
The description is returned as an array with one entry for each call frame on the stack.
The entries are represented by Pike.BacktraceFrame
objects.
The current call frame will be last in the array.
Please note that the frame order may be reversed in a later version of Pike to accommodate for deferred backtraces.
Note that the arguments reported in the backtrace are the current values of the variables, and not the ones that were at call-time. This can be used to hide sensitive information from backtraces (eg passwords).
In old versions of Pike the entries used to be represented by arrays of the following format:
Array | |
| A string with the filename if known, else zero. |
| An integer containing the linenumber if known, else zero. |
| The function that was called at this level. |
| The arguments that the function was called with. |
The above format is still supported by eg describe_backtrace()
.
catch()
, throw()
int
gc(mapping
|array
|void
quick
)
Force garbage collection.
quick
Perform a quick garbage collection on just this value,
which must have been made weak by set_weak_flag()
.
All values that only have a single reference from
quick
will then be freed.
When quick
hasn't been specified or is UNDEFINED
,
this function checks all the memory for cyclic structures such
as arrays containing themselves and frees them if appropriate.
It also frees up destructed objects and things with only weak
references.
Normally there is no need to call this function since Pike will call it by itself every now and then. (Pike will try to predict when 20% of all arrays/object/programs in memory is 'garbage' and call this routine then.)
The amount of garbage is returned. This is the number of arrays, mappings, multisets, objects and programs that had no nonweak external references during the garbage collection. It's normally the same as the number of freed things, but there might be some difference since _destruct() functions are called during freeing, which can cause more things to be freed or allocated.
Pike.gc_parameters
, Debug.gc_status
int
query_num_arg()
Returns the number of arguments given when the previous function was called.
This is useful for functions that take a variable number of arguments.
call_function()
string
version()
Report the version of Pike. Does the same as
sprintf("Pike v%d.%d release %d", __REAL_VERSION__,
__REAL_MINOR__, __REAL_BUILD__);
__VERSION__
, __MINOR__
, __BUILD__
,
__REAL_VERSION__
, __REAL_MINOR__
, __REAL_BUILD__
,