| 16. The rest |
float sin(float f)
Returns the sine value for f. f should be specified in radians.
asin, cos, tan
float asin(float f)
Return the arcus sine value for f. The result will be in radians.
sin, acos
float cos(float f)
Return the cosine value for f. f should be specified in radians.
acos, sin, tan
float acos(float f)
Return the arcus cosine value for f. The result will be in radians.
cos, asin
float tan(float f)
Returns the tangent value for f. f should be specified in radians.
atan, sin, cos
float atan(float f)
Returns the arcus tangent value for f. The result will be in radians.
tan, asin, acos, atan2
float atan2(float f1, float f2)
Returns the arcus tangent value for f1/f2, and uses the signs of f1 and f2 to determine the quadrant. The result will be in radians.
tan, asin, acos, atan
float sqrt(float f)
int sqrt(int i)
Returns the square root of f, or in the integer case, the square root truncated to the closest lower integer.
pow, log, exp, floor
float log(float f)
Return the natural logarithm of f.
for x > 0.exp( log(x) ) == x
pow, exp
float exp(float f)
Return the natural exponential of f.
as long as exp(x) doesn't overflow an int.log( exp( x ) ) == x
pow, log
float pow(float|int n, float|int x)
Return n raised to the power of x.
exp, log
float floor(float f)
Return the closest integer value less or equal to f.
floor does not return an int, merely an integer value stored in a float.
ceil, round
float ceil(float f)
Return the closest integer value greater or equal to f.
ceil does not return an int, merely an integer value stored in a float.
floor, round
float round(float f)
Return the closest integer value to f.
round does not return an int, merely an integer value stored in a float.
floor, ceil
mixed min(mixed ... args)
Returns the smallest value among args.
max
mixed max(mixed ... args)
Returns the largest value among args.
min
float abs(float f)
int abs(int f)
object abs(object f)
Return the absolute value for f.
int sgn(mixed value)
int sgn(mixed value, mixed zero)
Check the sign of a value.
Returns -1 if value is less than zero, 1 if value is greater than zero and 0 (zero) otherwise.
abs
Stdio.Stat file_stat(string path, void|int(0..1) symlink)
Stat a file.
If the argument symlink is 1 symlinks will not be followed.
If the path specified by path doesn't exist 0 (zero) will be returned.
Otherwise an object describing the properties of path will be returned.
In Pike 7.0 and earlier this function returned an array with 7 elements.
The old behaviour can be simulated with the following function:
array(int) file_stat(string path, void|int(0..1) symlink)
{
File.Stat st = predef::file_stat(path, symlink);
if (!st) return 0;
return (array(int))st;
}
Stdio.Stat, Stdio.File.stat
int file_truncate(string file, int length)
Truncates the file file to the length specified in length.
Returns 1 if ok, 0 if failed.
mapping(string:int) filesystem_stat(string path)
Returns a mapping describing the properties of the filesystem containing the path specified by path.
If a filesystem cannot be determined 0 (zero) will be returned.
Otherwise a mapping(string:int) with the following fields will be returned:
|
Please note that not all members are present on all OSs.
file_stat
void werror(string msg, mixed ... args)
Write to standard error.
int rm(string f)
Remove a file or directory.
Returns 0 (zero) on failure, 1 otherwise.
mkdir, Stdio.recursive_rm
int mkdir(string dirname, void|int mode)
Create a directory.
If mode is specified, it's will be used for the new directory after being &'ed with the current umask (on OS'es that support this).
Returns 0 (zero) on failure, 1 otherwise.
rm, cd, Stdio.mkdirhier
array(string) get_dir(string dirname)
Returns an array of all filenames in the directory dirname, or 0 (zero) if the directory does not exist.
mkdir, cd
int cd(string s)
Change the current directory for the whole Pike process.
Returns 1 for success, 0 (zero) otherwise.
getcwd
string getcwd()
Returns the current working directory.
cd
int exece(string file, array(string) args)
int exece(string file, array(string) args, mapping(string:string) env)
This function transforms the Pike process into a process running the program specified in the argument file with the arguments args.
If the mapping env is present, it will completely replace all environment variables before the new program is executed.
This function only returns if something went wrong during exece(2), and in that case it returns 0 (zero).
The Pike driver _dies_ when this function is called. You must either use fork or Process.create_process if you wish to execute a program and still run the Pike runtime.
Process.create_process, fork, Stdio.File.pipe
int mv(string from, string to)
Rename or move a file or directory.
If the destination already exists, it will be replaced. Replacement often only works if to is of the same type as from, i.e. a file can only be replaced by another file and so on. Also, a directory will commonly be replaced only if it's empty.
On some OSs this function can't move directories, only rename them.
Returns 0 (zero) on failure, 1 otherwise. Call errno to get more error info on failure.
rm
string strerror(int errno)
This function returns a description of an error code. The error code is usually obtained from eg Stdio.File.errno.
On some platforms the string returned can be somewhat nondescriptive.
int errno()
This function returns the system error from the last file operation.
Note that you should normally use Stdio.File.errno instead.
Stdio.File.errno, strerror
string sprintf(string format, mixed ... args)
Print formated output to string.
The format string is a string containing a description of how to output the data in args. This string should generally speaking have one %<modifiers><operator> format specifier (examples: %s, %0d, %-=20s) for each of the arguments.
The following modifiers are supported:
|
The following operators are supported:
|
Most modifiers and operators are combinable in any fashion, but some combinations may render strange results.
If an argument is an object that implements lfun::_sprintf, that callback will be called with the operator as the first argument, and the current modifiers as the second. The callback is expected to return a string.
Pike v7.3 release 11 running Hilfe v2.0 (Incremental Pike Frontend) > int screen_width=70; Result: 70 > mixed sample; > write(sprintf("fish: %c\n", 65)); fish: A Result: 8 > write(sprintf("Hello green friends\n")); Hello green friends Result: 20 > write(sprintf("num: %d\n", 10)); num: 10 Result: 8 > write(sprintf("num: %+10d\n", 10)); num: +10 Result: 16 > write(sprintf("num: %010d\n", 5*2)); num: 0000000010 Result: 16 > write(sprintf("num: %|10d\n", 20/2)); num: 10 Result: 16 > write(sprintf("%|*s\n",screen_width,"THE NOT END")); THE NOT END Result: 71 > write(sprintf("%|=*s\n",screen_width, "fun with penguins\n")); fun with penguins Result: 71 > write(sprintf("%-=*O\n",screen_width,({ "fish", 9, "gumbies", 2 }))); ({ /* 4 elements */ "fish", 9, "gumbies", 2 }) Result: 426 > write(sprintf("%-=*s\n", screen_width, >> "This will wordwrap the specified string within the "+ >> "specified field size, this is useful say, if you let "+ >> "users specify their screen size, then the room "+ >> "descriptions will automagically word-wrap as appropriate.\n"+ >> "slosh-n's will of course force a new-line when needed.\n")); This will wordwrap the specified string within the specified field size, this is useful say, if you let users specify their screen size, then the room descriptions will automagically word-wrap as appropriate. slosh-n's will of course force a new-line when needed. Result: 355 > write(sprintf("%-=*s %-=*s\n", screen_width/2, >> "Two columns next to each other (any number of columns will "+ >> "of course work) independantly word-wrapped, can be useful.", >> screen_width/2-1, >> "The - is to specify justification, this is in addherence "+ >> "to std sprintf which defaults to right-justification, "+ >> "this version also supports centre and right justification.")); Two columns next to each other (any The - is to specify justification, number of columns will of course this is in addherence to std work) independantly word-wrapped, sprintf which defaults to can be useful. right-justification, this version also supports centre and right justification. Result: 426 > write(sprintf("%-$*s\n", screen_width, >> "Given a\nlist of\nslosh-n\nseparated\n'words',\nthis option\n"+ >> "creates a\ntable out\nof them\nthe number of\ncolumns\n"+ >> "be forced\nby specifying a\npresision.\nThe most obvious\n"+ >> "use is for\nformatted\nls output.")); Given a list of slosh-n separated 'words', this option creates a table out of them the number of columns be forced by specifying a presision. The most obvious use is for formatted ls output. Result: 312 > write(sprintf("%-#*s\n", screen_width, >> "Given a\nlist of\nslosh-n\nseparated\n'words',\nthis option\n"+ >> "creates a\ntable out\nof them\nthe number of\ncolumns\n"+ >> "be forced\nby specifying a\npresision.\nThe most obvious\n"+ >> "use is for\nformatted\nls output.")); Given a creates a by specifying a list of table out presision. slosh-n of them The most obvious separated the number of use is for 'words', columns formatted this option be forced ls output. Result: 312 > sample = ([ "align":"left", "valign":"middle" ]); Result: ([ /* 2 elements */ "align":"left", "valign":"middle" ]) > write(sprintf("<td%{ %s='%s'%}>\n", (array)sample)); <td valign='middle' align='left'> Result: 34 > write(sprintf("Of course all the simple printf options "+ >> "are supported:\n %s: %d %x %o %c\n", >> "65 as decimal, hex, octal and a char", >> 65, 65, 65, 65)); Of course all the simple printf options are supported: 65 as decimal, hex, octal and a char: 65 41 101 A Result: 106 > write(sprintf("%[0]d, %[0]x, %[0]X, %[0]o, %[0]c\n", 75)); 75, 4b, 4B, 113, K Result: 19 > write(sprintf("%|*s\n",screen_width, "THE END")); THE END Result: 71
lfun::_sprintf
array(int|string|array(string)) getgrgid(int gid)
Get the group entry for the group with the id gid using the systemfunction getgrid(3).
The id of the group
An array with the information about the group
| ||||||||||
getgrent getgrnam
array(int|string|array(string)) getgrnam(string str)
Get the group entry for the group with the name str using the systemfunction getgrnam(3).
The name of the group
An array with the information about the group
| ||||||||||
getgrent getgrgid
array(int|string) getpwnam(string str)
Get the user entry for login str using the systemfunction getpwnam(3).
The login name of the user whos userrecord is requested.
An array with the information about the user
| ||||||||||||||||
getpwuid getpwent
array(int|string) getpwuid(int uid)
Get the user entry for UID uid using the systemfunction getpwuid(3).
The uid of the user whos userrecord is requested.
An array with the information about the user
| ||||||||||||||||
getpwnam getpwent
int setpwent()
Resets the getpwent function to the first entry in the passwd source using the systemfunction setpwent(3).
Always 0 (zero)
getpwent endpwent
int endpwent()
Closes the passwd source opened by getpwent function using the systemfunction endpwent(3).
Always 0 (zero)
getpwent setpwent
array(int|string) getpwent()
When first called, the getpwent function opens the passwd source and returns the first record using the systemfunction getpwent(3). For each following call, it returns the next record until EOF.
Call endpwent when done using getpwent.
An array with the information about the user
| ||||||||||||||||
0 if EOF.
getpwnam getpwent setpwent endpwent
array(array(int|string)) get_all_users()
Returns an array with all users in the system.
An array with arrays of userinfo as in getpwent.
getpwent getpwnam getpwuid
int setgrent()
Rewinds the getgrent pointer to the first entry
getgrent endgrent
int endgrent()
Closes the /etc/groups file after using the getgrent function.
getgrent setgrent
array(int|string|array(string)) getgrent()
Get a group entry from /etc/groups file. getgrent interates thru the groups source and returns one entry per call using the systemfunction getgrent(3).
Always call endgrent when done using getgrent!
An array with the information about the group
| ||||||||||
getgrnam getgrgid
array(array(int|string|array(string))) get_all_groups()
Returns an array of arrays with all groups in the system groups source. Each element in the returned array has the same structure as in getgrent function.
The groups source is system dependant. Refer to your system manuals for information about how to set the source.
| ||||
getgrent
array(int) get_groups_for_user(int|string user)
Gets all groups which a given user is a member of.
UID or loginname of the user
| ||||
get_all_groups getgrgid getgrnam getpwuid getpwnam
int equal(mixed a, mixed b)
This function checks if the values a and b are equal.
For all types but arrays, multisets and mappings, this operation is
the same as doing
.
For arrays, mappings and multisets however, their contents are checked
recursively, and if all their contents are the same and in the same
place, they are considered equal.a == b
copy_value
array aggregate(mixed ... elements)
Construct an array with the arguments as indices.
This function could be written in Pike as:
array aggregate(mixed ... elems) { return elems; }
Arrays are dynamically allocated there is no need to declare them
like
(and it isn't possible either) like
in C, just int a[10]=allocate(10);
will do.array(int) a=allocate(10);
sizeof, arrayp, allocate
int hash_7_0(string s)
int hash_7_0(string s, int max)
This function will return an int derived from the string s. The same string will always hash to the same value. If max is given, the result will be >= 0 and < max, otherwise the result will be >= 0 and <= 0x7fffffff.
This function is provided for backward compatibility reasons.
hash
int hash(string s)
int hash(string s, int max)
This function will return an int derived from the string s. The same string will always hash to the same value. If max is given, the result will be >= 0 and < max, otherwise the result will be >= 0 and <= 0x7fffffff.
The hash algorithm was changed in Pike 7.1. If you want a hash that is compatible with Pike 7.0 and earlier, use hash_7_0.
hash_7_0
mixed copy_value(mixed value)
Copy a value recursively.
If the result value is changed destructively (only possible for multisets, arrays and mappings) the copied value will not be changed.
The resulting value will always be equal to the copied (as tested with the function equal), but they may not the the same value (as tested with `==).
equal
string lower_case(string s)
Convert a string to lower case.
Returns a copy of the string s with all upper case characters converted to lower case.
upper_case
string upper_case(string s)
Convert a string to upper case.
Returns a copy of the string s with all lower case characters converted to upper case.
lower_case
string random_string(int len)
Returns a string of random characters 0-255 with the length len.
void random_seed(int seed)
This function sets the initial value for the random generator.
random
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
int search(string haystack, string|int needle, int|void start)
int search(array haystack, mixed needle, int|void start)
mixed search(mapping haystack, mixed needle, mixed|void start)
Search for needle in haystack. Return the position of needle in haystack or -1 if not found.
If the optional argument start is present search is started at this position.
When haystack is a string needle must be a string or an int, and the first occurrence of the string or int is returned.
When haystack is an array, needle is compared only to one value at a time in haystack.
When haystack is a mapping, search tries to find the index connected to the data needle. That is, it tries to lookup the mapping backwards. If needle isn't present in the mapping, zero is returned, and zero_type() will return 1 for this zero.
indices, values, zero_type
int has_prefix(string s, string prefix)
Returns 1 if the string s starts with prefix, returns 0 (zero) otherwise.
int has_suffix(string s, string suffix)
Returns 1 if the string s ends with suffix, returns 0 (zero) otherwise.
int has_index(string haystack, int index)
int has_index(array haystack, int index)
int has_index(mapping haystack, mixed index)
Search for index in haystack.
Returns 1 if index is in the index domain of haystack, or 0 (zero) if not found.
This function is equivalent to (but sometimes faster than):
search(indices(haystack), index) != -1
A negative index in strings and arrays as recognized by the index operators `[]() and `[]=() is not considered a proper index by has_index
has_value, indices, search, values, zero_type
int has_value(string haystack, string value)
int has_value(string haystack, int value)
int has_value(array haystack, int value)
int has_value(mapping haystack, mixed value)
Search for value in haystack.
Returns 1 if value is in the value domain of haystack, or 0 (zero) if not found.
This function is in all cases except when both arguments are strings equivalent to (but sometimes faster than):
search(values(haystack), value) != -1
If both arguments are strings, has_value is equivalent to:
search(haystack, value) != -1
has_index, indices, search, values, zero_type
void add_constant(string name, mixed value)
void add_constant(string name)
Add a new predefined constant.
This function is often used to add builtin functions. All programs compiled after the add_constant function has been called can access value by the name name.
If there is a constant called name already, it will be replaced by by the new definition. This will not affect already compiled programs.
Calling add_constant without a value will remove that name from the list of constants. As with replacing, this will not affect already compiled programs.
all_constants
string combine_path(string absolute, string ... relative)
string combine_path_unix(string absolute, string ... relative)
string combine_path_nt(string absolute, string ... relative)
Concatenate a relative path to an absolute path and remove any "//", "/.." or "/." to produce a straightforward absolute path as result.
combine_path_nt concatenates according to NT-filesystem conventions, while combine_path_unix concatenates according to UNIX-style.
combine_path is equvivalent to combine_path_unix on UNIX-like operating systems, and equvivalent to combine_path_nt on NT-like operating systems.
getcwd, Stdio.append_path
int zero_type(mixed a)
Return the type of zero.
There are many types of zeros out there, or at least there are two. One is returned by normal functions, and one returned by mapping lookups and find_call_out when what you looked for wasn't there. The only way to separate these two kinds of zeros is zero_type.
When doing a find_call_out or mapping lookup, zero_type on this value will return 1 if there was no such thing present in the mapping, or if no such call_out could be found.
If the argument to zero_type is a destructed object or a function in a destructed object, 2 will be returned.
In all other cases zero_type will return 0 (zero).
find_call_out
string string_to_unicode(string s)
Converts a string into an UTF16 compliant byte-stream.
Throws an error if characters not legal in an UTF16 stream are encountered. Valid characters are in the range 0x00000 - 0x10ffff, except for characters 0xfffe and 0xffff.
Characters in range 0x010000 - 0x10ffff are encoded using surrogates.
Locale.Charset.decoder, string_to_utf8, unicode_to_string, utf8_to_string
string unicode_to_string(string s)
Converts an UTF16 byte-stream into a string.
This function did not decode surrogates in Pike 7.2 and earlier.
Locale.Charset.decoder, string_to_unicode, string_to_utf8, utf8_to_string
string string_to_utf8(string s)
string string_to_utf8(string s, int extended)
Converts a string into an UTF8 compliant byte-stream.
Throws an error if characters not valid in an UTF8 stream are encountered. Valid characters are in the range 0x00000000 - 0x7fffffff.
If extended is 1, characters in the range 0x80000000-0xfffffffff will also be accepted, and encoded using a non-standard UTF8 extension.
Locale.Charset.encoder, string_to_unicode, unicode_to_string, utf8_to_string
string utf8_to_string(string s)
string utf8_to_string(string s, int extended)
Converts an UTF8 byte-stream into a string.
Throws an error if the stream is not a legal UFT8 byte-stream.
Accepts and decodes the extension used by string_to_utf8, if extended is 1.
Locale.Charset.encoder, string_to_unicode, string_to_utf8, unicode_to_string
string __parse_pike_type(string t)
mapping(string:mixed) all_constants()
Returns a mapping containing all global constants, indexed on the name of the constant, and with the value of the constant as value.
add_constant
array allocate(int size)
array allocate(int size, mixed zero)
Allocate an array of size elements and initialize them to zero.
sizeof, aggregate, arrayp
array(int) rusage()
Return resource usage.
Returns an array of ints describing how much resources the interpreter process has used so far. This array will have at least 29 elements, of which those values not available on this system will be zero.
The elements are as follows:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The values will not be further explained here; read your system manual for more information.
All values may not be present on all systems.
time
object this_object(void|int level)
Returns the object we are currently evaluating in.
level might be used to access the object of a surrounding class: The object at level 0 is the current object, the object at level 1 is the one belonging to the class surrounding the current class, and so on.
void throw(mixed value)
Throw value to a waiting catch.
If no catch is waiting the global error handling will send the value to master.
If you throw an array with where the first index contains an error message and the second index is a backtrace, (the output from backtrace) then it will be treated exactly like a real error by overlying functions.
catch
void exit(int returncode)
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.
_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
int time()
int time(int(1..1) one)
float time(int(2..) t)
This function returns the number of seconds since 1 Jan 1970.
The second syntax does not call the system call time() as often, but is only updated in the backed (when Pike code isn't running).
The third syntax can be used to measure time more preciely than one second. It return how many seconds has passed since t. The precision of this function varies from system to system.
ctime, localtime, mktime, gmtime
string crypt(string password)
int(0..1) crypt(string typed_password, string crypted_password)
This function crypts and verifies a short string (only the first 8 characters are significant).
The first syntax crypts the string password into something that is hopefully hard to decrypt.
The second syntax is used to verify typed_password against crypted_password, and returns 1 if they match, and 0 (zero) otherwise.
void destruct(object o)
Mark an object as destructed.
Calls o->destroy(), and then clears all variables in the object.
All pointers and function pointers to this object will become zero. The destructed object will be freed from memory as soon as possible.
array indices(string|array|mapping|multiset|object x)
Return an array of all valid indices for the value x.
For strings and arrays this is simply an array of ascending numbers.
For mappings and multisets, the array may contain any value.
For objects which define lfun::_indices that return value will be used.
For other objects an array with all non-static symbols will be returned.
values
array values(string|array|mapping|multiset|object x)
Return an array of all possible values from indexing the value x.
For strings an array of int with the ISO10646 codes of the characters in the string is returned.
For a multiset an array filled with ones (1) is returned.
For arrays a single-level copy of x is returned.
For mappings the array may contain any value.
For objects which define lfun::_values that return value will be used.
For other objects an array with the values of all non-static symbols will be returned.
indices
object next_object(object o)
object next_object()
Returns the next object from the list of all objects.
All objects are stored in a linked list.
If no arguments have been given next_object will return the first object from the list.
If o has been specified the object after o on the list will be returned.
This function is not recomended to use.
destruct
program object_program(mixed o)
Return the program from which o was instantiated.
If o is not an object or has been destructed 0 (zero) will be returned.
string reverse(string s)
array reverse(array a)
int reverse(int i)
Reverses a string, array or int.
This function reverses a string, char by char, an array, value by value or an int, bit by bit and returns the result.
Reversing strings can be particularly useful for parsing difficult syntaxes which require scanning backwards.
sscanf
string replace(string s, string from, string to)
string replace(string s, array(string) from, array(string) to)
string replace(string s, mapping(string:string) replacements)
array replace(array a, mixed from, mixed to)
mapping replace(mapping a, mixed from, mixed to)
Generic replace function.
This function can do several kinds replacement operations, the different syntaxes do different things as follows:
If all the arguments are strings, a copy of s with every occurrence of from replaced with to will be returned. Special case: to will be inserted between every character in s if from is the empty string.
If the first argument is a string, and the others array(string), a string
with every occurrance of from[i] in s replaced with
to[i] will be returned. Instead of the arrays from and to
a mapping equvivalent to
can be
used.mkmapping(from, to)
If the first argument is an array or mapping, the values of a which are `== with from will be replaced with to destructively. a will then be returned.
Note that replace on arrays and mappings is a destructive operation.
program compile(string source, object|void handler, int|void major, int|void minor, program|void target, object|void placeholder)
Compile a string to a program.
This function takes a piece of Pike code as a string and compiles it into a clonable program.
The optional argument handler is used to specify an alternative error handler. If it is not specified the current master object will be used.
The optional arguments major and minor are used to tell the compiler to attempt to be compatible with Pike major.minor.
Note that source must contain the complete source for a program. It is not possible to compile a single expression or statement.
Also note that compile does not preprocess the program. To preprocess the program you can use compile_string or call the preprocessor manually by calling cpp.
compile_string, compile_file, cpp, master
array|mapping|multiset set_weak_flag(array|mapping|multiset m, int state)
Set the value m to use weak or normal references in its indices and/or values (whatever is applicable). state is a bitfield built by using | between the following flags:
|
If a flag is absent, the corresponding field will use normal references. state can also be 1 as a compatibility measure; it's treated like Pike.WEAK.
m will be returned.
int objectp(mixed arg)
Returns 1 if arg is an object, 0 (zero) otherwise.
mappingp, programp, arrayp, stringp, functionp, multisetp, floatp, intp
int functionp(mixed arg)
Returns 1 if arg is a function, 0 (zero) otherwise.
mappingp, programp, arrayp, stringp, objectp, multisetp, floatp, intp
int callablep(mixed arg)
Returns 1 if arg is a callable, 0 (zero) otherwise.
mappingp, programp, arrayp, stringp, objectp, multisetp, floatp, intp
void sleep(int|float s)
This function makes the program stop for s seconds.
Only signal handlers can interrupt the sleep. Other callbacks are not called during sleep.
signal
void delay(int|float s)
This function makes the program stop for s seconds.
Only signal handlers can interrupt the sleep. Other callbacks are not called during sleep. Beware that this function uses busy-waiting to achieve the highest possible accuracy.
signal, sleep
int gc()
Force garbage collection.
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. It then returns how many arrays/objects/programs/etc. it managed to free by doing this.
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.)
int programp(mixed arg)
Returns 1 if arg is a program, 0 (zero) otherwise.
mappingp, intp, arrayp, stringp, objectp, multisetp, floatp, functionp
int intp(mixed arg)
Returns 1 if arg is an int, 0 (zero) otherwise.
mappingp, programp, arrayp, stringp, objectp, multisetp, floatp, functionp