17. The rest

  Namespace predef::

    Constant TOKENIZE_KEEP_ESCAPES

      `constant TOKENIZE_KEEP_ESCAPES`

    Description

      Don't unquote backslash-sequences in quoted strings during tokenizing. This is used for bug-compatibility with Microsoft...

    See also

      tokenize() , tokenize_labled()

    Method sin

      `float sin(float f)`

    Description

      Returns the sine value for f . f should be specified in radians.

    See also

      asin() , cos() , tan()

    Method asin

      `float asin(float f)`

    Description

      Return the arcus sine value for f . The result will be in radians.

    See also

      sin() , acos()

    Method cos

      `float cos(float f)`

    Description

      Return the cosine value for f . f should be specified in radians.

    See also

      acos() , sin() , tan()

    Method acos

      `float acos(float f)`

    Description

      Return the arcus cosine value for f . The result will be in radians.

    See also

      cos() , asin()

    Method tan

      `float tan(float f)`

    Description

      Returns the tangent value for f . f should be specified in radians.

    See also

      atan() , sin() , cos()

    Method atan

      `float atan(float f)`

    Description

      Returns the arcus tangent value for f . The result will be in radians.

    See also

      tan() , asin() , acos() , atan2()

    Method atan2

      `float atan2(float f1, float f2)`

    Description

      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.

    See also

      tan() , asin() , acos() , atan()

    Method sinh

      `float sinh(float f)`

    Description

      Returns the hyperbolic sine value for f .

    See also

      asinh() , cosh() , tanh()

    Method asinh

      `float asinh(float f)`

    Description

      Return the hyperbolic arcus sine value for f .

    See also

      sinh() , acosh()

    Method cosh

      `float cosh(float f)`

    Description

      Return the hyperbolic cosine value for f .

    See also

      acosh() , sinh() , tanh()

    Method acosh

      `float acosh(float f)`

    Description

      Return the hyperbolic arcus cosine value for f .

    See also

      cosh() , asinh()

    Method tanh

      `float tanh(float f)`

    Description

      Returns the hyperbolic tangent value for f .

    See also

      atanh() , sinh() , cosh()

    Method atanh

      `float atanh(float f)`

    Description

      Returns the hyperbolic arcus tangent value for f .

    See also

      tanh() , asinh() , acosh()

    Method sqrt

      `float sqrt(float f)`
      `int sqrt(int i)`
      `mixed sqrt(object o)`

    Description

      Returns the square root of f , or in the integer case, the square root truncated to the closest lower integer. If the argument is an object, the lfun _sqrt in the object will be called.

    See also

      pow() , log() , exp() , floor() , lfun::_sqrt

    Method log

      `float log(float f)`

    Description

      Return the natural logarithm of f . `exp( log(x) ) == x` for x > 0.

    See also

      pow() , exp()

    Method exp

      `float exp(float|int f)`

    Description

      Return the natural exponential of f . `log( exp( x ) ) == x` as long as exp(x) doesn't overflow an int.

    See also

      pow() , log()

    Method pow

      `int|float pow(float|int n, float|int x)`
      `mixed pow(object n, float|int|object x)`

    Description

      Return n raised to the power of x . If both n and x are integers the result will be an integer. If n is an object its pow method will be called with x as argument.

    See also

      exp() , log()

    Method floor

      `float floor(float f)`

    Description

      Return the closest integer value less or equal to f .

    Note

      floor() does not return an `int`, merely an integer value stored in a `float`.

    See also

      ceil() , round()

    Method ceil

      `float ceil(float f)`

    Description

      Return the closest integer value greater or equal to f .

    Note

      ceil() does not return an `int`, merely an integer value stored in a `float`.

    See also

      floor() , round()

    Method round

      `float round(float f)`

    Description

      Return the closest integer value to f .

    Note

      round() does not return an `int`, merely an integer value stored in a `float`.

    See also

      floor() , ceil()

    Method limit

      `int|float|object limit(int|float|object minval, int|float|object x, int|float|object maxval)`

    Description

      Limits the value x so that it's between minval and maxval . If x is an object, it must implement the lfun::`< method.

    See also

      max() and min()

    Method min

      `int|float|object min(int|float|object ... args)`
      `string min(string ... args)`
      `int(0..0) min()`

    Description

      Returns the smallest value among args . Compared objects must implement the lfun::`< method.

    See also

      max() and limit()

    Method max

      `int|float|object max(int|float|object ... args)`
      `string max(string ... args)`
      `int(0..0) max()`

    Description

      Returns the largest value among args . Compared objects must implement the lfun::`< method.

    See also

      min() and limit()

    Method abs

      `float abs(float f)`
      `int abs(int f)`
      `object abs(object f)`

    Description

      Return the absolute value for f . If f is an object it must implement lfun::`< and unary lfun::`- .

    Method sgn

      `int sgn(mixed value)`
      `int sgn(mixed value, mixed zero)`

    Description

      Check the sign of a value.

    Returns

      Returns `-1` if value is less than zero , `1` if value is greater than zero and `0` (zero) otherwise.

    See also

      abs()

    Method listxattr

      `array(string) listxattr(string file, void|int(0..1) symlink)`

    Description

      Return an array of all extended attributes set on the file

    Method getxattr

      `string getxattr(string file, string attr, void|int(0..1) symlink)`

    Description

      Return the value of a specified attribute, or 0 if it does not exist.

    Method removexattr

      `void removexattr(string file, string attr, void|int(0..1) symlink)`

    Description

      Remove the specified extended attribute.

    Method setxattr

      `void setxattr(string file, string attr, string value, int flags, void|int(0..1) symlink)`

    Description

      Set the attribute attr to the value value .

      The flags parameter can be used to refine the semantics of the operation.

      Stdio.XATTR_CREATE specifies a pure create, which fails if the named attribute exists already.

      Stdio.XATTR_REPLACE specifies a pure replace operation, which fails if the named attribute does not already exist.

      By default (no flags), the extended attribute will be created if need be, or will simply replace the value if the attribute exists.

    Returns

      1 if successful, 0 otherwise, setting errno.

    Method file_stat

      `Stdio.Stat file_stat(string path, void|int(0..1) symlink)`

    Description

      Stat a file.

      If the argument symlink is `1` symlinks will not be followed.

    Returns

      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.

    Note

      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; }

  See also

    Stdio.Stat , Stdio.File->stat()

  Method file_truncate

    `int file_truncate(string file, int length)`

  Description

    Truncates the file file to the length specified in length .

  Returns

    Returns 1 if ok, 0 if failed.

  Method filesystem_stat

    `mapping(string:int) filesystem_stat(string path)`

  Description

    Returns a mapping describing the properties of the filesystem containing the path specified by path .

  Returns

    If a filesystem cannot be determined `0` (zero) will be returned.

    Otherwise a mapping(string:int) with the following fields will be returned:

    `"blocksize" : int` | Size in bytes of the filesystem blocks.
    `"blocks" : int` | Size of the entire filesystem in blocks.
    `"bfree" : int` | Number of free blocks in the filesystem.
    `"bavail" : int` | Number of available blocks in the filesystem. This is usually somewhat less than the `"bfree"` value, and can usually be adjusted with eg tunefs(1M).
    `"files" : int` | Total number of files (aka inodes) allowed by this filesystem.
    `"ffree" : int` | Number of free files in the filesystem.
    `"favail" : int` | Number of available files in the filesystem. This is usually the same as the `"ffree"` value, and can usually be adjusted with eg tunefs(1M).
    `"fsname" : string` | Name assigned to the filesystem. This item is not available on all systems.
    `"fstype" : string` | Type of filesystem (eg `"nfs"`). This item is not available on all systems.

  Note

    Please note that not all members are present on all OSs.

  See also

    file_stat()

  Method rm

    `int rm(string f)`

  Description

    Remove a file or directory.

  Returns

    Returns `0` (zero) on failure, `1` otherwise.

  See also

    mkdir() , Stdio.recursive_rm()

  Method mkdir

    `int mkdir(string dirname, void|int mode)`

  Description

    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

    Returns `0` (zero) on failure, `1` otherwise.

  See also

    rm() , cd() , Stdio.mkdirhier()

  Method get_dir

    `array(string) get_dir(void|string dirname)`

  Description

    Returns an array of all filenames in the directory dirname , or `0` (zero) if the directory does not exist. When no dirname is given, current work directory is used.

  See also

    mkdir() , cd()

  Method cd

    `int cd(string s)`

  Description

    Change the current directory for the whole Pike process.

  Returns

    Returns `1` for success, `0` (zero) otherwise.

  See also

    getcwd()

  Method getcwd

    `string getcwd()`

  Description

    Returns the current working directory.

  See also

    cd()

  Method exece

    `int exece(string file, array(string) args)`
    `int exece(string file, array(string) args, mapping(string:string) env)`

  Description

    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.

  Returns

    This function only returns if something went wrong during `exece(2)`, and in that case it returns `0` (zero).

  Note

    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.

    This function is not available on all platforms.

  See also

    Process.create_process() , fork() , Stdio.File->pipe()

  Method mv

    `int mv(string from, string to)`

  Description

    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

    Returns `0` (zero) on failure, `1` otherwise. Call errno() to get more error info on failure.

  See also

    rm()

  Method strerror

    `string strerror(int errno)`

  Description

    This function returns a description of an error code. The error code is usually obtained from eg Stdio.File->errno() .

  Note

    On some platforms the string returned can be somewhat nondescriptive.

  Method errno

    `int errno()`

  Description

    This function returns the system error from the last file operation.

  Note

    Note that you should normally use Stdio.File->errno() instead.

  See also

    Stdio.File->errno() , strerror()

  Method create

    `void (array(string) headers, object from, int offset, int len, array(string) trailers, object to, function callback, mixed ... args)`

  Description

    Low-level implementation of Stdio.sendfile() .

    Sends headers followed by len bytes starting at offset from the file from followed by trailers to the file to . When completed callback will be called with the total number of bytes sent as the first argument, followed by args .

    Any of headers , from and trailers may be left out by setting them to `0`.

    Setting offset to `-1` means send from the current position in from .

    Setting len to `-1` means send until from 's end of file is reached.

  Note

    Don't use this class directly! Use Stdio.sendfile() instead.

    In Pike 7.7 and later the callback function will be called from the backend associated with to .

  See also

    Stdio.sendfile()

    `constant HKEY_CLASSES_ROOT`
    `constant HKEY_LOCAL_MACHINE`
    `constant HKEY_CURRENT_USER`
    `constant HKEY_USERS`

  Description

    Root handles in the Windows registry.

  Note

    These constants are only available on Win32 systems.

  See also

    RegGetValue() , RegGetValues() , RegGetKeyNames()

  Method RegGetValue

    `string|int|array(string) RegGetValue(int hkey, string key, string index)`

  Description

    Get a single value from the register.

  Parameter `hkey`

    One of the following:

    `HKEY_CLASSES_ROOT`
    `HKEY_LOCAL_MACHINE`
    `HKEY_CURRENT_USER`
    `HKEY_USERS`

  Parameter `key`

    Registry key.

  Parameter `index`

    Value name.

  Returns

    Returns the value stored at the specified location in the register if any. Returns `UNDEFINED` on missing keys, throws errors on other failures.

  Note

    This function threw errors on missing keys in Pike 7.6 and earlier (see System.RegGetValue_76() ).

  Note

    This function is only available on Win32 systems.

  See also

    RegGetValues() , RegGetKeyNames() , System.RegGetValue_76()

  Method RegGetKeyNames

    `array(string) RegGetKeyNames(int hkey, string key)`

  Description

    Get a list of value key names from the register.

  Parameter `hkey`

    One of the following:

    `HKEY_CLASSES_ROOT`
    `HKEY_LOCAL_MACHINE`
    `HKEY_CURRENT_USER`
    `HKEY_USERS`

  Parameter `key`

    A registry key.

  Returns

    Returns an array of value keys stored at the specified location if any. Returns `UNDEFINED` on missing key . Throws errors on other failures.

  Example

        > RegGetKeyNames(HKEY_CURRENT_USER, "Keyboard Layout");
          (1) Result: ({
            "IMEtoggle",
            "Preload",
            "Substitutes",
            "Toggle"
           })

  Note

    This function threw errors on missing key in Pike 7.6 and earlier (see System.RegGetKeyNames_76() ).

  Note

    This function is only available on Win32 systems.

  See also

    RegGetValue() , RegGetValues() , System.RegGetKeyNames_76()

  Method RegGetValues

    `mapping(string:string|int|array(string)) RegGetValues(int hkey, string key)`

  Description

    Get multiple values from the register.

  Parameter `hkey`

    One of the following:

    `HKEY_CLASSES_ROOT`
    `HKEY_LOCAL_MACHINE`
    `HKEY_CURRENT_USER`
    `HKEY_USERS`

  Parameter `key`

    Registry key.

  Returns

    Returns a mapping with all the values stored at the specified location in the register if any. Returns `UNDEFINED` on missing key . Throws errors on other failures.

  Example

        > RegGetValues(HKEY_CURRENT_USER, "Keyboard Layout\\Preload");
        (5) Result: ([
          "1":"0000041d"
         ])

  Note

    This function threw errors on missing key in Pike 7.6 and earlier (see System.RegGetValues_76() ).

  Note

    This function is only available on Win32 systems.

  See also

    RegGetValue() , RegGetKeyNames() , System.RegGetValues_76()

  Method getgrgid

    `array(int|string|array(string)) getgrgid(int gid)`

  Description

    Get the group entry for the group with the id gid using the systemfunction `getgrid(3)`.

  Parameter `gid`

    The id of the group

  Returns

    An array with the information about the group

    Array
    `string 0` | Group name
    `string 1` | Group password (encrypted)
    `int 2` | ID of the group
    `array 3..` | Array with UIDs of group members

  See also

    getgrent() getgrnam()

  Method getgrnam

    `array(int|string|array(string)) getgrnam(string str)`

  Description

    Get the group entry for the group with the name str using the systemfunction `getgrnam(3)`.

  Parameter `str`

    The name of the group

  Returns

    An array with the information about the group

    Array
    `string 0` | Group name
    `string 1` | Group password (encrypted)
    `int 2` | ID of the group
    `array 3..` | Array with UIDs of group members

  See also

    getgrent() getgrgid()

  Method getpwnam

    `array(int|string) getpwnam(string str)`

  Description

    Get the user entry for login str using the systemfunction `getpwnam(3)`.

  Parameter `str`

    The login name of the user whos userrecord is requested.

  Returns

    An array with the information about the user

    Array
    `string 0` | Users username (loginname)
    `string 1` | User password (encrypted)
    `int 2` | Users ID
    `int 3` | Users primary group ID
    `string 4` | Users real name an possibly some other info
    `string 5` | Users home directory
    `string 6` | Users shell

  See also

    getpwuid() getpwent()

  Method getpwuid

    `array(int|string) getpwuid(int uid)`

  Description

    Get the user entry for UID uid using the systemfunction `getpwuid(3)`.

  Parameter `uid`

    The uid of the user whos userrecord is requested.

  Returns

    An array with the information about the user

    Array
    `string 0` | Users username (loginname)
    `string 1` | User password (encrypted)
    `int 2` | Users ID
    `int 3` | Users primary group ID
    `string 4` | Users real name an possibly some other info
    `string 5` | Users home directory
    `string 6` | Users shell

  See also

    getpwnam() getpwent()

  Method get_all_users

    `array(array(int|string)) get_all_users()`

  Description

    Returns an array with all users in the system.

  Returns

    An array with arrays of userinfo as in getpwent .

  See also

    getpwent() getpwnam() getpwuid()

  Method get_all_groups

    `array(array(int|string|array(string))) get_all_groups()`

  Description

    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.

  Note

    The groups source is system dependant. Refer to your system manuals for information about how to set the source.

  Returns

    Array
    `array(int|string|array(string)) 0..` | Array with info about the group

  See also

    getgrent()

  Method get_groups_for_user

    `array(int) get_groups_for_user(int|string user)`

  Description

    Gets all groups which a given user is a member of.

  Parameter `user`

    UID or loginname of the user

  Returns

    Array
    `array 0..` | Information about all the users groups

  See also

    get_all_groups() getgrgid() getgrnam() getpwuid() getpwnam()

  Method sprintf

    `string sprintf(strict_sprintf_format format, sprintf_args ... args)`

  Description

    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:

    `'0'` | Zero pad numbers (implies right justification).
    `'!'` | Toggle truncation.
    `' '` | Pad positive integers with a space.
    `'+'` | Pad positive integers with a plus sign.
    `'-'` | Left adjust within field size (default is right).
    `'|'` | Centered within field size.
    `'='` | Column mode if strings are greater than field size. Breaks between words (possibly skipping or adding spaces). Can not be used together with `'/'`.
    `'/'` | Column mode with rough line break (break at exactly field size instead of between words). Can not be used together with `'='`.
    `'#'` | Table mode, print a list of `'\n'` separated words (top-to-bottom order).
    `'$'` | Inverse table mode (left-to-right order).
    `'n'` | (Where n is a number or *) field width specifier.
    `':n'`
    `'.n'` | Precision specifier.
    `';n'` | Column width specifier.

    `'*'`

    If n is a `*` then next argument is used for precision/field size. The argument may either be an integer, or a modifier mapping as received by lfun::_sprintf() :

    `"precision" : int|void` | Precision.
    `"width" : int(0..)|void` | Field width.
    `"flag_left" : int(0..1)|void` | Indicates that the output should be left-aligned.
    `"indent" : int(0..)|void` | Indentation level in `%O`-mode.

    `"'"` | Set a pad string. `'` cannot be a part of the pad string (yet).
    `'~'` | Get pad string from argument list.
    `'<'` | Use same argument again.
    `'^'` | Repeat this on every line produced.
    `'@'` | Repeat this format for each element in the argument array.
    `'>'` | Put the string at the bottom end of column instead of top.
    `'_'` | Set width to the length of data.
    `'[n]'` | Select argument number `n`. Use `*` to use the next argument as selector. The arguments are numbered starting from `0` (zero) for the first argument after the format . Note that this only affects where the current operand is fetched.

    The following operators are supported:

    `'%'` | Percent.
    `'b'` | Signed binary integer.
    `'d'` | Signed decimal integer.
    `'u'` | Unsigned decimal integer.
    `'o'` | Signed octal integer.
    `'x'` | Lowercase signed hexadecimal integer.
    `'X'` | Uppercase signed hexadecimal integer.
    `'c'` | Character. If a fieldsize has been specified this will output the low-order bytes of the integer in network (big endian) byte order. To get little endian byte order, negate the field size.
    `'f'` | Float. (Locale dependent formatting.)
    `'g'` | Heuristically chosen representation of float. (Locale dependent formatting.)
    `'G'` | Like `%g`, but uses uppercase `E` for exponent.
    `'e'` | Exponential notation float. (Locale dependent output.)
    `'E'` | Like `%e`, but uses uppercase `E` for exponent.
    `'F'` | Binary IEEE representation of float (`%4F` gives single precision, `%8F` gives double precision) in network (big endian) byte order. To get little endian byte order, negate the field size.
    `'s'` | String.
    `'q'` | Quoted string. Escapes all control and non-8-bit characters, as well as the quote characters `'\\'` and `'\"'`.
    `'O'` | Any value, debug style. Do not rely on the exact formatting; how the result looks can vary depending on locale, phase of the moon or anything else the lfun::_sprintf() method implementor wanted for debugging.
    `'H'` | Binary Hollerith string. Equivalent to `sprintf("%c%s", strlen(str), str)`. Arguments (such as width etc) adjust the length-part of the format. Requires 8-bit strings.
    `'n'` | No argument. Same as `"%s"` with an empty string as argument. Note: Does take an argument array (but ignores its content) if the modifier `'@'` is active.
    `'t'` | Type of the argument.
    `'{'` | Perform the enclosed format for every element of the argument array.
    `'}'`

    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.

  Note

    sprintf-style formatting is applied by many formatting functions, such write() and werror() . It is also possible to get sprintf-style compile-time argument checking by using the type-attributes sprintf_format or strict_sprintf_format in combination with sprintf_args .

  Note

    The `'q'` operator was added in Pike 7.7.

  Note

    Support for specifying modifiers via a mapping was added in Pike 7.8. This support can be tested for with the constant String.__HAVE_SPRINTF_STAR_MAPPING__ .

  Note

    Support for specifying little endian byte order to `'F'` was added in Pike 7.8. This support can be tested for with the constant String.__HAVE_SPRINTF_NEGATIVE_F__ .

  Example

    Pike v7.8 release 263 running Hilfe v3.5 (Incremental Pike Frontend) > sprintf("The unicode character %c has character code %04X.", 'A', 'A'); (1) Result: "The unicode character A has character code 0041." > sprintf("#%@02X is the HTML code for purple.", Image.Color.purple->rgb()); (2) Result: "#A020F0 is the HTML code for purple." > int n=4711; > sprintf("%d = hexadecimal %x = octal %o = %b binary", n, n, n, n); (3) Result: "4711 = hexadecimal 1267 = octal 11147 = 1001001100111 binary" > write(#"Formatting examples: Left adjusted [%-10d] Centered [%|10d] Right adjusted [%10d] Zero padded [%010d] ", n, n, n, n); Formatting examples: Left adjusted [4711 ] Centered [ 4711 ] Right adjusted [ 4711] Zero padded [0000004711] (5) Result: 142 int screen_width=70; > write("%-=*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. (6) Result: 355 > write("%-=*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. (7) Result: 426 > write("%-$*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. (8) Result: 312 > write("%-#*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. (9) Result: 312 > sample = ([ "align":"left", "valign":"middle" ]); (10) Result: ([ /* 2 elements */ "align":"left", "valign":"middle" ]) > write("<td%{ %s='%s'%}>\n", (array)sample); <td valign='middle' align='left'> (11) Result: 34 > write("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 (12) Result: 106 > write("%[0]d, %[0]x, %[0]X, %[0]o, %[0]c\n", 75); 75, 4b, 4B, 113, K (13) Result: 19 > write("%|*s\n",screen_width, "THE END"); THE END (14) Result: 71 > write("%|*s\n", ([ "width":screen_width ]), "ALTERNATIVE END"); ALTERNATIVE END (15) Result: 71

See also

  lfun::_sprintf() , strict_sprintf_format , sprintf_format , sprintf_args , String.__HAVE_SPRINTF_STAR_MAPPING__ , String.__HAVE_SPRINTF_NEGATIVE_F__ .

Method __handle_sprintf_format

  `type(mixed) __handle_sprintf_format(string attr, string fmt, type(mixed) arg_type, type(mixed) cont_type)`

Description

  Type attribute handler for `"sprintf_format"`.

Parameter `attr`

  Attribute to handle, either `"sprintf_format"` or `"strict_sprintf_format"`.

Parameter `fmt`

  Sprintf-style formatting string to generate type information from.

Parameter `arg_type`

  Declared type of the fmt argument (typically `string`).

Parameter `cont_type`

  Continuation function type after the fmt argument. This is scanned for the type attribute `"sprintf_args"` to determine where the remaining arguments to sprintf() will come from.

  This function is typically called from PikeCompiler()->apply_attribute_constant() and is used to perform stricter compile-time argument checking of sprintf() -style functions.

  It currently implements two operating modes depending on the value of attr :

  `"strict_sprintf_format"` | The formatting string fmt is known to always be passed to sprintf() .
  `"sprintf_format"` | The formatting string fmt is passed to sprintf() only if there are `"sprintf_args"`.

See also

  PikeCompiler()->apply_attribute_constant() , sprintf()

Constant sprintf_format

  `constant sprintf_format`

Description

  Type constant used for typing arguments that are optionally sent to sprintf() depending on the presence of extra arguments.

See also

  strict_sprintf_format , sprintf_args , sprintf()

Constant strict_sprintf_format

  `constant strict_sprintf_format`

Description

  Type constant used for typing arguments that are always sent to sprintf() regardless of the presence of extra arguments.

See also

  sprintf_format , sprintf_args , sprintf()

Constant sprintf_args

  `constant sprintf_args`

Description

  Type constant used for typing extra arguments that are sent to sprintf() .

See also

  strict_sprintf_format , sprintf_format , sprintf()

Method get_iterator

  `Iterator get_iterator(object|array|mapping|multiset|string data)`

Description

  Creates and returns a canonical iterator for data .

Returns
  `data` can have any of the following types:

  `object` | If data is an object with lfun::_get_iterator defined then it's called in it to create the iterator. If data is an object that lacks lfun::_get_iterator then it's assumed to already be an iterator object, and is simply returned.
  `array` | If data is an array, an Array.Iterator object will be returned.
  `mapping` | If data is a mapping, a Mapping.Iterator object will be returned
  `multiset` | If data is a multiset, a Multiset.Iterator object will be returned
  `string` | If data is a string, a String.Iterator object will be returned

Note

  This function is used by foreach to get an iterator for an object.

See also

  Iterator , lfun::_get_iterator

Method aggregate_mapping

  `mapping aggregate_mapping(mixed ... elems)`

Description

  Construct a mapping.

  Groups the arguments together two and two in key-index pairs and creates a mapping of those pairs. Generally, the mapping literal syntax is handier: `([ key1:val1, key2:val2, ... ])`

See also

  sizeof() , mappingp() , mkmapping()

Method load_module

  `program load_module(string module_name)`

Description

  Load a binary module.

  This function loads a module written in C or some other language into Pike. The module is initialized and any programs or constants defined will immediately be available.

  When a module is loaded the C function `pike_module_init()` will be called to initialize it. When Pike exits `pike_module_exit()` will be called. These two functions must be available in the module.

Note

  The current working directory is normally not searched for dynamic modules. Please use `"./name.so"` instead of just `"name.so"` to load modules from the current directory.

Method equal

  `int equal(mixed a, mixed b)`

Description

  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 `<font face='courier'>a` == <font face='courier'>b . 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.

See also

  copy_value()

Method aggregate

  `array aggregate(mixed ... elements)`

Description

  Construct an array with the arguments as indices.

  This function could be written in Pike as:

  array aggregate(mixed ... elems) { return elems; }

Note

  Arrays are dynamically allocated there is no need to declare them like `int a[10]=allocate(10);` (and it isn't possible either) like in C, just `array(int) a=allocate(10);` will do.

See also

  sizeof() , arrayp() , allocate()

Method hash_7_4

  `__deprecated__ int hash_7_4(string s)`
  `__deprecated__ int hash_7_4(string s, int max)`

Deprecated
See also

  7.4::hash()

Method hash_7_0

  `__deprecated__ int hash_7_0(string s)`
  `__deprecated__ int hash_7_0(string s, int max)`

Deprecated
See also

  7.0::hash()

Method hash

  `int hash(string s)`
  `int hash(string s, int max)`

Description

  Return an integer derived from the string s . The same string always hashes to the same value, also between processes, architectures, and Pike versions (see compatibility notes below, though).

  If max is given, the result will be >= 0 and < max , otherwise the result will be >= 0 and <= 0x7fffffff.

Note

  The hash algorithm was changed in Pike 7.5. If you want a hash that is compatible with Pike 7.4 and earlier, use 7.4::hash() . The difference only affects wide strings.

  The hash algorithm was also changed in Pike 7.1. If you want a hash that is compatible with Pike 7.0 and earlier, use 7.0::hash() .

Note

  This hash function differs from the one provided by hash_value() , in that hash_value() returns a process specific value.

See also

  7.0::hash() , 7.4::hash() , hash_value

Method hash_value

  `int hash_value(mixed value)`

Description

  Return a hash value for the argument. It's an integer in the native integer range.

  The hash will be the same for the same value in the running process only (the memory address is typically used as the basis for the hash value).

  If the value is an object with an lfun::__hash , that function is called and its result returned.

Note

  This is the hashing method used by mappings.

See also

  hash() , lfun::__hash()

Method copy_value

  `mixed copy_value(mixed value)`

Description

  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 `==() ).

See also

  equal()

Method lower_case

  `string lower_case(string s)`
  `int lower_case(int c)`

Description

  Convert a string or character to lower case.

Returns

  Returns a copy of the string s with all upper case characters converted to lower case, or the character c converted to lower case.

Note

  Assumes the string or character to be coded according to ISO-10646 (aka Unicode). If they are not, Locale.Charset.decoder can do the initial conversion for you.

Note

  Prior to Pike 7.5 this function only accepted strings.

See also

  upper_case() , Locale.Charset.decoder

Method upper_case

  `string upper_case(string s)`
  `int upper_case(int c)`

Description

  Convert a string or character to upper case.

Returns

  Returns a copy of the string s with all lower case characters converted to upper case, or the character c converted to upper case.

Note

  Assumes the string or character to be coded according to ISO-10646 (aka Unicode). If they are not, Locale.Charset.decoder can do the initial conversion for you.

Note

  Prior to Pike 7.5 this function only accepted strings.

See also

  lower_case() , Locale.Charset.decoder

Method random_string

  `string random_string(int len)`

Description

  Returns a string of random characters 0-255 with the length len .

Method random_seed

  `void random_seed(int seed)`

Description

  This function sets the initial value for the random generator.

See also

  random()

Method query_num_arg

  `int query_num_arg()`

Description

  Returns the number of arguments given when the previous function was called.

  This is useful for functions that take a variable number of arguments.

See also

  call_function()

Method search

  `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)`
  `mixed search(object haystack, mixed needle, mixed|void start)`

Description

  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.

  `haystack` can have any of the following types:

  `string` | When haystack is a string needle must be a string or an int, and the first occurrence of the string or int is returned.
  `array` | When haystack is an array, needle is compared only to one value at a time in haystack .
  `mapping` | 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.

  `object`

  When haystack is an object implementing lfun::_search() , the result of calling lfun::_search() with needle will be returned.

  If haystack is an object that doesn't implement lfun::_search() it is assumed to be an Iterator , and implement Iterator()->index() , Iterator()->value() , and Iterator()->next() . search() will then start comparing elements with `==() until a match with needle is found. If needle is found haystack will be advanced to the element, and the iterator index will be returned. If needle is not found, haystack will be advanced to the end (and will thus evaluate to false), and a zero with zero_type 1 will be returned.

Note

  If start is supplied to an iterator object without an lfun::_search() , haystack will need to implement Iterator()->set_index() .

Note

  For mappings and object UNDEFINED will be returned when not found. In all other cases `-1` will be returned when not found.

See also

  indices() , values() , zero_type() , has_value() , has_prefix() , has_suffix()

Method has_prefix

  `int has_prefix(string|object s, string prefix)`

Description

  Returns `1` if the string s starts with prefix , returns `0` (zero) otherwise.

  When s is an object, it needs to implement lfun::_sizeof() and lfun::`[] .

See also

  has_suffix() , has_value() , search()

Method has_suffix

  `int has_suffix(string s, string suffix)`

Description

  Returns `1` if the string s ends with suffix , returns `0` (zero) otherwise.

See also

  has_prefix() , has_value() , search()

Method has_index

  `int has_index(string haystack, int index)`
  `int has_index(array haystack, int index)`
  `int has_index(mapping|multiset|object|program haystack, mixed index)`

Description

  Search for index in haystack .

Returns

  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

Note

  A negative index in strings and arrays as recognized by the index operators ``[]()` and ``[]=()` is not considered a proper index by has_index()

See also

  has_value() , has_prefix() , has_suffix() , indices() , search() , values() , zero_type()

Method has_value

  `int has_value(string haystack, string value)`
  `int has_value(string haystack, int value)`
  `int has_value(array|mapping|object|program haystack, mixed value)`

Description

  Search for value in haystack .

Returns

  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

See also

  has_index() , indices() , search() , has_prefix() , has_suffix() , values() , zero_type()

Method add_constant

  `void add_constant(string name, mixed value)`
  `void add_constant(string name)`

Description

  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.

See also

  all_constants()

Method combine_path
Method combine_path_unix
Method combine_path_nt
Method combine_path_amigaos

  `string combine_path(string path, string ... paths)`
  `string combine_path_unix(string path, string ... paths)`
  `string combine_path_nt(string path, string ... paths)`
  `string combine_path_amigaos(string path, string ... paths)`

Description

  Concatenate a number of paths to a straightforward path without any `"//"`, `"/.."` or `"/."`. If any path argument is absolute then the result is absolute and the preceding arguments are ignored. If the result is relative then it might have leading `".."` components. If the last nonempty argument ends with a directory separator then the result ends with that too. If all components in a relative path disappear due to subsequent `".."` components then the result is `"."`.

  combine_path_unix() concatenates in UNIX style, which also is appropriate for e.g. URL:s ("/" separates path components and absolute paths start with "/"). combine_path_nt() concatenates according to NT filesystem conventions ("/" and "\" separates path components and there might be a drive letter in front of absolute paths). combine_path_amigaos() concatenates according to AmigaOS filesystem conventions.

  combine_path() is equivalent to combine_path_unix() on UNIX-like operating systems, and equivalent to combine_path_nt() on NT-like operating systems, and equivalent to combine_path_amigaos() on AmigaOS-like operating systems.

See also

  getcwd() , Stdio.append_path()

Method zero_type

  `int zero_type(mixed a)`

Description

  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() .

Returns

  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).

See also

  find_call_out()

Method string_to_unicode

  `string string_to_unicode(string s)`

Description

  Converts a string into an UTF16 compliant byte-stream.

Note

  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.

See also

  Locale.Charset.decoder() , string_to_utf8() , unicode_to_string() , utf8_to_string()

Method unicode_to_string

  `string unicode_to_string(string s)`

Description

  Converts an UTF16 byte-stream into a string.

Note

  This function did not decode surrogates in Pike 7.2 and earlier.

See also

  Locale.Charset.decoder() , string_to_unicode() , string_to_utf8() , utf8_to_string()

Method string_to_utf8

  `string string_to_utf8(string s)`
  `string string_to_utf8(string s, int extended)`

Description

  Converts a string into an UTF-8 compliant byte-stream.

Note

  Throws an error if characters not valid in an UTF-8 stream are encountered. Valid characters are in the ranges `0x00000000-0x0000d7ff` and `0x0000e000-0x0010ffff`.

  If extended is 1 then characters outside the valid ranges are accepted too and encoded using the same algorithm. Such encoded characters are however not UTF-8 compliant.

See also

  Locale.Charset.encoder() , string_to_unicode() , unicode_to_string() , utf8_to_string()

Method utf8_to_string

  `string utf8_to_string(string s)`
  `string utf8_to_string(string s, int extended)`

Description

  Converts an UTF-8 byte-stream into a string.

Note

  Throws an error if the stream is not a legal UTF-8 byte-stream.

  Accepts and decodes the extension used by string_to_utf8() if extended is `1`.

Note

  In conformance with RFC 3629 and Unicode 3.1 and later, non-shortest forms are not decoded. An error is thrown instead.

See also

  Locale.Charset.encoder() , string_to_unicode() , string_to_utf8() , unicode_to_string()

Method __parse_pike_type

  `string __parse_pike_type(string t)`

Method __soft_cast

  `type(mixed) __soft_cast(type(mixed) to, type(mixed) from)`

Description

  Return the resulting type from a soft cast of from to to .

Method __low_check_call

  `type(mixed) __low_check_call(type(mixed) fun_type, type(mixed) arg_type)`
  `type(mixed) __low_check_call(type(mixed) fun_type, type(mixed) arg_type, int flags)`

Description

  Check whether a function of type fun_type may be called with a first argument of type arg_type .

Parameter `flags`

  The following flags are currently defined:

  `1` | Strict types. Fail if not all possible values in arg_type are valid as the first argument to fun_type .
  `2` | Last argument. arg_type is the last argument to fun_type .
  `3` | Both strict types and last argument as above.

Returns

  Returns a continuation type on success.

  Returns `0` (zero) on failure.

Method __get_return_type

  `type(mixed) __get_return_type(type(mixed) fun_type)`

Description

  Check what a function of the type fun_type will return if called with no arguments.

Returns

  Returns the type of the returned value on success

  Returns `0` (zero) on failure.

Method __get_first_arg_type

  `type(mixed) __get_first_arg_type(type(mixed) fun_type)`

Description

  Check if a function of the type fun_type may be called with an argument, and return the type of that argument.

Returns

  Returns the expected type of the first argument to the function.

  Returns `0` (zero) if a function of the type fun_type may not be called with any argument, or if it is not callable.

Method all_constants

  `mapping(string:mixed) all_constants()`

Description

  Returns a mapping containing all global constants, indexed on the name of the constant, and with the value of the constant as value.

See also

  add_constant()

Method get_active_compilation_handler

  `CompilationHandler get_active_compilation_handler()`

Description

  Returns the currently active compilation compatibility handler, or `0` (zero) if none is active.

Note

  This function should only be used during a call of compile() .

See also

  get_active_error_handler() , compile() , master()->get_compilation_handler() , CompilationHandler

Method get_active_error_handler

  `CompilationHandler get_active_error_handler()`

Description

  Returns the currently active compilation error handler (second argument to compile() ), or `0` (zero) if none is active.

Note

  This function should only be used during a call of compile() .

See also

  get_active_compilation_handler() , compile() , CompilationHandler

Method allocate

  `array allocate(int size)`
  `array allocate(int size, mixed init)`

Description

  Allocate an array of size elements. If init is specified then each element is initialized by copying that value recursively.

See also

  sizeof() , aggregate() , arrayp()

Method this_object

  `object this_object(void|int level)`

Description

  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 that surrounds the class that the object comes from, and so on.

Note

  As opposed to a qualified `this` reference such as `global::this`, this function doesn't always access the objects belonging to the lexically surrounding classes. If the class containing the call has been inherited then the objects surrounding the inheriting class are accessed.

Method throw

  `mixed|void throw(mixed value)`

Description

  Throw value to a waiting catch .

  If no catch is waiting the global error handling will send the value to master()->handle_error() .

  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.

See also

  catch

Method exit

  `void exit(int returncode, void|string fmt, mixed ... extra)`

Description

  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.

See also

  _exit()

Method _exit

  `void _exit(int returncode)`

Description

  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.

See also

  exit()

Method time

  `int time()`
  `int time(int(1..1) one)`
  `float time(int(2..) t)`

Description

  This function returns the number of seconds since 00:00:00 UTC, 1 Jan 1970.

  The second syntax does not query the system for the current time. Instead the latest done by the pike process is returned again. That's slightly faster but can be wildly inaccurate. Pike queries the time internally when a thread has waited for something, typically in sleep or in a backend (see Pike.Backend ).

  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.

See also

  ctime() , localtime() , mktime() , gmtime() , System.gettimeofday , gethrtime

Method crypt

  `string crypt(string password)`
  `int(0..1) crypt(string typed_password, string crypted_password)`

Description

  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.

Note

  Note that strings containing null characters will only be processed up until the null character.

Method destruct

  `void destruct(void|object o)`

Description

  Mark an object as destructed.

  Calls `o->destroy()`, and then clears all variables in the object. If no argument is given, the current object is destructed.

  All pointers and function pointers to this object will become zero. The destructed object will be freed from memory as soon as possible.

Method indices

  `array indices(string|array|mapping|multiset|object x)`

Description

  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 might contain any value.

  For objects which define lfun::_indices() that return value is used.

  For other objects an array with all non-protected symbols is returned.

See also

  values()

Method values

  `array values(string|array|mapping|multiset|object x)`

Description

  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 is used.

  For other objects an array with the values of all non-protected symbols is returned.

See also

  indices()

Method next_object

  `object next_object(object o)`
  `object next_object()`

Description

  Returns the next object from the list of all objects.

  All objects are stored in a linked list.

Returns

  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.

Note

  This function is not recomended to use.

See also

  destruct()

Method object_program

  `program|function object_program(mixed o)`

Description

  Return the program from which o was instantiated. If the object was instantiated from a class using parent references the generating function will be returned.

  If o is not an object or has been destructed `0` (zero) will be returned.

Method reverse

  `string reverse(string s, int|void start, int|void end)`
  `array reverse(array a, int|void start, int|void end)`
  `int reverse(int i, int|void start, int|void end)`

Description

  Reverses a string, array or int.

Parameter `s`

  String to reverse.

Parameter `a`

  Array to reverse.

Parameter `i`

  Integer to reverse.

Parameter `start`

  Optional start index of the range to reverse. Default: `0` (zero).

Parameter `end`

  Optional end index of the range to reverse. Default for strings: `sizeof(s)-1`. Default for arrays: `sizeof(a)-1`. Default for integers: `Pike.get_runtime_info()->int_size - 1`.

  This function reverses a string, char by char, an array, value by value or an int, bit by bit and returns the result. It's not destructive on the input value.

  Reversing strings can be particularly useful for parsing difficult syntaxes which require scanning backwards.

See also

  sscanf()

Method replace

  `string replace(string s, string from, string to)`
  `string replace(string s, array(string) from, array(string) to)`
  `string replace(string s, array(string) from, 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)`

Description

  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 `<font face='courier'>mkmapping` (<font face='courier'>from , <font face='courier'>to ) can be used.

  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

  Note that replace() on arrays and mappings is a destructive operation.

Method compile

  `program compile(string source, CompilationHandler|void handler, int|void major, int|void minor, program|void target, object|void placeholder)`

Description

  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

  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() .

See also

  compile_string() , compile_file() , cpp() , master() , CompilationHandler , DefaultCompilerEnvironment

Method set_weak_flag

  `array|mapping|multiset set_weak_flag(array|mapping|multiset m, int state)`

Description

  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:

  `Pike.WEAK_INDICES` | Use weak references for indices. Only applicable for multisets and mappings.
  `Pike.WEAK_VALUES` | Use weak references for values. Only applicable for arrays and mappings.
  `Pike.WEAK` | Shorthand for `Pike.WEAK_INDICES|Pike.WEAK_VALUES`.

  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 .

Returns

  m will be returned.

Method objectp

  `int objectp(mixed arg)`

Description

  Returns `1` if arg is an object, `0` (zero) otherwise.

See also

  mappingp() , programp() , arrayp() , stringp() , functionp() , multisetp() , floatp() , intp()

Method functionp

  `int functionp(mixed arg)`

Description

  Returns `1` if arg is a function, `0` (zero) otherwise.

See also

  mappingp() , programp() , arrayp() , stringp() , objectp() , multisetp() , floatp() , intp()

Method callablep

  `int callablep(mixed arg)`

Description

  Returns `1` if arg is a callable, `0` (zero) otherwise.

See also

  mappingp() , programp() , arrayp() , stringp() , objectp() , multisetp() , floatp() , intp()

Method sleep

  `void sleep(int|float s, void|int abort_on_signal)`

Description

  This function makes the program stop for s seconds.

  Only signal handlers can interrupt the sleep, and only when abort_on_signal is set. If more than one thread is running the signal must be sent to the sleeping thread. Other callbacks are not called during sleep.

  If s is zero then this thread will yield to other threads but not sleep otherwise. Note that Pike yields internally at regular intervals so it's normally not necessary to do this.

See also

  signal() , delay()

Method delay

  `void delay(int|float s)`

Description

  This function makes the program stop for s seconds.

  Only signal handlers can interrupt the sleep. Other callbacks are not called during delay. Beware that this function uses busy-waiting to achieve the highest possible accuracy.

See also

  signal() , sleep()

Method gc

  `int gc()`

Description

  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.

  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.)

Returns

  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 destroy() functions are called during freeing, which can cause more things to be freed or allocated.

See also

  Pike.gc_parameters , Debug.gc_status

Method undefinedp

  `int undefinedp(mixed arg)`

Description

  Returns `1` if arg is undefined, `0` (zero) otherwise.

See also

  zero_type , destructedp , intp

Method destructedp

  `int destructedp(mixed arg)`

Description

  Returns `1` if arg is a destructed object, `0` (zero) otherwise.

See also

  zero_type , undefinedp , intp

Method programp

  `int programp(mixed arg)`

Description

  Returns `1` if arg is a program, `0` (zero) otherwise.

See also

  mappingp() , intp() , arrayp() , stringp() , objectp() , multisetp() , floatp() , functionp()

Method intp

  `int intp(mixed arg)`

Description

  Returns `1` if arg is an int, `0` (zero) otherwise.

See also

  mappingp() , programp() , arrayp() , stringp() , objectp() , multisetp() , floatp() , functionp()

Method mappingp

  `int mappingp(mixed arg)`

Description

  Returns `1` if arg is a mapping, `0` (zero) otherwise.

See also

  intp() , programp() , arrayp() , stringp() , objectp() , multisetp() , floatp() , functionp()

Method arrayp

  `int arrayp(mixed arg)`

Description

  Returns `1` if arg is an array, `0` (zero) otherwise.

See also

  intp() , programp() , mappingp() , stringp() , objectp() , multisetp() , floatp() , functionp()

Method multisetp

  `int multisetp(mixed arg)`

Description

  Returns `1` if arg is a multiset, `0` (zero) otherwise.

See also

  intp() , programp() , arrayp() , stringp() , objectp() , mappingp() , floatp() , functionp()

Method stringp

  `int stringp(mixed arg)`

Description

  Returns `1` if arg is a string, `0` (zero) otherwise.

See also

  intp() , programp() , arrayp() , multisetp() , objectp() , mappingp() , floatp() , functionp()

Method floatp

  `int floatp(mixed arg)`

Description

  Returns `1` if arg is a float, `0` (zero) otherwise.

See also

  intp() , programp() , arrayp() , multisetp() , objectp() , mappingp() , stringp() , functionp()

Method sort

  `array sort(array(mixed) index, array(mixed) ... data)`

Description

  Sort arrays destructively.

  This function sorts the array index destructively. That means that the array itself is changed and returned, no copy is created.

  If extra arguments are given, they are supposed to be arrays of the same size as index . Each of these arrays will be modified in the same way as index . I.e. if index 3 is moved to position 0 in index index 3 will be moved to position 0 in all the other arrays as well.

  The sort order is as follows:

  - Integers and floats are sorted in ascending order.

  - Strings are sorted primarily on the first characters that are different, and secondarily with shorter strings before longer. Different characters are sorted in ascending order on the character value. Thus the sort order is not locale dependent.

  - Arrays are sorted recursively on the first element. Empty arrays are sorted before nonempty ones.

  - Multisets are sorted recursively on the first index. Empty multisets are sorted before nonempty ones.

  - Objects are sorted in ascending order according to `<() , `>() and `==() .

  - Other types aren't reordered.

  - Different types are sorted in this order: Arrays, mappings, multisets, objects, functions, programs, strings, types, integers and floats. Note however that objects can control their ordering wrt other types with `< , `> and `== , so this ordering of types only applies to objects without those functions.

Returns

  The first argument is returned.

Note

  The sort is stable, i.e. elements that are compare-wise equal aren't reordered.

See also

  Array.sort_array , reverse()

Method rows

  `array rows(mixed data, array index)`

Description

  Select a set of rows from an array.

  This function is en optimized equivalent to:

  map(index , lambda(mixed x) { return data [x]; })

That is, it indices data on every index in the array index and returns an array with the results.

See also

  column()

Method gmtime

  `mapping(string:int) gmtime(int timestamp)`

Description

  Convert seconds since 00:00:00 UTC, Jan 1, 1970 into components.

  This function works like localtime() but the result is not adjusted for the local time zone.

See also

  localtime() , time() , ctime() , mktime()

Method localtime

  `mapping(string:int) localtime(int timestamp)`

Description

  Convert seconds since 00:00:00 UTC, 1 Jan 1970 into components.

Returns

  This function returns a mapping with the following components:

  `"sec" : int(0..60)` | Seconds over the minute.
  `"min" : int(0..59)` | Minutes over the hour.
  `"hour" : int(0..23)` | Hour of the day.
  `"mday" : int(1..31)` | Day of the month.
  `"mon" : int(0..11)` | Month of the year.
  `"year" : int(0..)` | Year since 1900.
  `"wday" : int(0..6)` | Day of week (0 = Sunday).
  `"yday" : int(0..365)` | Day of the year.
  `"isdst" : int(0..1)` | Is daylight savings time.
  `"timezone" : int` | Offset from UTC, including daylight savings time adjustment.

  An error is thrown if the localtime(2) call failed on the system. It's platform dependent what time ranges that function can handle, e.g. Windows doesn't handle a negative timestamp .

Note

  Prior to Pike 7.5 the field `"timezone"` was sometimes not present, and was sometimes not adjusted for daylight savings time.

See also

  Calendar , gmtime() , time() , ctime() , mktime()

Method mktime

  `int mktime(mapping(string:int) tm)`
  `int mktime(int sec, int min, int hour, int mday, int mon, int year, int|void isdst, int|void tz)`

Description

  This function converts information about date and time into an integer which contains the number of seconds since 00:00:00 UTC, Jan 1, 1970.

  You can either call this function with a mapping containing the following elements:

  `"sec" : int(0..60)` | Seconds over the minute.
  `"min" : int(0..59)` | Minutes over the hour.
  `"hour" : int(0..23)` | Hour of the day.
  `"mday" : int(1..31)` | Day of the month.
  `"mon" : int(0..11)` | Month of the year.
  `"year" : int(0..)` | Year since 1900.
  `"isdst" : int(0..1)` | Is daylight savings time.
  `"timezone" : int` | The timezone offset from UTC in seconds. If left out, the time will be calculated in the local timezone.

  Or you can just send them all on one line as the second syntax suggests.

Note

  On some operating systems (notably AIX and Win32), dates before 00:00:00 UTC, Jan 1, 1970 are not supported.

  On most systems, the supported range of dates are Dec 13, 1901 20:45:52 UTC through Jan 19, 2038 03:14:07 UTC (inclusive).

See also

  time() , ctime() , localtime() , gmtime()

Method glob

  `int(0..1) glob(string glob, string str)`
  `array(string) glob(string glob, array(string) str)`

Description

  Match strings against a glob pattern.

Parameter `glob`

  The glob pattern. A question sign ('?') matches any character and an asterisk ('*') matches a string of arbitrary length. All other characters only match themselves.

Parameter `str`

  `string` | `1` is returned if the string str matches glob , `0` (zero) otherwise.
  `array(string)` | All strings in the array str are matched against glob , and those that match are returned in an array (in the same order).

See also

  sscanf() , Regexp

Method _next

  `mixed _next(mixed x)`

Description

  Find the next object/array/mapping/multiset/program or string.

  All objects, arrays, mappings, multisets, programs and strings are stored in linked lists inside Pike. This function returns the next item on the corresponding list. It is mainly meant for debugging the Pike runtime, but can also be used to control memory usage.

See also

  next_object() , _prev()

Method _prev

  `mixed _prev(mixed x)`

Description

  Find the previous object/array/mapping/multiset or program.

  All objects, arrays, mappings, multisets and programs are stored in linked lists inside Pike. This function returns the previous item on the corresponding list. It is mainly meant for debugging the Pike runtime, but can also be used to control memory usage.

Note

  Unlike _next() this function does not work on strings.

See also

  next_object() , _next()

Method _refs

  `int _refs(string|array|mapping|multiset|function|object|program o)`

Description

  Return the number of references o has.

  It is mainly meant for debugging the Pike runtime, but can also be used to control memory usage.

Note

  Note that the number of references will always be at least one since the value is located on the stack when this function is executed.

See also

  _next() , _prev()

Method _typeof

  `type(mixed) _typeof(mixed x)`

Description

  Return the runtime type of x .

See also

  typeof()

Method replace_master

  `void replace_master(object o)`

Description

  Replace the master object with o .

  This will let you control many aspects of how Pike works, but beware that `master.pike` may be required to fill certain functions, so it is usually a good idea to have your master inherit the original master and only re-define certain functions.

  FIXME: Tell how to inherit the master.

See also

  master()

Method master

  `object master()`

Description

  Return the current master object.

Note

  May return UNDEFINED if no master has been loaded yet.

See also

  replace_master()

Method gethrvtime

  `int gethrvtime(void|int nsec)`

Description

  Return the CPU time that has been consumed by this process or thread. -1 is returned if the system couldn't determine it. The time is normally returned in microseconds, but if the optional argument nsec is nonzero it's returned in nanoseconds.

  The CPU time includes both user and system time, i.e. it's approximately the same thing you would get by adding together the "utime" and "stime" fields returned by System.getrusage (but perhaps with better accuracy).

  It's however system dependent whether or not it's the time consumed in all threads or in the current one only; System.CPU_TIME_IS_THREAD_LOCAL tells which. If both types are available then thread local time is preferred.

Note

  The actual accuracy on many systems is significantly less than microseconds or nanoseconds. See System.CPU_TIME_RESOLUTION .

Note

  The garbage collector might run automatically at any time. The time it takes is not included in the figure returned by this function, so that normal measurements aren't randomly clobbered by it. Explicit calls to gc are still included, though.

Note

  The special function gauge is implemented with this function.

See also

  System.CPU_TIME_IS_THREAD_LOCAL , System.CPU_TIME_RESOLUTION , gauge() , System.getrusage() , gethrtime()

Method gethrtime

  `int gethrtime(void|int nsec)`

Description

  Return the high resolution real time since some arbitrary event in the past. The time is normally returned in microseconds, but if the optional argument nsec is nonzero it's returned in nanoseconds.

  It's system dependent whether or not this time is monotonic, i.e. if it's unaffected by adjustments of the calendaric clock in the system. System.REAL_TIME_IS_MONOTONIC tells what it is. Pike tries to use monotonic time for this function if it's available.

Note

  The actual accuracy on many systems is significantly less than microseconds or nanoseconds. See System.REAL_TIME_RESOLUTION .

See also

  System.REAL_TIME_IS_MONOTONIC , System.REAL_TIME_RESOLUTION , time() , System.gettimeofday() , gethrvtime() , Pike.implicit_gc_real_time

Method get_profiling_info

  `array(int|mapping(string:array(int))) get_profiling_info(program prog)`

Description

  Get profiling information.

Returns

  Returns an array with two elements.

  Array
  `int num_clones` | The first element is the number of times the program prog has been instantiated.

  `mapping(string:array(int)) fun_prof_info`

  The second element is mapping from function name to an array with three elements.

  Array
  `int num_calls` | The first element is the number of times the function has been called.
  `int total_time` | The second element is the total time (in milliseconds) spent executing this function, and any functions called from it.
  `int self_time` | The third element is the time (in milliseconds) actually spent in this function so far.

Note

  This function is only available if the runtime was compiled with the option `--with-profiling`.

Method object_variablep

  `int(0..1) object_variablep(object o, string var)`

Description

  Find out if an object identifier is a variable.

Returns

  This function returns `1` if var exists as a non-protected variable in o , and returns `0` (zero) otherwise.

See also

  indices() , values()

Method map

  `mixed map(mixed arr, void|mixed fun, mixed ... extra)`

Description

  Applies fun to the elements in arr and collects the results.

  arr is treated as a set of elements, as follows:

  array
  multiset
  string

    fun is applied in order to each element. The results are collected, also in order, to a value of the same type as arr , which is returned.

  mapping

    fun is applied to the values, and each result is assigned to the same index in a new mapping, which is returned.

  program

    The program is treated as a mapping containing the identifiers that are indexable from it and their values.

  object

    If there is a lfun::cast method in the object, it's called to try to cast the object to an array, a mapping, or a multiset, in that order, which is then handled as described above.

  fun is applied in different ways depending on its type:

  function

    fun is called for each element. It gets the current element as the first argument and extra as the rest. The result of the call is collected.

  object

    fun is used as a function like above, i.e. the lfun::`() method in it is called.

  multiset
  mapping

    fun is indexed with each element. The result of that is collected.

  "zero or left out"

    Each element that is callable is called with extra as arguments. The result of the calls are collected. Elements that aren't callable gets zero as result.

  string

    Each element is indexed with the given string. If the result of that is zero then a zero is collected, otherwise it's called with extra as arguments and the result of that call is collected.

    This is typically used when arr is a collection of objects, and fun is the name of some function in them.

Note

  The function is never destructive on arr .

See also

  filter() , enumerate() , foreach()

Method filter

  `mixed filter(mixed arr, void|mixed fun, mixed ... extra)`

Description

  Filters the elements in arr through fun .

  arr is treated as a set of elements to be filtered, as follows:

  array
  multiset
  string

    Each element is filtered with fun . The return value is of the same type as arr and it contains the elements that fun accepted. fun is applied in order to each element, and that order is retained between the kept elements.

    If fun is an array, it should have the same length as arr . In this case, the elements in arr are kept where the corresponding positions in fun are nonzero. Otherwise fun is used as described below.

  mapping

    The values are filtered with fun , and the index/value pairs it accepts are kept in the returned mapping.

  program

    The program is treated as a mapping containing the identifiers that are indexable from it and their values.

  object

    If there is a lfun::cast method in the object, it's called to try to cast the object to an array, a mapping, or a multiset, in that order, which is then filtered as described above.

  Unless something else is mentioned above, fun is used as filter like this:

  function

    fun is called for each element. It gets the current element as the first argument and extra as the rest. The element is kept if it returns true, otherwise it's filtered out.

  object

    The object is used as a function like above, i.e. the lfun::`() method in it is called.

  multiset
  mapping

    fun is indexed with each element. The element is kept if the result is nonzero, otherwise it's filtered out.

  "zero or left out"

    Each element that is callable is called with extra as arguments. The element is kept if the result of the call is nonzero, otherwise it's filtered out. Elements that aren't callable are also filtered out.

  string

    Each element is indexed with the given string. If the result of that is zero then the element is filtered out, otherwise the result is called with extra as arguments. The element is kept if the return value is nonzero, otherwise it's filtered out.

    This is typically used when arr is a collection of objects, and fun is the name of some predicate function in them.

Note

  The function is never destructive on arr .

See also

  map() , foreach()

Method enumerate

  `array(int) enumerate(int n)`
  `array enumerate(int n, void|mixed step, void|mixed start, void|function operator)`

Description

  Create an array with an enumeration, useful for initializing arrays or as first argument to map() or foreach() .

  The defaults are: step = 1, start = 0, operator = `+

  ## Advanced use

  The resulting array is calculated like this:

  array enumerate(int n, mixed step, mixed start, function operator) { array res = allocate(n); for (int i=0; i < n; i++) { res[i] = start; start = operator(start, step); } return res; }

See also

  map() , foreach()

Method basetype

  `string basetype(mixed x)`

Description

  Same as sprintf("%t",x);

See also

  sprintf()

Method column

  `array column(array data, mixed index)`

Description

  Extract a column from a two-dimensional array.

  This function is exactly equivalent to:

  map(data , lambda(mixed x,mixed y) { return x[y]; }, index )

Except of course it is a lot shorter and faster. That is, it indices every index in the array data on the value of the argument index and returns an array with the results.

See also

  rows()

Method mkmultiset

  `multiset mkmultiset(array a)`

Description

  This function creates a multiset from an array.

See also

  aggregate_multiset()

Method trace

  `int trace(int level, void|string facility, void|int all_threads)`

Description

  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.

Parameter `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:

  `1` | Trace calls to Pike functions and garbage collector runs.
  `2` | Trace calls to builtin functions.
  `3` | Trace every interpreted opcode.
  `4` | Also trace the opcode arguments.

Parameter `facility`

  Valid facilities are:

  `"gc"`

  Trace the doings of the garbage collector. The setting is never thread local. level has two different meanings:
  1..2

    Trace the start and end of each gc run.

  3..

    Additionally show info about the collected garbage, to aid hunting down garbage problems. This currently shows gc'd trampolines. Note that the output can be very bulky and is somewhat low-level technical. Also note that pike currently has to be configured with `--with-rtldebug` to enable this.

Parameter `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.

Returns

  The old trace level in the current thread is returned.

Method ctime

  `string ctime(int timestamp)`

Description

  Convert the output from a previous call to time() into a readable string containing the current year, month, day and time.

  Like localtime , this function might throw an error if the ctime(2) call failed on the system. It's platform dependent what time ranges that function can handle, e.g. Windows doesn't handle a negative timestamp .

See also

  time() , localtime() , mktime() , gmtime()

Method mkmapping

  `mapping mkmapping(array ind, array val)`

Description

  Make a mapping from two arrays.

  Makes a mapping ind[x] :val[x] , `0 <= x < sizeof(ind)`.

  ind and val must have the same size.

  This is the inverse operation of indices() and values() .

See also

  indices() , values()

Method m_delete

  `mixed m_delete(object|mapping map, mixed index)`

Description

  If map is an object that implements lfun::_m_delete() , that function will be called with index as its single argument.

  Otherwise if map is a mapping the entry with index index will be removed from map destructively.

  If the mapping does not have an entry with index index , nothing is done.

Returns

  The value that was removed will be returned.

Note

  Note that m_delete() changes map destructively.

See also

  mappingp()

Method get_weak_flag

  `int get_weak_flag(array|mapping|multiset m)`

Description

  Returns the weak flag settings for m . It's a combination of Pike.WEAK_INDICES and Pike.WEAK_VALUES .

Method __empty_program

  `program __empty_program(int|void line, string|void file)`

Method function_name

  `string function_name(function f)`

Description

  Return the name of the function f .

  If f is a global function defined in the runtime `0` (zero) will be returned.

See also

  function_object()

Method function_object

  `object function_object(function f)`

Description

  Return the object the function f is in.

  If f is a global function defined in the runtime `0` (zero) will be returned.

  Zero will also be returned if f is a constant in the parent class. In that case function_program() can be used to get the parent program.

See also

  function_name() , function_program()

Method function_program

  `program function_program(function|program f)`

Description

  Return the program the function f is in.

  If f is a global function defined in the runtime `0` (zero) will be returned.

See also

  function_name() , function_object()

Method random

  `mixed random(object o)`

Description

  If random is called with an object, lfun::random will be called in the object.

See also

  lfun::_random

Method random

  `int random(int max)`
  `float random(float max)`

Description

  This function returns a random number in the range 0 - max -1.

See also

  random_seed()

Method random

  `mixed random(array|multiset x)`

Description

  Returns a random element from x .

Method random

  `array random(mapping m)`

Description

  Returns a random index-value pair from the mapping.

Method backtrace

  `array(Pike.BacktraceFrame) backtrace()`

Description

  FIXME: This documentation is not up to date!

  Get a description of the current call stack.

  The description is returned as an array with one entry for each call frame on the stack.

  Each entry has this format:

  Array
  `string file` | A string with the filename if known, else zero.
  `int line` | An integer containing the linenumber if known, else zero.
  `function fun` | The function that was called at this level.
  `mixed|void ... args` | The arguments that the function was called with.

  The current call frame will be last in the array.

Note

  Please note that the frame order may be reversed in a later version (than 7.1) 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).

See also

  catch() , throw()

Constant is_val_null

  `constant is_val_null`

Description

  Nonzero recognition constant.

Constant is_sql_null

  `constant is_sql_null`

Description

  SQL Null marker.

Deprecated

Constant UNDEFINED

  `constant UNDEFINED`

Description

  The undefined value; ie a zero for which zero_type() returns 1.

Constant this

  `constant this`

Description

  Builtin read only variable that evaluates to the current object.

See also

  this_program , this_object()

Constant this_program

  `constant this_program`

Description

  Builtin constant that evaluates to the current program.

See also

  this , this_object()

Constant __null_program

  `constant __null_program`

Description

  Program used internally by the compiler to create objects that are later modified into instances of the compiled program by the compiler.

See also

  __placeholder_object

Constant __placeholder_object

  `constant __placeholder_object`

Description

  Object used internally by the compiler.

See also

  __null_program

Method encode_value

  `string encode_value(mixed value, Codec|void codec)`

Description

  Code a value into a string.

  This function takes a value, and converts it to a string. This string can then be saved, sent to another Pike process, packed or used in any way you like. When you want your value back you simply send this string to decode_value() and it will return the value you encoded.

  Almost any value can be coded, mappings, floats, arrays, circular structures etc.

  If codec is specified, it's used as the codec for the decode. If no codec is specified, the current master object will be used.

  If `<font face='courier'>codec` ->nameof(o) returns `UNDEFINED` for an object, `val = o->encode_object(o)` will be called. The returned value will be passed to `o->decode_object(o, val)` when the object is decoded.

Note

  When only simple types like int, floats, strings, mappings, multisets and arrays are encoded, the produced string is very portable between pike versions. It can at least be read by any later version.

  The portability when objects, programs and functions are involved depends mostly on the codec. If the byte code is encoded, i.e. when Pike programs are actually dumped in full, then the string can probably only be read by the same pike version.

See also

  decode_value() , sprintf() , encode_value_canonic()

Method encode_value_canonic

  `string encode_value_canonic(mixed value, object|void codec)`

Description

  Code a value into a string on canonical form.

  Takes a value and converts it to a string on canonical form, much like encode_value() . The canonical form means that if an identical value is encoded, it will produce exactly the same string again, even if it's done at a later time and/or in another Pike process. The produced string is compatible with decode_value() .

Note

  Note that this function is more restrictive than encode_value() with respect to the types of values it can encode. It will throw an error if it can't encode to a canonical form.

See also

  encode_value() , decode_value()

Method decode_value

  `mixed decode_value(string coded_value, void|Codec codec)`

Description

  Decode a value from the string coded_value .

  This function takes a string created with encode_value() or encode_value_canonic() and converts it back to the value that was coded.

  If codec is specified, it's used as the codec for the decode. If no codec is specified, the current master object will be used.

See also

  encode_value() , encode_value_canonic()

Method signal

  `void signal(int sig, function(int|void:void) callback)`
  `void signal(int sig)`

Description

  Trap signals.

  This function allows you to trap a signal and have a function called when the process receives a signal. Although it IS possible to trap SIGBUS, SIGSEGV etc. I advice you not to. Pike should not receive any such signals and if it does it is because of bugs in the Pike interpreter. And all bugs should be reported, no matter how trifle.

  The callback will receive the signal number as its only argument.

  See the documentation for kill() for a list of signals.

  If no second argument is given, the signal handler for that signal is restored to the default handler.

  If the second argument is zero, the signal will be completely ignored.

See also

  kill() , signame() , signum()

Method signum

  `int signum(string sig)`

Description

  Get a signal number given a descriptive string.

  This function is the inverse of signame() .

See also

  signame() , kill() , signal()

Method signame

  `string signame(int sig)`

Description

  Returns a string describing the signal sig .

See also

  kill() , signum() , signal()

Method set_priority

  `int set_priority(string level, int|void pid)`

Method fork

  `object fork()`

Description

  Fork the process in two.

  Fork splits the process in two, and for the parent it returns a pid object for the child. Refer to your Unix manual for further details.

Note

  This function can cause endless bugs if used without proper care.

  This function is disabled when using threads.

  This function is not available on all platforms.

  The most common use for fork is to start sub programs, which is better done with Process.create_process() .

See also

  Process.create_process()

Method kill

  `void kill(int pid, int signal)`

Description

  Send a signal to another process. Returns nonzero if it worked, zero otherwise. errno may be used in the latter case to find out what went wrong.

  Some signals and their supposed purpose:

  `SIGHUP` | Hang-up, sent to process when user logs out.
  `SIGINT` | Interrupt, normally sent by ctrl-c.
  `SIGQUIT` | Quit, sent by ctrl-\.
  `SIGILL` | Illegal instruction.
  `SIGTRAP` | Trap, mostly used by debuggers.
  `SIGABRT` | Aborts process, can be caught, used by Pike whenever something goes seriously wrong.
  `SIGEMT` | Emulation trap.
  `SIGFPE` | Floating point error (such as division by zero).
  `SIGKILL` | Really kill a process, cannot be caught.
  `SIGBUS` | Bus error.
  `SIGSEGV` | Segmentation fault, caused by accessing memory where you shouldn't. Should never happen to Pike.
  `SIGSYS` | Bad system call. Should never happen to Pike.
  `SIGPIPE` | Broken pipe.
  `SIGALRM` | Signal used for timer interrupts.
  `SIGTERM` | Termination signal.
  `SIGUSR1` | Signal reserved for whatever you want to use it for. Note that some OSs reserve this signal for the thread library.
  `SIGUSR2` | Signal reserved for whatever you want to use it for. Note that some OSs reserve this signal for the thread library.
  `SIGCHLD` | Child process died. This signal is reserved for internal use by the Pike run-time.
  `SIGPWR` | Power failure or restart.
  `SIGWINCH` | Window change signal.
  `SIGURG` | Urgent socket data.
  `SIGIO` | Pollable event.
  `SIGSTOP` | Stop (suspend) process.
  `SIGTSTP` | Stop (suspend) process. Sent by ctrl-z.
  `SIGCONT` | Continue suspended.
  `SIGTTIN` | TTY input for background process.
  `SIGTTOU` | TTY output for background process.
  `SIGVTALRM` | Virtual timer expired.
  `SIGPROF` | Profiling trap.
  `SIGXCPU` | Out of CPU.
  `SIGXFSZ` | File size limit exceeded.
  `SIGSTKFLT` | Stack fault

Note

  Note that you have to use signame to translate the name of a signal to its number.

  Note that the kill function is not available on platforms that do not support signals. Some platforms may also have signals not listed here.

See also

  signal() , signum() , signame() , fork()

Method getpid

  `int getpid()`

Description

  Returns the process ID of this process.

See also

  System.getppid() , System.getpgrp()

Method alarm

  `int alarm(int seconds)`

Description

  Set an alarm clock for delivery of a signal.

  alarm() arranges for a SIGALRM signal to be delivered to the process in seconds seconds.

  If seconds is `0` (zero), no new alarm will be scheduled.

  Any previous alarms will in any case be canceled.

Returns

  Returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.

Note

  This function is only available on platforms that support signals.

See also

  ualarm() , signal() , call_out()

Method ualarm

  `int ualarm(int useconds)`

Description

  Set an alarm clock for delivery of a signal.

  alarm() arranges for a SIGALRM signal to be delivered to the process in useconds microseconds.

  If useconds is `0` (zero), no new alarm will be scheduled.

  Any previous alarms will in any case be canceled.

Returns

  Returns the number of microseconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.

Note

  This function is only available on platforms that support signals.

See also

  alarm() , signal() , call_out()

Method atexit

  `void atexit(function callback)`

Description

  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 .

Note

  Please note that atexit callbacks are not called if Pike exits abnormally.

See also

  exit() , _exit()

Method aggregate_multiset

  `multiset aggregate_multiset(mixed ... elems)`

Description

  Construct a multiset with the arguments as indices. The multiset will not contain any values. This method is most useful when constructing multisets with map or similar; generally, the multiset literal syntax is handier: `(<elem1, elem2, ...>)` With it, it's also possible to construct a multiset with values: `(<index1: value1, index2: value2, ...>)`

See also

  sizeof() , multisetp() , mkmultiset()

Method cpp

  `string cpp(string data, string|void current_file, int|string|void charset, object|void handler, void|int compat_major, void|int compat_minor, void|int picky_cpp)`

Description

  Run a string through the preprocessor.

  Preprocesses the string data with Pike's builtin ANSI-C look-alike preprocessor. If the current_file argument has not been specified, it will default to `"-"`. charset defaults to `"ISO-10646"`.

See also

  compile()

Method `()
Method call_function

  `mixed `()(function fun, mixed ... args)`
  `mixed call_function(function fun, mixed ... args)`

Description

  Call a function.

  Calls the function fun with the arguments specified by args .

See also

  lfun::`()()

Method sscanf

  `int sscanf(string data, string format, mixed ... lvalues)`

Description

  The purpose of sscanf is to match a string data against a format string and place the matching results into a list of variables. The list of lvalues are destructively modified (which is only possible because sscanf really is an opcode, rather than a pike function) with the values extracted from the data according to the format specification. Only the variables up to the last matching directive of the format string are touched.

  The format string can contain strings separated by special matching directives like `%d`, `%s``%c` and `%f`. Every such directive corresponds to one of the lvalues , in order they are listed. An lvalue is the name of a variable, a name of a local variable, an index in an array, mapping or object. It is because of these lvalues that sscanf can not be implemented as a normal function.

  Whenever a percent character is found in the format string, a match is performed, according to which operator and modifiers follow it:

  `"%b"` | Reads a binary integer (`"0101"` makes `5`)
  `"%d"` | Reads a decimal integer (`"0101"` makes `101`).
  `"%o"` | Reads an octal integer (`"0101"` makes `65`).
  `"%x"` | Reads a hexadecimal integer (`"0101"` makes `257`).
  `"%D"` | Reads an integer that is either octal (leading zero), hexadecimal (leading 0x) or decimal. (`"0101"` makes `65`).

  `"%c"`

  Reads one character and returns it as an integer (`"0101"` makes `48`, or `'0'`, leaving `"101"` for later directives). Using the field width and endianness modifiers, you can decode integers of any size and endianness. For example `"%-2c"` decodes `"0101"` into `12592`, leaving `"01"` fot later directives. The sign modifiers can be used to modify the signature of the data, making `"%+1c"` decode `"ä"` into `-28`.

  `"%n"` | Returns the current character offset in data . Note that any characters matching fields scanned with the `"!"`-modifier are removed from the count (see below).
  `"%f"` | Reads a float ("0101" makes 101.0).
  `"%F"` | Reads a float encoded according to the IEEE single precision binary format (`"0101"` makes `6.45e-10`, approximately). Given a field width modifier of 8 (4 is the default), the data will be decoded according to the IEEE double precision binary format instead. (You will however still get a float, unless your pike was compiled with the configure argument `--with-double-precision`.)
  `"%s"` | Reads a string. If followed by %d, %s will only read non-numerical characters. If followed by a %[], %s will only read characters not present in the set. If followed by normal text, %s will match all characters up to but not including the first occurrence of that text.
  `"%H"` | Reads a Hollerith-encoded string, i.e. first reads the length of the string and then that number of characters. The size and byte order of the length descriptor can be modified in the same way as `%c`. As an example `"%2H"` first reads `"%2c"` and then the resulting number of characters.

  `"%[set]"`

  Matches a string containing a given set of characters (those given inside the brackets). Ranges of characters can be defined by using a minus character between the first and the last character to be included in the range. Example: %[0-9H] means any number or 'H'. Note that sets that includes the character '-' must have it first (not possible in complemented sets, see below) or last in the brackets to avoid having a range defined. Sets including the character ']' must list this first too. If both '-' and ']' should be included then put ']' first and '-' last. It is not possible to make a range that ends with ']'; make the range end with '\' instead and put ']' at the beginning of the set. Likewise it is generally not possible to have a range start with '-'; make the range start with '.' instead and put '-' at the end of the set. If the first character after the [ bracket is '^' (%[^set]), and this character does not begin a range, it means that the set is complemented, which is to say that any character except those inside brackets is matched. To include '-' in a complemented set, it must be put last, not first. To include '^' in a non-complemented set, it can be put anywhere but first, or be specified as a range ("^-^").

  `"%{format%}"` | Repeatedly matches 'format' as many times as possible and assigns an array of arrays with the results to the lvalue.
  `"%O"` | Match a Pike constant, such as string or integer (currently only integer, string and character constants are functional).
  `"%%"` | Match a single percent character (hence this is how you quote the % character to just match, and not start an lvalue matcher directive).

  Similar to sprintf , you may supply modifiers between the % character and the operator, to slightly change its behaviour from the default:

  `"*"` | The operator will only match its argument, without assigning any variable.
  `number` | You may define a field width by supplying a numeric modifier. This means that the format should match that number of characters in the input data; be it a number characters long string, integer or otherwise (`"0101"` using the format %2c would read an unsigned short `12337`, leaving the final `"01"` for later operators, for instance).
  `"-"` | Supplying a minus sign toggles the decoding to read the data encoded in little-endian byte order, rather than the default network (big-endian) byte order.
  `"+"` | Interpret the data as a signed entity. In other words, `"%+1c"` will read `"\xFF"` as `-1` instead of `255`, as `"%1c"` would have.
  `"!"` | Ignore the matched characters with respect to any following `"%n"`.

Note

  Sscanf does not use backtracking. Sscanf simply looks at the format string up to the next % and tries to match that with the string. It then proceeds to look at the next part. If a part does not match, sscanf immediately returns how many % were matched. If this happens, the lvalues for % that were not matched will not be changed.

Example

      // a will be assigned "oo" and 1 will be returned
       sscanf("foo", "f%s", a);
       // a will be 4711 and b will be "bar", 2 will be returned
       sscanf("4711bar", "%d%s", a, b);
       // a will be 4711, 2 will be returned
       sscanf("bar4711foo", "%*s%d", a);
       // a will become "test", 2 will be returned
       sscanf(" \t test", "%*[ \t]%s", a);
       // Remove "the " from the beginning of a string
       // If 'str' does not begin with "the " it will not be changed
       sscanf(str, "the %s", str);
       // It is also possible to declare a variable directly in the sscanf call;
       // another reason for sscanf not to be an ordinary function:
       sscanf("abc def", "%s %s", string a, string b);

Returns

  The number of directives matched in the format string. Note that a string directive (%s or %[]) counts as a match even when matching just the empty string (which either may do).

See also

  sprintf , array_sscanf

Method array_sscanf

  `array array_sscanf(string data, string format)`

Description

  This function works just like sscanf() , but returns the matched results in an array instead of assigning them to lvalues. This is often useful for user-defined sscanf strings.

See also

  sscanf() , `/()

Method version

  `string version()`

Description

  Report the version of Pike. Does the same as

  sprintf("Pike v%d.%d release %d", __REAL_VERSION__, __REAL_MINOR__, __REAL_BUILD__);

See also

  __VERSION__ , __MINOR__ , __BUILD__ , __REAL_VERSION__ , __REAL_MINOR__ , __REAL_BUILD__ ,

Method _disable_threads

  `_disable_threads _disable_threads()`

Description

  This function first posts a notice to all threads that it is time to stop. It then waits until all threads actually *have* stopped, and then then returns a lock object. All other threads will be blocked from running until that object has been freed/destroyed.

  It's mainly useful to do things that require a temporary uid/gid change, since on many OS the effective user and group applies to all threads.

Note

  You should make sure that the returned object is freed even if some kind of error is thrown. That means in practice that it should only have references (direct or indirect) from function local variables. Also, it shouldn't be referenced from cyclic memory structures, since those are only destructed by the periodic gc. (This advice applies to mutex locks in general, for that matter.)

Method `!=

  `int(0..1) `!=(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Inequality test.

  Every expression with the `!=` operator becomes a call to this function, i.e. `a!=b` is the same as `predef::`!=(a,b)`.

  This is the inverse of `==() ; see that function for further details.

Returns

  Returns `1` if the test is successful, `0` otherwise.

See also

  `==()

Method `==

  `int(0..1) `==(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Equality test.

  Every expression with the `==` operator becomes a call to this function, i.e. `a==b` is the same as `predef::`==(a,b)`.

  If more than two arguments are given, each argument is compared with the following one as described below, and the test is successful iff all comparisons are successful.

  If the first argument is an object with an lfun::`==() , that function is called with the second as argument, unless the second argument is the same as the first argument. The test is successful iff its result is nonzero (according to `! ).

  Otherwise, if the second argument is an object with an lfun::`==() , that function is called with the first as argument, and the test is successful iff its result is nonzero (according to `! ).

  Otherwise, if the arguments are of different types, the test is unsuccessful. Function pointers to programs are automatically converted to program pointers if necessary, though.

  Otherwise the test depends on the type of the arguments:

  `int` | Successful iff the two integers are numerically equal.
  `float` | Successful iff the two floats are numerically equal or if both are NaN.
  `string` | Successful iff the two strings are identical, character for character. (Since all strings are kept unique, this is actually a test whether the arguments point to the same string, and it therefore run in constant time.)
  `array|mapping|multiset|object|function|program|type(mixed)` | Successful iff the two arguments point to the same instance.

Returns

  Returns `1` if the test is successful, `0` otherwise.

Note

  Floats and integers are not automatically converted to test against each other, so e.g. `0==0.0` is false.

Note

  Programs are not automatically converted to types to be compared type-wise.

See also

  `!() , `!=()

Method `<

  `int(0..1) `<(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Less than test.

  Every expression with the `<` operator becomes a call to this function, i.e. `a<b` is the same as `predef::`<(a,b)`.

Returns

  Returns `1` if the test is successful, `0` otherwise.

See also

  `<=() , `>() , `>=()

Method `<=

  `int(0..1) `<=(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Less than or equal test.

  Every expression with the `<=` operator becomes a call to this function, i.e. `a<=b` is the same as `predef::`<=(a,b)`.

Returns

  Returns `1` if the test is successful, `0` otherwise.

Note

  For total orders, e.g. integers, this is the inverse of `>() .

See also

  `<() , `>() , `>=()

Method `>

  `int(0..1) `>(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Greater than test.

  Every expression with the `>` operator becomes a call to this function, i.e. `a>b` is the same as `predef::`>(a,b)`.

Returns

  Returns `1` if the arguments are strictly decreasing, and `0` (zero) otherwise.

See also

  `<() , `<=() , `>=()

Method `>=

  `int(0..1) `>=(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Greater than or equal test.

  Every expression with the `>=` operator becomes a call to this function, i.e. `a>=b` is the same as `predef::`>=(a,b)`.

Returns

  Returns `1` if the test is successful, `0` otherwise.

Note

  For total orders, e.g. integers, this is the inverse of `<() .

See also

  `<=() , `>() , `<()

Method `+

  `mixed `+(mixed arg)`
  `mixed `+(object arg, mixed ... more)`
  `int `+(int arg, int ... more)`
  `float `+(float|int arg, float|int ... more)`
  `string `+(string|float|int arg, string|float|int ... more)`
  `array `+(array arg, array ... more)`
  `mapping `+(mapping arg, mapping ... more)`
  `multiset `+(multiset arg, multiset ... more)`

Description

  Addition/concatenation.

  Every expression with the `+` operator becomes a call to this function, i.e. `a+b` is the same as `predef::`+(a,b)`. Longer `+` expressions are normally optimized to one call, so e.g. `a+b+c` becomes `predef::`+(a,b,c)`.

Returns

  If there's a single argument, that argument is returned.

  If arg is an object with only one reference and an lfun::`+=() , that function is called with the rest of the arguments, and its result is returned.

  Otherwise, if arg is an object with an lfun::`+() , that function is called with the rest of the arguments, and its result is returned.

  Otherwise, if any of the other arguments is an object that has an lfun::``+() , the first such function is called with the arguments leading up to it, and `+() is then called recursively with the result and the rest of the arguments.

  Otherwise, if arg is UNDEFINED and the other arguments are either arrays, mappings or multisets, the first argument is ignored and the remaining are added together as described below. This is useful primarily when appending to mapping values since `m[x] += ({foo})` will work even if `m[x]` doesn't exist yet.

  Otherwise the result depends on the argument types:

  `int|float` | The result is the sum of all the arguments. It's a float if any argument is a float.
  `string|int|float` | If any argument is a string, all will be converted to strings and concatenated in order to form the result.
  `array` | The array arguments are concatened in order to form the result.
  `mapping` | The result is like arg but extended with the entries from the other arguments. If the same index (according to hash_value and `== ) occur in several arguments, the value from the last one is used.
  `multiset` | The result is like arg but extended with the entries from the other arguments. Subsequences with orderwise equal indices (i.e. where `< returns false) are concatenated into the result in argument order.

  The function is not destructive on the arguments - the result is always a new instance.

Note

  In Pike 7.0 and earlier the addition order was unspecified.

  The treatment of UNDEFINED was new in Pike 7.0.

See also

  `-() , lfun::`+() , lfun::``+()

Method `-

  `mixed `-(mixed arg1)`
  `mixed `-(mixed arg1, mixed arg2, mixed ... extras)`
  `mixed `-(object arg1, mixed arg2)`
  `mixed `-(mixed arg1, object arg2)`
  `int `-(int arg1, int arg2)`
  `float `-(float arg1, int|float arg2)`
  `float `-(int|float arg1, float arg2)`
  `string `-(string arg1, string arg2)`
  `array `-(array arg1, array arg2)`
  `mapping `-(mapping arg1, array arg2)`
  `mapping `-(mapping arg1, mapping arg2)`
  `mapping `-(mapping arg1, multiset arg2)`
  `multiset `-(multiset arg1, multiset arg2)`

Description

  Negation/subtraction/set difference.

  Every expression with the `-` operator becomes a call to this function, i.e. `-a` is the same as `predef::`-(a)` and `a-b` is the same as `predef::`-(a,b)`. Longer `-` expressions are normally optimized to one call, so e.g. `a-b-c` becomes `predef::`-(a,b,c)`.

Returns

  If there's a single argument, that argument is returned negated. If arg1 is an object with an lfun::`-() , that function is called without arguments, and its result is returned.

  If there are more than two arguments the result is: ``-(`-(<font face='courier'>arg1` , <font face='courier'>arg2 ), @<font face='courier'>extras ).

  Otherwise, if arg1 is an object with an lfun::`-() , that function is called with arg2 as argument, and its result is returned.

  Otherwise, if arg2 is an object with an lfun::``-() , that function is called with arg1 as argument, and its result is returned.

  Otherwise the result depends on the argument types:

  `arg1` can have any of the following types:

  `int|float` | The result is `<font face='courier'>arg1` - <font face='courier'>arg2 , and is a float if either arg1 or arg2 is a float.
  `string` | The result is arg1 with all nonoverlapping occurrences of the substring arg2 removed. In cases with two overlapping occurrences, the leftmost is removed.
  `array|mapping|multiset` | The result is like arg1 but without the elements/indices that match any in arg2 (according to `== and, in the case of mappings, hash_value ).

  The function is not destructive on the arguments - the result is always a new instance.

Note

  In Pike 7.0 and earlier the subtraction order was unspecified.

See also

  `+()

Method `&

  `mixed `&(mixed arg1)`
  `mixed `&(mixed arg1, mixed arg2, mixed ... extras)`
  `mixed `&(object arg1, mixed arg2)`
  `mixed `&(mixed arg1, object arg2)`
  `int `&(int arg1, int arg2)`
  `string `&(string arg1, string arg2)`
  `array `&(array arg1, array arg2)`
  `mapping `&(mapping arg1, mapping arg2)`
  `mapping `&(mapping arg1, array arg2)`
  `mapping `&(mapping arg1, multiset arg2)`
  `multiset `&(multiset arg1, multiset arg2)`
  `type(mixed) `&(type(mixed)|program arg1, type(mixed)|program arg2)`

Description

  Bitwise and/intersection.

  Every expression with the `&` operator becomes a call to this function, i.e. `a&b` is the same as `predef::`&(a,b)`.

Returns

  If there's a single argument, that argument is returned.

  If there are more than two arguments the result is: ``&(`&(<font face='courier'>arg1` , <font face='courier'>arg2 ), @<font face='courier'>extras ).

  Otherwise, if arg1 is an object with an lfun::`&() , that function is called with arg2 as argument, and its result is returned.

  Otherwise, if arg2 is an object with an lfun::``&() , that function is called with arg1 as argument, and its result is returned.

  Otherwise the result depends on the argument types:

  `arg1` can have any of the following types:

  `int` | Bitwise and of arg1 and arg2 .
  `string` | The result is a string where each character is the bitwise and of the characters in the same position in arg1 and arg2 . The arguments must be strings of the same length.
  `array|mapping|multiset` | The result is like arg1 but only with the elements/indices that match any in arg2 (according to `== and, in the case of mappings, hash_value ).
  `type(mixed)|program` | Type intersection of arg1 and arg2 .

  The function is not destructive on the arguments - the result is always a new instance.

See also

  `|() , lfun::`&() , lfun::``&()

Method `|

  `mixed `|(mixed arg1)`
  `mixed `|(mixed arg1, mixed arg2, mixed ... extras)`
  `mixed `|(object arg1, mixed arg2)`
  `mixed `|(mixed arg1, object arg2)`
  `int `|(int arg1, int arg2)`
  `string `|(string arg1, string arg2)`
  `array `|(array arg1, array arg2)`
  `mapping `|(mapping arg1, mapping arg2)`
  `multiset `|(multiset arg1, multiset arg2)`
  `type(mixed) `|(program|type(mixed) arg1, program|type(mixed) arg2)`

Description

  Bitwise or/union.

  Every expression with the `|` operator becomes a call to this function, i.e. `a|b` is the same as `predef::`|(a,b)`.

Returns

  If there's a single argument, that argument is returned.

  If there are more than two arguments, the result is: ``|(`|(<font face='courier'>arg1` , <font face='courier'>arg2 ), @<font face='courier'>extras ).

  Otherwise, if arg1 is an object with an lfun::`|() , that function is called with arg2 as argument, and its result is returned.

  Otherwise, if arg2 is an object with an lfun::``|() , that function is called with arg1 as argument, and its result is returned.

  Otherwise the result depends on the argument types:

  `arg1` can have any of the following types:

  `int` | Bitwise or of arg1 and arg2 .
  `string` | The result is a string where each character is the bitwise or of the characters in the same position in arg1 and arg2 . The arguments must be strings of the same length.

  `array`

  The result is an array with the elements in arg1 concatenated with those in arg2 that doesn't occur in arg1 (according to `== ). The order between the elements that come from the same argument is kept.

  Every element in arg1 is only matched once against an element in arg2 , so if arg2 contains several elements that are equal to each other and are more than their counterparts in arg1 , the rightmost remaining elements in arg2 are kept.

  `mapping` | The result is like arg1 but extended with the entries from arg2 . If the same index (according to hash_value and `== ) occur in both, the value from arg2 is used.
  `multiset` | The result is like arg1 but extended with the entries in arg2 that doesn't already occur in arg1 (according to `== ). Subsequences with orderwise equal entries (i.e. where `< returns false) are handled just like the array case above.
  `type(mixed)|program` | Type union of arg1 and arg2 .

  The function is not destructive on the arguments - the result is always a new instance.

See also

  `&() , lfun::`|() , lfun::``|()

Method `^

  `mixed `^(mixed arg1)`
  `mixed `^(mixed arg1, mixed arg2, mixed ... extras)`
  `mixed `^(object arg1, mixed arg2)`
  `mixed `^(mixed arg1, object arg2)`
  `int `^(int arg1, int arg2)`
  `string `^(string arg1, string arg2)`
  `array `^(array arg1, array arg2)`
  `mapping `^(mapping arg1, mapping arg2)`
  `multiset `^(multiset arg1, multiset arg2)`
  `type(mixed) `^(program|type(mixed) arg1, program|type(mixed) arg2)`

Description

  Exclusive or.

  Every expression with the `^` operator becomes a call to this function, i.e. `a^b` is the same as `predef::`^(a,b)`.

Returns

  If there's a single argument, that argument is returned.

  If there are more than two arguments, the result is: ``^(`^(<font face='courier'>arg1` , <font face='courier'>arg2 ), @<font face='courier'>extras ).

  Otherwise, if arg1 is an object with an lfun::`^() , that function is called with arg2 as argument, and its result is returned.

  Otherwise, if arg2 is an object with an lfun::``^() , that function is called with arg1 as argument, and its result is returned.

  Otherwise the result depends on the argument types:

  `arg1` can have any of the following types:

  `int` | Bitwise exclusive or of arg1 and arg2 .
  `string` | The result is a string where each character is the bitwise exclusive or of the characters in the same position in arg1 and arg2 . The arguments must be strings of the same length.

  `array`

  The result is an array with the elements in arg1 that doesn't occur in arg2 concatenated with those in arg2 that doesn't occur in arg1 (according to `== ). The order between the elements that come from the same argument is kept.

  Every element is only matched once against an element in the other array, so if one contains several elements that are equal to each other and are more than their counterparts in the other array, the rightmost remaining elements are kept.

  `mapping` | The result is like arg1 but with the entries from arg1 and arg2 whose indices are different between them (according to hash_value and `== ).
  `multiset` | The result is like arg1 but with the entries from arg1 and arg2 that are different between them (according to hash_value and `== ). Subsequences with orderwise equal entries (i.e. where `< returns false) are handled just like the array case above.
  `type(mixed)|program` | The result is a type computed like this: `(<font face='courier'>arg1` &~<font face='courier'>arg2 )|(~<font face='courier'>arg1 &<font face='courier'>arg2 ).

  The function is not destructive on the arguments - the result is always a new instance.

See also

  `&() , `|() , lfun::`^() , lfun::``^()

Method `<<

  `int `<<(int arg1, int arg2)`
  `mixed `<<(object arg1, int|object arg2)`
  `mixed `<<(int arg1, object arg2)`

Description

  Left shift.

  Every expression with the `<<` operator becomes a call to this function, i.e. `a<<b` is the same as `predef::`<<(a,b)`.

  If arg1 is an object that implements lfun::`<<() , that function will be called with arg2 as the single argument.

  If arg2 is an object that implements lfun::``<<() , that function will be called with arg1 as the single argument.

  Otherwise arg1 will be shifted arg2 bits left.

See also

  `>>()

Method `>>

  `int `>>(int arg1, int arg2)`
  `mixed `>>(object arg1, int|object arg2)`
  `mixed `>>(int arg1, object arg2)`

Description

  Right shift.

  Every expression with the `>>` operator becomes a call to this function, i.e. `a>>b` is the same as `predef::`>>(a,b)`.

  If arg1 is an object that implements lfun::`>>() , that function will be called with arg2 as the single argument.

  If arg2 is an object that implements lfun::``>>() , that function will be called with arg1 as the single argument.

  Otherwise arg1 will be shifted arg2 bits right.

See also

  `<<()

Method `*

  `mixed `*(mixed arg1)`
  `mixed `*(object arg1, mixed arg2, mixed ... extras)`
  `mixed `*(mixed arg1, object arg2)`
  `array `*(array arg1, int arg2)`
  `array `*(array arg1, float arg2)`
  `string `*(string arg1, int arg2)`
  `string `*(string arg1, float arg2)`
  `string `*(array(string) arg1, string arg2)`
  `array `*(array(array) arg1, array arg2)`
  `float `*(float arg1, int|float arg2)`
  `float `*(int arg1, float arg2)`
  `int `*(int arg1, int arg2)`
  `mixed `*(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Multiplication/repetition/implosion.

  Every expression with the `*` operator becomes a call to this function, i.e. `a*b` is the same as `predef::`*(a,b)`. Longer `*` expressions are normally optimized to one call, so e.g. `a*b*c` becomes `predef::`*(a,b,c)`.

Returns

  If there's a single argument, that argument will be returned.

  If the first argument is an object that implements lfun::`*() , that function will be called with the rest of the arguments.

  If there are more than two arguments, the result will be ``*(`*(<font face='courier'>arg1` , <font face='courier'>arg2 ), @<font face='courier'>extras ).

  If arg2 is an object that implements lfun::``*() , that function will be called with arg1 as the single argument.

  Otherwise the result will be as follows:

  `arg1` can have any of the following types:

  `array`

  `arg2` can have any of the following types:

  `int|float` | The result will be arg1 concatenated arg2 times.
  `string|array` | The result will be the elements of arg1 concatenated with arg2 interspersed.

  `string` | The result will be arg1 concatenated arg2 times.
  `int|float` | The result will be `<font face='courier'>arg1` * <font face='courier'>arg2 , and will be a float if either arg1 or arg2 is a float.

Note

  In Pike 7.0 and earlier the multiplication order was unspecified.

See also

  `+() , `-() , `/() , lfun::`*() , lfun::``*()

Method `/

  `mixed `/(object arg1, mixed arg2)`
  `mixed `/(mixed arg1, object arg2)`
  `array(string) `/(string arg1, int arg2)`
  `array(string) `/(string arg1, float arg2)`
  `array(array) `/(array arg1, int arg2)`
  `array(array) `/(array arg1, float arg2)`
  `array(string) `/(string arg1, string arg2)`
  `array(array) `/(array arg1, array arg2)`
  `float `/(float arg1, int|float arg2)`
  `float `/(int arg1, float arg2)`
  `int `/(int arg1, int arg2)`
  `mixed `/(mixed arg1, mixed arg2, mixed ... extras)`

Description

  Division/split.

  Every expression with the `/` operator becomes a call to this function, i.e. `a/b` is the same as `predef::`/(a,b)`.

Returns

  If there are more than two arguments, the result will be ``/(`/(<font face='courier'>arg1` , <font face='courier'>arg2 ), @<font face='courier'>extras ).

  If arg1 is an object that implements lfun::`/() , that function will be called with arg2 as the single argument.

  If arg2 is an object that implements lfun::``/() , that function will be called with arg1 as the single argument.

  Otherwise the result will be as follows:

  `arg1` can have any of the following types:

  `string`

  `arg2` can have any of the following types:

  `int|float` | The result will be and array of arg1 split in segments of length arg2 . If arg2 is negative the splitting will start from the end of arg1 .
  `string` | The result will be an array of arg1 split at each occurrence of arg2 . Note that the segments that matched against arg2 will not be in the result.

  `array`

  `arg2` can have any of the following types:

  `int|float` | The result will be and array of arg1 split in segments of length arg2 . If arg2 is negative the splitting will start from the end of arg1 .
  `array` | The result will be an array of arg1 split at each occurrence of arg2 . Note that the elements that matched against arg2 will not be in the result.

  `float|int` | The result will be `<font face='courier'>arg1` / <font face='courier'>arg2 . If both arguments are int, the result will be truncated to an int. Otherwise the result will be a float.

Note

  Unlike in some languages, the function f(x) = x/n (x and n integers) behaves in a well-defined way and is always rounded down. When you increase x, f(x) will increase with one for each n:th increment. For all x, (x + n) / n = x/n + 1; crossing zero is not special. This also means that / and % are compatible, so that a = b*(a/b) + a%b for all a and b.

See also

  `%

Method `%

  `mixed `%(object arg1, mixed arg2)`
  `mixed `%(mixed arg1, object arg2)`
  `string `%(string arg1, int arg2)`
  `array `%(array arg1, int arg2)`
  `float `%(float arg1, float|int arg2)`
  `float `%(int arg1, float arg2)`
  `int `%(int arg1, int arg2)`

Description

  Modulo.

  Every expression with the `%` operator becomes a call to this function, i.e. `a%b` is the same as `predef::`%(a,b)`.

Returns

  If arg1 is an object that implements lfun::`%() then that function will be called with arg2 as the single argument.

  If arg2 is an object that implements lfun::``%() then that function will be called with arg2 as the single argument.

  Otherwise the result will be as follows:

  `arg1` can have any of the following types:

  `string|array` | If arg2 is positive, the result will be the last ``%(<font face='courier'>sizeof` (<font face='courier'>arg1 ), <font face='courier'>arg2 ) elements of arg1 . If arg2 is negative, the result will be the first ``%(<font face='courier'>sizeof` (<font face='courier'>arg1 ), -<font face='courier'>arg2 ) elements of arg1 .
  `int|float` | The result will be `<font face='courier'>arg1` - <font face='courier'>arg2 *<font face='courier'>floor (<font face='courier'>arg1 /<font face='courier'>arg2 ). The result will be a float if either arg1 or arg2 is a float, and an int otherwise.

  For numbers, this means that

  1. a % b always has the same sign as b (typically b is positive; array size, rsa modulo, etc, and a varies a lot more than b).

  2. The function f(x) = x % n behaves in a sane way; as x increases, f(x) cycles through the values 0,1, ..., n-1, 0, .... Nothing strange happens when you cross zero.

  3. The % operator implements the binary "mod" operation, as defined by Donald Knuth (see the Art of Computer Programming, 1.2.4). It should be noted that Pike treats %-by-0 as an error rather than returning 0, though.

  4. / and % are compatible, so that a = b*(a/b) + a%b for all a and b.

See also

  `/

Method `!

  `int(0..1) `!(object|function arg)`
  `int(1..1) `!(int(0..0) arg)`
  `int(0..0) `!(mixed arg)`

Description

  Logical not.

  Every expression with the `!` operator becomes a call to this function, i.e. `!a` is the same as `predef::`!(a)`.

  It's also used when necessary to test truth on objects, i.e. in a statement `if (o) ...` where `o` is an object, the test becomes the equivalent of `!!o` so that any lfun::`!() the object might have gets called.

Returns

  If arg is an object that implements lfun::`!() , that function will be called.

  If arg is `0` (zero), a destructed object, or a function in a destructed object, `1` will be returned.

  Otherwise `0` (zero) will be returned.

Note

  No float is considered false, not even `0.0`.

See also

  `==() , `!=() , lfun::`!()

Method `~

  `mixed `~(object arg)`
  `int `~(int arg)`
  `float `~(float arg)`
  `type(mixed) `~(type(mixed)|program arg)`
  `string `~(string arg)`

Description

  Complement/inversion.

  Every expression with the `~` operator becomes a call to this function, i.e. `~a` is the same as `predef::`~(a)`.

Returns

  The result will be as follows:

  `arg` can have any of the following types:

  `object` | If arg implements lfun::`~() , that function will be called.
  `int` | The bitwise inverse of arg will be returned.
  `float` | The result will be `-1.0 - <font face='courier'>arg` .
  `type(mixed)|program` | The type inverse of arg will be returned.
  `string` | If arg only contains characters in the range 0 - 255 (8-bit), a string containing the corresponding 8-bit inverses will be returned.

See also

  `!() , lfun::`~()

Method `[..]

  `mixed `[..](object arg, mixed start, int start_type, mixed end, int end_type)`
  `string `[..](string arg, int start, int start_type, int end, int end_type)`
  `array `[..](array arg, int start, int start_type, int end, int end_type)`

Description

  Extracts a subrange.

  This is the function form of expressions with the `[..]` operator. arg is the thing from which the subrange is to be extracted. start is the lower bound of the subrange and end the upper bound.

  start_type and end_type specifies how the start and end indices, respectively, are to be interpreted. The types are either Pike.INDEX_FROM_BEG , Pike.INDEX_FROM_END or Pike.OPEN_BOUND . In the last case, the index value is insignificant.

  The relation between `[..]` expressions and this function is therefore as follows:

  a[i..j] <=> `[..] (a, i, Pike.INDEX_FROM_BEG, j, Pike.INDEX_FROM_BEG) a[i..<j] <=> `[..] (a, i, Pike.INDEX_FROM_BEG, j, Pike.INDEX_FROM_END) a[i..] <=> `[..] (a, i, Pike.INDEX_FROM_BEG, 0, Pike.OPEN_BOUND) a[<i..j] <=> `[..] (a, i, Pike.INDEX_FROM_END, j, Pike.INDEX_FROM_BEG) a[<i..<j] <=> `[..] (a, i, Pike.INDEX_FROM_END, j, Pike.INDEX_FROM_END) a[<i..] <=> `[..] (a, i, Pike.INDEX_FROM_END, 0, Pike.OPEN_BOUND) a[..j] <=> `[..] (a, 0, Pike.OPEN_BOUND, j, Pike.INDEX_FROM_BEG) a[..<j] <=> `[..] (a, 0, Pike.OPEN_BOUND, j, Pike.INDEX_FROM_END) a[..] <=> `[..] (a, 0, Pike.OPEN_BOUND, 0, Pike.OPEN_BOUND)

The subrange is specified as follows by the two bounds:

- If the lower bound refers to an index before the lowest allowable (typically zero) then it's taken as an open bound which starts at the first index (without any error).

- Correspondingly, if the upper bound refers to an index past the last allowable then it's taken as an open bound which ends at the last index (without any error).

- If the lower bound is less than or equal to the upper bound, then the subrange is the inclusive range between them, i.e. from and including the element at the lower bound and up to and including the element at the upper bound.

- If the lower bound is greater than the upper bound then the result is an empty subrange (without any error).

Returns

  The returned value depends on the type of arg :

  `arg` can have any of the following types:

  `string` | A string with the characters in the range is returned.
  `array` | An array with the elements in the range is returned.

  `object`

  If the object implements lfun::`[..] , that function is called with the four remaining arguments.

  As a compatibility measure, if the object does not implement lfun::`[..] but lfun::`[] then the latter is called with the bounds transformed to normal from-the-beginning indices in array-like fashion:
  @{`[..] (a, i, Pike.INDEX_FROM_BEG, j, Pike.INDEX_FROM_BEG)@}

    Calls `a->`[] (i, j)`

  @{`[..] (a, i, Pike.INDEX_FROM_BEG, j, Pike.INDEX_FROM_END)@}

    Calls `a->`[] (i, a->_sizeof()-1-j)`

  @{`[..] (a, i, Pike.INDEX_FROM_BEG, 0, Pike.OPEN_BOUND)@}

    Calls `a->`[] (i, <font face='courier'>Int.NATIVE_MAX` )

  @{`[..] (a, i, Pike.INDEX_FROM_END, j, Pike.INDEX_FROM_BEG)@}

    Calls `a->`[] (a->_sizeof()-1-i, j)`

  @{`[..] (a, i, Pike.INDEX_FROM_END, j, Pike.INDEX_FROM_END)@}

    Calls `a->`[] (a->_sizeof()-1-i, a->_sizeof()-1-j)`, except that `a->_sizeof()` is called only once.

  @{`[..] (a, i, Pike.INDEX_FROM_END, 0, Pike.OPEN_BOUND)@}

    Calls `a->`[] (a->_sizeof()-1-i, <font face='courier'>Int.NATIVE_MAX` )

  @{`[..] (a, 0, Pike.OPEN_BOUND, j, Pike.INDEX_FROM_BEG)@}

    Calls `a->`[] (0, j)`

  @{`[..] (a, 0, Pike.OPEN_BOUND, j, Pike.INDEX_FROM_END)@}

    Calls `a->`[] (0, a->_sizeof()-1-j)`

  @{`[..] (a, 0, Pike.OPEN_BOUND, 0, Pike.OPEN_BOUND)@}

    Calls `a->`[] (0, <font face='courier'>Int.NATIVE_MAX` )

  Note that Int.NATIVE_MAX might be replaced with an even larger integer in the future.

See also

  lfun::`[..] , `[]

Method `[]

  `mixed `[](object arg, mixed index)`
  `mixed `[](object arg, string index)`
  `function `[](int arg, string index)`
  `int `[](string arg, int index)`
  `mixed `[](array arg, int index)`
  `mixed `[](array arg, mixed index)`
  `mixed `[](mapping arg, mixed index)`
  `int(0..1) `[](multiset arg, mixed index)`
  `mixed `[](program arg, string index)`
  `mixed `[](object arg, mixed start, mixed end)`
  `string `[](string arg, int start, int end)`
  `array `[](array arg, int start, int end)`

Description

  Indexing.

  This is the function form of expressions with the `[]` operator, i.e. `a[i]` is the same as `predef::`[](a,i)`.

Returns

  If arg is an object that implements lfun::`[]() , that function is called with the index argument.

  Otherwise, the action depends on the type of arg :

  `arg` can have any of the following types:

  `object` | The non-protected (i.e. public) symbol named index is looked up in arg .
  `int` | The bignum function named index is looked up in arg . The bignum functions are the same as those in the Gmp.mpz class.
  `string` | The character at index index in arg is returned as an integer. The first character in the string is at index `0` and the highest allowed index is therefore `sizeof(<font face='courier'>arg` )-1. A negative index number accesses the string from the end instead, from `-1` for the last char back to `-sizeof(<font face='courier'>arg` ) for the first.

  `array`

  If index is an int, index number index of arg is returned. Allowed index number are in the range `[-sizeof(<font face='courier'>arg` )..sizeof(<font face='courier'>arg )-1]; see the string case above for details.

  If index is not an int, an array of all elements in arg indexed with index are returned. I.e. it's the same as doing `column(<font face='courier'>arg` , <font face='courier'>index ).

  `mapping` | If index exists in arg the corresponding value is returned. Otherwise `UNDEFINED` is returned.
  `multiset` | If index exists in arg , `1` is returned. Otherwise `UNDEFINED` is returned.
  `program` | The non-protected (i.e. public) constant symbol index is looked up in arg .

  As a compatibility measure, this function also performs range operations if it's called with three arguments. In that case it becomes equivalent to:

  `[..] (arg, start, Pike.INDEX_FROM_BEG , end, Pike.INDEX_FROM_BEG )

See `[..] for further details.

Note

  An indexing expression in an lvalue context, i.e. where the index is being assigned a new value, uses `[]= instead of this function.

See also

  `->() , lfun::`[]() , `[]= , `[..]

Method `->

  `mixed `->(object arg, string index)`
  `mixed `->(int arg, string index)`
  `mixed `->(array arg, string index)`
  `mixed `->(mapping arg, string index)`
  `int(0..1) `->(multiset arg, string index)`
  `mixed `->(program arg, string index)`

Description

  Arrow indexing.

  Every non-lvalue expression with the `->` operator becomes a call to this function. `a->b` is the same as `predef::`^(a,"b")` where `"b"` is the symbol `b` in string form.

  This function behaves like `[] , except that the index is passed literally as a string instead of being evaluated.

Returns

  If arg is an object that implements lfun::`->() , that function will be called with index as the single argument.

  Otherwise the result will be as follows:

  `arg` can have any of the following types:

  `object` | The non-protected (ie public) symbol named index will be looked up in arg .
  `int` | The bignum function named index will be looked up in arg .
  `array` | An array of all elements in arg arrow indexed with index will be returned.
  `mapping` | If index exists in arg the corresponding value will be returned. Otherwise `UNDEFINED` will be returned.
  `multiset` | If index exists in arg , `1` will be returned. Otherwise `UNDEFINED` will be returned.
  `program` | The non-protected (ie public) constant symbol index will be looked up in arg .

Note

  In an expression `a->b`, the symbol `b` can be any token that matches the identifier syntax - keywords are disregarded in that context.

Note

  An arrow indexing expression in an lvalue context, i.e. where the index is being assigned a new value, uses `->= instead of this function.

See also

  `[]() , lfun::`->() , ::`->() , `->=

Method `[]=

  `mixed `[]=(object arg, mixed index, mixed val)`
  `mixed `[]=(object arg, string index, mixed val)`
  `mixed `[]=(array arg, int index, mixed val)`
  `mixed `[]=(mapping arg, mixed index, mixed val)`
  `int(0..1) `[]=(multiset arg, mixed index, int(0..1) val)`

Description

  Index assignment.

  Every lvalue expression with the `[]` operator becomes a call to this function, i.e. `a[b]=c` is the same as `predef::`[]=(a,b,c)`.

  If arg is an object that implements lfun::`[]=() , that function will be called with index and val as the arguments.

  `arg` can have any of the following types:

  `object` | The non-protected (ie public) variable named index will be looked up in arg , and assigned val .
  `array|mapping` | Index index in arg will be assigned val .
  `multiset` | If val is `0` (zero), one occurrance of index in arg will be removed. Otherwise index will be added to arg if it is not already there.

Returns

  val will be returned.

Note

  An indexing expression in a non-lvalue context, i.e. where the index is being queried instead of assigned, uses `[] instead of this function.

See also

  `->=() , lfun::`[]=() , `[]

Method `->=

  `mixed `->=(object arg, string index, mixed val)`
  `mixed `->=(mapping arg, string index, mixed val)`
  `int(0..1) `->=(multiset arg, string index, int(0..1) val)`

Description

  Arrow index assignment.

  Every lvalue expression with the `->` operator becomes a call to this function, i.e. `a->b=c` is the same as `predef::`->=(a,"b",c)` where `"b"` is the symbol `b` in string form.

  This function behaves like `[]= , except that the index is passed literally as a string instead of being evaluated.

  If arg is an object that implements lfun::`->=() , that function will be called with index and val as the arguments.

  `arg` can have any of the following types:

  `object` | The non-protected (ie public) variable named index will be looked up in arg , and assigned val .
  `array|mapping` | Index index in arg will be assigned val .
  `multiset` | If val is `0` (zero), one occurrance of index in arg will be removed. Otherwise index will be added to arg if it is not already there.

Returns

  val will be returned.

Note

  In an expression `a->b=c`, the symbol `b` can be any token that matches the identifier syntax - keywords are disregarded in that context.

Note

  An arrow indexing expression in a non-lvalue context, i.e. where the index is being queried instead of assigned, uses `-> instead of this function.

See also

  `[]=() , lfun::`->=() , `->

Method sizeof

  `int sizeof(string arg)`
  `int sizeof(array arg)`
  `int sizeof(mapping arg)`
  `int sizeof(multiset arg)`
  `int sizeof(object arg)`

Description

  Size query.

Returns

  The result will be as follows:

  `arg` can have any of the following types:

  `string` | The number of characters in arg will be returned.
  `array|multiset` | The number of elements in arg will be returned.
  `mapping` | The number of key-value pairs in arg will be returned.
  `object` | If arg implements lfun::_sizeof() , that function will be called. Otherwise the number of non-protected (ie public) symbols in arg will be returned.

See also

  lfun::_sizeof()

Method call_out
Method _do_call_outs
Method find_call_out
Method remove_call_out
Method call_out_info

  `mixed call_out(function f, float|int delay, mixed ... args)`
  `void _do_call_outs()`
  `int find_call_out(function f)`
  `int find_call_out(mixed id)`
  `int remove_call_out(function f)`
  `int remove_call_out(function id)`
  `array(array) call_out_info()`

Description

  These are aliases for the corresponding functions in Pike.DefaultBackend .

See also

  Pike.Backend()->call_out() , Pike.Backend()->_do_call_outs() , Pike.Backend()->find_call_out() , Pike.Backend()->remove_call_out() , Pike.Backend()->call_out_info()

Method error

  `void error(sprintf_format f, sprintf_args ... args)`

Description

  Throws an error. A more readable version of the code `throw( ({ sprintf(f, @args), backtrace() }) )`.

Method is_absolute_path

  `int is_absolute_path(string p)`

Description

  Check if a path p is fully qualified (ie not relative).

Returns

  Returns 1 if the path is absolute, 0 otherwise.

Method explode_path

  `array(string) explode_path(string p)`

Description

  Split a path p into its components.

  This function divides a path into its components. This might seem like it could be done by dividing the string on <tt>"/"</tt>, but that will not work on some operating systems. To turn the components back into a path again, use combine_path() .

Method dirname

  `string dirname(string x)`

Description

  Returns all but the last segment of a path. Some example inputs and outputs:

  Expression | Value
  dirname("/a/b") | "/a"
  dirname("/a/") | "/a"
  dirname("/a") | "/"
  dirname("/") | "/"
  dirname("") | ""

See also

  basename() , explode_path()

Method basename

  `string basename(string x)`

Description

  Returns the last segment of a path.

See also

  dirname() , explode_path()

Method compile_string

  `program compile_string(string source, void|string filename, object|void handler, void|program p, void|object o, void|int _show_if_constant_errors)`

Description

  Compile the Pike code in the string source into a program. If filename is not specified, it will default to `"-"`.

  Functionally equal to `<font face='courier'>compile` (<font face='courier'>cpp (<font face='courier'>source , <font face='courier'>filename )).

See also

  compile() , cpp() , compile_file()

Method compile_file

  `program compile_file(string filename, object|void handler, void|program p, void|object o)`

Description

  Compile the Pike code contained in the file filename into a program.

  This function will compile the file filename to a Pike program that can later be instantiated. It is the same as doing `<font face='courier'>compile_string` (<font face='courier'>Stdio.read_file (<font face='courier'>filename ), <font face='courier'>filename ).

See also

  compile() , compile_string() , cpp()

Method normalize_path

  `string normalize_path(string path)`

Description

  Replaces "\" with "/" if runing on MS Windows. It is adviced to use System.normalize_path instead.

Method strlen

  `int strlen(string|multiset|array|mapping|object thing)`

Description

  Alias for sizeof .

Deprecated

Method write

  `int write(string fmt, mixed ... args)`

Description

  Writes a string on stdout. Works just like Stdio.File.write on Stdio.stdout .

Method werror

  `int werror(string fmt, mixed ... args)`

Description

  Writes a string on stderr. Works just like Stdio.File.write on Stdio.stderr .

Method describe_backtrace

  `string describe_backtrace(mixed trace, void|int linewidth)`

Description

  Return a readable message that describes where the backtrace trace was made (by backtrace ).

  It may also be an error object or array (typically caught by a catch ), in which case the error message also is included in the description.

See also

  backtrace() , describe_error() , catch() , throw()

Method describe_error

  `string describe_error(mixed err)`

Description

  Return the error message from an error object or array (typically caught by a catch ). The type of the error is checked, hence err is declared as `mixed` and not `object|array`.

  If an error message couldn't be obtained, a fallback message describing the failure is returned. No errors due to incorrectness in err are thrown.

See also

  describe_backtrace() , get_backtrace

Method get_backtrace

  `array get_backtrace(object|array err)`

Description

  Return the backtrace array from an error object or array (typically caught by a catch ), or zero if there is none. Errors are thrown on if there are problems retrieving the backtrace.

See also

  describe_backtrace() , describe_error()

CLASS Iterator

  Description

    This is the interface for iterator objects. They implement an interface to a collection or stream of data items and a cursor that can be used to iterate over and examine individual items in the data set.

    Iterators are typically created to access a data set in some specific object, array, mapping, multiset or string. An object can have several iterators that access different data sets in it, or the same in different ways. E.g. strings have both an iterator for access char-by-char (String.Iterator ), and another for access over splitted substrings (String.SplitIterator ). lfun::_get_iterator may be defined in an object to get an instance of the canonical iterator type for it. It's used by e.g. foreach to iterate over objects conveniently.

    It's not an error to advance an iterator past the beginning or end of the data set; `!() will only return true then, and index and value will return UNDEFINED . An iterator in that state need not keep track of positions, so it's undefined what happens if it's "moved back" into the set of items.

    Backward movement for iterators is optional. It's supported if and only if `-() is defined, but even then it's undefined how far back the iterator can move. Therefore iterators may support only a limited amount of backward movement, e.g. when they access a stream through a limited buffer. If such an iterator is moved back past the limit then it'll behave as if it's pointing entirely outside the data set (see above).

    An iterator that doesn't support backward movement at all should throw an error if it's attempted.

  See also

    predef::get_iterator , lfun::_get_iterator , Array.Iterator , Mapping.Iterator , Multiset.Iterator , String.Iterator , String.SplitIterator .

  Method create

    `void Iterator(void|mixed data)`

  Description

    Initialize this iterator to access a data set in data . The type of data is specific to the iterator implementation. An iterator may also access some implicit data set, in which case data isn't specified at all.

    The iterator initially points to the first item in the data set, if there is any.

    The iterator does not need to support being reused, so this function is typically declared `protected`.

  Method `!

    `int(0..1) `!()`

  Description

    Returns `0` (zero) when the iterator points to an item, `1` otherwise.

  Method `+

    `Iterator `+(int steps)`

  Description

    Returns a clone of this iterator which is advanced the specified number of steps. The amount may be negative to move backwards. If the iterator doesn't support backward movement it should throw an exception in that case.

  See also

    next , `+= , `-

  Method `+=

    `Iterator `+=(int steps)`

  Description

    Advance this iterator the specified number of steps and return it. The amount may be negative to move backwards. If the iterator doesn't support backward movement it should throw an exception in that case.

  Note

    foreach calls this function with a step value of `1` if next() doesn't exist for compatibility with Pike 7.6 and earlier.

  Note

    foreach will call this function even when the the iterator has more than one reference. If you want to loop over a copy of the iterator, you can create a copy by adding `0` (zero) to it:

    Iterator iterator; ... foreach(iterator+0; mixed index; mixed value) { ... }

Note

  Even though this function is sufficient for foreach to advance the iterator, next() is the preferred API. next() has the additional advantage of not being an lfun, so it is possible to advance the iterator by hand.

See also

  next , `+ , `-

Method `-

  `Iterator `-(int steps)`

Description

  This lfun should be defined if and only if the iterator supports backward movement to some degree. It should back up the specified number of steps. The amount may be negative to move forward.

See also

  next , `+ , `+=

Method index

  `mixed index()`

Description

  Returns the current index, or UNDEFINED if the iterator doesn't point to any item.

  If there's no obvious index set then the index is the current position in the data set, counting from `0` (zero).

Method value

  `mixed value()`

Description

  Returns the current value, or UNDEFINED if the iterator doesn't point to any item.

Method _sizeof

  `int _sizeof()`

Description

  Returns the total number of items in the data set according to this iterator. If the size of the data set is unlimited or unknown then this function shouldn't be defined.

Method _random

  `void _random()`

Description

  If this function is defined then it sets the iterator to point to a random item in the accessible set. The random distribution should be rectangular within that set, and the pseudorandom sequence provided by random should be used.

Method first

  `int(0..1) first()`

Description

  If this function is defined then it resets the iterator to point to the first item.

Returns

  Returns zero if there are no items at all in the data set, one otherwise.

Note

  It's not enough to set the iterator to the earliest accessible item. If the iterator doesn't support backing up to the original start position then this function should not be implemented.

Method next

  `int next()`

Description

  If this function is defined it should advance the iterator one step, just like `<font face='courier'>`+=` (1) would do.

Note

  This is the preferred way to advance the iterator, since it reduces the overhead.

Note

  This function was optional in Pike 7.6 and earlier.

Returns

  Returns `1` if it succeeded in advancing, and `0` (zero) if it has reached the end of the iterator.

See also

  `+ , `+= , `-

Method set_index

  `void set_index(zero index)`

Description

  If this function is defined it should set the iterator at the specified index.

Note

  It should be possible to set the index at the end of the iterator.

CLASS MasterObject

  Description

    Master control program for Pike.

  See also

    predef::master() , predef::replace_master()

  Method runtime_warning

    `void runtime_warning(string subsystem, string msg, mixed|void data)`

  Description

    Called by the Pike runtime to warn about data inconsistencies.

  Parameter `subsystem`

    Runtime subsystem where the warning was generated. Currently the following subsystems may call this function:

    `"gc"` | The garbage collector.

  Parameter `msg`

    Warning message. Currently the following messages may be generated:

    `"bad_cycle"` | A cycle where the destruction order isn't deterministic was detected by the garbage collector. data will in this case contain an array of the elements in the cycle.

  Parameter `data`

    Optional data that further describes the warning specified by msg .

  Method unregister

    `void unregister(program p)`

  Description

    Unregister a program that was only partially compiled.

    Called by compile() to clean up references to partially compiled programs.

  Parameter `p`

    Partially compiled program that should no longer be referenced.

  FIXME

    Shouldn't this function be in the compilation handler?

  Inherit Codec

    inherit Codec : Codec

  Description

    The master object is used as a fallback codec by encode_value() and decode_value() if no codec was given.

    It will also be used as a codec if decode_value() encounters old-style encode_value() 'ed data.

  Inherit CompilationHandler

    inherit CompilationHandler : CompilationHandler

  Description

    The master object acts as fallback compilation handler for compile() and cpp() .

  Method get_compilation_handler

    `CompilationHandler get_compilation_handler(int major, int minor)`

  Description

    Get compilation handler for simulation of Pike vmajor .minor .

    This function is called by cpp() when it encounters `#pike` directives.

  Parameter `major`

    Major version.

  Parameter `minor`

    Minor version.

  Returns

    Returns a compilation handler for Pike >= major .minor .

  Method decode_charset

    `string decode_charset(string raw, string charset)`

  Description

    Convert raw from encoding charset to UNICODE.

    This function is called by cpp() when it encounters `#charset` directives.

  Parameter `raw`

    String to convert.

  Parameter `charset`

    Name of encoding that raw uses.

  Returns

    raw decoded to UNICODE, or `0` (zero) if the decoding failed.

  See also

    Locale.Charset

  Method handle_error

    `void handle_error(mixed exception)`

  Description

    Called by the Pike runtime if an exception isn't caught.

  Parameter `exception`

    Value that was throw() 'n.

  See also

    describe_backtrace()

  Method cast_to_object

    `object cast_to_object(string str, string|void current_file)`

  Description

    Called by the Pike runtime to cast strings to objects.

  Parameter `str`

    String to cast to object.

  Parameter `current_file`

    Filename of the file that attempts to perform the cast.

  Returns

    Returns the resulting object.

  See also

    cast_to_program()

  Method cast_to_program

    `program cast_to_program(string str, string|void current_file)`

  Description

    Called by the Pike runtime to cast strings to programs.

  Parameter `str`

    String to cast to object.

  Parameter `current_file`

    Filename of the file that attempts to perform the cast.

  Returns

    Returns the resulting program.

  See also

    cast_to_object()

  Method describe_backtrace

    `string describe_backtrace(mixed exception)`

  Description

    Called by various routines to format a readable description of an exception.

  Parameter `exception`

    Something that was thrown. Usually an Error.Generic object, or an array with the following content:

    Array
    `string msg` | Error message.
    `array(backtrace_frame|array(mixed)) backtrace` | Backtrace to the point where the exception occurred.

  Returns

    Returns a string describing the exeception.

  Note

    Usually added by the initialization code the global name space with add_constant() .

  See also

    predef::describe_backtrace()

  Inherit CompatResolver

    inherit CompatResolver : CompatResolver

  Inherit Codec

    inherit Codec : Codec

  Constant bt_max_string_len

    `constant MasterObject.bt_max_string_len`

  Description

    This constant contains the maximum length of a function entry in a backtrace. Defaults to 200 if no BT_MAX_STRING_LEN define has been given.

  Constant out_of_date_warning

    `constant MasterObject.out_of_date_warning`

  Description

    Should Pike complain about out of date compiled files. 1 means yes and 0 means no. Controlled by the OUT_OF_DATE_WARNING define.

  Variable want_warnings

    `int MasterObject.want_warnings`

  Description

    If not zero compilation warnings will be written out on stderr.

  Variable compat_major

    `int MasterObject.compat_major`

  Variable compat_minor

    `int MasterObject.compat_minor`

  Variable show_if_constant_errors

    `int MasterObject.show_if_constant_errors`

  Inherit Pike_7_6_master

    inherit Pike_7_6_master : Pike_7_6_master

  Description

    Namespaces for compat masters.

    This inherit is used to provide compatibility namespaces for get_compat_master() .

  See also

    get_compat_master()

  Method error

    `void error(sprintf_format f, sprintf_args ... args)`

  Description

    Throws an error. A more readable version of the code `throw( ({ sprintf(f, @args), backtrace() }) )`.

  Method is_absolute_path

    `int is_absolute_path(string p)`

  Description

    Check if a path p is fully qualified (ie not relative).

  Returns

    Returns 1 if the path is absolute, 0 otherwise.

  Method explode_path

    `array(string) explode_path(string p)`

  Description

    Split a path p into its components.

    This function divides a path into its components. This might seem like it could be done by dividing the string on <tt>"/"</tt>, but that will not work on some operating systems. To turn the components back into a path again, use combine_path() .

  Method dirname

    `string dirname(string x)`

  Description

    Returns all but the last segment of a path. Some example inputs and outputs:

    Expression | Value
    dirname("/a/b") | "/a"
    dirname("/a/") | "/a"
    dirname("/a") | "/"
    dirname("/") | "/"
    dirname("") | ""

  See also

    basename() , explode_path()

  Method basename

    `string basename(string x)`

  Description

    Returns the last segment of a path.

  See also

    dirname() , explode_path()

  Method compile_string

    `program compile_string(string source, void|string filename, object|void handler, void|program p, void|object o, void|int _show_if_constant_errors)`

  Description

    Compile the Pike code in the string source into a program. If filename is not specified, it will default to `"-"`.

    Functionally equal to `<font face='courier'>compile` (<font face='courier'>cpp (<font face='courier'>source , <font face='courier'>filename )).

  See also

    compile() , cpp() , compile_file()

  Method master_read_file

    `string master_read_file(string file)`

  Method getenv

    `string getenv(string varname, void|int force_update)`
    `mapping(string:string) getenv(void|int force_update)`

  Description

    Queries the environment variables. The first variant returns the value of a specific variable or zero if it doesn't exist in the environment. The second variant returns the whole environment as a mapping. Destructive operations on the mapping will not affect the internal environment representation.

    A cached copy of the real environment is kept to make this function quicker. If the optional flag force_update is nonzero then the real environment is queried and the cache is updated from it. That can be necessary if the environment changes through other means than putenv , typically from a C-level library.

    Variable names and values cannot be wide strings nor contain `'\0'` characters. Variable names also cannot contain `'='` characters.

  Note

    On NT the environment variable name is case insensitive.

  See also

    putenv()

  Method putenv

    `void putenv(string varname, void|string value)`

  Description

    Sets the environment variable varname to value .

    If value is omitted or zero, the environment variable varname is removed.

    varname and value cannot be wide strings nor contain `'\0'` characters. varname also cannot contain `'='` characters.

  Note

    On NT the environment variable name is case insensitive.

  See also

    getenv()

  Method compile_file

    `program compile_file(string filename, object|void handler, void|program p, void|object o)`

  Description

    Compile the Pike code contained in the file filename into a program.

    This function will compile the file filename to a Pike program that can later be instantiated. It is the same as doing `<font face='courier'>compile_string` (<font face='courier'>Stdio.read_file (<font face='courier'>filename ), <font face='courier'>filename ).

  See also

    compile() , compile_string() , cpp()

  Method normalize_path

    `string normalize_path(string path)`

  Description

    Replaces "\" with "/" if runing on MS Windows. It is adviced to use System.normalize_path instead.

    `mapping(string:program|NoValue) MasterObject.programs`
    `mapping(program:object) MasterObject.documentation`
    `mapping(program:string) MasterObject.source_cache`

  Description

    Mapping containing the cache of currently compiled files.

    This mapping currently has the following structure:

    `filename : program`

    The filename path separator is / on both NT and UNIX.

  Note

    Special cases: The current master program is available under the name `"/master"`, and the program containing the main function under `"/main"`.

  Method programs_reverse_lookup

    `string programs_reverse_lookup(program prog)`

  Description

    Returns the path for prog in programs , if it got any.

  Method objects_reverse_lookup

    `program objects_reverse_lookup(object obj)`

  Description

    Returns the program for obj , if known to the master.

  Method fc_reverse_lookup

    `string fc_reverse_lookup(object obj)`

  Description

    Returns the path for obj in fc , if it got any.

  Method module_defined

    `array(string) module_defined(object|program mod)`

  Description

    Find the files in which mod is defined, as they may be hidden away in joinnodes and dirnodes

  Parameter `mod`

    The module we are looking for.

  Returns

    An array of strings with filenames. (one for each file in a joinnode, or just one otherwise)

  Method enable_source_cache

    `void enable_source_cache()`

  Description

    Enable caching of sources from compile_string()

  Method show_doc

    `object show_doc(program|object|function obj)`

  Description

    Show documentation for the item obj

  Parameter `obj`

    The object for which the documentation should be shown

  Returns

    an AutoDoc object

  Method cast_to_program

    `program cast_to_program(string pname, string current_file, object|void handler)`

  Description

    This function is called when the driver wants to cast a string to a program, this might be because of an explicit cast, an inherit or a implict cast. In the future it might receive more arguments, to aid the master finding the right program.

  Method handle_error

    `void handle_error(array|object trace)`

  Description

    This function is called when an error occurs that is not caught with catch().

  Variable include_prefix

    `string MasterObject.include_prefix`

  Description

    Prefix for Pike-related C header files.

  Variable doc_prefix

    `string MasterObject.doc_prefix`

  Description

    Prefix for autodoc files.

  Variable cflags

    `string MasterObject.cflags`

  Description

    Flags suitable for use when compiling Pike C modules

  Variable ldflags

    `string MasterObject.ldflags`

  Description

    Flags suitable for use when linking Pike C modules

  Method strlen

    `int strlen(string|multiset|array|mapping|object thing)`

  Description

    Alias for sizeof .

  Deprecated

  Method write

    `int write(string fmt, mixed ... args)`

  Description

    Writes a string on stdout. Works just like Stdio.File.write on Stdio.stdout .

  Method werror

    `int werror(string fmt, mixed ... args)`

  Description

    Writes a string on stderr. Works just like Stdio.File.write on Stdio.stderr .

  Method handle_inherit

    `program handle_inherit(string pname, string current_file, object|void handler)`

  Description

    This function is called whenever a inherit is called for. It is supposed to return the program to inherit. The first argument is the argument given to inherit, and the second is the file name of the program currently compiling. Note that the file name can be changed with #line, or set by compile_string, so it can not be 100% trusted to be a filename. previous_object(), can be virtually anything in this function, as it is called from the compiler.

  Method cast_to_object

    `object cast_to_object(string oname, string current_file, object|void current_handler)`

  Description

    This function is called when the drivers wants to cast a string to an object because of an implict or explicit cast. This function may also receive more arguments in the future.

    `string MasterObject._pike_file_name`
    `string MasterObject._master_file_name`

  Description

    These are useful if you want to start other Pike processes with the same options as this one was started with.

  Method asyncp

    `int(0..1) asyncp()`

  Description

    Returns 1 if we´re in async-mode, e.g. if the main method has returned a negative number.

  Method backend_thread

    `object backend_thread()`

  Description

    The backend_thread() function is useful to determine if you are the backend thread - important when doing async/sync protocols. This method is only available if thread_create is present.

  Method _main

    `void _main(array(string) orig_argv)`

  Description

    This function is called when all the driver is done with all setup of modules, efuns, tables etc. etc. and is ready to start executing _real_ programs. It receives the arguments not meant for the driver.

  Method compile_error

    `void compile_error(string file, int line, string err)`

  Description

    This function is called whenever a compile error occurs. line is zero for errors that aren't associated with any specific line. err is not newline terminated.

  Method compile_warning

    `void compile_warning(string file, int line, string err)`

  Description

    This function is called whenever a compile warning occurs. line is zero for warnings that aren't associated with any specific line. err is not newline terminated.

  Method compile_exception

    `int compile_exception(array|object trace)`

  Description

    This function is called when an exception is caught during compilation. Its message is also reported to compile_error if this function returns zero.

  Method runtime_warning

    `void runtime_warning(string where, string what, mixed ... args)`

  Description

    Called for every runtime warning. The first argument identifies where the warning comes from, the second identifies the specific message, and the rest depends on that. See code below for currently implemented warnings.

  Method decode_charset

    `string decode_charset(string data, string charset)`

  Description

    This function is called by cpp() when it wants to do character code conversion.

  Method program_path_to_name

    `string program_path_to_name(string path, void|string module_prefix, void|string module_suffix, void|string object_suffix)`

  Description

    Converts a module path on the form `"Foo.pmod/Bar.pmod"` or `"/path/to/pike/lib/modules/Foo.pmod/Bar.pmod"` to a module identifier on the form `"Foo.Bar"`.

    If module_prefix or module_suffix are given, they are prepended and appended, respectively, to the returned string if it's a module file (i.e. ends with `".pmod"` or `".so"`). If object_suffix is given, it's appended to the returned string if it's an object file (i.e. ends with `".pike"`).

  Method describe_module

    `string describe_module(object|program mod, array(object)|void ret_obj)`

  Description

    Describe the path to the module mod .

  Parameter `mod`

    If mod is a program, attempt to describe the path to a clone of mod .

  Parameter `ret_obj`

    If an instance of mod is found, it will be returned by changing element `0` of ret_obj .

  Returns

    The a description of the path.

  Note

    The returned description will end with a proper indexing method currently either `"."` or `"->"`.

  Method describe_object

    `string describe_object(object o)`

  Method describe_program

    `string describe_program(program|function p)`

  Method describe_function

    `string describe_function(function f)`

  Method describe_backtrace

    `string describe_backtrace(mixed trace, void|int linewidth)`

  Description

    Return a readable message that describes where the backtrace trace was made (by backtrace ).

    It may also be an error object or array (typically caught by a catch ), in which case the error message also is included in the description.

  See also

    backtrace() , describe_error() , catch() , throw()

  Method describe_error

    `string describe_error(mixed err)`

  Description

    Return the error message from an error object or array (typically caught by a catch ). The type of the error is checked, hence err is declared as `mixed` and not `object|array`.

    If an error message couldn't be obtained, a fallback message describing the failure is returned. No errors due to incorrectness in err are thrown.

  See also

    describe_backtrace() , get_backtrace

  Method get_backtrace

    `array get_backtrace(object|array err)`

  Description

    Return the backtrace array from an error object or array (typically caught by a catch ), or zero if there is none. Errors are thrown on if there are problems retrieving the backtrace.

  See also

    describe_backtrace() , describe_error()

  Variable currentversion

    `Version MasterObject.currentversion`

  Description

    Version information about the current Pike version.

  Method get_compat_master

    `object get_compat_master(int major, int minor)`

  Description

    Return a master object compatible with the specified version of Pike.

    This function is used to implement the various compatibility versions of master() .

  See also

    get_compilation_handler() , master()

  CLASS MasterObject.Pike_0_5_master

    Description

      Pike 0.5 master compatibility interface.

      Most of the interface is implemented via mixin, or overloading by more recent masters.

      This interface is used for compatibility with all pikes until Pike 0.5.

    Deprecated
    See also

      get_compat_master() , master() , predef::MasterObject

    Variable environment

      `mapping(string:array(string)) MasterObject.Pike_0_5_master.environment`

    Description

      Mapping containing the environment variables.

      The mapping currently has the following structure:

      `index : array(string)`

      Note that the index is lower_case() 'd on NT.

      Array
      `string varname` | Variable name with case intact.
      `string value` | Variable value.

    Note

      This mapping should not be accessed directly; use getenv() and putenv() instead. This mapping is not publicly accessible in pikes newer than 7.6.

    Note

      This mapping is not compatible with Process.create_process() ; use the mapping returned from calling getenv() without arguments instead.

    Bugs

      This mapping is not the real environment; it is just a copy of the environment made at startup. Pike does attempt to keep track of changes in the mapping and to reflect them in the real environment, but avoid accessing this mapping if at all possible.

    Method new

      `__deprecated__ object new(mixed prog, mixed ... args)`

    Description

      Make a new instance of a class.

    Note

      This function should not be used. It is here for compatibility reasons only.

  CLASS MasterObject.Pike_0_6_master

    Description

      Pike 0.6 master compatibility interface.

      Most of the interface is implemented via mixin, or overloading by more recent masters.

      This interface is used for compatibility with Pike 0.6.

    Deprecated
    See also

      get_compat_master() , master() , predef::MasterObject

    Inherit Pike_0_5_master

      inherit Pike_0_5_master : Pike_0_5_master

  CLASS MasterObject.Pike_7_0_master

    Description

      Pike 7.0 master compatibility interface.

      Most of the interface is implemented via mixin, or overloading by more recent masters.

      This interface is used for compatibility with Pike 0.7 through 7.0.

    Deprecated
    See also

      get_compat_master() , master() , predef::MasterObject

    Inherit Pike_0_6_master

      inherit Pike_0_6_master : Pike_0_6_master

  CLASS MasterObject.Pike_7_2_master

    Description

      Pike 7.2 master compatibility interface.

      Most of the interface is implemented via mixin, or overloading by more recent masters.

      This interface is used for compatibility with Pike 7.1 and 7.2.

    Deprecated
    See also

      get_compat_master() , master() , predef::MasterObject

    Inherit Pike_7_0_master

      inherit Pike_7_0_master : Pike_7_0_master

  CLASS MasterObject.Pike_7_4_master

    Description

      Pike 7.4 master compatibility interface.

      Most of the interface is implemented via mixin, or overloading by more recent masters.

      This interface is used for compatibility with Pike 7.3 and 7.4.

    Deprecated
    See also

      get_compat_master() , master() , predef::MasterObject

    Inherit Pike_7_2_master

      inherit Pike_7_2_master : Pike_7_2_master

  CLASS MasterObject.Pike_7_6_master

    Description

      Pike 7.6 master compatibility interface.

      Most of the interface is implemented via mixin, or overloading by more recent masters.

      This interface is used for compatibility with Pike 7.5 and 7.6.

    Deprecated
    See also

      get_compat_master() , master() , predef::MasterObject

    Inherit Pike_7_4_master

      inherit Pike_7_4_master : Pike_7_4_master

  CLASS MasterObject.dirnode

    Description

      Module node representing a single directory.

    See also

      joinnode

  CLASS MasterObject.joinnode

    Description

      Module node holding possibly multiple directories, and optionally falling back to another level.

    See also

      dirnode

  CLASS MasterObject.CompatResolver

    Description

      Resolver of symbols not located in the program being compiled.

    Variable root_module

      `joinnode MasterObject.CompatResolver.root_module`

    Description

      Join node of the root modules for this resolver.

    Variable handler_root_modules

      `mapping(object:joinnode) MasterObject.CompatResolver.handler_root_modules`

    Description

      Lookup from handler module to corresponding root_module.

    Variable system_module_path

      `array(string) MasterObject.CompatResolver.system_module_path`

    Description

      The pike system module path, not including any set by the user.

    Variable pike_module_path

      `array(string) MasterObject.CompatResolver.pike_module_path`

    Description

      The complete module search path

    Variable pike_include_path

      `array(string) MasterObject.CompatResolver.pike_include_path`

    Description

      The complete include search path

    Variable pike_program_path

      `array(string) MasterObject.CompatResolver.pike_program_path`

    Description

      The complete program search path

    Variable fallback_resolver

      `CompatResolver MasterObject.CompatResolver.fallback_resolver`

    Description

      If we fail to resolv, try the fallback.

      Typical configuration:

          0.6->7.0->7.2-> ... ->master

    Method create

      `void MasterObject.CompatResolver(mixed version, CompatResolver|void fallback_resolver)`

    Description

      The CompatResolver is initialized with a value that can be casted into a "%d.%d" string, e.g. a version object.

      It can also optionally be initialized with a fallback resolver.

    Method add_include_path

      `void add_include_path(string tmp)`

    Description

      Add a directory to search for include files.

      This is the same as the command line option `-I`.

    Note

      Note that the added directory will only be searched when using < > to quote the included file.

    See also

      remove_include_path()

    Method remove_include_path

      `void remove_include_path(string tmp)`

    Description

      Remove a directory to search for include files.

      This function performs the reverse operation of add_include_path() .

    See also

      add_include_path()

    Method add_module_path

      `void add_module_path(string tmp)`

    Description

      Add a directory to search for modules.

      This is the same as the command line option `-M`.

    See also

      remove_module_path()

    Method remove_module_path

      `void remove_module_path(string tmp)`

    Description

      Remove a directory to search for modules.

      This function performs the reverse operation of add_module_path() .

    See also

      add_module_path()

    Method add_program_path

      `void add_program_path(string tmp)`

    Description

      Add a directory to search for programs.

      This is the same as the command line option `-P`.

    See also

      remove_program_path()

    Method remove_program_path

      `void remove_program_path(string tmp)`

    Description

      Remove a directory to search for programs.

      This function performs the reverse operation of add_program_path() .

    See also

      add_program_path()

    Method add_predefine

      `void add_predefine(string name, string value)`

    Description

      Add a define (without arguments) which will be implicitly defined in cpp calls.

    Method remove_predefine

      `void remove_predefine(string name)`

    Description

      Remove a define from the set that are implicitly defined in cpp calls.

    Method get_predefines

      `mapping get_predefines()`

    Description

      Returns a mapping with the current predefines.

    Method instantiate_static_modules

      `mapping(string:mixed) instantiate_static_modules(object|mapping static_modules)`

    Description

      Instantiate static modules in the same way that dynamic modules are instantiated.

    Method get_default_module

      `mapping get_default_module()`

    Method resolv_base

      `mixed resolv_base(string identifier, string|void current_file, object|void current_handler)`

    Method resolv_or_error

      `mixed resolv_or_error(string identifier, string|void current_file, void|object current_handler)`

    Description

      Same as resolv , but throws an error instead of returning UNDEFINED if the resolv failed.

    Method resolv

      `mixed resolv(string identifier, string|void current_file, object|void current_handler)`

    Method handle_include

      `string handle_include(string f, string current_file, int local_include)`

    Description

      This function is called whenever an #include directive is encountered. It receives the argument for #include and should return the file name of the file to include

    Method read_include

      `string read_include(string f)`

  CLASS MasterObject.Pike06Resolver

    Inherit CompatResolver

      inherit CompatResolver : CompatResolver

    Method resolv_base

      `mixed resolv_base(string identifier, string|void current_file, object|void current_handler)`

    Description

      In Pike 0.6 the current directory was implicitly searched.

  CLASS MasterObject.Encoder

    Description

      Codec for use with encode_value . It understands all the standard references to builtin functions, pike modules, and the main program script.

      The format of the produced identifiers are documented here to allow extension of this class:

      The produced names are either strings or arrays. The string variant specifies the thing to look up according to the first character:

      'c' Look up in all_constants(). 's' Look up in _static_modules. 'r' Look up with resolv(). 'p' Look up in programs. 'o' Look up in programs, then look up the result in objects. 'f' Look up in fc.

      In the array format, the first element is a string as above and the rest specify a series of things to do with the result:

      A string Look up this string in the result. 'm' Get module object in dirnode. 'p' Do object_program(result).

      All lowercase letters and the symbols ':', '/' and '.' are reserved for internal use in both cases where characters are used above.

    Method nameof

      `string|array nameof(mixed what, void|array(object) module_object)`

    Description

      When module_object is set and the name would end with an `object_program` step (i.e. `'p'`), then drop that step so that the name corresponds to the object instead. `<font face='courier'>module_object` [0] will receive the found object.

    Method create

      `void MasterObject.Encoder(void|mixed encoded)`

    Description

      Creates an encoder instance. If encoded is specified, it's encoded instead of being reverse resolved to a name. That's necessary to encode programs.

  CLASS MasterObject.Decoder

    Description

      Codec for use with decode_value . This is the decoder corresponding to Encoder . See that one for more details.

    syntax

      `void|string MasterObject.Decoder.fname`
      `void|int MasterObject.Decoder.mkobj`
      `void|object MasterObject.Decoder.handler` `void MasterObject.Decoder(void|string fname, void|int mkobj, void|object handler)`

    Method decode_object

      `array(mixed) decode_object(object o, mixed data)`

    Description

      Restore the state of an encoded object.

    Parameter `o`

      Object to modify.

    Parameter `data`

      State information from Encoder()->encode_object() .

      The default implementation calls `o->_decode(data)` if the object has an `_decode()`, otherwise if data is an array, returns it to indicate that lfun::create() should be called.

    Note

      This function is called before lfun::create() in the object has been called, but after lfun::__INIT() has been called.

    Returns

      Returns an array to indicate to the caller that lfun::create() should be called with the elements of the array as arguments.

      Returns `0` (zero) to inhibit calling of lfun::create() .

    See also

      Encoder()->encode_object()

  CLASS MasterObject.Codec

    Description

      Encoder and Decoder rolled into one. This is for mainly compatibility; there's typically no use combining encoding and decoding into the same object.

    Inherit Encoder

      inherit Encoder : Encoder

    Inherit Decoder

      inherit Decoder : Decoder

    Method create

      `void MasterObject.Codec(void|mixed encoded)`

    Description

      The optional argument is the thing to encode; it's passed on to Encoder .

  CLASS MasterObject.Version

    Description

      Contains version information about a Pike version.

      `int MasterObject.Version.major`
      `int MasterObject.Version.minor`

    Description

      The major and minor parts of the version.

    Method create

      `void MasterObject.Version(int major, int minor)`

    Description

      Set the version in the object.

    Method `<
    Method `>
    Method `==
    Method __hash

      `int `<(mixed v)`
      `int `>(mixed v)`
      `int `==(mixed v)`
      `int __hash()`

    Description

      Methods define so that version objects can be compared and ordered.

    Method cast

      `mixed cast(string type)`

    Description

      The version object can be casted into a string.

CLASS CompilationHandler

  Description

    Objects used by the compiler to handle references to global symbols, modules, external files, etc.

    There can be up to three compilation handlers active at the same time during a compilation. They are in order of precedence:

    1. The error handler

       This is the object passed to compile() as the second argument (if any). This object is returned by get_active_error_handler() during a compilation.

    2. The compatibility handler

       This is the object returned by master()->get_compilation_handler() (if any), which the compiler calls when it sees `#pike`-directives, or expressions using the version scope (eg `7.4::rusage`). This object is returned by get_active_compilation_handler() during a compilation.

    3. The master object.

       This is returned by master() at any time.

    Any of the objects may implement a subset of the CompilationHandler functions, and the first object that implements a function will be used. The error handler object can thus be used to block certain functionality (eg to restrict the number of available functions).

  See also

    master()->get_compilation_handler() , get_active_error_handler() , get_active_compilation_handler() , compile()

  Method get_default_module

    `mapping(string:mixed)|object get_default_module()`

  Description

    Returns the default module from which global symbols will be fetched.

  Returns

    Returns the default module, or `0` (zero).

    If `0` (zero) is returned the compiler use the mapping returned by all_constants() as fallback.

  See also

    get_predefines()

  Method compile_warning

    `void compile_warning(string filename, int line, string msg)`

  Description

    Called by compile() to report warnings.

  Parameter `filename`

    File which triggered the warning.

  Parameter `line`

    Line which triggered the warning.

  Parameter `msg`

    Warning message.

  See also

    compile_error()

  Method compile_error

    `void compile_error(string filename, int line, string msg)`

  Description

    Called by compile() and cpp() when they encounter errors in the code they compile.

  Parameter `filename`

    File where the error was detected.

  Parameter `line`

    Line where the error was detected.

  Parameter `msg`

    Description of error.

  See also

    compile_warning() .

  Method compile_exception

    `void compile_exception(mixed exception)`

  Description

    Called by compile() and cpp() if they trigger exceptions.

  Method get_predefines

    `mapping(string:mixed) get_predefines()`

  Description

    Called by cpp() to get the set of global symbols.

  Returns

    Returns a mapping from symbol name to symbol value. Returns zero on failure.

  See also

    resolv() , get_default_module()

  Method resolv

    `mixed resolv(string symbol, string filename, CompilationHandler handler)`

  Description

    Called by compile() and cpp() to resolv module references.

  Returns

    Returns the resolved value, or UNDEFINED on failure.

  See also

    get_predefines()

  Method handle_import

    `mixed handle_import(string path, string filename, CompilationHandler handler)`

  Description

    Called by compile() and cpp() to handle import directives specifying specific paths.

  Returns

    Returns the resolved value, or UNDEFINED on failure.

  Method handle_include

    `string handle_include(string header_file, string current_file, int(0..1) is_local_ref)`

  Description

    Called by cpp() to resolv `#include` and `#string` directives.

  Parameter `header_file`

    File that was requested for inclusion.

  Parameter `current_file`

    File where the directive was found.

  Parameter `is_local_ref`

    Specifies reference method.

    `0` | Directive was `#include <header_file>`.
    `1` | Directive was `#include "header_file"`.

  Returns

    Returns the filename to pass to read_include() if found, and `0` (zero) on failure.

  See also

    read_include()

  Method read_include

    `string read_include(string filename)`

  Description

    Called by cpp() to read included files.

  Parameter `filename`

    Filename as returned by handle_include() .

  Returns

    Returns a string with the content of the header file on success, and `0` (zero) on failure.

  See also

    handle_include()

CLASS CompilerEnvironment

  Description

    The compiler environment.

    By inheriting this class and overloading the functions, it is possible to make a custom Pike compiler.

  Note

    Prior to Pike 7.8 this sort of customization has to be done either via custom master objects, or via CompilationHandler s.

  See also

    CompilationHandler , MasterObject , master() , replace_master()

  Method report

    `void report(SeverityLevel severity, string filename, int linenumber, string subsystem, string message, mixed ... extra_args)`

  Description

    Report a diagnostic from the compiler.

  Parameter `severity`

    The severity of the diagnostic.

    The default implementation does the following depending on severity :

    `NOTICE` | Ignored.
    `WARNING` | Calls MasterObject()->compile_warning() .
    `ERROR` | Calls MasterObject()->compile_error() .
    `FATAL`

    If there's no master object yet, the diagnostic is output to Stdio.stderr .

  Parameter `filename`
  Parameter `linenumber`

    Location which triggered the diagnostic.

  Parameter `subsystem`

    Compiler subsystem that generated the diagnostic.

  Parameter `message`

    sprintf() -style formatting string with the diagnostic message.

  Parameter `extra_args`

    Extra arguments to sprintf() .

  See also

    PikeCompiler()->report()

  Method compile

    `program compile(string source, CompilationHandler|void handler, int|void major, int|void minor, program|void target, object|void placeholder)`

  Description

    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

    This function essentially performs

    program compile(mixed ... args) { return PikeCompiler(@args)->compile(); }

Note

  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() .

See also

  compile_string() , compile_file() , cpp() , master() , CompilationHandler

Method resolv

  `mixed resolv(string identifier, string filename, object|void handler)`

Method get_compilation_handler

  `object get_compilation_handler(int major, int minor)`

Description

  Get compatibility handler for Pike major .minor .

  The default implementation calls the corresponding function in the master object.

Note

  This function is typically called by PikeCompiler()->get_compilation_handler() .

See also

  MasterObject()->get_compilation_handler() .

Method get_default_module

  `mapping(string:mixed)|object get_default_module()`

Description

  Get the default module for the current compatibility level (ie typically the value returned by predef::all_constants() ).

  The default implementation calls the corresponding function in the master object.

Returns

  `mapping(string:mixed)|object` | Constant table to use.
  `int(0..0)` | Use the builtin constant table.

Note

  This function is typically called by Pike_compiler()->get_default_module() .

See also

  MasterObject()->get_default_module() .

Method handle_inherit

  `program handle_inherit(string inh, string current_file, object|void handler)`

Description

  Look up an inherit inh .

  The default implementation calls the corresponding function in the master object.

See also

  MasterObject()->handle_inherit() .

Method filter_exception

  `int filter_exception(SeverityLevel level, mixed err)`

Description

  The default implementation calls MasterObject()->compile_exception() for level ERROR and FATAL .

Note

  This function is not implemented in Pike 7.8.

See also

  MasterObject()->compile_exception() .

ENUM CompilerEnvironment.SeverityLevel

  Description

    Message severity level. { NOTICE, WARNING, ERROR, FATAL }

  See also

    report()

    `constant CompilerEnvironment.NOTICE`
    `constant CompilerEnvironment.WARNING`
    `constant CompilerEnvironment.ERROR`
    `constant CompilerEnvironment.FATAL`

CLASS CompilerEnvironment.PikeCompiler

  Description

    The Pike compiler.

    An object of this class compiles a single string of Pike code.

  Method report

    `void report(SeverityLevel severity, string filename, int linenumber, string subsystem, string message, mixed ... extra_args)`

  Description

    Report a diagnostic from the compiler.

    The default implementation calls the corresponding function in the active handlers, and otherwise falls back to CompilerEnvironment()->report() in the parent object.

  Method create

    `void CompilerEnvironment.PikeCompiler(string|void source, CompilationHandler|void handler, int|void major, int|void minor, program|void target, object|void placeholder)`

  Description

    Create a PikeCompiler object for a source string.

    This function takes a piece of Pike code as a string and initializes a compiler object accordingly.

  Parameter `source`

    Source code to compile.

  Parameter `handler`

    The optional argument handler is used to specify an alternative error handler. If it is not specified the current master object at compile time will be used.

  Parameter `major`
  Parameter `minor`

    The optional arguments major and minor are used to tell the compiler to attempt to be compatible with Pike major .minor .

  Parameter `target`

    __empty_program() program to fill in. The virgin program returned by __empty_program() will be modified and returned by compile() on success.

  Parameter `placeholder`

    __null_program() placeholder object to fill in. The object will be modified into an instance of the resulting program on successfull compile. Note that lfun::create() in the program will be called without any arguments.

  Note

    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 no preprocessing is performed. To preprocess the program you can use compile_string() or call the preprocessor manually by calling cpp() .

  Note

    Note that all references to target and placeholder should removed if compile() failes. On failure the placeholder object will be destructed.

  See also

    compile_string() , compile_file() , cpp() , master() , CompilationHandler

  Method compile

    `program compile()`

  Description

    Compile the current source into a program.

    This function compiles the current Pike source code into a clonable program.

  See also

    compile_string() , compile_file() , cpp() , master() , CompilationHandler , create()

  Method resolv

    `mixed resolv(string identifier, string filename, object handler)`

  Description

    Resolve the symbol identifier .

    The default implementation calls the corresponding function in any active handler, and otherwise falls back to CompilerEnvironment()->resolv() in the parent object.

  Method get_compilation_handler

    `object get_compilation_handler(int major, int minor)`

  Description

    Get compatibility handler for Pike major .minor .

  Note

    This function is called by change_compiler_compatibility() .

  Method get_default_module

    `mapping(string:mixed)|object get_default_module()`

  Description

    Get the default module for the current compatibility level (ie typically the value returned by predef::all_constants() ).

    The default implementation calls the corresponding function in the current handler, the current compatibility handler or in the parent CompilerEnvironment in that order.

  Returns

    `mapping(string:mixed)|object` | Constant table to use.
    `int(0..0)` | Use the builtin constant table.

  Note

    This function is called by change_compiler_compatibility() .

  Method change_compiler_compatibility

    `void change_compiler_compatibility(int major, int minor)`

  Description

    Change compiler to attempt to be compatible with Pike major .minor .

  Method handle_inherit

    `program handle_inherit(string inh)`

  Description

    Look up an inherit inh in the current program.

  Method pop_type_attribute

    `int(0..1) pop_type_attribute(string attribute, type(mixed) a, type(mixed) b)`

  Description

    Type attribute handler.

    Called during type checking when `a <= b` and a had the type attribute attribute before the comparison.

    The default implementation implements the "deprecated" attribute.

  Returns

    Returns `1` if the type check should be allowed (ie `__attribute__(attribute, a) <= b`), and `0` (zero) otherwise.

  See also

    push_type_attribute()

  Method push_type_attribute

    `int(0..1) push_type_attribute(string attribute, type(mixed) a, type(mixed) b)`

  Description

    Type attribute handler.

    Called during type checking when `a <= b` and b had the type attribute attribute before the comparison.

    The default implementation implements the "deprecated" attribute.

  Returns

    Returns `1` if the type check should be allowed (ie `a <= __attribute__(attribute, b)`), and `0` (zero) otherwise.

  See also

    pop_type_attribute()

  Method apply_type_attribute

    `int(0..1) apply_type_attribute(string attribute, type(mixed) a, type(mixed)|void b)`

  Description

    Type attribute handler.

  Parameter `attribute`

    Attribute that a had.

  Parameter `a`

    Type of the value being called.

  Parameter `b`

    Type of the first argument in the call, or UNDEFINED if no more arguments.

    Called during type checking when a has been successfully had a partial evaluation with the argument b and a had the type attribute attribute before the evaluation.

    The default implementation implements the "deprecated" attribute.

  Returns

    Returns `1` if the type check should be allowed (ie `__attribute__(attribute, a)(b)`) is valid, and `0` (zero) otherwise.

  See also

    pop_type_attribute() , push_type_attribute()

  Method apply_attribute_constant

    `type(mixed) apply_attribute_constant(string attr, mixed value, type(mixed) arg_type, void cont_type)`

  Description

    Handle constant arguments to attributed function argument types.

  Parameter `attr`

    Attribute that arg_type had.

  Parameter `value`

    Constant value sent as parameter.

  Parameter `arg_type`

    Declared type of the function argument.

  Parameter `cont_type`

    Continuation function type after the current argument.

    This function is called when a function is called with the constant value value and it has been successfully matched against arg_type , and arg_type had the type attribute attr .

    This function is typically used to perform specialized argument checking and to allow for a strengthening of the function type based on value .

    The default implementation implements the `"sprintf_format"`, `"sscanf_format"` and `"sscanf_76_format"` attributes.

  Returns

    Returns a continuation type if it succeeded in strengthening the type.

    Returns `UNDEFINED` otherwise (this is not an error indication).

  See also

    pop_type_attribute() , push_type_attribute()

  CLASS CompilerEnvironment.PikeCompiler.CompilerState

    Description

      Keeps the state of a single program/class during compilation.

    Note

      Not in use yet!

CLASS Codec

  Description

    Codec objects are used by encode_value() and decode_value() to encode and decode objects, functions and programs.

  Note

    encode_value() and decode_value() will use the current master object as fallback codec object if no codec was specified.

  Method nameof

    `mixed nameof(object|function|program x)`

  Description

    Called by encode_value() to encode objects, functions and programs.

  Returns

    Returns something encodable on success, typically a string. The returned value will be passed to the corresponding objectof() , functionof() or programof() by decode_value() .

    Returns UNDEFINED on failure.

  Note

    encode_value() has fallbacks for some classes of objects, functions and programs.

  See also

    objectof() , functionof() , objectof()

  Method objectof

    `object objectof(string data)`

  Description

    Decode object encoded in data .

    This function is called by decode_value() when it encounters encoded objects.

  Parameter `data`

    Encoding of some object as specified by nameof() .

  Parameter `minor`

    Minor version.

  Returns

    Returns the decoded object.

  See also

    functionof() , programof()

  Method functionof

    `function functionof(string data)`

  Description

    Decode function encoded in data .

    This function is called by decode_value() when it encounters encoded functions.

  Parameter `data`

    Encoding of some function as specified by nameof() .

  Parameter `minor`

    Minor version.

  Returns

    Returns the decoded function.

  See also

    objectof() , programof()

  Method programof

    `program programof(string data)`

  Description

    Decode program encoded in data .

    This function is called by decode_value() when it encounters encoded programs.

  Parameter `data`

    Encoding of some program as specified by nameof() .

  Parameter `minor`

    Minor version.

  Returns

    Returns the decoded program.

  See also

    functionof() , objectof()

  Method __register_new_program

    `object __register_new_program(program p)`

  Description

    Called by decode_value() to register the program that is being decoded. Might get called repeatedly with several other programs that are being decoded recursively. The only safe assumption is that when the top level thing being decoded is a program, then the first call will be with the unfinished embryo that will later become that program.

  Returns

    Returns either zero or a placeholder object. A placeholder object must be a clone of __null_program . When the program is finished, the placeholder object will be converted to a clone of it. This is used for pike module objects.

CLASS FacetGroup

  Description

    This class is used to handle facets in the system. All facets in the system have to belong to a facet group. A facet group is a pike module that inherits from this class. For example you can create a file MyFacetgroup.pmod with the following content:

    inherit FacetGroup;

  You can then use the facet group MyFacetGroup in a facet-class like this:

      class A
       {
         facet NameOfMyFacet : .MyFacetGroup;
         // Rest of class A
       }

CLASS mklibpike

  Method parse

    `mapping(string:array(array(Parser.C.Token))) parse(array(Parser.C.Token) tokens)`

  Description

    Returns a mapping from symbol to a tuple of return type and parameters.

CLASS string_assignment

  Method `[]

    `int `[](int i)`

  Description

    String index operator.

  Method `[]=

    `int `[]=(int i, int j)`

  Description

    String assign index operator.

Module Regexp

  Inherit "___Regexp"

    inherit "___Regexp"

  Method `()

    `SimpleRegexp `()(void|string regexp)`

  Description

    Convenience/compatibility method to get a SimpleRegexp object.

  Method match

    `int(0..1) match(string regexp, string data)`

  Description

    Calls Regexp.PCRE.Plain.match in a temporary regexp object. Faster to type but slower to run...

  Method split

    `array split(string regexp, string data)`

  Description

    Calls Regexp.PCRE.Plain.split in a temporary regexp object. Faster to type but slower to run...

  Method split2

    `array split2(string regexp, string data)`

  Description

    Calls Regexp.PCRE.Plain.split2 in a temporary regexp object. Faster to type but slower to run...

  Method replace

    `string replace(string regexp, string data, string|function(string:string) transform)`

  Description

    Calls Regexp.PCRE.Plain.replace in a temporary regexp object. Faster to type but slower to run...

  CLASS Regexp.SimpleRegexp

    Description

      This class implements the interface to a simple regexp engine with the following capabilities:

      . | Matches any character.
      [abc] | Matches a, b or c.
      [a-z] | Matches any character a to z inclusive.
      [^ac] | Matches any character except a and c.
      (x) | Matches x (x might be any regexp) If used with split, this also puts the string matching x into the result array.
      x* | Matches zero or more occurances of 'x' (x may be any regexp).
      x+ | Matches one or more occurances of 'x' (x may be any regexp).
      x|y | Matches x or y. (x or y may be any regexp).
      xy | Matches xy (x and y may be any regexp).
      ^ | Matches beginning of string (but no characters).
      $ | Matches end of string (but no characters).
      \< | Matches the beginning of a word (but no characters).
      \> | Matches the end of a word (but no characters).

      Note that \ can be used to quote these characters in which case they match themselves, nothing else. Also note that when quoting these something in Pike you need two \ because Pike also uses this character for quoting.

    Method create

      `void Regexp.SimpleRegexp(string re)`

    Description

      When create is called, the current regexp bound to this object is cleared. If a string is sent to create(), this string will be compiled to an internal representation of the regexp and bound to this object for laters calls to e.g. match or split . Calling create() without an argument can be used to free up a little memory after the regexp has been used.

    Method match

      `int match(string str)`

    Description

      Returns 1 if str matches the regexp bound to the regexp object. Zero otherwise.

    Method match

      `array(string) match(array(string) strs)`

    Description

      Returns an array containing strings in strs that match the regexp bound to the regexp object.

    Bugs

      The current implementation doesn't support searching in strings containing the NUL character or any wide character.

    See also

      split

    Method split

      `array(string) split(string s)`

    Description

      Works as match , but returns an array of the strings that matched the subregexps. Subregexps are those contained in "( )" in the regexp. Subregexps that were not matched will contain zero. If the total regexp didn't match, zero is returned.

    Bugs

      You can currently only have 39 subregexps.

    Bugs

      The current implementation doesn't support searching in strings containing the NUL character or any wide character.

    See also

      match

    Inherit _SimpleRegexp

      inherit _SimpleRegexp : _SimpleRegexp

    Method replace

      `string replace(string in, string|function(string:string) transform)`

    Method _encode
    Method _decode

      `mixed _encode()`
      `mixed _decode(string s)`

    Description

      Regexp objects can be encoded and decoded.

    See also

      encode_value , decode_value

  Module Regexp.PCRE

    Method split_subject

      `array(string) split_subject(string subject, array(int) previous_result)`

    Description

      Convenience function that splits a subject string on the result from _pcre->exec()

      equal to map(previous_result/2, lambda(array v) { return subject[v[0]..v[1]-1]; })

    Constant buildconfig_UTF8

      `constant Regexp.PCRE.buildconfig_UTF8`

    Description

      (from the pcreapi man-page) "The output is an integer that is set to one if UTF-8 support is available; otherwise it is set to zero." This constant is calculated when the module is initiated by using pcre_config(3).

    Constant buildconfig_NEWLINE

      `constant Regexp.PCRE.buildconfig_NEWLINE`

    Description

      (from the pcreapi man-page) "The output is an integer that is set to the value of the code that is used for the newline character. It is either linefeed (10) or carriage return (13), and should normally be the standard character for your operating system." This constant is calculated when the module is initiated by using pcre_config(3).

    Constant buildconfig_LINK_SIZE

      `constant Regexp.PCRE.buildconfig_LINK_SIZE`

    Description

      (from the pcreapi man-page) "The output is an integer that contains the number of bytes used for internal linkage in compiled regular expressions. The value is 2, 3, or 4. Larger values allow larger regular expressions to be compiled, at the expense of slower match- ing. The default value of 2 is sufficient for all but the most massive patterns, since it allows the compiled pattern to be up to 64K in size." This constant is calculated when the module is initiated by using pcre_config(3).

    Constant buildconfig_POSIX_MALLOC_THRESHOLD

      `constant Regexp.PCRE.buildconfig_POSIX_MALLOC_THRESHOLD`

    Description

      (from the pcreapi man-page) "The output is an integer that contains the threshold above which the POSIX interface uses malloc() for output vectors. Further details are given in the pcreposix documentation." This constant is calculated when the module is initiated by using pcre_config(3).

    Constant buildconfig_MATCH_LIMIT

      `constant Regexp.PCRE.buildconfig_MATCH_LIMIT`

    Description

      (from the pcreapi man-page) "The output is an integer that gives the default limit for the number of internal matching function calls in a pcre_exec() execution. Further details are given with pcre_exec() below." This constant is calculated when the module is initiated by using pcre_config(3).

    CLASS Regexp.PCRE._pcre

      Method create

        `void Regexp.PCRE._pcre(string pattern, void|int options, void|object table)`

      Description

        The option bits are:

        `OPTION.ANCHORED` | Force pattern anchoring
        `OPTION.CASELESS` | Do caseless matching
        `OPTION.DOLLAR_ENDONLY` | $ not to match newline at end
        `OPTION.DOTALL` | . matches anything including NL
        `OPTION.EXTENDED` | Ignore whitespace and # comments
        `OPTION.EXTRA` | PCRE extra features (not much use currently)
        `OPTION.MULTILINE` | ^ and $ match newlines within data
        `OPTION.NO_AUTO_CAPTURE` | Disable numbered capturing parentheses (named ones available)
        `OPTION.UNGREEDY` | Invert greediness of quantifiers
        `OPTION.UTF8` | Run in UTF-8 mode

      Method study

        `object study()`

      Description

        (from the pcreapi man-page) "When a pattern is going to be used several times, it is worth spending more time analyzing it in order to speed up the time taken for match- ing."

      Method _sprintf

        `string _sprintf(int c, mapping flags)`

      Method info

        `mapping info()`

      Description

        Returns additional information about a compiled pattern. Only available if PCRE was compiled with Fullinfo.

      Returns

        `"backrefmax" : int` | Return the number of the highest back reference in the pattern. The fourth argument should point to an int variable. Zero is returned if there are no back references.
        `"capturecount" : int` | Return the number of capturing subpatterns in the pattern. The fourth argument should point to an int variable.

        `"firstbyte" : int`

        Return information about the first byte of any matched string, for a non-anchored pattern. (This option used to be called PCRE_INFO_FIRSTCHAR; the old name is still recognized for backwards compatibility.)

        If there is a fixed first byte, e.g. from a pattern such as (cat|cow|coyote), it is returned in the integer pointed to by where. Otherwise, if either

        (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch starts with `"^"`, or

        (b) every branch of the pattern starts with `".*"` and PCRE_DOTALL is not set (if it were set, the pattern would be anchored),

        `-1` is returned, indicating that the pattern matches only at the start of a subject string or after any newline within the string. Otherwise `-2` is returned. For anchored patterns, `-2` is returned.

        `"lastliteral" : int`

        Return the value of the rightmost literal byte that must exist in any matched string, other than at its start, if such a byte has been recorded. The fourth argument should point to an int variable. If there is no such byte, `-1` is returned. For anchored patterns, a last literal byte is recorded only if it follows something of variable length. For example, for the pattern /^a\d+z\d+/ the returned value is `"z"`, but for /^a\dz\d/ the returned value is `-1`.

        `"namecount" : int` |
        `"nameentrysize" : int` |

        `"options" : int`

        Return a copy of the options with which the pattern was compiled. The fourth argument should point to an unsigned long int variable. These option bits are those specified in the call to pcre_compile(), modified by any top-level option settings within the pattern itself.

        A pattern is automatically anchored by PCRE if all of its top-level alternatives begin with one of the following:

        ^ | unless PCRE_MULTILINE is set
        \A | always
        \G | always
        .* | if PCRE_DOTALL is set and there are no back references to the subpattern in which .* appears

        For such patterns, the PCRE_ANCHORED bit is set in the options returned.

        `"size" : int` | Return the size of the compiled pattern, that is, the value that was passed as the argument to pcre_malloc() when PCRE was getting memory in which to place the compiled data. The fourth argument should point to a size_t variable.
        `"studysize" : int` | Returns the size of the data block pointed to by the study_data field in a pcre_extra block. That is, it is the value that was passed to pcre_malloc() when PCRE was getting memory into which to place the data created by pcre_study(). The fourth argument should point to a size_t variable.

      Method exec

        `int|array exec(string subject, void|int startoffset)`

      Description

        match a regexp; will return an array of 2*n integers where n is the number of hits; returns an int upon failure

        Error codes:

        `ERROR.NOMATCH` | The subject string did not match the pattern.
        `ERROR.NULL` | Either code or subject was passed as NULL, or ovector was NULL and oversize was not zero.
        `ERROR.BADOPTION` | An unrecognized bit was set in the options argument.
        `ERROR.BADMAGIC` | PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch the case when it is passed a junk pointer. This is the error it gives when the magic number isn't present.
        `ERROR.UNKNOWN_NODE` | While running the pattern match, an unknown item was encountered in the compiled pattern. This error could be caused by a bug in PCRE or by overwriting of the compiled pattern.
        `ERROR.NOMEMORY` | If a pattern contains back references, but the ovector that is passed to pcre_exec() is not big enough to remember the referenced substrings, PCRE gets a block of memory at the start of matching to use for this purpose. If the call via pcre_malloc() fails, this error is given. The memory is freed at the end of matching.
        `ERROR.NOSUBSTRING` | This error is used by the pcre_copy_substring(), pcre_get_substring(), and pcre_get_substring_list() functions (see below). It is never returned by pcre_exec().
        `ERROR.MATCHLIMIT` | The recursion and backtracking limit, as specified by the match_limit field in a pcre_extra structure (or defaulted) was reached. See the description above.
        `ERROR.CALLOUT` | This error is never generated by pcre_exec() itself. It is provided for use by callout functions that want to yield a distinctive error code. See the pcrecallout documentation for details.

      Method get_stringnumber

        `int get_stringnumber(string stringname)`

      Description

        returns the number of a named subpattern

    Module Regexp.PCRE.OPTION

      Description

        contains all option constants

      Constant ANCHORED

        `constant Regexp.PCRE.OPTION.ANCHORED`

      Description

        (from the pcreapi manpage) If this bit is set, the pattern is forced to be "anchored", that is, it is constrained to match only at the first matching point in the string which is being searched (the "subject string"). This effect can also be achieved by appropriate constructs in the pattern itself, which is the only way to do it in Perl.

      Constant CASELESS

        `constant Regexp.PCRE.OPTION.CASELESS`

      Description

        (from the pcreapi manpage) If this bit is set, letters in the pattern match both upper and lower case letters. It is equivalent to Perl's /i option, and it can be changed within a pattern by a (?i) option setting.

      Constant DOLLAR_ENDONLY

        `constant Regexp.PCRE.OPTION.DOLLAR_ENDONLY`

      Description

        (from the pcreapi manpage) If this bit is set, a dollar metacharacter in the pattern matches only at the end of the subject string. Without this option, a dollar also matches immediately before the final character if it is a newline (but not before any other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is set. There is no equivalent to this option in Perl, and no way to set it within a pattern.

      Constant DOTALL

        `constant Regexp.PCRE.OPTION.DOTALL`

      Description

        (from the pcreapi manpage) If this bit is set, a dot metacharater in the pattern matches all characters, including newlines. Without it, newlines are excluded. This option is equivalent to Perl's /s option, and it can be changed within a pattern by a (?s) option setting. A negative class such as [^a] always matches a newline character, independent of the setting of this option.

      Constant EXTENDED

        `constant Regexp.PCRE.OPTION.EXTENDED`

      Description

        (from the pcreapi manpage) If this bit is set, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class. Whitespace does not include the VT character (code 11). In addition, characters between an unescaped # outside a character class and the next newline character, inclusive, are also ignored. This is equivalent to Perl's /x option, and it can be changed within a pattern by a (?x) option setting.

        This option makes it possible to include comments inside complicated patterns. Note, however, that this applies only to data characters. Whitespace characters may never appear within special character sequences in a pattern, for example within the sequence (?( which introduces a conditional subpattern.

      Constant EXTRA

        `constant Regexp.PCRE.OPTION.EXTRA`

      Description

        (from the pcreapi manpage) This option was invented in order to turn on additional functionality of PCRE that is incompatible with Perl, but it is currently of very little use. When set, any backslash in a pattern that is followed by a letter that has no special meaning causes an error, thus reserving these combinations for future expansion. By default, as in Perl, a backslash followed by a letter with no special meaning is treated as a literal. There are at present no other features controlled by this option. It can also be set by a (?X) option setting within a pattern.

      Constant MULTILINE

        `constant Regexp.PCRE.OPTION.MULTILINE`

      Description

        (from the pcreapi manpage) By default, PCRE treats the subject string as consisting of a single "line" of characters (even if it actually contains several newlines). The "start of line" metacharacter (^) matches only at the start of the string, while the "end of line" metacharacter ($) matches only at the end of the string, or before a terminating newline (unless PCRE_DOL- LAR_ENDONLY is set). This is the same as Perl.

        When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs match immediately following or immediately before any new- line in the subject string, respectively, as well as at the very start and end. This is equivalent to Perl's /m option, and it can be changed within a pattern by a (?m) option setting. If there are no "\n" charac- ters in a subject string, or no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no effect.

      Constant NO_AUTO_CAPTURE

        `constant Regexp.PCRE.OPTION.NO_AUTO_CAPTURE`

      Description

        (from the pcreapi manpage) If this option is set, it disables the use of numbered capturing paren- theses in the pattern. Any opening parenthesis that is not followed by ? behaves as if it were followed by ?: but named parentheses can still be used for capturing (and they acquire numbers in the usual way). There is no equivalent of this option in Perl.

      Constant UNGREEDY

        `constant Regexp.PCRE.OPTION.UNGREEDY`

      Description

        (from the pcreapi manpage) This option inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?". It is not compatible with Perl. It can also be set by a (?U) option setting within the pattern.

      Constant UTF8

        `constant Regexp.PCRE.OPTION.UTF8`

      Description

        (from the pcreapi manpage) This option causes PCRE to regard both the pattern and the subject as strings of UTF-8 characters instead of single-byte character strings. However, it is available only if PCRE has been built to include UTF-8 support. If not, the use of this option provokes an error. Details of how this option changes the behaviour of PCRE are given in the section on UTF-8 support in the main pcre page.

    Module Regexp.PCRE.ERROR

        `constant Regexp.PCRE.ERROR.NOMATCH`
        `constant Regexp.PCRE.ERROR.NULL`
        `constant Regexp.PCRE.ERROR.BADOPTION`
        `constant Regexp.PCRE.ERROR.BADMAGIC`
        `constant Regexp.PCRE.ERROR.UNKNOWN_NODE`
        `constant Regexp.PCRE.ERROR.NOMEMORY`
        `constant Regexp.PCRE.ERROR.NOSUBSTRING`
        `constant Regexp.PCRE.ERROR.MATCHLIMIT`
        `constant Regexp.PCRE.ERROR.CALLOUT`

      Description

        Documented in exec .

    Module Regexp.PCRE._Regexp_PCRE

      Inherit "____Regexp_PCRE"

        inherit "____Regexp_PCRE"

      Method `()

        `GOOD `()(string pattern, void|int options, void|object table)`

      Description

        Convenience function to create a suitable PCRE Regexp object; will create a StudiedWidestring from the arguments.

        That means the result will be able to handle widestrings, and will produce fast matchings by studying the pattern, but the widestring wrapping will on the other hand add overhead.

        If you need a faster regexp and doesn't use widestring, create a Regexp.PCRE.Studied instead.

        Widestring support will not be used if the linked libpcre lacks UTF8 support. This can be tested with checking that the Regexp.PCRE.Widestring class exist.

      CLASS Regexp.PCRE._Regexp_PCRE.Plain

        Description

          The main regexp class. Will provide anything needed for matching regexps.

          There are subclasses that adds wrappers for widestrings, and to optimize the regexp pattern.

        Inherit _pcre

          inherit _pcre : _pcre

        Method split2

          `array(string)|int(0..0) split2(string subject, void|int startoffset)`

        Description

          Matches a subject against the pattern, returns an array where the first element are the whole match, and the subsequent are the matching subpatterns. Returns 0 if there was no match.

          example: > Regexp.PCRE.Plain("i\(.*\) is \(.*\)u")->split2("pike is fun"); Result: ({ "ike is fu", "ke", "f" })

        Method split

          `array(string)|int(0..0) split(string subject, void|int startoffset)`

        Description

          Matches a subject against the pattern, compatible with the old split method: returns an array of the subpatterns, or if there are no subpattern but still a match, ({0}). Returns 0 if there was no match.

          example: > Regexp.PCRE.Plain("i\(.*\) is \(.*\)u")->split("pike is fun"); (1) Result: ({ "ke", "f" }) > Regexp.PCRE.Plain("is fun")->split("pike is fun"); (4) Result: ({ 0 })

        Method match

          `int(0..1) match(string subject, void|int startoffset)`

        Description

          returns true (1) if a match is found, false otherwise

          example: > Regexp.PCRE.Plain("is fun")->match("pike is fun"); Result: 1 > Regexp.PCRE.Plain("is fun")->match("pike isn't fun"); Result: 0

        Method replace

          `string replace(string subject, string|function with, mixed|void ... args)`

        Description

          replace all occurances of a pattern in a subject; callbacks and replacements will be from the first occurance, not from the last as in Regexp.Builtin.replace.

          if with is a function, the first argument will be the total match string, and the subsequent arguments will contain any submatches

          example: > Regexp.PCRE("b[^-]*m")->replace("abam-boom-fooabadoom","gurka"); Result: "agurka-gurka-fooagurka" > Regexp.PCRE("b[^-]*m")->replace("abam-boom-fooabadoom", lambda(string s) { werror("%O\n",s); return "gurka"; }); "bam" "boom" "badoom" Result: "agurka-gurka-fooagurka"

          example:

          > Regexp.PCRE("([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})") ->replace("foo@bar.org", lambda(string whole, string user, string loc, string domain) { return user + " from " + loc + " dot " + domain; } ); (4) Result: "foo from bar dot org"

        Method replace1

          `string replace1(string subject, string|function(string:string) with)`

        Description

          replace one (first) occurance of a pattern in a subject

          example: > Regexp.PCRE("b[^-]*m")->replace1("abam-boom-fooabadoom","gurka"); Result: "agurka-boom-fooabadoom"

        Method matchall

          `this_program matchall(string subject, function(array(string)|void:mixed|void) callback)`

        Description

          Will give a callback for each match in a subject. Called arguments will be matching patterns and subpatterns in an array and as second argument the exec result array.

          returns called object

          example: > Regexp.PCRE("b(a*)([^-\1234]*)(\1234*)m") ->matchall("abam-boom-fooabado\1234m", lambda(mixed s) { werror("%O\n",s); return "gurka"; }); ({ /* 4 elements */ "bam", "a", "", "" }) ({ /* 4 elements */ "boom", "", "oo", "" }) ({ /* 4 elements */ "bado\1234m", "a", "do", "\1234" }) Result: Regexp.PCRE.StudiedWidestring("b(a*)([^-Ê\234]*)(Ê\234*)m")

        Method replace_positional

          `string replace_positional(string subject, string subst)`

        Description

          replaces matches in a string, with support for backreferences (matched groups)

        Parameter `subject`

          the string to be tested against the regular expression

        Parameter `subst`

          string to be inserted in place of each match. backreferences can be inserted into the string to be substituted using the syntax %[n]s where n is the nth matching string group, and 0 (zero) is the full match.

          example: > Regexp.PCRE.Plain("my name is ([a-zA-Z]+)")->replace_positional("allow me to introduce myself: my name is john", "%[0]s is my name"); (1) Result: "allow me to introduce myself: john is my name"

      CLASS Regexp.PCRE._Regexp_PCRE.Studied

        Description

          Same as Plain, but will be studied to match faster; useful if you're doing many matches on the same pattern

        Inherit Plain

          inherit Plain : Plain

      CLASS Regexp.PCRE._Regexp_PCRE.Widestring

        Description

          Wrapper class around Plain, that will allow widestring patterns and subjects.

          Widestring support and this class will not be implemented if the linked libpcre lacks UTF8 support.

        Inherit Plain

          inherit Plain : Plain

        Method exec

          `array(int)|int exec(string subject, void|int startoffset)`

        Description

          The exec function is wrapped to give the correct indexes for the widestring.

      CLASS Regexp.PCRE._Regexp_PCRE.StudiedWidestring

        Description

          Same as Widestring, but will be studied to match faster; useful if you're doing many matches on the same pattern

        Inherit Widestring

          inherit Widestring : Widestring

Module Image

  Method lay

    `Image.Layer lay(array(Image.Layer|mapping) layers)`
    `Image.Layer lay(array(Image.Layer|mapping) layers, int xoffset, int yoffset, int xsize, int ysize)`

  Description

    Combine layers.

  Returns

    a new layer object.

  See also

    Image.Layer

  Method _decode

    `mapping _decode(string data)`

  Description

    Attempts to decode data as image data. The heuristics has some limited ability to decode macbinary files as well.

  Method decode_layers

    `array(Image.Layer) decode_layers(string data, mapping|void opt)`

  Description

    Attempts to decode data as image layer data. Additional arguments to the various formats decode_layers method can be passed through opt .

  Method read_file

    `string read_file(string file)`

  Description

    Reads the file file and, if the file is compressed with gzip or bzip, attempts to decompress it by calling `gzip` and `bzip2` in a Process.create_process call.

  Method load_file

    `string load_file(void|object|string file)`

  Description

    Loads in a file, which need not be an image file. If no argument is given the data will be taken from stdin. If a file object is given, it will be read to the end of the file. If a string is given the function will first attempt to load a file with that name, then try to download data with the string as URL. Zero will be returned upon failure.

  Method _load

    `mapping _load(void|object|string file)`

  Description

    Loads a file with load_file and decodes it with _decode .

  Method load_layer

    `Image.Layer load_layer(void|object|string file)`

  Description

    Helper function to load an image layer from a file. If no filename is given, Stdio.stdin is used. The loaded file is decoded with _decode.

  Method load_layers

    `array(Image.Layer) load_layers(void|object|string file, mixed|void opts)`

  Description

    Helper function to load all image layers from a file. If no filename is given, Stdio.stdin is used. The loaded file is decoded with decode_layers. Extra arguments to the image types layer decoder, e.g. for XCF files, can be given in the opts mapping.

  Method load

    `Image.Image load(void|object|string file)`

  Description

    Helper function to load an image from a file. If no filename is given, Stdio.stdin is used. The loaded file is decoded with _decode.

  Method filled_circle
  Method filled_circle_layer

    `Image.Image filled_circle(int d)`
    `Image.Image filled_circle(int xd, int yd)`
    `Image.Layer filled_circle_layer(int d)`
    `Image.Layer filled_circle_layer(int xd, int yd)`
    `Image.Layer filled_circle_layer(int d, Image.Color.Color color)`
    `Image.Layer filled_circle_layer(int xd, int yd, Image.Color.Color color)`
    `Image.Layer filled_circle_layer(int d, int r, int g, int b)`
    `Image.Layer filled_circle_layer(int xd, int yd, int r, int g, int b)`

  Description

    Generates a filled circle of the dimensions xd x yd (or d x d). The Image is a white circle on black background; the layer function defaults to a white circle (the background is transparent).

  CLASS Image.Image

    Description

      The main object of the Image module, this object is used as drawing area, mask or result of operations.

      basic:
      clear , clone , create , xsize , ysize

      plain drawing:
      box , circle , getpixel , line , setcolor , setpixel , threshold , polyfill

      operators:
      `& , `* , `+ , `- , `== , `> , `< , `|

      pasting images:
      paste , paste_alpha , paste_alpha_color , paste_mask

      getting subimages, scaling, rotating:
      autocrop , clone , copy , dct , mirrorx , rotate , rotate_ccw , rotate_cw , rotate_expand , scale , skewx , skewx_expand , skewy , skewy_expand

      calculation by pixels:
      apply_matrix , change_color , color , distancesq , grey , invert , modify_by_intensity , outline select_from , rgb_to_hsv , hsv_to_rgb , rgb_to_yuv , yuv_to_rgb ,

      average , max , min , sum , sumf , find_min , find_max

      special pattern drawing:
      noise , turbulence , test , tuned_box , gradients , random

    See also

      Image , Image.Font , Image.Colortable , Image.X

    Method average
    Method min
    Method max
    Method sum
    Method sumf

      `array(float) average()`
      `array(int) min()`
      `array(int) max()`
      `array(int) sum()`
      `array(float) sumf()`

    Description

      Gives back the average, minimum, maximum color value, and the sum of all pixel's color value.

    Note

      sum() values can wrap! Most systems only have 31 bits available for positive integers. (Meaning, be careful with images that have more than 8425104 pixels.)

      average() and sumf() may also wrap, but on a line basis. (Meaning, be careful with images that are wider than 8425104 pixels.) These functions may have a precision problem instead, during to limits in the 'double' C type and/or 'float' Pike type.

    Method find_min
    Method find_max

      `array(int) find_min()`
      `array(int) find_max()`
      `array(int) find_min(int r, int g, int b)`
      `array(int) find_max(int r, int g, int b)`

    Description

      Gives back the position of the minimum or maximum pixel value, weighted to grey.

    Parameter `r`
    Parameter `g`
    Parameter `b`

      weight of color, default is r=87,g=127,b=41, same as the grey () method.

    Method `/
    Method `%

      `object `/(object operand)`
      `object `/(Color color)`
      `object `/(int value)`
      `object `%(object operand)`
      `object `%(Color color)`
      `object `%(int value)`

    Description

      Divides pixel values and creates a new image from the result or the rest.

    Parameter `operand`

      the other image to divide with; the images must have the same size.

    Parameter `color`
    Parameter `value`

      if specified as color or value, it will act as a whole image of that color (or value).

    Returns

      the new image object

    Note

      It isn't possible to do a modulo 256 either. (why?)

    See also

      `- , `+ , `| , `&amp; , `* , Image.Layer

    Method `&

      `object `&(object operand)`
      `object `&(array(int) color)`
      `object `&(int value)`

    Description

      makes a new image out of the minimum pixels values

    Parameter `operand`

      the other image to compare with; the images must have the same size.

    Parameter `color`

      an array in format ({r,g,b}), this is equal to using an uniform-colored image.

    Parameter `value`

      equal to ({value,value,value}).

    Returns

      the new image object

    See also

      `- , `+ , `| , `* , Image.Layer

    Method `==
    Method `<
    Method `>

      `int `==(object operand)`
      `int `==(array(int) color)`
      `int `==(int value)`
      `int `<(object operand)`
      `int `<(array(int) color)`
      `int `<(int value)`
      `int `>(object operand)`
      `int `>(array(int) color)`
      `int `>(int value)`

    Description

      Compares an image with another image or a color.

      Comparision is strict and on pixel-by-pixel basis. (Means if not all pixel r,g,b values are correct compared with the corresponding pixel values, 0 is returned.)

    Parameter `operand`

      the other image to compare with; the images must have the same size.

    Parameter `color`

      an array in format ({r,g,b}), this is equal to using an uniform-colored image.

    Parameter `value`

      equal to ({value,value,value}).

    Returns

      true (1) or false (0).

    Note

      `< or `> on empty ("no image") image objects or images with different size will result in an error. `== is always true on two empty image objects and always false if one and only one of the image objects is empty or the images differs in size.

      a>=b and a<=b between objects is equal to !(a<b) and !(a>b), which may not be what you want (since both < and > can return false, comparing the same images).

    See also

      `- , `+ , `| , `* , `&amp;

    Method `*

      `object `*(object operand)`
      `object `*(array(int) color)`
      `object `*(int value)`
      `object `*(float value)`

    Description

      Multiplies pixel values and creates a new image. This can be useful to lower the values of an image, making it greyer, for instance:

          image=image*128+64;

    Parameter `operand`

      the other image to multiply with; the images must have the same size.

    Parameter `color`

      an array in format ({r,g,b}), this is equal to using an uniform-colored image.

    Parameter `value`

      equal to ({value,value,value}).

    Returns

      the new image object

    See also

      `- , `+ , `| , `&amp; , Image.Layer

    Method `+

      `object `+(object operand)`
      `object `+(array(int) color)`
      `object `+(int value)`

    Description

      adds two images; values are truncated at 255.

    Parameter `operand`

      the image which to add.

    Parameter `color`

      an array in format ({r,g,b}), this is equal to using an uniform-colored image.

    Parameter `value`

      equal to ({value,value,value}).

    Returns

      the new image object

    See also

      `- , `| , `&amp; , `* , Image.Layer

    Method `-

      `object `-(object operand)`
      `object `-(array(int) color)`
      `object `-(int value)`

    Description

      makes a new image out of the difference

    Parameter `operand`

      the other image to compare with; the images must have the same size.

    Parameter `color`

      an array in format ({r,g,b}), this is equal to using an uniform-colored image.

    Parameter `value`

      equal to ({value,value,value}).

    Returns

      the new image object

    See also

      `+ , `| , `&amp; , `* , Image.Layer , min , max , `==

    Method `|

      `object `|(object operand)`
      `object `|(array(int) color)`
      `object `|(int value)`

    Description

      makes a new image out of the maximum pixels values

    Parameter `operand`

      the other image to compare with; the images must have the same size.

    Parameter `color`

      an array in format ({r,g,b}), this is equal to using an uniform-colored image.

    Parameter `value`

      equal to ({value,value,value}).

    Returns

      the new image object

    See also

      `- , `+ , `&amp; , `* , Image.Layer

    Method polyfill

      `object polyfill(array(int|float) ... curve)`

    Description

      fills an area with the current color

    Parameter `curve`

      curve(s), `({x1,y1,x2,y2,...,xn,yn})`, automatically closed.

      If any given curve is inside another, it will make a hole.

          Image.Image(100,100)->setcolor(255,0,0,128)->
            polyfill( ({ 20,20, 80,20, 80,80 }) );

    Returns

      the current object

    Note

      Lines in the polygon may not be crossed without the crossing coordinate specified in both lines.

    Bugs

      Inverted lines reported on Intel and Alpha processors.

    See also

      setcolor

    Method apply_curve

      `object apply_curve(object array(int(0..255)`
      `object apply_curve(object array(int(0..255)`
      `object apply_curve(object stringchannel, object array(int(0..255)`

    Description

      Apply a lookup-table on all pixels in an image. If only one curve is passed, use the same curve for red, green and blue. If 'channel' is specified, the curve is only applied to the specified channel.

    Parameter `curve_r`
    Parameter `curve_g`
    Parameter `curve_b`
    Parameter `curve`

      An array with 256 elements, each between 0 and 255. It is used as a look-up table, if the pixel value is 2 and curve[2] is 10, the new pixel value will be 10.

    Parameter `channel`

      one of "red", "green", "blue", "value", "saturation" and "hue".

    Returns

      a new image object

    See also

      gamma , `* , modify_by_intensity

    Method apply_matrix

      `object apply_matrix(array(array(int|array(int))) matrix)`
      `object apply_matrix(array(array(int|array(int))) matrix, int r, int g, int b)`
      `object apply_matrix(array(array(int|array(int))) matrix, int r, int g, int b, int|float div)`

    Description

      Applies a pixel-transform matrix, or filter, to the image.

                                 2   2
          pixel(x,y)= base+ k ( sum sum pixel(x+k-1,y+l-1)*matrix(k,l) )
                                k=0 l=0

      1/k is sum of matrix, or sum of matrix multiplied with div. base is given by r,g,b and is normally black.

      blur (ie a 2d gauss function):

          ({({1,2,1}),
            ({2,5,2}),
            ({1,2,1})})

      | original

      sharpen (k>8, preferably 12 or 16):

          ({({-1,-1,-1}),
            ({-1, k,-1}),
            ({-1,-1,-1})})

      edge detect:

          ({({1, 1,1}),
            ({1,-8,1}),
            ({1, 1,1})})

      horisontal edge detect (get the idea):

          ({({0, 0,0}),
            ({1,-2,1}),
            ({0, 0,0})})

      emboss (might prefer to begin with a grey image):

          ({({2, 1, 0}),
            ({1, 0,-1}),
            ({0,-1,-2})}), 128,128,128, 3

      | greyed

      This function is not very fast.

    Parameter `array`

      the matrix; innermost is a value or an array with red, green, blue values for red, green, blue separation.

    Parameter `r`
    Parameter `g`
    Parameter `b`

      base level of result, default is zero

    Parameter `div`

      division factor, default is 1.0.

    Returns

      the new image object

    Method autocrop
    Method find_autocrop

      `object autocrop()`
      `object autocrop(int border)`
      `object autocrop(int border, Color color)`
      `object autocrop(int border, int left, int right, int top, int bottom)`
      `object autocrop(int border, int left, int right, int top, int bottom, Color color)`
      `array(int) find_autocrop()`
      `array(int) find_autocrop(int border)`
      `array(int) find_autocrop(int border, int left, int right, int top, int bottom)`

    Description

      Removes "unneccesary" borders around the image, adds one of its own if wanted to, in selected directions.

      "Unneccesary" is all pixels that are equal -- ie if all the same pixels to the left are the same color, that column of pixels are removed.

      The find_autocrop() function simply returns x1,y1,x2,y2 for the kept area. (This can be used with copy later.)

    Parameter `border`
    Parameter `left`
    Parameter `right`
    Parameter `top`
    Parameter `bottom`

      which borders to scan and cut the image; a typical example is removing the top and bottom unneccesary pixels:

          img=img->autocrop(0, 0,0,1,1);

    Returns

      the new image object

    See also

      copy

    Method bitscale

      `object bitscale(float factor)`
      `object bitscale(float xfactor, float yfactor)`

    Description

      scales the image with a factor, without smoothing. This routine is faster than scale, but gives less correct results

      original | bitscale(0.75) | scale(0.75)

    Parameter `factor`

      factor to use for both x and y

    Parameter `xfactor`
    Parameter `yfactor`

      separate factors for x and y

    Returns

      the new image object

    Method bitscale

      `object bitscale(int newxsize, int newysize)`
      `object bitscale(0, int newysize)`
      `object bitscale(int newxsize, 0)`

    Description

      scales the image to a specified new size, if one of newxsize or newysize is 0, the image aspect ratio is preserved.

    Parameter `newxsize`
    Parameter `newysize`

      new image size in pixels

    Returns

      the new image object

    Note

      resulting image will be 1x1 pixels, at least

    Method blur

      `string blur(int no_pass)`

    Description

      A special case of apply_matrix that creates a blur effect. About four times faster than the generic apply_matrix. @[no_pass] is the number of times the blur matrix is applied.

      original | blur(1) | blur(5)

    See also

      apply_matrix , grey_blur

    Method box

      `object box(int x1, int y1, int x2, int y2)`
      `object box(int x1, int y1, int x2, int y2, int r, int g, int b)`
      `object box(int x1, int y1, int x2, int y2, int r, int g, int b, int alpha)`

    Description

      Draws a filled rectangle on the image.

      original | ->box (40,10, 10,80, 0,255,0) | ->box (40,10, 10,80, 255,0,0,75)

    Parameter `x1`
    Parameter `y1`
    Parameter `x2`
    Parameter `y2`

      box corners

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color of the box

    Parameter `alpha`

      alpha value

    Returns

      the object called

    Method cast

      `string cast(string type)`

    Description

      Cast the image to another datatype. Currently supported are string ("rgbrgbrgb...") and array (double array of Image.Color objects).

    See also

      Image.Color , Image.X

    Method change_color

      `object change_color(int tor, int tog, int tob)`
      `object change_color(int fromr, int fromg, int fromb, int tor, int tog, int tob)`

    Description

      Changes one color (exact match) to another. If non-exact-match is preferred, check distancesq and paste_alpha_color .

    Parameter `tor`
    Parameter `tog`
    Parameter `tob`

      destination color and next current color

    Parameter `fromr`
    Parameter `fromg`
    Parameter `fromb`

      source color, default is current color

    Returns

      a new (the destination) image object

    Method circle

      `object circle(int x, int y, int rx, int ry)`
      `object circle(int x, int y, int rx, int ry, int r, int g, int b)`
      `object circle(int x, int y, int rx, int ry, int r, int g, int b, int alpha)`

    Description

      Draws a circle on the image. The circle is not antialiased.

      original | ->circle (50,50, 30,50, 0,255,255)

    Parameter `x`
    Parameter `y`

      circle center

    Parameter `rx`
    Parameter `ry`

      circle radius in pixels

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color

    Parameter `alpha`

      alpha value

    Returns

      the object called

    Method clear

      `void clear()`
      `void clear(int r, int g, int b)`
      `void clear(int r, int g, int b, int alpha)`

    Description

      gives a new, cleared image with the same size of drawing area

      original | ->clear (0,128,255)

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color of the new image

    Parameter `alpha`

      new default alpha channel value

    See also

      copy , clone

    Method clone

      `object clone()`
      `object clone(int xsize, int ysize)`
      `object clone(int xsize, int ysize, int r, int g, int b)`
      `object clone(int xsize, int ysize, int r, int g, int b, int alpha)`

    Description

      Copies to or initialize a new image object.

      original | clone | clone(50,50)

    Parameter `xsize`
    Parameter `ysize`

      size of (new) image in pixels, called image is cropped to that size

    Parameter `r`
    Parameter `g`
    Parameter `b`

      current color of the new image, default is black. Will also be the background color if the cloned image is empty (no drawing area made).

    Parameter `alpha`

      new default alpha channel value

    Returns

      the new object

    See also

      copy , create

    Method color

      `object color()`
      `object color(int value)`
      `object color(Color color)`
      `object color(int r, int g, int b)`

    Description

      Colorize an image.

      The red, green and blue values of the pixels are multiplied with the given value(s). This works best on a grey image...

      The result is divided by 255, giving correct pixel values.

      If no arguments are given, the current color is used as factors.

      original | ->color(128,128,255);

    Parameter `r`
    Parameter `g`
    Parameter `b`

      red, green, blue factors

    Parameter `color`

      Color object with factors

    Parameter `value`

      factor

    Returns

      the new image object

    See also

      grey , `* , modify_by_intensity

    Method copy

      `object copy()`
      `object copy(int x1, int y1, int x2, int y2)`
      `object copy(int x1, int y1, int x2, int y2, int r, int g, int b)`
      `object copy(int x1, int y1, int x2, int y2, int r, int g, int b, int alpha)`

    Description

      Copies this part of the image. The requested area can be smaller, giving a cropped image, or bigger - the new area will be filled with the given or current color.

      original | ->copy (5,5, XSIZE-6,YSIZE-6) | ->copy (-5,-5, XSIZE+4,YSIZE+4, 10,75,10)

    Parameter `x1`
    Parameter `y1`
    Parameter `x2`
    Parameter `y2`

      The requested new area. Default is the old image size.

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color of the new image

    Parameter `alpha`

      new default alpha channel value

    Returns

      a new image object

    Note

      clone (void) and copy (void) does the same operation

    See also

      clone , autocrop

    Method create

      `void Image.Image()`
      `void Image.Image(int xsize, int ysize)`
      `void Image.Image(int xsize, int ysize, Color color)`
      `void Image.Image(int xsize, int ysize, int r, int g, int b)`
      `void Image.Image(int xsize, int ysize, int r, int g, int b, int alpha)`
      `void Image.Image(int xsize, int ysize, string method, method ...)`

    Description

      Initializes a new image object.

      Image.Image (XSIZE,YSIZE) | Image.Image (XSIZE,YSIZE,255,128,0)

      The image can also be calculated from some special methods, for convinience:

          channel modes; followed by a number of 1-char-per-pixel strings
          or image objects (where red channel will be used),
          or an integer value:
            "grey" : make a grey image (needs 1 source: grey)
            "rgb"  : make an rgb image (needs 3 sources: red, green and blue)
            "cmyk" : make a rgb image from cmyk (cyan, magenta, yellow, black)
            "adjusted_cmyk" : make a rgb image from cmyk
                     (cyan, magenta, yellow, black) where the colors aren't
                     100% pure (C: 009ee0, M: e2007a, Y: ffec00, K: 1a171b).

          generate modes; all extra arguments is given to the
          generation function. These has the same name as the method:
            "test ,"
            "gradients "
            "noise "
            "turbulence "
            "random "
            "randomgrey "
          specials cases:
            "tuned_box " (coordinates is automatic)

    Parameter `xsize`
    Parameter `ysize`

      size of (new) image in pixels

    Parameter `color`
    Parameter `r`
    Parameter `g`
    Parameter `b`

      background color (will also be current color), default color is black

    Parameter `alpha`

      default alpha channel value

    Bugs

      SIGSEGVS can be caused if the size is too big, due to unchecked overflow - (xsize*ysize)&MAXINT is small enough to allocate.

    See also

      copy , clone , Image.Image

    Method distancesq

      `object distancesq()`
      `object distancesq(int r, int g, int b)`

    Description

      Makes an grey-scale image, for alpha-channel use.

      The given value (or current color) are used for coordinates in the color cube. Each resulting pixel is the distance from this point to the source pixel color, in the color cube, squared, rightshifted 8 steps:

          p = pixel color
          o = given color
          d = destination pixel
          d.red=d.blue=d.green=
              ((o.red-p.red)²+(o.green-p.green)²+(o.blue-p.blue)²)>>8

      original | distance² to cyan | ...to purple | ...to yellow

    Parameter `r`
    Parameter `g`
    Parameter `b`

      red, green, blue coordinates

    Returns

      the new image object

    See also

      select_from

    Method gamma

      `object gamma(float g)`
      `object gamma(float gred, object floatggreen, object floatgblue)`

    Description

      Calculate pixels in image by gamma curve.

      Intensity of new pixels are calculated by:
      i' = i^g

      For example, you are viewing your image on a screen with gamma 2.2. To correct your image to the correct gamma value, do something like:

      `my_display_image(my_image()->gamma(1/2.2);`

    Parameter `g`
    Parameter `gred`
    Parameter `ggreen`
    Parameter `gblue`

      gamma value

    Returns

      a new image object

    See also

      grey , `* , color

    Method getpixel

      `array(int) getpixel(int x, int y)`

    Description

    Parameter `x`
    Parameter `y`

      position of the pixel

    Returns

      color of the requested pixel -- ({int red,int green,int blue})

    Method gradients

      `int gradients(array(int) point, object ...)`
      `int gradients(array(int) point, object ..., object floatgrad)`

    Description

      original | 2 color gradient | 10 color gradient | 3 colors, grad=4.0 | 3 colors, grad=1.0 | 3 colors, grad=0.25

    Returns

      the new image

    Method grey

      `object grey()`
      `object grey(int r, int g, int b)`

    Description

      Makes a grey-scale image (with weighted values).

      original | ->grey(); | ->grey(0,0,255);

    Parameter `r`
    Parameter `g`
    Parameter `b`

      weight of color, default is r=87,g=127,b=41, which should be pretty accurate of what the eyes see...

    Returns

      the new image object

    See also

      color , `* , modify_by_intensity

    Method grey_blur

      `object grey_blur(int no_pass)`

    Description

      Works like blur, but only operates on the r color channel. A faster alternative to blur for grey scale images. @[no_pass] is the number of times the blur matrix is applied.

      original | grey_blur(1) | grey_blur(5)

    See also

      blur

    Method rgb_to_hsv
    Method hsv_to_rgb

      `object rgb_to_hsv()`
      `object hsv_to_rgb()`

    Description

      Converts RGB data to HSV data, or the other way around. When converting to HSV, the resulting data is stored like this: pixel.r = h; pixel.g = s; pixel.b = v;

      When converting to RGB, the input data is asumed to be placed in the pixels as above.

      original | ->hsv_to_rgb(); | ->rgb_to_hsv();
      tuned box (below) | the rainbow (below) | same, but rgb_to_hsv()

      HSV to RGB calculation:

          in = input pixel
          out = destination pixel
          h=-pos*c_angle*3.1415/(float)NUM_SQUARES;
          out.r=(in.b+in.g*cos(in.r));
          out.g=(in.b+in.g*cos(in.r + pi*2/3));
          out.b=(in.b+in.g*cos(in.r + pi*4/3));

      RGB to HSV calculation: Hmm.

      Example: Nice rainbow.

           object i = Image.Image(200,200);
           i = i->tuned_box(0,0, 200,200,
                            ({ ({ 255,255,128 }), ({ 0,255,128 }),
                               ({ 255,255,255 }), ({ 0,255,255 })}))
                ->hsv_to_rgb();

    Returns

      the new image object

    Method invert

      `object invert()`

    Description

      Invert an image. Each pixel value gets to be 255-x, where x is the old value.

      original | ->invert(); | ->rgb_to_hsv()->invert()->hsv_to_rgb();

    Returns

      the new image object

    Method line

      `object line(int x1, int y1, int x2, int y2)`
      `object line(int x1, int y1, int x2, int y2, int r, int g, int b)`
      `object line(int x1, int y1, int x2, int y2, int r, int g, int b, int alpha)`

    Description

      Draws a line on the image. The line is not antialiased.

      original | ->line (50,10, 10,50, 255,0,0)

    Parameter `x1`
    Parameter `y1`
    Parameter `x2`
    Parameter `y2`

      line endpoints

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color

    Parameter `alpha`

      alpha value

    Returns

      the object called

    Method modify_by_intensity

      `object modify_by_intensity(int r, int g, int b, int|array(int) ... vn)`

    Description

      Recolor an image from intensity values.

      For each color an intensity is calculated, from r, g and b factors (see grey ), this gives a value between 0 and max.

      The color is then calculated from the values given, v1 representing the intensity value of 0, vn representing max, and colors between representing intensity values between, linear.

      original | ->grey()->modify_by_intensity(1,0,0, 0,({255,0,0}),({0,255,0}));

    Parameter `r`
    Parameter `g`
    Parameter `b`

      red, green, blue intensity factors

    Parameter `v1`
    Parameter `vn`

      destination color

    Returns

      the new image object

    See also

      grey , `* , color

    Method outline
    Method outline_mask

      `object outline()`
      `object outline(int olr, int olg, int olb)`
      `object outline(int olr, int olg, int olb, int bkgr, int bkgg, int bkgb)`
      `object outline(array(array(int)) mask)`
      `object outline(array(array(int)) mask, int olr, int olg, int olb)`
      `object outline(array(array(int)) mask, int olr, int olg, int olb, int bkgr, int bkgg, int bkgb)`
      `object outline_mask()`
      `object outline_mask(int bkgr, int bkgg, int bkgb)`
      `object outline_mask(array(array(int)) mask)`
      `object outline_mask(array(array(int)) mask, int bkgr, int bkgg, int bkgb)`

    Description

      Makes an outline of this image, ie paints with the given color around the non-background pixels.

      Default is to paint above, below, to the left and the right of these pixels.

      You can also run your own outline mask.

      The outline_mask function gives the calculated outline as an alpha channel image of white and black instead.

      original | masked through threshold | ...and outlined with red

    Parameter `mask`

      mask matrix. Default is `({({0,1,0}),({1,1,1}),({0,1,0})})`.

    Parameter `olr`
    Parameter `olg`
    Parameter `olb`

      outline color. Default is current.

    Parameter `bkgr`
    Parameter `bkgg`
    Parameter `bkgb`

      background color (what color to outline to); default is color of pixel 0,0.

    Parameter `div`

      division factor, default is 1.0.

    Returns

      the new image object

    Note

      no antialias!

    Method write_lsb_rgb
    Method write_lsb_grey
    Method read_lsb_rgb
    Method read_lsb_grey

      `object write_lsb_rgb(string what)`
      `object write_lsb_grey(string what)`
      `string read_lsb_rgb()`
      `string read_lsb_grey()`

    Description

      These functions read/write in the least significant bit of the image pixel values. The _rgb() functions read/write on each of the red, green and blue values, and the grey keeps the same lsb on all three.

      The string is nullpadded or cut to fit.

    Parameter `what`

      the hidden message

    Returns

      the current object or the read string

    Method rgb_to_yuv
    Method yuv_to_rgb

      `object rgb_to_yuv()`
      `object yuv_to_rgb()`

    Description

      Converts RGB data to YUV (YCrCb) data, or the other way around. When converting to YUV, the resulting data is stored like this: pixel.r = v (cr); pixel.g = y; pixel.b = u (cb);

      When converting to RGB, the input data is asumed to be placed in the pixels as above.

      original | ->yuv_to_rgb(); | ->rgb_to_yuv();
      tuned box (below) | the rainbow (below) | same, but rgb_to_yuv()

      RGB to YUB calculation (this follows CCIR.601):

          in = input pixel
          out = destination pixel
          Ey = 0.299*in.r+0.587*in.g+0.114*in.b
          Ecr = 0.713*(in.r - Ey) = 0.500*in.r-0.419*in.g-0.081*in.b
          Ecb = 0.564*(in.b - Ey) = -0.169*in.r-0.331*in.g+0.500*in.b
          out.r=0.875*Ecr+128
          out.g=0.86*Ey+16
          out.b=0.875*Ecb+128

      Example: Nice rainbow.

           object i = Image.Image(200,200);
           i = i->tuned_box(0,0, 200,200,
                            ({ ({ 255,255,128 }), ({ 0,255,128 }),
                               ({ 255,255,255 }), ({ 0,255,255 })}))
                ->yuv_to_rgb();

    Returns

      the new image object

    Method select_from

      `object select_from(int x, int y)`
      `object select_from(int x, int y, int edge_value)`

    Description

      Makes an grey-scale image, for alpha-channel use.

      This is very close to a floodfill.

      The image is scanned from the given pixel, filled with 255 if the color is the same, or 255 minus distance in the colorcube, squared, rightshifted 8 steps (see distancesq ).

      When the edge distance is reached, the scan is stopped. Default edge value is 30. This value is squared and compared with the square of the distance above.

      35, 35, 16 | 35, 35, 32 | 35, 35, 64 | 35, 35, 96 | 35, 35, 128 | 35, 35, 192 | 35, 35, 256

      original | original * select_from(35,35,200)

    Parameter `x`
    Parameter `y`

      originating pixel in the image

    Returns

      the new image object

    See also

      distancesq

    Method setcolor

      `object setcolor(int r, int g, int b)`
      `object setcolor(int r, int g, int b, int alpha)`

    Description

      set the current color

    Parameter `r`
    Parameter `g`
    Parameter `b`

      new color

    Parameter `alpha`

      new alpha value

    Returns

      the object called

    Method setpixel

      `object setpixel(int x, int y)`
      `object setpixel(int x, int y, Image.Color c)`
      `object setpixel(int x, int y, int r, int g, int b)`
      `object setpixel(int x, int y, int r, int g, int b, int alpha)`

    Description

      original | ->setpixel (10,10, 255,0,0)

    Parameter `x`
    Parameter `y`

      position of the pixel

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color

    Parameter `alpha`

      alpha value

    Returns

      the object called

    Method test

      `object test()`
      `object test(int seed)`

    Description

      Generates a test image, currently random gradients.

      original | ->test() | ...and again

    Returns

      the new image

    Note

      May be subject to change or cease without prior warning.

    See also

      gradients , tuned_box

    Method threshold

      `object threshold()`
      `object threshold(int level)`
      `object threshold(int r, int g, int b)`
      `object threshold(Color color)`

    Description

      Makes a black-white image.

      If any of red, green, blue parts of a pixel is larger then the given value, the pixel will become white, else black.

      This method works fine with the grey method.

      If no arguments are given, it will paint all non-black pixels white. (Ie, default is 0,0,0.)

      original | ->threshold(100); | ->threshold(0,100,0);

    Returns

      the new image object

    Note

      The above statement "any ..." was changed from "all ..." in Pike 0.7 (9906). It also uses 0,0,0 as default input, instead of current color. This is more useful.

    See also

      grey

    Method tuned_box

      `object tuned_box(int x1, int y1, int x2, int y2, array(array(int)) corner_color)`

    Description

      Draws a filled rectangle with colors (and alpha values) tuned between the corners.

      Tuning function is (1.0-x/xw)*(1.0-y/yw) where x and y is the distance to the corner and xw and yw are the sides of the rectangle.

      original | tuned box | solid tuning (blue,red,green,yellow) | tuning transparency (as left + 255,128,128,0)

    Parameter `x1`
    Parameter `y1`
    Parameter `x2`
    Parameter `y2`

      rectangle corners

    Parameter `corner_color`

      colors of the corners:

          ({x1y1,x2y1,x1y2,x2y2})

      each of these is an array of integeres:

          ({r,g,b}) or ({r,g,b,alpha})

      Default alpha channel value is 0 (opaque).
    Returns

      the object called

    Method xsize

      `int xsize()`

    Returns

      the width of the image

    Method ysize

      `int ysize()`

    Returns

      the height of the image

    Method noise

      `void noise(array(float|int|array(int)) colorrange)`
      `void noise(array(float|int|array(int)) colorrange, float scale, float xdiff, float ydiff, float cscale)`

    Description

      Gives a new image with the old image's size, filled width a 'noise' pattern.

      The random seed may be different with each instance of pike.

      Example: `->noise( ({0,({255,0,0}), 0.3,({0,255,0}), 0.6,({0,0,255}), 0.8,({255,255,0})}), 0.2,0.0,0.0,1.0 );`

    Parameter `colorrange`

      colorrange table

    Parameter `scale`

      default value is 0.1

    Parameter `xdiff`
    Parameter `ydiff`

      default value is 0,0

    Parameter `cscale`

      default value is 1

    See also

      turbulence

    Method random
    Method randomgrey

      `object random()`
      `object random(int seed)`
      `object randomgrey()`
      `object random(greyint seed)`

    Description

      Gives a randomized image;

      original | ->random() | ->random(17) | greyed (same again) | color(red) (same again) | ...red channel

      Use with ->grey () or ->color () for one-color-results.

    Returns

      a new image

    See also

      test , noise

    Method turbulence

      `void turbulence(array(float|int|array(int)) colorrange)`
      `void turbulence(array(float|int|array(int)) colorrange, int octaves, float scale, float xdiff, float ydiff, float cscale)`

    Description

      gives a new image with the old image's size, filled width a 'turbulence' pattern

      The random seed may be different with each instance of pike.

      Example:
      `->turbulence( ({0,({229,204,204}), 0.9,({229,20,20}), 0.9,Color.black}) );`

    Parameter `colorrange`

      colorrange table

    Parameter `octaves`

      default value is 3

    Parameter `scale`

      default value is 0.1

    Parameter `xdiff`
    Parameter `ydiff`

      default value is 0,0

    Parameter `cscale`

      default value is 1

    See also

      noise , Image.Color

    Method mirrorx

      `object mirrorx()`

    Description

      mirrors an image:

      original | ->mirrorx();

    Returns

      the new image object

    Method mirrory

      `object mirrory()`

    Description

      mirrors an image:

      original | ->mirrory();

    Method rotate
    Method rotate_expand

      `object rotate(int|float angle)`
      `object rotate(int|float angle, int r, int g, int b)`
      `object rotate_expand(int|float angle)`
      `object rotate_expand(int|float angle, int r, int g, int b)`

    Description

      Rotates an image a certain amount of degrees (360° is a complete rotation) counter-clockwise:

      original | ->rotate(15,255,0,0); | ->rotate_expand(15);

      The "expand" variant of functions stretches the image border pixels rather then filling with the given or current color.

      This rotate uses the skewx () and skewy () functions.

    Parameter `angle`

      the number of degrees to rotate

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color to fill with; default is current

    Returns

      the new image object

    Method rotate_ccw

      `object rotate_ccw()`

    Description

      rotates an image counter-clockwise, 90 degrees.

      original | ->rotate_ccw();

    Returns

      the new image object

    Method rotate_cw

      `object rotate_cw()`

    Description

      rotates an image clockwise, 90 degrees.

      original | ->rotate_cw();

    Returns

      the new image object

    Method scale

      `object scale(float factor)`
      `object scale(0.5)`
      `object scale(float xfactor, float yfactor)`

    Description

      scales the image with a factor, 0.5 is an optimized case.

    Parameter `factor`

      factor to use for both x and y

    Parameter `xfactor`
    Parameter `yfactor`

      separate factors for x and y

    Returns

      the new image object

    Method scale

      `object scale(int newxsize, int newysize)`
      `object scale(0, int newysize)`
      `object scale(int newxsize, 0)`

    Description

      scales the image to a specified new size, if one of newxsize or newysize is 0, the image aspect ratio is preserved.

    Parameter `newxsize`
    Parameter `newysize`

      new image size in pixels

    Returns

      the new image object

    Note

      resulting image will be 1x1 pixels, at least

    Method skewx
    Method skewx_expand

      `object skewx(int x)`
      `object skewx(float yfactor)`
      `object skewx(int x, int r, int g, int b)`
      `object skewx(float yfactor, int r, int g, int b)`
      `object skewx_expand(int x)`
      `object skewx_expand(float yfactor)`
      `object skewx_expand(int x, int r, int g, int b)`
      `object skewx_expand(float yfactor, int r, int g, int b)`

    Description

      Skews an image an amount of pixels or a factor; a skew-x is a transformation:

      original | ->skewx(15,255,0,0); | ->skewx_expand(15);

    Parameter `x`

      the number of pixels The "expand" variant of functions stretches the image border pixels rather then filling with the given or current color.

    Parameter `yfactor`

      best described as: x=yfactor*this->ysize()

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color to fill with; default is current

    Returns

      the new image object

    Method skewy
    Method skewy_expand

      `object skewy(int y)`
      `object skewy(float xfactor)`
      `object skewy(int y, int r, int g, int b)`
      `object skewy(float xfactor, int r, int g, int b)`
      `object skewy_expand(int y)`
      `object skewy_expand(float xfactor)`
      `object skewy_expand(int y, int r, int g, int b)`
      `object skewy_expand(float xfactor, int r, int g, int b)`

    Description

      Skews an image an amount of pixels or a factor; a skew-y is a transformation:

      original | ->skewy(15,255,0,0); | ->skewy_expand(15);

      The "expand" variant of functions stretches the image border pixels rather then filling with the given or current color.

    Parameter `y`

      the number of pixels

    Parameter `xfactor`

      best described as: t=xfactor*this->xsize()

    Parameter `r`
    Parameter `g`
    Parameter `b`

      color to fill with; default is current

    Returns

      the new image object

    Method paste

      `object paste(object image)`
      `object paste(object image, int x, int y)`

    Description

      Pastes a given image over the current image.

    Parameter `image`

      image to paste (may be empty, needs to be an image object)

    Parameter `x`
    Parameter `y`

      where to paste the image; default is 0,0

    Returns

      the object called

    See also

      paste_mask , paste_alpha , paste_alpha_color

    Method paste_alpha

      `object paste_alpha(object image, int alpha)`
      `object paste_alpha(object image, int alpha, int x, int y)`

    Description

      Pastes a given image over the current image, with the specified alpha channel value.

      An alpha channel value of 0 leaves nothing of the original image in the paste area, 255 is meaningless and makes the given image invisible.

    Parameter `image`

      image to paste

    Parameter `alpha`

      alpha channel value

    Parameter `x`
    Parameter `y`

      where to paste the image; default is 0,0

    Returns

      the object called

    See also

      paste_mask , paste , paste_alpha_color

    Method paste_alpha_color

      `object paste_alpha_color(object mask)`
      `object paste_alpha_color(object mask, int x, int y)`
      `object paste_alpha_color(object mask, int r, int g, int b)`
      `object paste_alpha_color(object mask, int r, int g, int b, int x, int y)`
      `object paste_alpha_color(object mask, Color color)`
      `object paste_alpha_color(object mask, Color color, int x, int y)`

    Description

      Pastes a given color over the current image, using the given mask as opaque channel.

      A pixel value of 255 makes the result become the color given, 0 doesn't change anything.

      The masks red, green and blue values are used separately. If no color are given, the current is used.

    Parameter `mask`

      mask image

    Parameter `r`
    Parameter `g`
    Parameter `b`

      what color to paint with; default is current

    Parameter `x`
    Parameter `y`

      where to paste the image; default is 0,0

    Returns

      the object called

    See also

      paste_mask , paste_alpha , paste_alpha_color

    Method paste_mask

      `object paste_mask(object image, object mask)`
      `object paste_mask(object image, object mask, int x, int y)`

    Description

      Pastes a given image over the current image, using the given mask as opaque channel.

      A pixel value of 255 makes the result become a pixel from the given image, 0 doesn't change anything.

      The masks red, green and blue values are used separately.

    Parameter `image`

      image to paste

    Parameter `mask`

      mask image

    Parameter `x`
    Parameter `y`

      where to paste the image; default is 0,0

    Returns

      the object called

    See also

      paste , paste_alpha , paste_alpha_color

    Method apply_max

      `object apply_max(array(array(int|array(int))) matrix)`
      `object apply_max(array(array(int|array(int))) matrix, int r, int g, int b)`
      `object apply_max(array(array(int|array(int))) matrix, int r, int g, int b, int|float div)`

    Description

      This is the same as apply_matrix, but it uses the maximum instead.

      This function is not very fast.

    Parameter `array`

      the matrix; innermost is a value or an array with red, green, blue values for red, green, blue separation.

    Parameter `r`
    Parameter `g`
    Parameter `b`

      base level of result, default is zero

    Parameter `div`

      division factor, default is 1.0.

    Returns

      the new image object

    Note

      experimental status; may not be exact the same output in later versions

    Method make_ascii

      `string make_ascii(object orient1, object orient2, object orient3, object orient4, int|void tlevel, int|void xsize, int|void ysize)`

    Description

      This method creates a string that looks like the image. Example:

             //Stina is an image with a cat.
             array(object) Stina4=Stina->orient4();
             Stina4[1]*=215;
             Stina4[3]*=215;
             string foo=Stina->make_ascii(@Stina4,40,4,8);

    Returns

      some nice acsii-art.

    Note

      experimental status; may not be exact the same output in later versions

                |      /    -    \
               hue=  0     64   128  192  (=red in an hsv image)

    See also

      orient , orient4

    Method match

      `object match(int|float scale, object objectneedle)`
      `object match(int|float scale, object objectneedle, object objecthaystack_cert, object objectneedle_cert)`
      `object match(int|float scale, object objectneedle, object objecthaystack_avoid, object intfoo)`
      `object match(int|float scale, object objectneedle, object objecthaystack_cert, object objectneedle_cert, object objecthaystack_avoid, object intfoo)`

    Description

      This method creates an image that describes the match in every pixel in the image and the needle-Image.

             new pixel value =
               sum( my_abs(needle_pixel-haystack_pixel))

      The new image only have the red rgb-part set.

    Parameter `scale`

      Every pixel is divided with this value. Note that a proper value here depends on the size of the neadle.

    Parameter `needle`

      The image to use for the matching.

    Parameter `haystack_cert`

      This image should be the same size as the image itselves. A non-white-part of the haystack_cert-image modifies the output by lowering it.

    Parameter `needle_cert`

      The same, but for the needle-image.

    Parameter `foo`
    Parameter `haystack_avoid`

      This image should be the same size as the image itselves. If foo is less than the red value in haystack_avoid the corresponding matching-calculating is not calculated. The avoided parts are drawn in the color 0,100,0.

    Returns

      the new image object

    Note

      experimental status; may not be exact the same output in later versions

    See also

      phasev , phaseh

    Method phaseh
    Method phasev
    Method phasevh
    Method phasehv

      `object phaseh()`
      `object phasev()`
      `object phasevh()`
      `object phasehv()`

    Description

      Draws images describing the phase of the current image. phaseh gives the horizontal phase and phasev the vertical phase.

      `phaseh` gives an image where

                 max  falling   min  rising
          value=  0     64      128   192

      0 is set if there is no way to determine if it is rising or falling. This is done for the every red, green and blue part of the image.

      Phase images can be used to create ugly effects or to find meta-information in the orginal image.

      original | phaseh() | phasev() | phasevh() | phasehv()

    Returns

      the new image object

    Note

      experimental status; may not be exact the same output in later versions

    Bugs

      0 should not be set as explained above.

    Method dct

      `object dct(int newx, int newy)`

    Description

      Scales the image to a new size.

      Method for scaling is rather complex; the image is transformed via a cosine transform, and then resampled back.

      This gives a quality-conserving upscale, but the algorithm used is n*n+n*m, where n and m is pixels in the original and new image.

      Recommended wrapping algorithm is to scale overlapping parts of the image-to-be-scaled.

      This functionality is actually added as an true experiment, but works...

    Parameter `newx`
    Parameter `newy`

      new image size in pixels

    Returns

      the new image object

    Note

      Do NOT use this function if you don't know what you're dealing with! Read some signal theory first...

      It doesn't use any fct (compare: fft) algorithms.

    Method orient
    Method orient4

      `object orient(void|array(object) something)`
      `array(object) orient4()`

    Description

      Draws images describing the orientation of the current image.

      `orient` gives an HSV image (run a hsv_to_rgb pass on it to get a viewable image). corresponding to the angle of the orientation:

                |      /    -    \
               hue=  0     64   128  192  (=red in an hsv image)
                   purple cyan green red

      Red, green and blue channels are added and not compared separately.

      If you first use orient4 you can give its output as input to this function.

      The `orient4` function gives back 4 image objects, corresponding to the amount of different directions, see above.

    Returns

      an image or an array of the four new image objects

    Note

      experimental status; may not be exact the same output in later versions

  CLASS Image.Layer

    See also

      layers

    Method set_image
    Method image
    Method alpha

      `object set_image(Image.Image image)`
      `object set_image(Image.Image image, Image.Image alpha_channel)`
      `object|int(0..) image()`
      `object|int(0..) alpha()`

    Description

      Set/change/get image and alpha channel for the layer. You could also cancel the channels giving 0 instead of an image object.

    Note

      image and alpha channel must be of the same size, or canceled.

    Method set_alpha_value
    Method alpha_value

      `object set_alpha_value(float value)`
      `float alpha_value()`

    Description

      Set/get the general alpha value of this layer. This is a float value between 0 and 1, and is multiplied with the alpha channel.

    Method autocrop
    Method find_autocrop

      `object autocrop()`
      `object autocrop(int(0..1) left, int(0..1) right, int(0..1) top, int(0..1) bottom)`
      `array(int) find_autocrop()`
      `array(int) find_autocrop(int(0..1) left, int(0..1) right, int(0..1) top, int(0..1) bottom)`

    Description

      This crops (of finds) a suitable crop, non-destructive crop. The layer alpha channel is checked, and edges that is transparent is removed.

      (What really happens is that the image and alpha channel is checked, and edges equal the fill setup is cropped away.)

      find_autocrop () returns an array of xoff,yoff,xsize,ysize, which can be fed to crop ().

    Note

      A tiled image will not be cropped at all.

      `left`...`bottom` arguments can be used to tell what sides cropping are ok on.

    See also

      crop , Image.Image->autocrop

    Method set_mode
    Method mode
    Method available_modes

      `object set_mode(string mode)`
      `string mode()`
      `array(string) available_modes()`

    Description

      Set/get layer mode. Mode is one of these:

      All channels are calculated separately, if nothing else is specified.

      top layer
      bottom layer
      normal
      | D=L applied with alpha: D=(L*aL+S*(1-aL)*aS) / (aL+(1-aL)*aS), aD=(aL+(1-aL)*aS)
      add
      | D=L+S applied with alpha, aD=aS
      subtract
      | D=S-L applied with alpha, aD=aS
      multiply
      | D=S*L applied with alpha, aD=aS
      divide
      | D=S/L applied with alpha, aD=aS
      negdivide
      | D=1.0-S/L applied with alpha, aD=aS
      modulo
      | D=S%L applied with alpha, aD=aS
      invsubtract
      | D=L-S applied with alpha, aD=aS
      invdivide
      | D=L/S applied with alpha, aD=aS
      invmodulo
      | D=L%S applied with alpha, aD=aS
      imultiply
      | D=(1-L)*S applied with alpha, aD=aS
      idivide
      | D=S/(1-L) applied with alpha, aD=aS
      invidivide
      | D=L/(1-S) applied with alpha, aD=aS
      difference
      | D=abs(L-S) applied with alpha, aD=aS
      max
      | D=max(L,S) applied with alpha, aD=aS
      min
      | D=min(L,S) applied with alpha, aD=aS
      bitwise_and
      | D=L&amp;S applied with alpha, aD=aS
      bitwise_or
      | D=L|S applied with alpha, aD=aS
      bitwise_xor
      | D=L^S applied with alpha, aD=aS
      replace
      | D=(L*aL+S*(1-aL)*aS) / (aL+(1-aL)*aS), aD=aS
      red
      | Dr=(Lr*aLr+Sr*(1-aLr)*aSr) / (aLr+(1-aLr)*aSr), Dgb=Sgb, aD=aS
      green
      | Dg=(Lg*aLg+Sg*(1-aLg)*aSg) / (aLg+(1-aLg)*aSg), Drb=Srb, aD=aS
      blue
      | Db=(Lb*aLb+Sb*(1-aLb)*aSb) / (aLb+(1-aLb)*aSb), Drg=Srg, aD=aS
      hardlight
      | Like photoshop hardlight layer mode, aD=aS
      replace_hsv
      | Dhsv=Lhsv apply with alpha, aD=aS
      hue
      | Dh=Lh apply with alpha, Dsv=Lsv, aD=aS
      saturation
      | Ds=Ls apply with alpha, Dhv=Lhv, aD=aS
      value
      | Dv=Lv apply with alpha, Dhs=Lhs, aD=aS
      color
      | Dhs=Lhs apply with alpha, Dv=Lv, aD=aS
      value_mul
      | Dv=Lv*Sv apply with alpha, Dhs=Lhs, aD=aS
      darken
      | Dv=min(Lv,Sv) apply with alpha, Dhs=Lhs, aD=aS
      lighten
      | Dv=max(Lv,Sv) apply with alpha, Dhs=Lhs, aD=aS
      saturate
      | Ds=max(Ls,Ss) apply with alpha, Dhv=Lhv, aD=aS
      desaturate
      | Ds=min(Ls,Ss) apply with alpha, Dhv=Lhv, aD=aS
      hls_replace
      | Dhls=Lhls apply with alpha, aD=aS
      hls_hue
      | Dh=Lh apply with alpha, Dsv=Lsv, aD=aS
      hls_saturation
      | Ds=Ls apply with alpha, Dhv=Lhv, aD=aS
      hls_lightness
      | Dl=Ll apply with alpha, Dhs=Lhs, aD=aS
      hls_color
      | Dhs=Lhs apply with alpha, Dl=Ll, aD=aS
      hls_lightness_mul
      | Dl=Ll*Sl apply with alpha, Dhs=Lhs, aD=aS
      hls_darken
      | Dl=min(Ll,Sl) apply with alpha, Dhs=Lhs, aD=aS
      hls_lighten
      | Dl=max(Ll,Sl) apply with alpha, Dhs=Lhs, aD=aS
      hls_saturate
      | Ds=max(Ls,Ss) apply with alpha, Dhl=Lhl, aD=aS
      hls_desaturate
      | Ds=min(Ls,Ss) apply with alpha, Dhl=Lhl, aD=aS
      dissolve
      | i=random 0 or 1, D=i?L:S, aD=i+aS
      behind
      | D=(S*aS+L*(1-aS)*aL) / (aS+(1-aS)*aL), aD=(aS+(1-aS)*aL); simply swap S and L
      erase
      | D=S, aD=aS*(1-aL)
      screen
      | 1-(1-S)*(1-L) applied with alpha, aD=aS
      overlay
      | (1-(1-a)*(1-b)-a*b)*a+a*b applied with alpha, aD=aS
      burn_alpha
      | aD=aL+aS applied with alpha, D=L+S; experimental, may change or be removed
      equal
      | each channel D=max if L==S, 0 otherwise, apply with alpha
      not_equal
      | each channel D=max if L!=S, 0 otherwise, apply with alpha
      less
      | each channel D=max if L<S, 0 otherwise, apply with alpha
      more
      | each channel D=max if L>S, 0 otherwise, apply with alpha
      less_or_equal
      | each channel D=max if L<=S, 0 otherwise, apply with alpha
      more_or_equal
      | each channel D=max if L>=S, 0 otherwise, apply with alpha
      logic_equal
      | logic: D=white and opaque if L==S, black and transparent otherwise
      logic_not_equal
      | logic: D=white and opaque if any L!=S, black and transparent otherwise
      logic_strict_less
      | logic: D=white and opaque if all L<S, black and transparent otherwise
      logic_strict_more
      | logic: D=white and opaque if all L>S, black and transparent otherwise
      logic_strict_less_equal
      | logic: D=white and opaque if all L<=L, black and transparent otherwise
      logic_strict_more_equal
      | logic: D=white and opaque if all L>=L, black and transparent otherwise

      available_modes () simply gives an array containing the names of these modes.

    Note

      image and alpha channel must be of the same size, or canceled.

    Method cast

      `mapping(string:mixed)|string cast()`

    Description

      ([ "xsize":int, "ysize":int, "image":image, "alpha":image, "xoffset":int, "yoffset":int, "fill":image, "fill_alpha":image "tiled":int, "mode":string ])

    Method clone

      `object clone()`

    Description

      Creates a copy of the called object.

    Returns

      the copy

    Method create

      `void Image.Layer(object image, object alpha, string mode)`
      `void Image.Layer(mapping info)`
      `void Image.Layer()`
      `void Image.Layer(int xsize, int ysize, object color)`
      `void Image.Layer(object color)`

    Description

      The Layer construct either three arguments, the image object, alpha channel and mode, or a mapping with optional elements:

          "image":image,
                  // default: black

          "alpha":alpha,
                  // alpha channel object
                  // default: full opaque

          "mode":string mode,
                  // layer mode, see mode .
                  // default: "normal"

          "alpha_value":float(0.0-1.0),
                  // layer general alpha value
                  // default is 1.0; this is multiplied
                  // with the alpha channel.

          "xoffset":int,
          "yoffset":int,
                  // offset of this layer

          "fill":Color,
          "fill_alpha":Color,
                  // fill color, ie what color is used
                  // "outside" the image. default: black
                  // and black (full transparency).

          "tiled":int(0|1),
                  // select tiling; if 1, the image
                  // will be tiled. deafult: 0, off

      The layer can also be created "empty", either giving a size and color - this will give a filled opaque square, or a color, which will set the "fill" values and fill the whole layer with an opaque color.

      All values can be modified after object creation.

    Note

      image and alpha channel must be of the same size.

    Method crop

      `object crop(int xoff, int yoff, int xsize, int ysize)`

    Description

      Crops this layer at this offset and size. Offset is not relative the layer offset, so this can be used to crop a number of layers simuntaneously.

      The fill values are used if the layer is enlarged.

    Returns

      a new layer object

    Note

      The new layer object may have the same image object, if there was no cropping to be done.

    Method description

      `array(string) description()`

    Description

      Layer descriptions

    Method set_fill
    Method fill
    Method fill_alpha

      `object set_fill(Color color)`
      `object set_fill(Color color, Color alpha)`
      `object fill()`
      `object fill_alpha()`

    Description

      Set/query fill color and alpha, ie the color used "outside" the image. This is mostly useful if you want to "frame" a layer.

    Method set_misc_value
    Method get_misc_value

      `mixed set_misc_value(object mixedwhat, object mixedto)`
      `mixed get_misc_value(object mixedwhat)`

    Description

      Set or query misc. attributes for the layer.

      As an example, the XCF and PSD image decoders set the 'name' attribute to the name the layer had in the source file.

    Method set_offset
    Method xoffset
    Method yoffset

      `object set_offset(int x, int y)`
      `int xoffset()`
      `int yoffset()`

    Description

      Set/query layer offset.

    Method set_tiled
    Method tiled

      `object set_tiled(int yes)`
      `int tiled()`

    Description

      Set/query tiled flag. If set, the image and alpha channel will be tiled rather then framed by the fill values.

    Method xsize
    Method ysize

      `int xsize()`
      `int ysize()`

    Description

      Query layer offset. This is the same as layer image/alpha image size.

  CLASS Image.Colortable

    Description

      This object keeps colortable information, mostly for image re-coloring (quantization).

      The object has color reduction, quantisation, mapping and dithering capabilities.

    See also

      Image , Image.Image , Image.Font , Image.GIF

    Method create
    Method add

      `void Image.Colortable()`
      `void Image.Colortable(array(array(int)) colors)`
      `void Image.Colortable(Image.Image image, int number)`
      `void Image.Colortable(Image.Image image, int number, array(array(int)) needed)`
      `void Image.Colortable(int r, int g, int b)`
      `void Image.Colortable(int r, int g, int b, object array(int)`
      `object add(array(array(int)) colors)`
      `object add(Image.Image image, int number)`
      `object add(Image.Image image, int number, array(array(int)) needed)`
      `object add(int r, int g, int b)`
      `object add(int r, int g, int b, object array(int)`

    Description

      create initiates a colortable object. Default is that no colors are in the colortable.

      add takes the same argument(s) as create , thus adding colors to the colortable.

      The colortable is mostly a list of colors, or more advanced, colors and weight.

      The colortable could also be a colorcube, with or without additional scales. A colorcube is the by-far fastest way to find colors.

      Example:

          ct=colortable(my_image,256); // the best 256 colors
          ct=colortable(my_image,256,({0,0,0})); // black and the best other 255

          ct=colortable(({({0,0,0}),({255,255,255})})); // black and white

          ct=colortable(6,7,6); // a colortable of 252 colors
          ct=colortable(7,7,5, ({0,0,0}),({255,255,255}),11);
                  // a colorcube of 245 colors, and a greyscale of the rest -> 256

    Parameter `colors`

      list of colors

    Parameter `image`

      source image

    Parameter `number`

      number of colors to get from the image

      0 (zero) gives all colors in the image.

      Default value is 256.

    Parameter `needed`

      needed colors (to optimize selection of others to these given)

      this will add to the total number of colors (see argument 'number')

    Parameter `r`
    Parameter `g`
    Parameter `b`

      size of sides in the colorcube, must (of course) be equal or larger than 2 - if smaller, the cube is ignored (no colors). This could be used to have only scales (like a greyscale) in the output.

    Parameter `fromi`
    Parameter `toi`
    Parameter `stepi`

      This is to add the possibility of adding a scale of colors to the colorcube; for instance a grayscale using the arguments `({0,0,0}),({255,255,255}),17`, adding a scale from black to white in 17 or more steps.

      Colors already in the cube is used again to add the number of steps, if possible.

      The total number of colors in the table is therefore `r*b*g+step1+...+stepn`.

    Note

      max hash size is (probably, set by a `#define`) 32768 entries, giving maybe half that number of colors as maximum.

    Method cast

      `object cast(string to)`

    Description

      cast the colortable to an array or mapping, the array consists of Image.Color objects and are not in index order. The mapping consists of index:Image.Color pairs, where index is the index (int) of that color.

      example: `(mapping)Image.Colortable(img)`

    Parameter `to`

      must be "string", "array" or "mapping".

    Method corners

      `array(object) corners()`

    Description

      Gives the eight corners in rgb colorspace as an array. The "black" and "white" corners are the first two.

    Method cubicles

      `object cubicles()`
      `object cubicles(int r, int g, int b)`
      `object cubicles(int r, int g, int b, int accuracy)`

    Description

      Set the colortable to use the cubicles algorithm to lookup the closest color. This is a mostly very fast and very accurate way to find the correct color, and the default algorithm.

      The colorspace is divided in small cubes, each cube containing the colors in that cube. Each cube then gets a list of the colors in the cube, and the closest from the corners and midpoints between corners.

      When a color is needed, the algorithm first finds the correct cube and then compares with all the colors in the list for that cube.

      example: `colors=Image.Colortable(img)->cubicles();`

      algorithm time: between O[m] and O[m * n], where n is numbers of colors and m is number of pixels

      The arguments can be heavy trimmed for the usage of your colortable; a large number (10×10×10 or bigger) of cubicles is recommended when you use the colortable repeatedly, since the calculation takes much more time than usage.

      recommended values:

          image size  setup
          100×100     cubicles(4,5,4) (default)
          1000×1000   cubicles(12,12,12) (factor 2 faster than default)

      In some cases, the full method is faster.

      original | default cubicles, 16 colors | accuracy=200

    Parameter `r`
    Parameter `g`
    Parameter `b`

      Size, ie how much the colorspace is divided. Note that the size of each cubicle is at least about 8b, and that it takes time to calculate them. The number of cubicles are `r*g*b`, and default is 4,5,4, ie 80 cubicles. This works good for 200±100 colors.

    Parameter `accuracy`

      Accuracy when checking sides of cubicles. Default is 16. A value of 1 gives complete accuracy, ie cubicle() method gives exactly the same result as full(), but takes (in worst case) 16× the time to calculate.

    Returns

      the object being called

    Note

      this method doesn't figure out the cubicles, this is done on the first use of the colortable.

      Not applicable to colorcube types of colortable.

    Method floyd_steinberg

      `object floyd_steinberg()`
      `object floyd_steinberg(int bidir, int|float forward, int|float downforward, int|float down, int|float downback, int|float factor)`

    Description

      Set dithering method to floyd_steinberg.

      The arguments to this method is for fine-tuning of the algorithm (for computer graphics wizards).

      original | floyd_steinberg to a 4×4×4 colorcube | floyd_steinberg to 16 chosen colors

    Parameter `bidir`

      Set algorithm direction of forward. -1 is backward, 1 is forward, 0 for toggle of direction each line (default).

    Parameter `forward`
    Parameter `downforward`
    Parameter `down`
    Parameter `downback`

      Set error correction directions. Default is forward=7, downforward=1, down=5, downback=3.

    Parameter `factor`

      Error keeping factor. Error will increase if more than 1.0 and decrease if less than 1.0. A value of 0.0 will cancel any dither effects. Default is 0.95.

    Returns

      the object being called

    Method full

      `object full()`

    Description

      Set the colortable to use full scan to lookup the closest color.

      example: `colors=Image.Colortable(img)->full();`

      algorithm time: O[n*m], where n is numbers of colors and m is number of pixels

    Returns

      the object being called

    Note

      Not applicable to colorcube types of colortable.

    See also

      cubicles , map

    Method greyp

      `int(0..1) greyp()`

    Description

      Returns true if this colortable only contains greyscale.

    Method image

      `object image()`

    Description

      cast the colortable to an image object

      each pixel in the image object is an entry in the colortable

    Returns

      the resulting image object

    Method map
    Method `*
    Method ``*

      `object map(object image)`
      `object `*(object image)`
      `object ``*(object image)`
      `object map(string data, int xsize, int ysize)`
      `object `*(string data, int xsize, int ysize)`
      `object ``*(string data, int xsize, int ysize)`

    Description

      Map colors in an image object to the colors in the colortable, and creates a new image with the closest colors.

      |  |  |  |  |  | no dither
      |  |  |  |  |  | floyd_steinberg dither
      |  |  |  |  |  | ordered dither
      |  |  |  |  |  | randomcube dither
      original | 2 | 4 | 8 | 16 | 32 colors

    Returns

      a new image object

    Note

      Flat (not cube) colortable and not 'full ' method: this method does figure out the data needed for the lookup method, which may take time the first use of the colortable - the second use is quicker.

    See also

      cubicles , full

    Method nodither

      `object nodither()`

    Description

      Set no dithering (default).

    Returns

      the object being called

    Method ordered

      `object ordered()`
      `object ordered(int r, int g, int b)`
      `object ordered(int r, int g, int b, int xsize, int ysize)`
      `object ordered(int r, int g, int b, int xsize, int ysize, int x, int y)`
      `object ordered(int r, int g, int b, int xsize, int ysize, int rx, int ry, int gx, int gy, int bx, int by)`

    Description

      Set ordered dithering, which gives a position-dependent error added to the pixel values.

      original | mapped to `Image.Colortable(6,6,6)->`
      | `ordered (42,42,42,2,2)` | `ordered()` | `ordered (42,42,42, 8,8, 0,0, 0,1, 1,0)`

    Parameter `r`
    Parameter `g`
    Parameter `b`

      The maximum error. Default is 32, or colorcube steps (256/size).

    Parameter `xsize`
    Parameter `ysize`

      Size of error matrix. Default is 8×8. Only values which factors to multiples of 2 and 3 are possible to choose (2,3,4,6,8,12,...).

    Parameter `x`
    Parameter `y`
    Parameter `rx`
    Parameter `ry`
    Parameter `gx`
    Parameter `gy`
    Parameter `bx`
    Parameter `by`

      Offset for the error matrix. `x` and `y` is for both red, green and blue values, the other is individual.

    Returns

      the object being called

    See also

      randomcube , nodither , floyd_steinberg , create

    Method randomcube
    Method randomgrey

      `object randomcube()`
      `object randomcube(int r, int g, int b)`
      `object randomgrey()`
      `object randomgrey(int err)`

    Description

      Set random cube dithering. Color choosen is the closest one to color in picture plus (flat) random error; `color±random(error)`.

      The randomgrey method uses the same random error on red, green and blue and the randomcube method has three random errors.

      original | mapped to `Image.Colortable(4,4,4)->`
      | randomcube() | randomgrey()

    Parameter `r`
    Parameter `g`
    Parameter `b`
    Parameter `err`

      The maximum error. Default is 32, or colorcube step.

    Returns

      the object being called

    Note

      randomgrey method needs colorcube size to be the same on red, green and blue sides to work properly. It uses the red colorcube value as default.

    See also

      ordered , nodither , floyd_steinberg , create

    Method reduce
    Method reduce_fs

      `object reduce(int colors)`
      `object reduce_fs(int colors)`

    Description

      reduces the number of colors

      All needed (see create ) colors are kept.

      reduce_fs creates and keeps the outmost corners of the color space, to improve floyd-steinberg dithering result. (It doesn't work very well, though.)

    Parameter `colors`

      target number of colors

    Returns

      the new Colortable object

    Note

      this algorithm assumes all colors are different to begin with (!)

      reduce_fs keeps the "corners" as "needed colors".

    See also

      corners

    Method rigid

      `object rigid()`
      `object rigid(int r, int g, int b)`

    Description

      Set the colortable to use the "rigid" method of looking up colors.

      This is a very simple way of finding the correct color. The algorithm initializes a cube with `r` x `g` x `b` colors, where every color is chosen by closest match to the corresponding coordinate.

      This format is not recommended for exact match, but may be usable when it comes to quickly view pictures on-screen.

      It has a high init-cost and low use-cost. The structure is initiated at first usage.

    Returns

      the object being called

    Note

      Not applicable to colorcube types of colortable.

    See also

      cubicles , map , full

    Method spacefactors

      `object spacefactors(int r, int g, int b)`

    Description

      Colortable tuning option, this sets the color space distance factors. This is used when comparing distances in the colorspace and comparing grey levels.

      Default factors are 3, 4 and 1; blue is much darker than green. Compare with Image.Image->grey ().

    Returns

      the object being called

    Note

      This has no sanity check. Some functions may bug if the factors are to high - color reduction functions sums grey levels in the image, this could exceed maxint in the case of high factors. Negative values may also cause strange effects. *grin*

    Method `+

      `object `+(object with, object mixed...more)`

    Description

      sums colortables

    Parameter `with`

      Colortable object with colors to add

    Returns

      the resulting new Colortable object

    Method `-

      `object `-(object with, object mixed...more)`

    Description

      subtracts colortables

    Parameter `with`

      Colortable object with colors to subtract

    Returns

      the resulting new Colortable object

  CLASS Image.Font

    Description

      Short technical documentation on a font file: This object adds the text-drawing and -creation capabilities of the Image module.

      For simple usage, see write and load .

    Note

          	       struct file_head
          	       {
          		  unsigned INT32 cookie;   - 0x464f4e54
          		  unsigned INT32 version;  - 1
          		  unsigned INT32 chars;    - number of chars
          		  unsigned INT32 height;   - height of font
          		  unsigned INT32 baseline; - font baseline
          		  unsigned INT32 o[1];     - position of char_head's
          	       } *fh;
          	       struct char_head
          	       {
          		  unsigned INT32 width;    - width of this character
          		  unsigned INT32 spacing;  - spacing to next character
          		  unsigned char data[1];   - pixmap data (1byte/pixel)
          	       } *ch;

                      version 2:

                      	  On-disk syntax (everything in N.B.O), int is 4 bytes, a byte is 8 bits:

                      pos
                      	0   int cookie = 'FONT';     or 0x464f4e54
                      	4   int version = 2;         1 was the old version without the last four chars
                      	8   int numchars;            Always 256 in this version of the dump program
                      12   int height;              in (whole) pixels
                      16   int baseline;            in (whole) pixels
                      20   char direction;          1==right to left, 0 is left to right
                      21   char format;             Font format
                      22   char colortablep;        Colortable format
                      23   char kerningtablep;      Kerning table format

                      24   int offsets[numchars];   pointers into the data, realative to &cookie.
                      	    [colortable]
                      	    [kerningtable]

                      	  At each offset:

                      0   int width;               in pixels
                      4   int spacing;             in 1/1000:th of a pixels
                      8   char data[];             Enough data to plot width * font->height pixels
                      				    Please note that if width is 0, there is no data.

                      Font formats:
                      	id type
                      	 0 Raw 8bit data
                      	 1 RLE encoded data,  char length, char data,   70% more compact than raw data
                      	 2 ZLib compressed data                         60% more compact than RLE

                      Colortable types:
                      	 0 No colortable		 (the data is an alpha channel)
                      	 1 24bit RGB with alpha         (index->color, 256*4 bytes, rgba)
                      	 2 8bit Greyscale with alpha    (index->color, 256*2 bytes)

                      Kerningtable types:
                      	 0 No kerning table
                      	 1 numchars*numchars entries, each a signed char with the kerning value
                      	 2 numchar entries, each with a list of kerning pairs, like this:
                      	    int len
                      	    len * (short char, short value)

    See also

      Image , Image.Image

    Method load

      `Image.Font|int load(string filename)`

    Description

      Loads a font file to this font object.

    Returns

      Returns zero upon failure and a font object upon success.

    Parameter `filename`

      The path to the font file.

    See also

      write

    Method create

      `void Image.Font(string filename)`

    Description

      Loads a font file to this font object. Similar to load() .

    Method write

      `Image.Image write(string text, string ... more_text_lines)`

    Description

      Writes some text; thus creating an image object that can be used as mask or as a complete picture. One or more text lines may be provided.

    See also

      text_extents , load , Image.Image->paste_mask , Image.Image->paste_alpha_color

    Method height

      `int height()`

    Description

      Returns the font height.

    See also

      baseline , text_extents

    Method text_extents

      `array(int) text_extents(string text, string ... more_text_lines)`

    Description

      Calculate extents of a text-image, that would be created by calling write with the same arguments. One or more lines of text may be provided.

    Returns

      Array
      `int width`
      `int height`

    See also

      write , height , baseline

    Method set_xspacing_scale
    Method set_yspacing_scale

      `void set_xspacing_scale(float scale)`
      `void set_yspacing_scale(float scale)`

    Description

      Set spacing scale to write characters closer or more far away. This does not change scale of character, only the space between them.

    Method baseline

      `int baseline()`

    Description

      Returns font baseline (pixels from top)

    See also

      height , text_extents

    Method center

      `void center()`

    FIXME

      Document this function.

    Method right

      `void right()`

    FIXME

      Document this function.

    Method left

      `void left()`

    FIXME

      Document this function.

  Module Image.TIFF

    Method decode

      `object decode(string data)`

    Description

      Decodes a TIFF image.

    Throws

      Throws upon error in data.

    Method _decode

      `mapping(string:mixed) _decode(string data)`

    Description

      Decodes a TIFF image to a mapping with at least the members image and alpha.

      `"image" : Image.Image` | The actual image.
      `"alpha" : Image.Image` | Image alpha channel.
      `"xres" : float` | Resolution
      `"yres" : float`

      `"unit" : string`

      `"unitless"`
      `"pixels/inch"`
      `"pixels/cm"`

      `"xdpy" : float` | Resolution
      `"ydpy" : float`
      `"xposition" : int` |
      `"yposition" : int` |
      `"photometric" : string` | Type of photometric. Can be `"unknown"`.

      `"extra_samples" : array(int|string)`

      Array elements are either integers or any of

      `"unspecified"`
      `"assoc-alpha"`
      `"unassoc-alpha"`

      `"threshholding" : string` |
      `"halftone_hints" : array(int)` | Array is always two elements.
      `"artist" : string` |
      `"datetime" : string` |
      `"hostcomputer" : string` |
      `"software" : string` |
      `"name" : string` |
      `"comment" : string` |
      `"make" : string` |
      `"model" : string` |
      `"page_name" : string` |
      `"page_number" : array(int)` | Array is always two elements.
      `"colormap" : array(array(int))` | Array of array of RGB values.
      `"whitepoint" : array(int)` | Array is always two elements.
      `"primary_chromaticities" : array(float)` | Array is always six elements.
      `"reference_black_white" : array(array(float))` | Array of array of two elements.

    Throws

      Throws upon error in data.

    Method encode
    Method _encode

      `string encode(object image)`
      `string encode(object image, mapping options)`
      `string _encode(object image)`
      `string _encode(object image, mapping options)`

    Description

      Encode an image object into a TIFF file. [encode] and _encode are identical.

      The options argument may be a mapping containing zero or more encoding options. See _decode .

    Example

          Image.TIFF.encode(img, ([
          	    "compression":Image.TIFF.COMPRESSION_LZW,
          	    "name":"an image name",
          	    "comment":"an image comment",
          	    "alpha":An alpha channel,
          	    "dpy":Dots per inch (as a float),
          	    "xdpy":Horizontal dots per inch (as a float),
          	    "ydpy":Vertical dots per inch (as a float),
             ]));

    Constant COMPRESSION_NONE

      `constant Image.TIFF.COMPRESSION_NONE`

    Constant COMPRESSION_CCITTRLE

      `constant Image.TIFF.COMPRESSION_CCITTRLE`

    Constant COMPRESSION_CCITTFAX3

      `constant Image.TIFF.COMPRESSION_CCITTFAX3`

    Constant COMPRESSION_CCITTFAX4

      `constant Image.TIFF.COMPRESSION_CCITTFAX4`

    Constant COMPRESSION_CCITTRLEW

      `constant Image.TIFF.COMPRESSION_CCITTRLEW`

    Constant COMPRESSION_LZW

      `constant Image.TIFF.COMPRESSION_LZW`

    Constant COMPRESSION_JPEG

      `constant Image.TIFF.COMPRESSION_JPEG`

    Constant COMPRESSION_NEXT

      `constant Image.TIFF.COMPRESSION_NEXT`

    Constant COMPRESSION_PACKBITS

      `constant Image.TIFF.COMPRESSION_PACKBITS`

    Constant COMPRESSION_THUNDERSCAN

      `constant Image.TIFF.COMPRESSION_THUNDERSCAN`

    Inherit "____Image_TIFF"

      inherit "____Image_TIFF"

    Method decode_header

      `mapping decode_header(string data)`

    Description

      Decodes the header of the TIFF data into a mapping.

      `"xsize" : int` | Size of image in pixels.
      `"ysize" : int`
      `"ImageWidth" : int`
      `"ImageLength" : int`
      `"type" : string` | File type information as MIME type. Always `"image/tiff"`.
      `"color_space" : string` | Color space of TIFF image. Either `"RGB"` or `"CMYK"`.
      `"byte_order" : string` | Either `"II"` for Little Endian or `"MM"` for Big Endian.
      `"NewSubfileType" : int` |
      `"BitsPerSample" : string` |
      `"Compression" : int` |
      `"PhotometricInterpretation" : int` |
      `"Make" : string` |
      `"Model" : string` |
      `"SamplesPerPixel" : int` |
      `"ResolutionUnit" : int` |
      `"Software" : string` |
      `"DateTime" : string` |
      `"Predictor" : int` |
      `"XMP" : string` |

  Module Image.TTF

    Description

      This module adds TTF (Truetype font) capability to the Image module.

    Note

      This module needs the `libttf` "Freetype" library

    Method `()

      `object `()(string filename)`
      `object `()(string filename, mapping options)`

    Description

      Makes a new TTF Face object.

    Parameter `filename`

      The filename of the `TTF` font or the `TTC` font collection.

    Parameter `options`

          advanced options:
              "face":int
                  If opening a font collection,  '.TTC',
                  this is used to get other fonts than the first.

    Returns

      0 if failed.

    CLASS Image.TTF.Face

      Description

        This represents instances of TTF Faces.

      Method flush

        `object flush()`

      Description

        This flushes all cached information. Might be used to save memory - the face information is read back from disk upon need.

      Returns

        the object being called

      Method names
      Method _names

        `mapping names()`
        `array(array) _names()`

      Description

        Gives back the names or the complete name-list of this face.

        The result from names () is a mapping, which has any or all of these indices:

            "copyright":   ("Copyright the Foo Corporation...bla bla")
            "family":      ("My Little Font")
            "style":       ("Bold")
            "full":        ("Foo: My Little Font: 1998")
            "expose":      ("My Little Font Bold")
            "version":     ("June 1, 1998; 1.00, ...")
            "postscript":  ("MyLittleFont-Bold")
            "trademark":   ("MyLittleFont is a registered...bla bla")

        This is extracted from the information from _names(), and fit into pike-strings using unicode or iso-8859-1, if possible.

        The result from _names () is a matrix, on this form:

                 ({ ({ int platform, encoding, language, id, string name }),
                    ({ int platform, encoding, language, id, string name }),
                    ...
                 })

      Returns

        the name as a mapping to string or the names as a matrix

      Note

        To use the values from _names (), check the TrueType standard documentation.

      Method properties

        `mapping properties()`

      Description

        This gives back a structure of the face's properties. Most of this stuff is information you can skip.

        The most interesting item to look at may be `->num_Faces`, which describes the number of faces in a `.TTC` font collection.

      Returns

        a mapping of a lot of properties

      Method `()

        `object `()()`

      Description

        This instantiates the face for normal usage - to convert font data to images.

      Returns

        a Image.TTF.FaceInstance object.

    CLASS Image.TTF.FaceInstance

      Description

        This is the instance of a face, with geometrics, encodings and stuff.

      Method create

        `void Image.TTF.FaceInstance(object face)`

      Description

        creates a new Instance from a face.

  Module Image.GIF

    Description

      This submodule keep the GIF encode/decode capabilities of the Image module.

      GIF is a common image storage format, usable for a limited color palette - a GIF image can only contain as most 256 colors - and animations.

      Simple encoding: encode , encode_trans

      Advanced stuff: render_block , header_block , end_block , netscape_loop_block

      Very advanced stuff: _render_block , _gce_block

    See also

      Image , Image.Image , Image.Colortable

    Method decode

      `object decode(string data)`
      `object decode(array _decoded)`
      `object decode(array __decoded)`

    Description

      Decodes GIF data and creates an image object.

    Returns

      the decoded image as an image object

    Note

      This function may throw errors upon illegal GIF data. This function uses __decode , _decode , Image.Image->paste and Image.Image->paste_alpha internally.

    See also

      encode

    Method decode_layers
    Method decode_layer

      `object decode_layers(string data)`
      `object decode_layers(array _decoded)`
      `object decode_layer(string data)`
      `object decode_layer(array _decoded)`

    Description

      Decodes GIF data and creates an array of layers or the resulting layer.

    Note

      The resulting layer may not have the same size as the gif image, but the resulting bounding box of all render chunks in the gif file. The offset should be correct, though.

    See also

      encode , decode_map

    Method decode_map

      `mapping decode_map(string|array layers)`

    Description

      Returns a mapping similar to other decoders `_decode` function.

              "image":the image
              "alpha":the alpha channel

              "xsize":int
              "ysize":int
                  size of image
              "type":"image/gif"
                  file type information as MIME type

    Note

      The weird name of this function (not `_decode` as the other decoders) is because gif was the first decoder and was written before the API was finally defined. Sorry about that. /Mirar

    Method encode
    Method encode_trans

      `string encode(object img)`
      `string encode(object img, int colors)`
      `string encode(object img, object colortable)`
      `string encode_trans(object img, object alpha)`
      `string encode_trans(object img, int tr_r, int tr_g, int tr_b)`
      `string encode_trans(object img, int colors, object alpha)`
      `string encode_trans(object img, int colors, int tr_r, int tr_g, int tr_b)`
      `string encode_trans(object img, int colors, object alpha, int tr_r, int tr_g, int tr_b)`
      `string encode_trans(object img, object colortable, object alpha)`
      `string encode_trans(object img, object colortable, int tr_r, int tr_g, int tr_b)`
      `string encode_trans(object img, object colortable, object alpha, int a_r, int a_g, int a_b)`
      `string encode_trans(object img, object colortable, int transp_index)`

    Description

      Create a complete GIF file.

      The latter (encode_trans ) functions add transparency capabilities.

      Example:

          img=Image.Image ([...]);
          [...] // make your very-nice image
          write(Image.GIF.encode (img)); // write it as GIF on stdout

    Parameter `img`

      The image which to encode.

    Parameter `colors`
    Parameter `colortable`

      These arguments decides what colors the image should be encoded with. If a number is given, a colortable with be created with (at most) that amount of colors. Default is '256' (GIF maximum amount of colors).

    Parameter `alpha`

      Alpha channel image (defining what is transparent); black color indicates transparency. GIF has only transparent or nontransparent (no real alpha channel). You can always dither a transparency channel: `Image.Colortable(my_alpha, ({({0,0,0}),({255,255,255})}))
      ->full()
      ->floyd_steinberg()
      ->map(my_alpha)`

    Parameter `tr_r`
    Parameter `tr_g`
    Parameter `tr_b`

      Use this (or the color closest to this) color as transparent pixels.

    Parameter `a_r`
    Parameter `a_g`
    Parameter `a_b`

      Encode transparent pixels (given by alpha channel image) to have this color. This option is for making GIFs for the decoders that doesn't support transparency.

    Parameter `transp_index`

      Use this color no in the colortable as transparent color.

    Note

      For advanced users:

          Image.GIF.encode_trans(img,colortable,alpha);

      is equivalent of using

          Image.GIF.header_block(img->xsize(),img->ysize(),colortable)+
          Image.GIF.render_block(img,colortable,0,0,0,alpha)+
          Image.GIF.end_block();

      and is actually implemented that way.

    Method end_block

      `string end_block()`

    Description

      This function gives back a GIF end (trailer) block.

    Returns

      the end block as a string.

    Note

      This is in the advanced sector of the GIF support; please read some about how GIFs are packed.

      The result of this function is always ";" or "\x3b", but I recommend using this function anyway for code clearity.

    See also

      header_block , end_block

    Method header_block

      `string header_block(int xsize, int ysize, int numcolors)`
      `string header_block(int xsize, int ysize, object colortable)`
      `string header_block(int xsize, int ysize, object colortable, int background_color_index, int gif87a, int aspectx, int aspecty)`
      `string header_block(int xsize, int ysize, object colortable, int background_color_index, int gif87a, int aspectx, int aspecty, int r, int g, int b)`

    Description

      This function gives back a GIF header block.

      Giving a colortable to this function includes a global palette in the header block.

    Parameter `xsize`
    Parameter `ysize`

      Size of drawing area. Usually same size as in the first (or only) render block(s).

    Parameter `background_color_index`

      This color in the palette is the background color. Background is visible if the following render block(s) doesn't fill the drawing area or are transparent. Most decoders doesn't use this value, though.

    Parameter `gif87a`

      If set, write 'GIF87a' instead of 'GIF89a' (default 0 == 89a).

    Parameter `aspectx`
    Parameter `aspecty`

      Aspect ratio of pixels, ranging from 4:1 to 1:4 in increments of 1/16th. Ignored by most decoders. If any of `aspectx` or `aspecty` is zero, aspectratio information is skipped.

    Parameter `r`
    Parameter `g`
    Parameter `b`

      Add this color as the transparent color. This is the color used as transparency color in case of alpha-channel given as image object. This increases (!) the number of colors by one.

    Returns

      the created header block as a string

    Note

      This is in the advanced sector of the GIF support; please read some about how GIFs are packed.

      This GIF encoder doesn't support different size of colors in global palette and color resolution.

    See also

      header_block , end_block

    Method netscape_loop_block

      `string netscape_loop_block()`
      `string netscape_loop_block(int number_of_loops)`

    Description

      Creates a application-specific extention block; this block makes netscape and compatible browsers loop the animation a certain amount of times.

    Parameter `number_of_loops`

      Number of loops. Max and default is 65535.

    Method render_block

      `string render_block(object img, object colortable, int x, int y, int localpalette)`
      `string render_block(object img, object colortable, int x, int y, int localpalette, object alpha)`
      `string render_block(object img, object colortable, int x, int y, int localpalette, object alpha, int r, int g, int b)`
      `string render_block(object img, object colortable, int x, int y, int localpalette, int delay, int transp_index, int interlace, int user_input, int disposal)`
      `string render_block(object img, object colortable, int x, int y, int localpalette, object alpha, int r, int g, int b, int delay, int interlace, int user_input, int disposal)`

    Description

      This function gives a image block for placement in a GIF file, with or without transparency. The some options actually gives two blocks, the first with graphic control extensions for such things as delay or transparency.

      Example:

          img1=Image.Image ([...]);
          img2=Image.Image ([...]);
          [...] // make your very-nice images
          nct=Image.Colortable ([...]); // make a nice colortable
          write(Image.GIF.header_block (xsize,ysize,nct)); // write a GIF header
          write(Image.GIF.render_block (img1,nct,0,0,0,10)); // write a render block
          write(Image.GIF.render_block (img2,nct,0,0,0,10)); // write a render block
          [...]
          write(Image.GIF.end_block ()); // write end block
          // voila! A GIF animation on stdout.

      The above animation is thus created:

          object nct=Image.Colortable(lena,32,({({0,0,0})}));
          string s=GIF.header_block(lena->xsize(),lena->ysize(),nct);
          foreach ( ({lena->xsize(),
                      (int)(lena->xsize()*0.75),
                      (int)(lena->xsize()*0.5),
                      (int)(lena->xsize()*0.25),
                      (int)(1),
                      (int)(lena->xsize()*0.25),
                      (int)(lena->xsize()*0.5),
                      (int)(lena->xsize()*0.75)}),int xsize)
          {
             object o=lena->scale(xsize,lena->ysize());
             object p=lena->clear(0,0,0);
             p->paste(o,(lena->xsize()-o->xsize())/2,0);
             s+=Image.GIF.render_block(p,nct,0,0,0,25);
          }
          s+=Image.GIF.netscape_loop_block(200);
          s+=Image.GIF.end_block();
          write(s);

    Parameter `img`

      The image.

    Parameter `colortable`

      Colortable with colors to use and to write as palette.

    Parameter `x`
    Parameter `y`

      Position of this image.

    Parameter `localpalette`

      If set, writes a local palette.

    Parameter `alpha`

      Alpha channel image; black is transparent.

    Parameter `r`
    Parameter `g`
    Parameter `b`

      Color of transparent pixels. Not all decoders understands transparency. This is ignored if localpalette isn't set.

    Parameter `delay`

      View this image for this many centiseconds. Default is zero.

    Parameter `transp_index`

      Index of the transparent color in the colortable. `-1` indicates no transparency.

    Parameter `user_input`

      If set: wait the delay or until user input. If delay is zero, wait indefinitely for user input. May sound the bell upon decoding. Default is non-set.

    Parameter `disposal`

      Disposal method number;

    Note

      This is in the advanced sector of the GIF support; please read some about how GIFs are packed.

      The user_input and disposal method are unsupported in most decoders.

    See also

      encode , header_block , end_block

    Method _decode

      `array _decode(string gifdata)`
      `array _decode(array __decoded)`

    Description

      Decodes a GIF image structure down to chunks, and also decode the images in the render chunks.

          ({int xsize,int ysize,    // 0: size of image drawing area
            void|object colortable, // 2: opt. global colortable
            ({ int aspx, int aspy,  // 3 0: aspect ratio or 0, 0 if not set
               int background }),   //   2: index of background color

      followed by any number these blocks in any order (gce chunks are decoded and incorporated in the render chunks):

            ({ GIF.RENDER,          //   0: block identifier
              int x, int y,         //   1: position of render
              object image,         //   3: render image
              void|object alpha,    //   4: 0 or render alpha channel
              object colortable,    //   5: colortable (may be same as global)

              int interlace,        //   6: interlace flag
              int trans_index,      //   7: 0 or transparent color index
              int delay,            //   8: 0 or delay in centiseconds
              int user_input,       //   9: user input flag
              int disposal})        //  10: disposal method number (0..7)

            ({ GIF.EXTENSION,       //   0: block identifier
               int extension,       //   1: extension number
               string data })       //   2: extension data

      and possibly ended with one of these:

            ({ GIF.ERROR_PREMATURE_EOD })   // premature end-of-data

            ({ GIF.ERROR_TOO_MUCH_DATA,     // data following end marker
               string data })               // (rest of file)

            ({ GIF.ERROR_UNKNOWN_DATA,      // unknown data
               string data })               // (rest of file)

      The decode method uses this data in a way similar to this program:

          import Image;

          object my_decode_gif(string data)
          {
             array a=GIF._decode(data);
             object img=image(a[0],a[1]);
             foreach (a[4..],array b)
                if (b[0]==GIF.RENDER)
                   if (b[4]) img->paste_alpha(b[3],b[4],b[1],b[2]);
                   else img->paste(b[3],b[1],b[2]);
             return img;
          }

    Parameter `gifdata`

      GIF data (with header and all)

    Parameter `__decoded`

      GIF data as from __decode

    Returns

      the above array

    Note

      May throw errors if the GIF header is incomplete or illegal.

      This is in the very advanced sector of the GIF support; please read about how GIF files works.

    Method _encode

      `string _encode(array data)`

    Description

      Encodes GIF data; reverses _decode.

    Parameter `data`

      data as returned from _encode

    Note

      Some given values in the array are ignored. This function does not give the _exact_ data back!

    Method _gce_block

      `string _gce_block(int transparency, int transparency_index, int delay, int user_input, int disposal)`

    Description

      This function gives back a Graphic Control Extension block. A GCE block has the scope of the following render block.

    Parameter `transparency`
    Parameter `transparency_index`

      The following image has transparency, marked with this index.

    Parameter `delay`

      View the following rendering for this many centiseconds (0..65535).

    Parameter `user_input`

      Wait the delay or until user input. If delay is zero, wait indefinitely for user input. May sound the bell upon decoding.

    Parameter `disposal`

      Disposal method number;

    Note

      This is in the very advanced sector of the GIF support; please read about how GIF files works.

      Most decoders just ignore some or all of these parameters.

    See also

      _render_block , render_block

    Method _render_block

      `string _render_block(int x, int y, int xsize, int ysize, int bpp, string indices, 0|string colortable, int interlace)`

    Description

      Advanced (!) method for writing renderblocks for placement in a GIF file. This method only applies LZW encoding on the indices and makes the correct headers.

    Parameter `x`
    Parameter `y`

      Position of this image.

    Parameter `xsize`
    Parameter `ysize`

      Size of the image. Length if the `indices` string must be xsize*ysize.

    Parameter `bpp`

      Bits per pixels in the indices. Valid range 1..8.

    Parameter `indices`

      The image indices as an 8bit indices.

    Parameter `colortable`

      Colortable with colors to write as palette. If this argument is zero, no local colortable is written. Colortable string len must be 1<<bpp.

    Parameter `interlace`

      Interlace index data and set interlace bit. The given string should _not_ be pre-interlaced.

    Note

      This is in the very advanced sector of the GIF support; please read about how GIF files works.

    See also

      encode , _encode , header_block , end_block

    Method __decode

      `array __decode()`

    Description

      Decodes a GIF image structure down to chunks and

          ({int xsize,int ysize,      // 0: size of image drawing area
            int numcol,               // 2: suggested number of colors
            void|string colortable,   // 3: opt. global colortable
            ({ int aspx, int aspy,    // 4,0: aspect ratio or 0, 0 if not set
               int background }),     //   1: index of background color

      followed by any number these blocks in any order:

            ({ GIF.EXTENSION,         //   0: block identifier
               int extension,         //   1: extension number
               string data })         //   2: extension data

            ({ GIF.RENDER,            //   0: block identifier
               int x, int y,          //   1: position of render
               int xsize, int ysize,  //   3: size of render
               int interlace,         //   5: interlace flag
               void|string colortbl,  //   6: opt. local colortable
               int lzwsize,           //   7: lzw code size
               string lzwdata })      //   8: packed lzw data

      and possibly ended with one of these:

            ({ GIF.ERROR_PREMATURE_EOD })   // premature end-of-data

            ({ GIF.ERROR_TOO_MUCH_DATA,     // data following end marker
               string data })               // (rest of file)

            ({ GIF.ERROR_UNKNOWN_DATA,      // unknown data
               string data })               // (rest of file)

    Returns

      the above array

    Note

      May throw errors if the GIF header is incomplete or illegal.

      This is in the very advanced sector of the GIF support; please read about how GIF files works.

  Module Image.XFace

    Description

    Note

      This module uses `libgmp`.

    Method decode

      `object decode(string data)`
      `object decode(string data, object mappingoptions)`

    Description

      Decodes an X-Face image.

      The `options` argument may be a mapping containing zero options.

    Method decode_header

      `object decode_header(string data)`
      `object decode_header(string data, object mappingoptions)`

    Description

      Decodes an X-Face image header.

              "xsize":int
              "ysize":int
                  size of image
              "type":"image/x-xface"
                  file type information

      The `options` argument may be a mapping containing zero options.

    Note

      There aint no such thing as a X-Face image header. This stuff tells the characteristics of an X-Face image.

    Method encode

      `string encode(object img)`
      `string encode(object img, object mappingoptions)`

    Description

      Encodes an X-Face image.

      The `img` argument must be an image of the dimensions 48 by 48 pixels. All non-black pixels will be considered white.

      The `options` argument may be a mapping containing zero options.

  Module Image.FreeType

    Description

      Pike glue for the FreeType2 library, http://www.freetype.org/

      `constant Image.FreeType.FACE_FLAG_SCALABLE`
      `constant Image.FreeType.FACE_FLAG_FIXED_WIDTH`
      `constant Image.FreeType.FACE_FLAG_SFNT`
      `constant Image.FreeType.FACE_FLAG_HORIZONTAL`
      `constant Image.FreeType.FACE_FLAG_VERTICAL`
      `constant Image.FreeType.FACE_FLAG_KERNING`
      `constant Image.FreeType.FACE_FLAG_FAST_GLYPHS`
      `constant Image.FreeType.FACE_FLAG_MULTIPLE_MASTERS`
      `constant Image.FreeType.FACE_FLAG_GLYPH_NAMES`

    FIXME

      `constant Image.FreeType.STYLE_FLAG_ITALIC`
      `constant Image.FreeType.STYLE_FLAG_BOLD`

    FIXME

    CLASS Image.FreeType.Face

      Description

        A FreeType font face. We recommend using the more generic font handling interfaces in Image.Fonts instead.

      Method write_char

        `Image.Image write_char(int char)`

      FIXME

      Method get_kerning

        `int get_kerning(int l, int r)`

      FIXME

      Method attach_file

        `void attach_file(string file)`

      FIXME

      Method set_size

        `Face set_size(int width, int height)`

      Method list_encodings

        `array(string) list_encodings()`

      Method select_encoding

        `void select_encoding(string|int encoding)`

      Method info

        `mapping info()`

      Returns

        `"family" : string` | The font family, or the string "unknown"
        `"style_name" : string` | The name of the font style, or "unknown"
        `"face_flags" : int` | The sum of all face/style flags respectively.
        `"style_flags" : int`

      Method create

        `void Image.FreeType.Face(string font)`

      Parameter `font`

        The path of the font file to use

  Module Image.AVS

    Description

    Method decode
    Method _decode
    Method encode

      `object decode(string data)`
      `mapping _decode(string data)`
      `string encode(object image)`

    Description

      Handle encoding and decoding of AVS-X images. AVS is rather trivial, and not really useful, but:

      An AVS file is a raw (uncompressed) 24 bit image file with alpha. The alpha channel is 8 bit, and there is no separate alpha for r, g and b.

  Module Image.NEO

    Description

      Decodes images from the Atari image editor Neochrome.

    Method _decode

      `mapping _decode(string data)`

    Description

      Low level decoding of the NEO file contents in data .

    Returns

      `"image" : Image.Image` | The decoded bitmap
      `"images" : array(Image.Image)` | Coler cycled images.
      `"filename" : string` | The filename stored into the file.
      `"right_limit" : int(0..15)` | The palette color range to be color cycled.
      `"left_limit" : int(0..15)`
      `"speed" : int(0..255)` | The animation speed, expressed as the number of VBLs per animation frame.
      `"direction" : string` | Color cycling direction. Can be either `"left"` or `"right"`.
      `"palette" : array(array(int(0..255)))` | The palette to be used for color cycling.

    Method decode

      `Image.Image decode(string data)`

    Description

      Decodes the image data into an Image.Image object.

  Module Image.WBMP

    Description

      WAP bitmap format - WBMP.

    Method decode

      `object decode(string image)`

    FIXME

      Document this function.

    Method _decode

      `mapping _decode(string image)`

    FIXME

      Document this function.

    Method decode_header

      `mapping decode_header(string image)`

    Returns

      `"format" : string` | The MIME type and encoding for the image, e.g. "image/x-wap.wbmp; type=0".
      `"xsize" : int` |
      `"ysize" : int` |
      `"fix_header_field" : int` |
      `"ext_header_field" : int` |

    Method encode
    Method _encode

      `string encode(object image, void|mapping args)`
      `string _encode(object image, void|mapping args)`

    FIXME

      Document this function.

  Module Image.X

    Description

      This submodule handles encoding and decoding of the binary formats of X11.

    See also

      Image , Image.Image , Image.Colortable

    Method decode_pseudocolor

      `object decode_pseudocolor(string data, int width, int height, int bpp, int alignbits, int swapbytes, object colortable)`

    Description

      lazy support for pseudocolor ZPixmaps

    Note

      currently, only byte-aligned pixmaps are supported

    Method decode_truecolor
    Method decode_truecolor_masks

      `object decode_truecolor(string data, int width, int height, int bpp, int alignbits, int swapbytes, int rbits, int rshift, int gbits, int gshift, int bbits, int bshift)`
      `object decode_truecolor_masks(string data, int width, int height, int bpp, int alignbits, int swapbytes, int rmask, int gmask, int bmask)`

    Description

      lazy support for truecolor ZPixmaps

    Note

      currently, only byte-aligned masks are supported

    Method encode_pseudocolor

      `string encode_pseudocolor(object image, int bpp, int alignbits, int vbpp, object colortable)`
      `string encode_pseudocolor(object image, int bpp, int alignbits, int vbpp, object colortable, string translate)`

    Parameter `image`

      the image object to encode

    Parameter `bpp`

      bits per pixel, how many bits each pixel should take

    Parameter `vbpp`

      value bits per pixel; how many bits per pixel that really contains information

    Parameter `alignbits`

      the number of even bits each line should be padded to

    Parameter `colortable`

      colortable to get indices for pseudocolor

    Parameter `translate`

      translate table for colors. Length of this string should be 1<<vbpp (or 2<<vbpp if vbpp are greater than 8).

    Note

      currently, only upto 16 bits pseudocolor are supported.

    Method encode_truecolor
    Method encode_truecolor_masks

      `string encode_truecolor(object image, int bpp, int alignbits, int swapbytes, int rbits, int rshift, int gbits, int gshift, int bbits, int bshift)`
      `string encode_truecolor_masks(object image, int bpp, int alignbits, int swapbytes, int rmask, int gmask, int bmask)`
      `string encode_truecolor(object image, int bpp, int alignbits, int swapbytes, int rbits, int rshift, int gbits, int gshift, int bbits, int bshift, object ct)`
      `string encode_truecolor_masks(object image, int bpp, int alignbits, int swapbytes, int rmask, int gmask, int bmask, object ct)`

    Description

      Pack an image into a truecolor string. You will get a string of packed red, green and blue bits; ie:

      `encode_truecolor(img, 12,32, 0, 3,5, 4,0, 3,8)` will give (aligned to even 32 bits for each row):
      `0bbbrrr0 gggg0bbb rrr0gggg 0bbb`...
      `<--pixel 1--><--pixel 2--> <--3-->`
      `10987654 32101098 76543210 1098`... <- bit position `<-><-> <-->` `| | +--- 4,0`: 4 bits green shifted 0 bits `| +-------- 3,5`: 3 bits red shifted 5 bits `+----------- 3,8`: 3 bits blue shifted 8 bits

      The above call is equal to
      `encode_truecolor_masks(img, 12,32, 0, 224, 15, 768)` and
      `encode_truecolor(img, 12,32, 0, 3,5,4,0,3,8, colortable(1<<3,1<<4,1<<3))`.
      The latter gives possibility to use dither algorithms, but is slightly slower.

    Parameter `image`

      the image object to encode

    Parameter `bpp`

      bits per pixel, how many bits each pixel should take

    Parameter `alignbits`

      the number of even bits each line should be padded to

    Parameter `rbits`
    Parameter `gbits`
    Parameter `bbits`

      bits for each basecolor

    Parameter `rshift`
    Parameter `gshift`
    Parameter `bshift`

      leftshifts for each basecolor

    Parameter `rmask`
    Parameter `gmask`
    Parameter `bmask`

      masks for each basecolor (xbits and gbits are calculated from this), needs to be massive (no zeroes among the ones in the mask).

    Parameter `ct`

      colortable object (for dithering, or whatever)

    Parameter `swapbytes`

      swap bytes for bpp==16,24,32, swaps bits in the bytes if bpp==1, for change of byte/bitorder between client and server.

  Module Image.XWD

    Description

      This submodule keeps the XWD (X Windows Dump) decode capabilities of the Image module.

      XWD is the output format for the xwd program.

      Simple decoding:
      decode

      Advanced decoding:
      _decode

    See also

      Image , Image.Image , Image.PNM , Image.X

    Method decode

      `object decode(string data)`

    Description

      Simple decodes a XWD image file.

    Method _decode
    Method decode_header

      `mapping _decode(string data)`
      `mapping decode_header(string data)`

    Description

      Decodes XWD data and returns the result.

      Supported XWD visual classes and encoding formats are TrueColor / ZPixmap DirectColor / ZPixmap PseudoColor / ZPixmap

      If someone sends me files of other formats, these formats may be implemented. `:)` /`mirar+pike@mirar.org`

    Returns

      the decoded image as an image object

    Note

      This function may throw errors upon illegal or unknown XWD data.

    See also

      decode

  Module Image.XCF

    Description

    Method decode

      `object decode(string data)`

    Description

      Decodes a XCF image to a single image object.

    Note

      Throws upon error in data, you will loose quite a lot of information by doing this. See Image.XCF._decode and Image.XCF.__decode

    Method decode_layers

      `array(object) decode_layers(object stringdata)`
      `array(object) decode_layers(object stringdata, object mappingoptions)`

    Description

      Decodes a XCF image to an array of Image.Layer objects

      The layer object have the following extra variables (to be queried using get_misc_value):

      image_xres, image_yres, image_colormap, image_guides, image_parasites, name, parasites, visible, active

      Takes the same argument mapping as _decode ,

    Method _decode

      `mapping _decode(string|object data, mapping|void options)`

    Description

      Decodes a XCF image to a mapping, with at least an 'image' and possibly an 'alpha' object. Data is either a XCF image, or a XCF.GimpImage object structure (as received from __decode)

           Supported options
           ([
              "background":({r,g,b})||Image.Color object
              "draw_all_layers":1,
                   Draw invisible layers as well

              "draw_guides":1,
                   Draw the guides

              "draw_selection":1,
                    Mark the selection using an overlay

              "ignore_unknown_layer_modes":1
                    Do not asume 'Normal' for unknown layer modes.

              "mark_layers":1,
                   Draw an outline around all (drawn) layers

              "mark_layer_names":Image.Font object,
                   Write the name of all layers using the font object,

              "mark_active_layer":1,
                   Draw an outline around the active layer
            ])

    Note

      Throws upon error in data. For more information, see Image.XCF.__decode

    Method __decode

      `object __decode(string|mapping data, object mapping|voidoptions)`

    Description

      Decodes a XCF image to a Image.XCF.GimpImage object.

          Returned structure reference

             !class GimpImage
             {
               int width;
               int height;
               int compression;
               int type;
               int tattoo_state;
               float xres = 72.0;
               float yres = 72.0;
               int res_unit;
               Image.Colortable colormap;
               Image.Colortable meta_colormap;
               array(Layer) layers = ({});
               array(Channel) channels = ({});
               array(Guide) guides = ({});
               array(Parasite) parasites = ({});
               array(Path) paths = ({});

               Layer active_layer;
               Channel active_channel;
               Channel selection;
             }

             !class Layer
             {
               string name;
               int opacity;
               int type;
               int mode;
               int tattoo;
               mapping flags = ([]);
               int width, height;
               int xoffset, yoffset;
               array (Parasite) parasites;
               LayerMask mask;
               Hierarchy image;
             }

             !class Channel
             {
               string name;
               int width;
               int height;
               int opacity;
               int r, g, b;
               int tattoo;
               Hierarchy image_data;
               object parent;
               mapping flags = ([]);
               array (Parasite) parasites;
             }

             !class Hierarchy
             {
               Image.Image img;
               Image.Image alpha;
               int width;
               int height;
               int bpp;
             }

             !class Parasite
             {
               string name;
               int flags;
               string data;
             }

             !class Guide
             {
               int pos;
               int vertical;
             }

             !class Path
             {
               string name;
               int ptype;
               int tattoo;
               int closed;
               int state;
               int locked;
               array (PathPoint) points = ({});
             }

             !class PathPoint
             {
               int type;
               float x;
               float y;
             }

    Method ___decode

      `object ___decode(string|mapping data)`

    Description

      Decodes a XCF image to a mapping.

          Structure reference

              ([
                "width":int,
                "height":int,
                "type":int,
                "properties":({
                  ([
                    "type":int,
                    "data":string,
                  ]),
                  ...
                }),
                "layers":({
                  ([
                    "name":string,
                    "width":int,
                    "height":int,
                    "type":type,
                    "properties":({
                      ([
                        "type":int,
                        "data":string,
                      ]),
                      ...
                    }),
                    "mask":0 || ([
                      "name":string,
                      "width":int,
                      "height":int,
                      "properties":({
                        ([
                          "type":int,
                          "data":string,
                        ]),
                        ...
                      }),
                      "image_data":([
                        "bpp":int,
                        "width":int,
                        "height":int,
                        "tiles":({
                          string,
                          ...
                        }),
                      ]),
                    ]),
                    "image_data":([
                      "bpp":int,
                      "width":int,
                      "height":int,
                      "tiles":({
                        string,
                        ...
                      }),
                    ]),
                  ]),
                  ...
                }),
                "channels":({
                  "name":string,
                  "width":int,
                  "height":int,
                  "properties":({
                    ([
                      "type":int,
                      "data":string,
                    ]),
                    ...
                  }),
                  "image_data":([
                    "bpp":int,
                    "width":int,
                    "height":int,
                    "tiles":({
                      string,
                      ...
                    }),
                  ]),
                }),
              ])

  Module Image.ANY

    Description

      These method calls other decoding methods and has some heuristics for what type of image this is.

    Method _decode
    Method decode
    Method decode_alpha

      `mapping _decode(string data)`
      `object decode(string data)`
      `object decode_alpha(string data)`

    Description

      Tries heuristics to find the correct method of decoding the data, then calls that method.

      The result of _decode() is a mapping that contains

      `"type" : string` | File type information as MIME type (ie "image/jpeg" or similar)
      `"image" : Image.Image` | the image object
      `alpha : int` | the alpha channel or 0 if N/A

    Note

      Throws upon failure.

    Method decode_header

      `mapping decode_header(string data)`

    Description

      Tries heuristics to find the correct method of decoding the header, then calls that method.

      The resulting mapping depends on wich decode_header method that is executed, but these keys will probably exist

      `"xsize" : int` | Size of image
      `"ysize" : int`
      `"type" : string` | File type information as MIME type.
      `"color_space" : string` | Color space of image.

    Note

      Throws upon failure.

  Module Image.PNG

    Description

      Support for encoding and decoding the Portable Network Graphics format, PNG.

    Note

      This module uses zlib.

    Method _chunk

      `string _chunk(string type, string data)`

    Description

      Encodes a PNG chunk.

    Note

      Please read about the PNG file format.

    Method __decode

      `array __decode(string data)`
      `array __decode(string data, int dontcheckcrc)`

    Description

      Splits a PNG file into chunks.

    Returns

      Result is an array of arrays, or 0 if data isn't a PNG file. Each element in the array is constructed as follows.

      Array
      `string 0` | The type of the chunk, e.g. "IHDR" or "IDAT".
      `string 1` | The actual chunk data.
      `int(0..1) 2` | Set to 1 if the checksum is ok and dontcheckcrc isn't set.

    Note

      Please read about the PNG file format. Support for decoding cHRM, gAMA, sBIT, hIST, pHYs, tIME, tEXt and zTXt chunks are missing.

    Method _decode

      `mapping _decode(string|array data)`
      `mapping _decode(string|array data, mapping options)`

    Description

      Decode a PNG image file.

    Parameter `options`

      `"colortable" : string|array|Image.Colortable` | A replacement color table to be used instead of the one in the PNG file, if any.

    Returns

      `"image" : Image.Image` | The decoded image.
      `"bpp" : int` | Number of bitplanes in the image. One of 1, 2, 4, 8 and 16.

      `"type" : int`

      Image color type. Bit values are:

      `1` | Palette used.
      `2` | Color used.
      `4` | Alpha channel used.

      Valid values are 0, 2, 3, 4 and 6.

      `"xsize" : int` | Image dimensions.
      `"ysize" : int`
      `"background" : array(int)` | The background color, if any. An array of size three with the RGB values.
      `"alpha" : Image.Image` | The alpha channel, if any.

    Throws

      Throws an error if the image data is erroneous.

    Note

      Please read about the PNG file format. This function ignores any checksum errors in the file. A PNG of higher color resolution than the Image module supports (8 bit) will lose that information in the conversion.

    Method encode

      `string encode(Image.Image image)`
      `string encode(Image.Image image, mapping options)`

    Description

      Encodes a PNG image.

    Parameter `options`

      `"alpha" : Image.Image` | Use this image as alpha channel (Note: PNG alpha channel is grey. The values are calculated by (r+2g+b)/4.)
      `"palette" : Image.Colortable` | Use this as palette for pseudocolor encoding (Note: encoding with alpha channel and pseudocolor at the same time are not supported)
      `"zlevel" : int(0..9)` | The level of z-compression to be applied. Default is 8.
      `"zstrategy" : int` | The type of LZ77 strategy to be used. Possible values are Gz.DEFAULT_STRATEGY , Gz.FILTERED , Gz.HUFFMAN_ONLY , Gz.RLE , Gz.FIXED . Default is Gz.DEFAULT_STRATEGY .

    See also

      __decode

    Note

      Please read some about PNG files.

    Method decode_header

      `mapping decode_header(string data)`

    Description

      Decodes only the PNG headers.

    See also

      _decode

    Method decode

      `Image.Image decode(string data)`
      `Image.Image decode(string data, mapping(string:mixed) options)`

    Description

      Decodes a PNG image. The options mapping is the as for _decode .

    Throws

      Throws upon error in data.

    Method decode_alpha

      `Image.Image decode_alpha(string data, void|mapping(string:mixed) options)`

    Description

      Decodes the alpha channel in a PNG file. The options mapping is the same as for _decode .

    Throws

      Throws upon error in data.

  Module Image.ILBM

    Description

      This submodule keep the ILBM encode/decode capabilities of the Image module.

    See also

      Image , Image.Image , Image.Colortable

    Method decode

      `object decode(string data)`
      `object decode(array _decoded)`
      `object decode(array __decoded)`

    Description

      Decodes ILBM data and creates an image object.

    Returns

      the decoded image as an image object

    Note

      This function may throw errors upon illegal ILBM data. This function uses __decode and _decode internally.

    See also

      encode

    Method encode

      `string encode(object image)`
      `string encode(object image, object mappingoptions)`

    Description

      Encodes an ILBM image.

      The `options` argument may be a mapping containing zero or more encoding options:

          normal options:
              "alpha":image object
                  Use this image as mask
                  (Note: ILBM mask is boolean.
                   The values are calculated by (r+2g+b)/4>=128.)

              "palette":colortable object
                  Use this as palette for pseudocolor encoding

    Method _decode

      `array _decode(string|array data)`

    Description

      Decode an ILBM image file.

      Result is a mapping,

          ([
             "image": object image,

             ... more ...
          ])

      `image` is the stored image.

    Method __decode

      `array __decode()`

    Description

      Decodes an ILBM image structure down to chunks and

          ({int xsize,int ysize,      // 0: size of image drawing area
            string bitmapheader,      // 2: BMHD chunk
            void|string colortable,   // 3: opt. colortable chunk (CMAP)
            void|string colortable,   // 4: opt. colormode chunk (CAMG)
            string body,              // 5: BODY chunk
            mapping more_chunks})     // 6: mapping with other chunks

    Returns

      the above array

    Note

      May throw errors if the ILBM header is incomplete or illegal.

  Module Image.TGA

    Description

    Method decode

      `object decode(string data)`

    Description

      Decodes a Targa image.

    Note

      Throws upon error in data.

    Method encode

      `string encode(object image)`
      `string encode(object image, object mappingoptions)`

    Description

      Encodes a Targa image.

      The `options` argument may be a mapping containing zero or more encoding options:

          normal options:
              "alpha":image object
                  Use this image as alpha channel
                  (Note: Targa alpha channel is grey.
                   The values are calculated by (r+2g+b)/4.)

              "raw":1
                  Do not RLE encode the image

    Method _decode

      `object _decode(string data)`

    Description

      Decodes a Targa image to a mapping. The mapping follows this format: ([ "image":img_object, "alpha":alpha_channel ])

    Note

      Throws upon error in data.

  Module Image.PCX

    Description

    Method decode

      `object decode(string data)`

    Description

      Decodes a PCX image.

    Note

      Throws upon error in data.

    Method encode
    Method _encode

      `string encode(object image)`
      `string encode(object image, object mappingoptions)`
      `string _encode(object image)`
      `string _encode(object image, object mappingoptions)`

    Description

      Encodes a PCX image. The _encode and the encode functions are identical

      The `options` argument may be a mapping containing zero or more encoding options:

          normal options:
              "raw":1
                  Do not RLE encode the image
              "dpy":int
              "xdpy":int
              "ydpy":int
                  Image resolution (in pixels/inch, integer numbers)
              "xoffset":int
              "yoffset":int
                  Image offset (not used by most programs, but gimp uses it)

    Method _decode

      `mapping _decode(string data)`

    Description

      Decodes a PCX image to a mapping.

    Note

      Throws upon error in data.

  Module Image.HRZ

    Description

    Method decode
    Method _decode
    Method encode

      `object decode(string data)`
      `mapping _decode(string data)`
      `string encode(object image)`

    Description

      Handle encoding and decoding of HRZ images. HRZ is rather trivial, and not really useful, but:

      The HRZ file is always 256x240 with RGB values from 0 to 63. No compression, no header, just the raw RGB data. HRZ is (was?) used for amatuer radio slow-scan TV.

  Module Image.XBM

    Description

    Method decode

      `object decode(string data)`

    Description

      Decodes a XBM image.

    Note

      Throws upon error in data.

    Method encode

      `string encode(object image)`
      `string encode(object image, object mappingoptions)`

    Description

      Encodes a XBM image.

      The `options` argument may be a mapping containing zero or more encoding options.

          normal options:
              "name":"xbm_image_name"
                  The name of the XBM. Defaults to 'image'

    Method _decode

      `object _decode(string data)`
      `object _decode(string data, object mappingoptions)`

    Description

      Decodes a XBM image to a mapping.

              Supported options:
             ([
                "fg":({fgcolor}),    // Foreground color. Default black
                "bg":({bgcolor}),    // Background color. Default white
                "invert":1,          // Invert the mask
              ])

    Note

      Throws upon error in data.

  Module Image.PVR

    Description

      Handle encoding and decoding of PVR images.

      PVR is the texture format of the NEC PowerVR system It is a rather simple, uncompressed, truecolor format.

    Method decode
    Method decode_alpha
    Method decode_header
    Method _decode

      `object decode(string data)`
      `object decode_alpha(string data)`
      `mapping decode_header(string data)`
      `mapping _decode(string data)`

    Description

      decodes a PVR image

      The decode_header and _decode has these elements:

             "image":object            - image object    \- not decode_header
             "alpha":object            - decoded alpha   /

             "type":"image/x-pvr"      - image type
             "xsize":int               - horisontal size in pixels
             "ysize":int               - vertical size in pixels
             "attr":int                - texture attributes
             "global_index":int        - global index (if present)

    Method encode

      `string encode(object image)`
      `string encode(object image, mapping options)`

    Description

      encode a PVR image

      options is a mapping with optional values:

             "alpha":object            - alpha channel
             "global_index":int        - global index
             "vq":int(0..1)            - Vector Quantification compression

  Module Image.PNM

    Description

      This submodule keeps the PNM encode/decode capabilities of the Image module.

      PNM is a common image storage format on unix systems, and is a very simple format.

      This format doesn't use any color palette.

      The format is divided into seven subformats;

          P1(PBM) - ascii bitmap (only two colors)
          P2(PGM) - ascii greymap (only grey levels)
          P3(PPM) - ascii truecolor
          P4(PBM) - binary bitmap
          P5(PGM) - binary greymap
          P6(PPM) - binary truecolor
          P7 - binary truecolor (used by xv for thumbnails)

      Simple encoding:
      encode ,
      encode_binary ,
      encode_ascii

      Simple decoding:
      decode

      Advanced encoding:
      encode_P1 ,
      encode_P2 ,
      encode_P3 ,
      encode_P4 ,
      encode_P5 ,
      encode_P6

    See also

      Image , Image.Image , Image.GIF

    Method decode

      `object decode(string data)`

    Description

      Decodes PNM (PBM/PGM/PPM) data and creates an image object.

    Returns

      the decoded image as an image object

    Note

      This function may throw errors upon illegal PNM data.

    See also

      encode

    Method encode
    Method encode_binary
    Method encode_ascii
    Method encode_P1
    Method encode_P2
    Method encode_P3
    Method encode_P4
    Method encode_P5
    Method encode_P6

      `string encode(object image)`
      `string encode_binary(object image)`
      `string encode_ascii(object image)`
      `string encode_P1(object image)`
      `string encode_P2(object image)`
      `string encode_P3(object image)`
      `string encode_P4(object image)`
      `string encode_P5(object image)`
      `string encode_P6(object image)`

    Description

      Make a complete PNM file from an image.

      encode_binary () and encode_ascii () uses the most optimized encoding for this image (bitmap, grey or truecolor) - P4, P5 or P6 respective P1, P2 or P3.

      encode_P1 /encode_P4 assumes the image is black and white. Use Image.Image->threshold () or something like `Image.Colortable ( ({({0,0,0}),({255,255,255})}) )
      ->floyd_steinberg()
      ->map(my_image)` to get a black and white image.

      encode_P2 /encode_P5 assumes the image is greyscale. Use Image.Image->grey () to get a greyscale image.

    Returns

      the encoded image as a string

    Note

      encode () is equal to encode_binary (), but may change in a future release.

    See also

      decode

  Module Image._XPM

    Method _xpm_write_rows

      `int(0..0) _xpm_write_rows(Image.Image img, Image.Image alpha, int bpc, array(string) colors, array(string) pixels)`

    Description

      Fills in img and alpha according to xpm data in bpc , colors and pixels .

    Parameter `bpc`

      Bytes per color. Number of bytes used to encode each color in pixels .

    Parameter `colors`

      Array of color definitions.

      A color definition is on the format `"ee c #RRGGBB"`, where `ee` is a bpc long string used to encode the color, `c` is a literal `"c"`, and `RRGGBB` is a hexadecimal RGB code.

    Parameter `pixels`

      Raw picture information.

      Array
      `string 0` | Size information on the format (`sprintf("%d %d %d %d", h, w, ncolors, bpn)`).
      `string 1..ncolors` | Same as colors .
      `string ncolors_plus_one..ncolors_plus_h` | Line information. Strings of length bpn *w with encoded pixels for each line.

    Method _xpm_trim_rows

      `array(string) _xpm_trim_rows(array(string) rows)`

  Module Image.BMP

    Description

      This submodule keeps the BMP (Windows Bitmap) encode/decode capabilities of the Image module.

      BMP is common in the Windows environment.

      Simple encoding:
      encode

    See also

      Image , Image.Image , Image.Colortable

    Method decode
    Method _decode
    Method decode_header

      `object decode(string data)`
      `mapping _decode(string data)`
      `mapping decode_header(string data)`
      `object decode(string data, mapping options)`
      `mapping _decode(string data, mapping options)`
      `mapping decode_header(string data, mapping options)`

    Description

      Decode a BMP.

      decode gives an image object, _decode gives a mapping in the format

                  "type":"image/x-MS-bmp",
                  "image":image object,
                  "colortable":colortable object (if applicable)

                  "xsize":int,
                  "ysize":int,
                  "compression":int,
                  "bpp":int,
                  "windows":int,

    Returns

      the encoded image as a string

    Bugs

      Doesn't support all BMP modes. At all.

    See also

      encode

    Method encode

      `string encode(object image)`
      `string encode(object image, mapping options)`
      `string encode(object image, object colortable)`
      `string encode(object image, int bpp)`

    Description

      Make a BMP. It default to a 24 bpp BMP file, but if a colortable is given, it will be 8bpp with a palette entry.

      `option` is a mapping that may contain:

          "colortable": Image.Colortable   - palette
          "bpp":        1|4|8|24           - force this many bits per pixel
          "rle":        0|1                - run-length encode (default is 0)

    Parameter `image`

      Source image.

    Parameter `colortable`

      Colortable object, shortcut for "colortable" in options.

    Returns

      the encoded image as a string

    Bugs

      Doesn't support old BMP mode, only "windows" mode.

    See also

      decode

  Module Image.TIM

    Description

      Handle decoding of TIM images.

      TIM is the framebuffer format of the PSX game system. It is a simple, uncompressed, truecolor or CLUT format with a one bit alpha channel.

    Method decode
    Method decode_alpha
    Method decode_header
    Method _decode

      `object decode(string data)`
      `object decode_alpha(string data)`
      `mapping decode_header(string data)`
      `mapping _decode(string data)`

    Description

      decodes a TIM image

      The decode_header and _decode has these elements:

             "image":object            - image object    \- not decode_header
             "alpha":object            - decoded alpha   /

             "type":"image/x-tim"      - image type
             "xsize":int               - horisontal size in pixels
             "ysize":int               - vertical size in pixels
             "attr":int                - texture attributes

  Module Image.RAS

    Description

      This submodule keep the RAS encode/decode capabilities of the Image module.

    See also

      Image , Image.Image , Image.Colortable

    Method decode

      `object decode(string data)`

    Description

      Decodes RAS data and creates an image object.

    Returns

      the decoded image as an image object

    Note

      This function may throw errors upon illegal RAS data.

    See also

      encode

    Method encode

      `string encode(object image)`
      `string encode(object image, object mappingoptions)`

    Description

      Encodes a RAS image.

      The `options` argument may be a mapping containing zero or more encoding options:

          normal options:

              "palette":colortable object
                  Use this as palette for pseudocolor encoding

  Module Image.Color

    Description

      This module keeps names and easy handling for easy color support. It gives you an easy way to get colors from names.

      A color is here an object, containing color information and methods for conversion, see below.

      Image.Color can be called to make a color object. Image.Color() takes the following arguments:

              Image.Color(string name)          // "red"
              Image.Color(string prefix_string) // "lightblue"
              Image.Color(string hex_name)      // "#ff00ff"
              Image.Color(string cmyk_string)   // "%17,42,0,19.4"
              Image.Color(string hsv_string)    // "%@327,90,32"
              Image.Color(int red, int green, int blue)

      The color names available can be listed by using indices on Image.Color. The colors are available by name directly as `Image.Color.name`, too:

              ...Image.Color.red...
              ...Image.Color.green...
              or, maybe
              import Image.Color;
              ...red...
              ...green...
              ...lightgreen...

      Giving red, green and blue values is equal to calling Image.Color.rgb ().

      The prefix_string method is a form for getting modified colors, it understands all modifiers (light , dark , bright , dull and neon ). Simply use "method"+"color"; (as in `lightgreen`, `dullmagenta`, `lightdullorange`).

      The `hex_name` form is a simple `#rrggbb` form, as in HTML or X-program argument. A shorter form (`#rgb`) is also accepted. This is the inverse to the Image.Color.Color->hex () method.

      The `cmyk_string` is a string form of giving cmyk (cyan, magenta, yellow, black) color. These values are floats representing percent.

      The `hsv_string` is another hue, saturation, value representation, but in floats; hue is in degree range (0..360), and saturation and value is given in percent. This is not the same as returned or given to the hsv () methods!

      This table lists all the different named colors available in Image.Color. The first column shows the actual color while the five following columns demonstrates the modifiers neon, light, dark, bright and dull. The color begind the name of the color is produced by calling neon()->dark()->dark()->dark() from the color object itself, i.e. Image.Color.mintcream->neon()->dark()->dark()->dark().

    Note

      `Image.Color["something"]` will never(!) generate an error, but a zero_type 0, if the color is unknown. This is enough to give the error "not present in module", if used as `Image.Color.something`, though.

      If you are using colors from for instance a webpage, you might want to create the color from Image.Color.guess (), since that method is more tolerant for mistakes and errors.

      `Image.Color`() is case- and space-sensitive. Use Image.Color.guess () to catch all variants.

      and subtract with a space (lower_case(x)-" ") to make sure you get all variants.

    See also

      Image.Color.Color , Image.Color.guess , Image , Image.Colortable

    Method rgb
    Method hsv
    Method cmyk
    Method greylevel
    Method html

      `object rgb(int red, object intgreen, object intblue)`
      `object hsv(int hue, object intsaturation, object intvalue)`
      `object cmyk(float c, float m, float y, float k)`
      `object greylevel(int level)`
      `object html(string html_color)`

    Description

      Creates a new color object from given red, green and blue, hue, saturation and value, or greylevel, in color value range. It could also be created from cmyk values in percent.

      The html () method only understands the HTML color names, or the `#rrggbb` form. It is case insensitive.

    Returns

      the created object.

    Method guess

      `object guess(string color)`

    Description

      This is equivalent to `Image.Color (lower_case(str)-" ")`, and tries the color with a prepending '#' if no corresponding color is found.

    Returns

      a color object or zero_type

    Method _indices
    Method _values

      `array(string) _indices()`
      `array(object) _values()`

    Description

      (ie as `indices(Image.Color)` or `values(Image.Color)`) `indices` gives a list of all the known color names, `values` gives there corresponding objects.

    See also

      Image.Color

    CLASS Image.Color.Color

      Description

        This is the color object. It has six readable variables, `r`, `g`, `b`, for the red, green and blue values, and `h`, `s`, `v`, for the hue, saturation anv value values.

      Method bits

        `int bits(object intrbits, object intgbits, object intbbits, object intrshift, object intgshift, object intbshift)`

      Description

        Returns the color as an integer. The first three parameters state how many bits to use for red, green and blue respectively. The last three state how many bits each colour should be shifted. For instance, `Image.Color("#AABBCC")->bits(8, 8, 8, 16, 8, 0)` returns the integer 11189196, that is, 0xAABBCC.

      Method light
      Method dark
      Method neon
      Method bright
      Method dull

        `object light()`
        `object dark()`
        `object neon()`
        `object bright()`
        `object dull()`

      Description

        Color modification methods. These returns a new color.

        method | effect | h | s | v | as
        --- | --- | --- | --- | --- | ---
        light | raise light level | ±0 | ±0 | +50 |
        dark | lower light level | ±0 | ±0 | -50 |
        bright | brighter color | ±0 | +50 | +50 |
        dull | greyer color | ±0 | -50 | -50 |
        neon | set to extreme | ±0 | max | max |

        light and dark lower/highers saturation when value is min-/maximised respective.

      Returns

        the new color object

      Note

        The opposites may not always take each other out. The color is maximised at white and black levels, so, for instance Image.Color .white->light ()->dark () doesn't give the white color back, but the equal to Image.Color .white->dark (), since white can't get any light er.

      Method cast

        `array|string cast()`

      Description

        cast the object to an array, representing red, green and blue (equal to `->rgb ()`), or to a string, giving the name (equal to `->name ()`).

      Returns

        the name as string or rgb as array

      See also

        rgb , name

      Method rgb
      Method rgbf
      Method hsv
      Method hsvf
      Method cmyk
      Method greylevel

        `array(int) rgb()`
        `array(float) rgbf()`
        `array(int) hsv()`
        `array(float) hsvf()`
        `array(float) cmyk()`
        `int greylevel()`
        `int greylevel(int r, object intg, object intb)`

      Description

        This is methods of getting information from an Image.Color.Color object.

        They give an array of red, green and blue (rgb) values (color value),
        hue, saturation and value (hsv) values (range as color value),
        cyan, magenta, yellow, black (cmyk) values (in percent)
        or the greylevel value (range as color value).

        The greylevel is calculated by weighting red, green and blue. Default weights are 87, 127 and 41, respective, and could be given by argument.

      Returns

        array(int) respective int

      See also

        Image.Color.Color , grey

      Method create

        `void Image.Color.Color(int r, int g, int b)`

      Description

        This is the main Image.Color.Color creation method, mostly for internal use.

      Method grey

        `object grey()`
        `object grey(int red, int green, int blue)`

      Description

        Gives a new color, containing a grey color, which is calculated by the greylevel method.

      Returns

        a new Image.Color.Color object

      See also

        greylevel

      Method hex
      Method name
      Method html

        `string hex()`
        `string hex(int n)`
        `string name()`
        `string html()`

      Description

        Information methods.

        hex () simply gives a string on the `#rrggbb` format. If `n` is given, the number of significant digits is set to this number. (Ie, `n=3` gives `#rrrgggbbb`.)

        name () is a simplified method; if the color exists in the database, the name is returned, per default is the hex () method use.

        html () gives the `HTML` name of the color, or the hex (2) if it isn't one of the 16 `HTML` colors.

      Returns

        a new Image.Color.Color object

      See also

        rgb , hsv , Image.Color

      Method `==

        `int `==(object other_color)`
        `int `==(array(int) rgb)`
        `int `==(int greylevel)`
        `int `==(string name)`

      Description

        Compares this object to another color, or color name. Example:

            object red=Image.Color.red;
            object other=Image.Color. ...;
            object black=Image.Color.black;

            if (red==other) ...
            if (red==({255,0,0})) ...
            if (black==0) ...
            if (red=="red") ...

      Returns

        1 or 0

      Note

        The other datatype (not color object) must be to the right!

      See also

        rgb , grey , name

  Module Image.JPEG

    Note

      This module uses `libjpeg`, a software from Independent JPEG Group.

    Method encode

      `string encode(object image)`
      `string encode(string|object image, mapping options)`

    Description

      Encodes an image object with JPEG compression. The image may also be a string containing a raw JPEG image. In the The options argument may be a mapping containing zero or more encoding options:

      `"quality" : int(0..100)` | Set quality of result. Default is 75.
      `"optimize" : int(0..1)` | Optimize Huffman table. Default is on (1) for images smaller than 50kpixels.
      `"progressive" : int(0..1)` | Make a progressive JPEG. Default is off (0).
      `"grayscale" : int(0..1)` | Make a grayscale JPEG instead of color (YCbCr).
      `"smooth" : int(1..100)` | Smooth input. Value is strength.
      `"method" : int` | DCT method to use. Any of IFAST , ISLOW , FLOAT , DEFAULT or FASTEST . DEFAULT and FASTEST is from the jpeg library, probably ISLOW and IFAST respectively.

      `"density_unit" : int(0..2)`

      The unit used for x_density and y_density.

      `0` | No unit
      `1` | dpi
      `2` | dpcm

      `"x_density" : int` | Density of image.
      `"y_density" : int`
      `"comment" : string` | Comment to be written in the JPEG file. Must not be a wide string.
      `"baseline" : int(0..1)` | Force baseline output. Useful for quality<25. Default is off for quality<25.
      `"quant_tables" : mapping(int:array(array(int)))` | Tune quantisation tables manually.
      `"marker" : mapping(int:string)` | Application and comment markers; the integer should be one of Marker.COM , Marker.APP0 , Marker.APP1 , ..., Marker.APP15 . The string is up to the application; most notable are Adobe and Photoshop markers.

      `"transform" : int`

      Lossless image transformation. Has only effect when supplying a JPEG file as indata.

      `FLIP_H` | Flip image horizontally
      `FLIP_V` | Flip image vertically
      `ROT_90` | Rotate image 90 degrees clockwise
      `ROT_180` | Rotate image 180 degrees clockwise
      `ROT_270` | Rotate image 270 degrees clockwise
      `TRANSPOSE` | Transpose image
      `TRANSVERSE` | Transverse image

    Note

      Please read some about JPEG files. A quality setting of 100 does not mean the result is lossless.

    Method decode
    Method _decode
    Method decode_header

      `object decode(string data)`
      `object decode(string data, mapping options)`
      `mapping _decode(string data)`
      `mapping _decode(string data, mapping options)`
      `mapping decode_header(string data)`

    Description

      Decodes a JPEG image. The simple decode function simply gives the image object, the other functions gives a mapping of information (see below).

      The options argument may be a mapping containing zero or more decoding options:

      `"block_smoothing" : int(0..1)` | Do interblock smoothing. Default is on (1).
      `"fancy_upsampling" : int(0..1)` | Do fancy upsampling of chroma components. Default is on (1).
      `"method" : int` | DCT method to use. Any of IFAST , ISLOW , FLOAT , DEFAULT or FASTEST . DEFAULT and FASTEST is from the jpeg library, probably ISLOW and IFAST respective.
      `"scale_num" : int(1..)` | Rescale the image when read from JPEG data. My (Mirar) version (6a) of jpeglib can only handle 1/1, 1/2, 1/4 and 1/8.
      `"scale_denom" : int(1..)`

      _decode and decode_header gives a mapping as result, with this content:

      `"comment" : string` | Comment marker of JPEG file, if present.
      `"xsize" : int` | Size of image
      `"ysize" : int`
      `"xdpi" : float` | Image dpi, if known.
      `"ydpi" : float`
      `"type" : string` | File type information as MIME type. Always "image/jpeg".
      `"num_compontents" : int` | Number of channels in JPEG image.
      `"color_space" : string` | Color space of JPEG image. Any of "GRAYSCALE", "RGB", "YUV", "CMYK", "YCCK" or "UNKNOWN".

      `"density_unit" : int(0..2)`

      The unit used for x_density and y_density.

      `0` | No unit
      `1` | dpi
      `2` | dpcm

      `"x_density" : int` | Density of image.
      `"y_density" : int`
      `"adobe_marker" : int(0..1)` | If the file has an Adobe marker.
      `"quant_tables" : mapping(int:array(array(int)))` | JPEG quant tables.
      `"quality" : int(0..100)` | JPEG quality guess.

    Method quant_tables

      `mapping(int:array(array(int))) quant_tables(int|void a)`

    FIXME

      Document this function

    Constant IFAST

      `constant Image.JPEG.IFAST`

    Constant FLOAT

      `constant Image.JPEG.FLOAT`

    Constant DEFAULT

      `constant Image.JPEG.DEFAULT`

    Constant ISLOW

      `constant Image.JPEG.ISLOW`

    Constant FASTEST

      `constant Image.JPEG.FASTEST`

    Constant FLIP_H

      `constant Image.JPEG.FLIP_H`

    Constant FLIP_V

      `constant Image.JPEG.FLIP_V`

    Constant ROT_90

      `constant Image.JPEG.ROT_90`

    Constant ROT_180

      `constant Image.JPEG.ROT_180`

    Constant ROT_270

      `constant Image.JPEG.ROT_270`

    Constant TRANSPOSE

      `constant Image.JPEG.TRANSPOSE`

    Constant TRANSVERSE

      `constant Image.JPEG.TRANSVERSE`

    CLASS Image.JPEG.Marker

      Constant EOI

        `constant Image.JPEG.Marker.EOI`

      Constant RST0

        `constant Image.JPEG.Marker.RST0`

      Constant COM

        `constant Image.JPEG.Marker.COM`

      Constant APP0

        `constant Image.JPEG.Marker.APP0`

      Constant APP1

        `constant Image.JPEG.Marker.APP1`

      Constant APP2

        `constant Image.JPEG.Marker.APP2`

      Constant APP3

        `constant Image.JPEG.Marker.APP3`

      Constant APP4

        `constant Image.JPEG.Marker.APP4`

      Constant APP5

        `constant Image.JPEG.Marker.APP5`

      Constant APP6

        `constant Image.JPEG.Marker.APP6`

      Constant APP7

        `constant Image.JPEG.Marker.APP7`

      Constant APP8

        `constant Image.JPEG.Marker.APP8`

      Constant APP9

        `constant Image.JPEG.Marker.APP9`

      Constant APP10

        `constant Image.JPEG.Marker.APP10`

      Constant APP11

        `constant Image.JPEG.Marker.APP11`

      Constant APP12

        `constant Image.JPEG.Marker.APP12`

      Constant APP13

        `constant Image.JPEG.Marker.APP13`

      Constant APP14

        `constant Image.JPEG.Marker.APP14`

      Constant APP15

        `constant Image.JPEG.Marker.APP15`

  Module Image.SVG

    Description

      This is a glue against the librsvg-2.0 library, providing Scalable Vector Graphics (SVG) for Pike.

    Method decode_header

      `mapping decode_header(string data, void|mapping options)`

    Description

      Data is the SVG data, the charset must be unicode.

      If options is specified, it contains one or more of the following options

      `xsize : int` | If specified, gives the exact width in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `ysize : int` | If specified, gives the exact height in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `scale : float` | If specified, gives the scale the image will be drawn with. A scale of 2.0 will give an image that is twice as large.

      The result is a mapping with the following members:

      `type : string` | Always image/svg
      `xsize : int` | The width of the image, in pixels
      `ysize : int` | The height of the image, in pixels

    Method _decode

      `mapping _decode(string data, void|mapping options)`

    Description

      Data is the SVG data, the charset must be unicode.

      If options is specified, it contains one or more of the following options

      `xsize : int` | If specified, gives the exact width in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `ysize : int` | If specified, gives the exact height in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `scale : float` | If specified, gives the scale the image will be drawn with. A scale of 2.0 will give an image that is twice as large.

      The result is a mapping with the following members:

      `type : string` | Always image/svg
      `xsize : int` | The width of the image, in pixels
      `ysize : int` | The height of the image, in pixels
      `image : Image.Image` | The image data
      `alpha : Image.Image` | The alpha channel data

    Method decode_layers

      `array(Image.Layer) decode_layers(string data, void|mapping options)`

    Description

      Data is the SVG data, the charset must be unicode.

      If options is specified, it contains one or more of the following options

      `xsize : int` | If specified, gives the exact width in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `ysize : int` | If specified, gives the exact height in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `scale : float` | If specified, gives the scale the image will be drawn with. A scale of 2.0 will give an image that is twice as large.

      The result is an array of Image.Layer objects. For now there is always at most one member in the array.

    Method decode

      `Image.Image decode(string data, void|mapping options)`

    Description

      Data is the SVG data, the charset must be unicode.

      If options is specified, it contains one or more of the following options

      `xsize : int` | If specified, gives the exact width in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `ysize : int` | If specified, gives the exact height in pixels the image will have. If only one of xsize or ysize is specified, the other is calculated.
      `scale : float` | If specified, gives the scale the image will be drawn with. A scale of 2.0 will give an image that is twice as large.

      Returns the image member of the mapping returned by _decode

  Module Image.Fonts

    Description

      Abstracted Font-handling support. Should be used instead of accessing the FreeType, TTF and Image.Font modules directly.

    Constant ITALIC

      `constant Image.Fonts.ITALIC`

    Description

      The font is/should be italic

    Constant BOLD

      `constant Image.Fonts.BOLD`

    Description

      The font is/should be bold

    Constant NO_FAKE

      `constant Image.Fonts.NO_FAKE`

    Description

      Used in open_font () to specify that no fake bold or italic should be attempted.

    Method open_font

      `Font open_font(string fontname, int size, int flags, int|void force)`

    Description

      Find a suitable font in the directories specified with set_font_dirs .

      flags is a bitwise or of 0 or more of ITALIC , BOLD and NO_FAKE .

      fontname is the human-readable name of the font.

      If force is true, a font is always returned (defaulting to arial or the pike builtin font), even if no suitable font is found.

    Method list_fonts

      `mapping list_fonts()`

    Description

      Returns a list of all the fonts as a mapping.

    Method set_font_dirs

      `void set_font_dirs(array(string) directories)`

    Description

      Set the directories where fonts can be found.

    CLASS Image.Fonts.Font

      Description

        The abstract Font class. The file is a valid font-file, size is in pixels, but the size of the characters to be rendered, not the height of the finished image (the image is generally speaking bigger then the size of the characters).

      syntax

        `protected string Image.Fonts.Font.file`
        `protected int Image.Fonts.Font.size` `void Image.Fonts.Font(string file, int size)`

      Method set_fake_bold

        `int set_fake_bold(int fb)`

      Description

        The amount of 'boldness' that should be added to the font when text is rendered.

      Method set_fake_italic

        `int set_fake_italic(int(0..1) fi)`

      Description

        If true, make the font italic.

      Method text_extents

        `array(int) text_extents(string ... lines)`

      Description

        Returns ({ xsize, ysize }) of the image that will result if lines is sent as the argument to write .

      Method info

        `mapping info()`

      Description

        Returns some information about the font. Always included: file: Filename specified when the font was opened size: Size specified when the font was opened family: Family name style: Bitwise or of the style flags, i.e. ITALIC and BOLD .

      Method write

        `Image.Image write(string ... line)`

      Description

        Render the text strings sent as line as an alpha-channel image.

  Module Image.Dims

    Description

      Reads the dimensions of images of various image formats without decoding the actual image.

    Method get_JPEG

      `array(int) get_JPEG(Stdio.File f)`

    Description

      Reads the dimensions from a JPEG file and returns an array with width and height, or if the file isn't a valid image, 0.

    Method get_GIF

      `array(int) get_GIF(Stdio.File f)`

    Description

      Reads the dimensions from a GIF file and returns an array with width and height, or if the file isn't a valid image, 0.

    Method get_PNG

      `array(int) get_PNG(Stdio.File f)`

    Description

      Reads the dimensions from a PNG file and returns an array with width and height, or if the file isn't a valid image, 0.

    Method get_TIFF

      `array(int) get_TIFF(Stdio.File f)`

    Description

      Reads the dimensions from a TIFF file and returns an array with width and height, or if the file isn't a valid image, 0.

    Method get_PSD

      `array(int) get_PSD(Stdio.File f)`

    Description

      Reads the dimensions from a PSD file and returns an array with width and height, or if the file isn't a valid image, 0.

    Method get

      `array(int) get(string|Stdio.File file)`

    Description

      Read dimensions from a JPEG, GIF, PNG, TIFF or PSD file and return an array with width and height, or if the file isn't a valid image, `0`. The argument file should be file object or the data from a file. The offset pointer will be assumed to be at the start of the file data and will be modified by the function.

      As a compatibility measure, if the file is a path to an image file, it will be loaded and processed once the processing of the path as data has failed.

    Returns

      Array
      `int 0` | Image width.
      `int 1` | Image height.
      `string 2` | Image type. Any of `"gif"`, `"png"`, `"tiff"`, `"jpeg"` and `"psd"`.

  Module Image.PS

    Description

      Codec for the Adobe page description language PostScript. Uses Ghostscript for decoding or built-in support.

    Method decode

      `object decode(string data, mapping|void options)`

    Description

      Decodes the postscript data into an image object using Ghostscript.

    Parameter `options`

      Optional decoding parameters.

      `"dpi" : int` | The resolution the image should be rendered in. Defaults to 100.
      `"device" : string` | The selected Ghostscript device. Defaults to "ppmraw".
      `"binary" : string` | Path to the Ghostscript binary to be used. If missing the environment paths will be searched for a file "gs" to be used instead.
      `"force_gs" : int(0..1)` | Forces use of Ghostscript for EPS files instead of Pikes native support.
      `"eps_crop" : int(0..1)` | Use -dEPSCrop option to Ghostscript to crop the BoundingBox for a EPS file.
      `"cie_color" : int(0..1)` | Use -dUseCIEColor option to Ghostscript for mapping color values through a CIE color space.
      `"file" : string` | Filename to read. If this is specified, it will be passed along to the `gs` binary, so that it can read the file directly. If this is specified data may be set to `0` (zero).

    Note

      Some versions of `gs` on MacOS X have problems with reading files on stdin. If this occurrs, try writing to a plain file and specifying the `file` option.

    Note

      `gs` versions 7.x and earlier don't support rendering of EPSes if they are specified with the `file` option. If this is a problem, upgrade to `gs` version 8.x or later.

    Method _decode

      `mapping _decode(string data, mapping|void options)`

    Description

      Calls decode and returns the image in the "image" index of the mapping. This method is present for API reasons.

    Method encode

      `string encode(object img, mapping|void options)`

    Description

      Encodes the image object img as a postscript 3.0 file.

    Parameter `options`

      Optional extra encoding parameters.

      `"dpi" : int` | The resolution of the encoded image. Defaults to 100.
      `"eps" : int(0..1)` | If the resulting image should be an eps instead of ps. Defaults to 0, no.

    Variable _encode

      `function Image.PS._encode`

    Description

      Same as encode. Present for API reasons.

    Method decode_header

      `mapping decode_header(string data)`

    Description

      Decodes the header of the postscript data into a mapping.

      `"xsize" : int` | Size of image
      `"ysize" : int`
      `"type" : string` | File type information as MIME type. Always "application/postscript".
      `"color_space" : string` | Color space of image. "GRAYSCALE", "LAB", RGB", "CMYK" or "UNKNOWN"

  Module Image.PSD

    Method __decode

      `mapping __decode(string|mapping data)`

    Description

      Decodes a PSD image to a mapping, defined as follows.

      `"channels" : int(1..24)` | The number of channels in the image, including any alpha channels.
      `"height" : int(1..30000)` | The image dimensions.
      `"width" : int(1..30000)`
      `"compression" : int(0..1)` | 1 if the image is compressed, 0 if not.
      `"depth" : int(1..1)|int(8..8)|int(16..16)` | The number of bits per channel.

      `"mode" : int(0..4)|int(7..9)`

      The color mode of the file.

      `0` | Bitmap
      `1` | Greyscale
      `2` | Indexed
      `3` | RGB
      `4` | CMYK
      `7` | Multichannel
      `8` | Duotone
      `9` | Lab

      `"color_data" : string` | Raw color data.
      `"image_data" : string` | Ram image data.
      `"resources" : mapping(string|int:mixed)` | Additional image data. Se mappping below.
      `"layers" : array(mapping)` | An array with the layers of the image. See mapping below.

      The resources mapping. Unknown resources will be identified by their ID number (as an int).

      `"caption" : string` | Image caption.
      `"url" : string` | Image associated URL.
      `"active_layer" : int` | Which layer is active.

      `"guides" : array(mapping(string:int))`

      An array with all guides stored in the image file.

      `"pos" : int` | The position of the guide.
      `"vertical" : int(0..1)` | 1 if the guide is vertical, 0 if it is horizontal.

      `"resinof" : mapping(string:int)`

      Resolution information

      `"hres" : int` | FIXME: Document these.
      `"hres_unit" : int`
      `"width_unit" : int`
      `"vres" : int`
      `"vres_unit" : int`
      `"height_unit" : int`

      The layer mapping:

      `"top" : int` | The rectangle containing the contents of the layer.
      `"left" : int`
      `"right" : int`
      `"bottom" : int`
      `"mask_top" : int` | FIXME: Document these
      `"mask_left" : int`
      `"mask_right" : int`
      `"mask_bottom" : int`
      `"mask_flags" : int`
      `"opacity" : int(0..255)` | 0=transparent, 255=opaque.
      `"clipping" : int` | 0=base, 1=non-base.
      `"flags" : int` | bit 0=transparency protected bit 1=visible

      `"mode" : string`

      Blend mode.

      `"norm"` | Normal
      `"dark"` | Darken
      `"lite"` | Lighten
      `"hue "` | Hue
      `"sat "` | Saturation
      `"colr"` | Color
      `"lum "` | Luminosity
      `"mul "` | Multiply
      `"scrn"` | Screen
      `"diss"` | Dissolve
      `"over"` | Overlay
      `"hLit"` | Hard light
      `"sLit"` | Soft light
      `"diff"` | Difference

      `"extra_data" : string` | Raw extra data.
      `"name" : string` | The name of the layer

      `"channels" : array(mapping(string:int|string))`

      The channels of the layer. Each array element is a mapping as follows

      `"id" : int`

      The ID of the channel

      `-2` | User supplied layer mask
      `-1` | Transparency mask
      `0` | Red
      `1` | Green
      `2` | Blue

      `"data" : string` | The image data

    Method decode_layers

      `array(Image.Layer) decode_layers(string data, mapping|void options)`

    Description

      Decodes a PSD image to an array of Image.Layer objects

      Takes the same aptions mapping as _decode , note especially "draw_all_layers":1, but implements "crop_to_bounds" which preserves the bounding box for the whole image (i.e. discards data that extend outside of the global bounds).

      The layer object have the following extra variables (to be queried using Image.Layer()->get_misc_value ):

      `"image_guides"` | Returns array containing guide definitions.
      `"name"` | Returns string containing the name of the layer.
      `"visible"` | Is 1 of the layer is visible and 0 if it is hidden.

    Method _decode

      `mapping _decode(string|mapping data, mapping|void options)`

    Description

      Decodes a PSD image to a mapping, with at least an 'image' and possibly an 'alpha' object. Data is either a PSD image, or a mapping (as received from __decode )

    Parameter `options`

      `"background" : array(int)|Image.Color` | Sets the background to the given color. Arrays should be in the format ({r,g,b}).
      `"draw_all_layers" : int(0..1)` | Draw invisible layers as well.
      `"draw_guides" : int(0..1)` | Draw the guides.
      `"draw_selection" : int(0..1)` | Mark the selection using an overlay.
      `"ignore_unknown_layer_modes" : int(0..1)` | Do not asume 'Normal' for unknown layer modes.
      `"mark_layers" : int(0..1)` | Draw an outline around all (drawn) layers.
      `"mark_layer_names" : Image.Font` | Write the name of all layers using the font object,
      `"mark_active_layer" : int(0..1)` | Draw an outline around the active layer

    Returns

      `"image" : Image.Image` | The image object.
      `"alpha" : Image.Image` | The alpha channel image object.

    Note

      Throws upon error in data. For more information, see __decode

    Method decode

      `Image.Image decode(string data)`

    Description

      Decodes a PSD image to a single image object.

    Note

      Throws upon error in data. To get access to more information like alpha channels and layer names, see _decode and __decode .

  Module Image.DWG

    Description

      This module decodes the thumbnail raster images embedded in AutoCAD DWG files for AutoCAD version R13, R14 and R2000 (which equals to file version 12, 14 and 15). Implemented according to specifications from http://www.opendwg.org/.

    Method __decode

      `mapping __decode(string data)`

    Description

      Decodes the DWG data into a mapping.

      `"version" : int` | The version of the DWG file. One of 12, 14 and 15.
      `"bmp" : array(string)` | An array with the raw BMP data.
      `"wmf" : array(string)` | An array with the raw WMF data.

    Throws

      This functions throws an error when decoding somehow fails.

    Method _decode

      `mapping _decode(string data)`

    Description

      Works like __decode , but in addition it has the element `"image"` in the result mapping, containing the first successfully decoded bitmap image. to the result of decode(data).

    Throws

      If no preview was stored, or no preview could be decoded an error is thrown.

    Method decode

      `Image.Image decode(string data)`

    Description

      Returns the first successfully decoded bitmap image.

    Throws

      If no preview was stored, or no preview could be decoded an error is thrown.

Module PDF

    `constant PDF.a0_width`
    `constant PDF.a0_height`
    `constant PDF.a1_width`
    `constant PDF.a1_height`
    `constant PDF.a2_width`
    `constant PDF.a2_height`
    `constant PDF.a3_width`
    `constant PDF.a3_height`
    `constant PDF.a4_width`
    `constant PDF.a4_height`
    `constant PDF.a5_width`
    `constant PDF.a5_height`
    `constant PDF.a6_width`
    `constant PDF.a6_height`
    `constant PDF.b5_width`
    `constant PDF.b5_height`
    `constant PDF.letter_width`
    `constant PDF.letter_height`
    `constant PDF.legal_width`
    `constant PDF.legal_height`
    `constant PDF.ledger_width`
    `constant PDF.ledger_height`
    `constant PDF.p11x17_width`
    `constant PDF.p11x17_height`

  CLASS PDF.PDFgen

    Method open_file

      `int open_file(string filename)`

    Method close

      `PDF close()`

    Method begin_page

      `PDF begin_page()`
      `PDF begin_page(float width, float height)`

    Description

      note: Defaults to a4, portrait

    Method end_page

      `PDF end_page()`

    Method get_value

      `float get_value(string key)`
      `float get_value(string key, float modifier)`

    Method set_value

      `float set_value(string key, float value)`

    Method get_parameter

      `string get_parameter(string key)`
      `string get_parameter(string key, float modifier)`

    Method set_parameter

      `float set_parameter(string key, string parameter)`

    Method set_info

      `float set_info(string key, string info)`

    Method findfont

      `int findfont(string fontname)`
      `int findfont(string fontname, void|string encoding, void|int embed)`

    Method setfont

      `PDF setfont(int n, float size)`

    Method show

      `PDF show(string s)`

    Method showxy

      `PDF showxy(string s, float x, float y)`

    Method continue_text

      `PDF continue_text(string s)`

    Method show_boxed

      `int show_boxed(string text, float x, float y, float width, float height, string mode)`
      `int show_boxed(string text, float x, float y, float width, float height, string mode, string feature)`

    Method stringwidth

      `float stringwidth(string text, int font, float size)`

    Method set_text_pos

      `object set_text_pos(float x, float y)`

    Method setdash

      `object setdash(float b, float w)`

    Method setflat

      `object setflat(float flatness)`

    Method setlinejoin

      `object setlinejoin(int linejoin)`

    Method setlinecap

      `object setlinecap(int linecap)`

    Method setmiterlimit

      `object setmiterlimit(float miter)`

    Method setlinewidth

      `object setlinewidth(float width)`

    Method translate

      `object translate(float tx, float ty)`

    Method scale

      `object scale(float sx, float sy)`

    Method rotate

      `object rotate(float phi)`

    Method skew

      `object skew(float alpha, float beta)`

    Method concat

      `object concat(float a, float b, float c, float d, float e, float f)`

    Method moveto

      `object moveto(float x, float y)`

    Method lineto

      `object lineto(float x, float y)`

    Method curveto

      `object curveto(float x1, float y1, float x2, float y2, float x3, float y3)`

    Method circle

      `object circle(float x, float y, float r)`

    Method arc

      `object arc(float x, float y, float r, float start, float end)`

    Method rect

      `object rect(float x, float y, float width, float height)`

    Method setgray_fill

      `object setgray_fill(float gray)`

    Method setgray_stroke

      `object setgray_stroke(float gray)`

    Method setgray

      `object setgray(float gray)`

    Method setrgbcolor_fill

      `object setrgbcolor_fill(float red, float green, float blue)`

    Method setrgbcolor_stroke

      `object setrgbcolor_stroke(float red, float green, float blue)`

    Method setrgbcolor

      `object setrgbcolor(float red, float green, float blue)`

    Method open_image_file

      `int open_image_file(string type, string filename)`
      `int open_image_file(string type, string filename, void|string stringparam, void|int intparam)`

    Method open_CCITT

      `int open_CCITT(string filename, int width, int height, int BitReverse, int K, int BlackIs1)`

    Method open_image

      `int open_image(string type, string source, string data, int width, int height, int components, int bpc, string params)`

    Method close_image

      `object close_image(int image)`

    Method place_image

      `object place_image(int image, float x, float y, float scale)`

    Method add_bookmark

      `int add_bookmark(string text, int parent, int open)`

    Method attach_file

      `object attach_file(float llx, float lly, float urx, float ury, string filename, string description, string author, string mimetype, string icon)`

    Method add_pdflink

      `object add_pdflink(float llx, float lly, float urx, float ury, string filename, int page, string dest)`

    Method add_locallink

      `object add_locallink(float llx, float lly, float urx, float ury, int page, string dest)`

    Method add_launchlink

      `object add_launchlink(float llx, float lly, float urx, float ury, string filename)`

    Method add_weblink

      `object add_weblink(float llx, float lly, float urx, float ury, string url)`

    Method set_border_style

      `object set_border_style(string style, float width)`

    Method set_border_color

      `object set_border_color(float red, float green, float blue)`

    Method set_border_dash

      `object set_border_dash(float b, float w)`

Module Postgres

  CLASS Postgres.postgres_result

    Description

      Contains the result of a Postgres-query.

    See also

      Sql.postgres, Postgres.postgres, Sql.Sql, Sql.sql_result

    Method create

      `void Postgres.postgres_result(object o)`

    Description

      You can't create istances of this object yourself. The only way to create it is via a big_query to a Postgres database.

    Method num_rows

      `int num_rows()`

    Description

      Returns the number of rows in the result.

    Method num_fields

      `int num_fields()`

    Description

      Returns the number of fields in the result.

    Method fetch_fields

      `array(mapping(string:mixed)) fetch_fields()`

    Description

      Returns an array with an entry for each field, each entry is a mapping with the following fields:

      `"name" : string` | Name of the column
      `"type" : int` | The type ID of the field. This is the database's internal representation type ID.
      `"length" : int|string` | Can be an integer (the size of the contents in bytes) or the word "variable".

    Note

      For char() fields, length is to be intended as the MAXIMUM length of the field. This is not part of the interface specifications in fact, but a driver-choice. In fact char() fields are for Postgres _FIXED_ length fields, and are space-padded. If CUT_TRAILING_SPACES is defined when the driver is compiled (default behavior) it will cut such spaces.

    Method seek

      `void seek()`

    Description

      Moves the result cursor (ahead or backwards) the specified number of rows. Notice that when you fetch a row, the cursor is automatically moved forward one slot.

    Method fetch_row

      `array(string) fetch_row()`

    Description

      Returns an array with the contents of the next row in the result. Advances the row cursor to the next row. Returns 0 at end of table.

    Bugs

      Since there's no generic way to know whether a type is numeric or not in Postgres, all results are returned as strings. You can typecast them in Pike to get the numeric value.

    See also

      seek()

  CLASS Postgres.postgres

    Description

      This is an interface to the Postgres database server using libpq. This module may or may not be available on your Pike, depending whether the appropriate include and library files could be found at compile-time. Note that you do not need to have a Postgres server running on your host to use this module: you can connect to the database over a TCP/IP socket.

      Please notice that unless you wish to specifically connect to a Postgres server, you'd better use the Sql.Sql , which is a server-independent sql-server-class. The interfaces to all existing sql-classes are consistent. Using Sql.Sql ensures that your Pike applications will run with any supported SQL server without changing a single line of code, at least for most common (and simple) operations.

      The program Postgres.postgres provides the raw interface to the database. Many functions are not available for this program. Therefore, its use is DEPRECATED. It is included in this documentation only for completeness' sake. Use Sql.postgres instead, or even better Sql.Sql

    Note

      This driver is based on libpq and is DEPRECATED. There is a newer driver called Sql.pgsql which is faster and more robust than this driver and does not depend on any libraries.

    Note

      There is no testsuite for this module, since to test anything would require a working Postgres server. You can try to use the included scripts in the "pike/src/modules/Postgres/extras" directory but you'll probably have to patch them to reflect your site's settings.

      The behavior of the Postgres C API also depends on certain environment variables defined in the environment of the pike interpreter.

      `"PGHOST"` | Sets the name of the default host to connect to. It defaults to "localhost"
      `"PGOPTIONS"` | Sets some extra flags for the frontend-backend connection. DO NOT SET unless you're sure of what you're doing.
      `"PGPORT"` | Sets the default port to connect to, otherwise it will use compile-time defaults (that is: the time you compiled the postgres library, not the Pike driver).
      `"PGTTY"` | Sets the file to be used for Postgres frontend debugging. Do not use, unless you're sure of what you're doing.
      `"PGDATABASE"` | Sets the default database to connect to.
      `"PGREALM"` | Sets the default realm for Kerberos authentication. I never used this, so I can't help you.

      Refer to the libpq documentation for further details.

    See also

      Sql.Sql , Sql.postgres , Sql.postgres_result

    Variable version

      `string Postgres.postgres.version`

    Description

      Should you need to report a bug to the author, please submit along with the report the driver version number, as returned by this call.

    Method create

      `void Postgres.postgres()`
      `void Postgres.postgres(string host, void|string database, void|int port)`

    Description

      With no arguments, this function initializes (reinitializes if a connection had been previously set up) a connection to the Postgres backend. Since Postgres requires a database to be selected, it will try to connect to the default database. The connection may fail however for a variety of reasons, in this case the most likely of all is because you don't have enough authority to connect to that database. So use of this particular syntax is discouraged.

      The host argument allows you to connect to databases residing on different hosts. If it is 0 or "", it will try to connect to localhost.

      The database argument specifies the database to connect to. If 0 or "", it will try to connect to the default database.

    Note

      You need to have a database selected before using the sql-object, otherwise you'll get exceptions when you try to query it. Also notice that this function can raise exceptions if the db server doesn't respond, if the database doesn't exist or is not accessible by you.

      You don't need bothering about syncronizing the connection to the database: it is automatically closed (and the database is sync-ed) when the object is destroyed.

    See also

      Sql.postgres , Sql.Sql , select_db

    Method select_db

      `void select_db(string dbname)`

    Description

      This function allows you to connect to a database. Due to restrictions of the Postgres frontend-backend protocol, you always have to be connected to a database, so in fact this function just allows you to connect to a different database on the same server.

    Note

      This function can raise exceptions if something goes wrong (backend process not running, not enough permissions..)

    See also

      create

    Method big_query

      `Sql.postgres_result big_query(string sqlquery)`

    Description

      This is the only provided interface which allows you to query the database. If you wish to use the simpler "query" function, you need to use the Sql.Sql generic sql-object.

      It returns a postgres_result object (which conforms to the Sql.sql_result standard interface for accessing data). I recommend using query() for simpler queries (because it is easier to handle, but stores all the result in memory), and big_query for queries you expect to return huge amounts of data (it's harder to handle, but fectches results on demand).

    Note

      This function can raise exceptions.

      The program Sql.postgres_result is a superset of the raw Postgres.postgres_result which does not do chunking to avoid excessive memory usage in case of large resultsets.

    See also

      Sql.Sql , Sql.sql_result

    Method error

      `string error()`

    Description

      This function returns the textual description of the last server-related error. Returns 0 if no error has occurred yet. It is not cleared upon reading (can be invoked multiple times, will return the same result until a new error occurs).

    See also

      big_query

    Method reset

      `void reset()`

    Description

      This function resets the connection to the backend. Can be used for a variety of reasons, for example to detect the status of a connection.

    Note

      This function is Postgres-specific, and thus it is not available through the generic SQL-interface.

    Method _set_notify_callback

      `void _set_notify_callback()`
      `void _set_notify_callback(function f)`

    Description

      With Postgres you can associate events and notifications to tables. This function allows you to detect and handle such events.

      With no arguments, resets and removes any callback you might have put previously, and any polling cycle.

      With one argument, sets the notification callback (there can be only one for each sqlobject).

      The callback function must return no value, and takes a string argument, which will be the name of the table on which the notification event has occurred. In future versions, support for user-specified arguments will be added.

    Note

      The Sql.postgres program adds support for automatic delivery of messages (see it for explanation on the inner workings of this feature).

      This function is Postgres-specific, and thus it is not available through the generic SQL-interface

    See also

      Sql.postgres

    Method host_info

      `string host_info()`

    Description

      This function returns a string describing what host are we talking to, and how (TCP/IP or UNIX sockets).

    Method affected_rows

      `int affected_rows()`

    Description

      This function returns the number of rows affected by the last query.

    Method _quote

      `string _quote(string s)`

    Description

      Escape a string to prevent SQL injection, using the current connection's character encoding settings.

Module Gmp

  Description

    GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. http://www.swox.com/gmp/

  Method fac

    `Gmp.mpz fac(int x)`

  Description

    Returns the factorial of x (x !).

  CLASS Gmp.mpf

    Description

      GMP floating point number.

      The mantissa of each float has a user-selectable precision, limited only by available memory. Each variable has its own precision, and that can be increased or decreased at any time.

      The exponent of each float is a fixed precision, one machine word on most systems. In the current implementation the exponent is a count of limbs, so for example on a 32-bit system this means a range of roughly 2^-68719476768 to 2^68719476736, or on a 64-bit system this will be greater.

      Each variable keeps a size for the mantissa data actually in use. This means that if a float is exactly represented in only a few bits then only those bits will be used in a calculation, even if the selected precision is high.

      All calculations are performed to the precision of the destination variable. Each function is defined to calculate with "infinite precision" followed by a truncation to the destination precision, but of course the work done is only what's needed to determine a result under that definition.

      The precision selected for a variable is a minimum value, GMP may increase it a little to facilitate efficient calculation. Currently this means rounding up to a whole limb, and then sometimes having a further partial limb, depending on the high limb of the mantissa. But applications shouldn't be concerned by such details.

      The mantissa in stored in binary, as might be imagined from the fact precisions are expressed in bits. One consequence of this is that decimal fractions like 0.1 cannot be represented exactly. The same is true of plain IEEE double floats. This makes both highly unsuitable for calculations involving money or other values that should be exact decimal fractions. (Suitably scaled integers, or perhaps rationals, are better choices.)

      mpf functions and variables have no special notion of infinity or not-a-number, and applications must take care not to overflow the exponent or results will be unpredictable. This might change in a future release.

      Note that the mpf functions are not intended as a smooth extension to IEEE P754 arithmetic. In particular results obtained on one computer often differ from the results on a computer with a different word size.

    Method create

      `void Gmp.mpf(void|int|string|float|object x, void|int(0..) precision)`
      `void Gmp.mpf(string x, int(0..) precision, int(2..36) base)`

    Method __hash

      `int __hash()`

    Method get_int

      `int|object get_int()`

    Method get_float

      `float get_float()`

    Description

      Returns the value of the object as a float.

    Method get_string

      `string get_string()`

    Method _sprintf

      `string _sprintf(int c, mapping flags)`

    Method _is_type

      `int(0..1) _is_type(string arg)`

    Description

      The Gmp.mpf object will claim to be a `"float"`.

    FIXME

      Perhaps it should also return true for `"object"`?

    Method cast

      `mixed cast(string to)`

    Method `+

      `Gmp.mpf `+(int|float|object ... a)`

    Method `+=

      `Gmp.mpf `+=(int|float|object ... a)`

    Method set_precision

      `Gmp.mpf set_precision(int(0..) prec)`

    Description

      Sets the precision of the current object to be at least prec bits. The precision is limited to 128Kb. The current object will be returned.

    Method get_precision

      `int(0..) get_precision()`

    Description

      Returns the current precision, in bits.

    Method `*

      `Gmp.mpf `*(int|float|object ... a)`

    Method ``*

      `Gmp.mpf ``*(int|float|object ... a)`

    Method `*=

      `Gmp.mpf `*=(int|float|object ... a)`

    Method `-

      `Gmp.mpf `-(int|float|object ... a)`

    Method ``-

      `Gmp.mpf ``-(int|float|object sv)`

    Method `/

      `Gmp.mpf `/(int|float|object ... a)`

    Method ``/

      `Gmp.mpf ``/(int|float|object sv)`

    Method `~

      `Gmp.mpf `~()`

    Method `>

      `int(0..1) `>(mixed q)`

    Method `<

      `int(0..1) `<(mixed q)`

    Method `>=

      `int(0..1) `>=(mixed q)`

    Method `<=

      `int(0..1) `<=(mixed q)`

    Method `==

      `int(0..1) `==(mixed q)`

    Method `!=

      `int(0..1) `!=(mixed q)`

    Method sgn

      `int sgn()`

    Method `!

      `int(0..1) `!()`

  CLASS Gmp.mpq

    Description

      Rational number stored in canonical form. The canonical from means that the denominator and the numerator have no common factors, and that the denominator is positive. Zero has the unique representation 0/1. All functions canonicalize their result.

    Method create

      `void Gmp.mpq(void|string|int|float|Gmp.mpz|Gmp.mpq x)`
      `void Gmp.mpq(int numerator, int denominator)`
      `void Gmp.mpq(string x, int base)`

    Method get_int

      `int get_int()`

    Method __hash

      `int __hash()`

    Method get_float

      `float get_float()`

    Method get_string

      `string get_string()`

    Method num

      `int num()`

    Description

      Returns the numerator.

    Method den

      `int den()`

    Description

      Returns the denominator. It is always positive.

    Method _sprintf

      `string _sprintf(int c, mapping flags)`

    Method _is_type

      `int(0..1) _is_type(string arg)`

    Method cast

      `int|string|float|object cast(string s)`

    Method `+

      `Gmp.mpq `+(int|float|object ... a)`

    Method ``+

      `Gmp.mpq ``+(int|float|object ... a)`

    Method `+=

      `Gmp.mpq `+=(int|float|object ... a)`

    Method `*

      `Gmp.mpq `*(int|float|object ... a)`

    Method ``*

      `Gmp.mpq ``*(int|float|object ... a)`

    Method `*=

      `Gmp.mpq `*=(int|float|object ... a)`

    Method `-

      `Gmp.mpq `-(int|float|object ... a)`

    Method ``-

      `Gmp.mpq ``-(int|float|object sv)`

    Method `/

      `Gmp.mpq `/(int|float|object ... a)`

    Method ``/

      `Gmp.mpq ``/(int|float|object sv)`

    Method `%

      `Gmp.mpq `%(int|float|object ... a)`

    Description

      `a%b = a - floor(a/b)*b`

    Method ``%

      `Gmp.mpq ``%(int|float|object a)`

    Method invert

      `Gmp.mpq invert()`

    Method `~

      `Gmp.mpq `~()`

    Description

      Defined as `-1-x`.

    Method `>

      `int(0..1) `>(mixed q)`

    Method `<

      `int(0..1) `<(mixed q)`

    Method `>=

      `int(0..1) `>=(mixed q)`

    Method `<=

      `int(0..1) `<=(mixed q)`

    Method `==

      `int(0..1) `==(mixed q)`

    Method `!=

      `int(0..1) `!=(mixed q)`

    Method sgn

      `int(-1..1) sgn()`

    Method `!

      `int(0..1) `!(mixed q)`

  CLASS Gmp.bignum

    Description

      This program is used by the internal auto-bignum conversion. It can be used to explicitly type integers that are too big to be INT_TYPE. Best is however to not use this program unless you really know what you are doing.

      Due to the auto-bignum conversion, all integers can be treated as Gmp.mpz objects insofar as that they can be indexed with the functions in the Gmp.mpz class. For instance, to calculate the greatest common divisor between `51` and `85`, you can do `51->gcd(85)`. In other words, all the functions in Gmp.mpz are also available here.

  CLASS Gmp.mpz

    Description

      Gmp.mpz implements very large integers. In fact, the only limitation on these integers is the available memory. The mpz object implements all the normal integer operations.

      Note that the auto-bignum feature also makes these operations available "in" normal integers. For instance, to calculate the greatest common divisor between `51` and `85`, you can do `51->gcd(85)`.

    Method create

      `void Gmp.mpz()`
      `void Gmp.mpz(string|int|float|object value)`
      `void Gmp.mpz(string value, int(2..36)|int(256..256) base)`

    Description

      Create and initialize a Gmp.mpz object.

    Parameter `value`

      Initial value. If no value is specified, the object will be initialized to zero.

    Parameter `base`

      Base the value is specified in. The default base is base 10. The base can be either a value in the range `[2..36]` (inclusive), in which case the numbers are taken from the ASCII range `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ` (case-insensitive), or the value 256, in which case value is taken to be the binary representation in network byte order.

    Note

      Leading zeroes in value are not significant. In particular leading NUL characters are not preserved in base 256 mode.

    Method cast_to_int

      `int cast_to_int()`

    Method __hash

      `int __hash()`

    Description

      Calculate a hash of the value.

    Note

      Prior to Pike 7.8.359 this function returned the low 32-bits as an unsigned integer. This could in some common cases lead to very unbalanced mappings.

    See also

      hash_value()

    Method cast_to_float

      `float cast_to_float()`

    Method cast_to_string

      `string cast_to_string()`

    Method digits

      `string digits(void|int(2..36)|int(256..256) base)`

    Description

      Convert this mpz object to a string. If a base is given the number will be represented in that base. Valid bases are 2-36 and 256. The default base is 10.

    See also

      cast_to_string

    Method _sprintf

      `string _sprintf(int ind, mapping opt)`

    Method _is_type

      `int(0..1) _is_type(string type)`

    Method size

      `int size(void|int base)`

    Description

      Return how long this mpz would be represented in the specified base . The default base is 2.

    Method cast

      `mixed cast(string type)`

    Description

      Cast this mpz object to another type. Allowed types are string, int and float.

    See also

      cast_to_int , cast_to_float , cast_to_string

    Method `+

      `Gmp.mpz `+(int|float|Gmp.mpz ... x)`

    Method ``+

      `Gmp.mpz ``+(int|float|Gmp.mpz ... x)`

    Method `+=

      `Gmp.mpz `+=(int|float|Gmp.mpz ... x)`

    Method `*

      `Gmp.mpz `*(int|float|Gmp.mpz ... x)`

    Method ``*

      `Gmp.mpz ``*(int|float|Gmp.mpz ... x)`

    Method `*=

      `Gmp.mpz `*=(int|float|Gmp.mpz ... x)`

    Method gcd

      `Gmp.mpz gcd(object|int|float|string ... arg)`

    Description

      Return the greatest common divisor between this mpz object and all the arguments.

    Method `-

      `Gmp.mpz `-(int|float|Gmp.mpz ... x)`

    Method ``-

      `Gmp.mpz ``-(int|float|Gmp.mpz ... x)`

    Method `/

      `Gmp.mpz `/(int|float|Gmp.mpz ... x)`

    Method ``/

      `Gmp.mpz ``/(int|float|Gmp.mpz ... x)`

    Method `%

      `Gmp.mpz `%(int|float|Gmp.mpz ... x)`

    Method ``%

      `Gmp.mpz ``%(int|float|Gmp.mpz ... x)`

    Method gcdext

      `array(Gmp.mpz) gcdext(int|float|Gmp.mpz x)`

    Description

      Compute the greatest common divisor between this mpz object and x . An array `({g,s,t})` is returned where `g` is the greatest common divisor, and `s` and `t` are the coefficients that satisfies

      this * s + x * t = g

  See also

    gcdext2 , gcd

  Method gcdext2

    `array(Gmp.mpz) gcdext2(int|float|Gmp.mpz x)`

  Description

    Compute the greatest common divisor between this mpz object and x . An array `({g,s})` is returned where `g` is the greatest common divisor, and `s` is a coefficient that satisfies

    this * s + x * t = g

  where `t` is some integer value.

See also

  gcdext , gcd

Method invert

  `Gmp.mpz invert(int|float|Gmp.mpz x)`

Description

  Return the inverse of this mpz value modulo x . The returned value satisfies `0 <= result < x`.

Throws

  An error is thrown if no inverse exists.

Method fac

  `Gmp.mpz fac()`

Description

  Return the factorial of this mpz object.

Throws

  Since factorials grow very quickly, only small integers are supported. An error is thrown if the value in this mpz object is too large.

Method bin

  `Gmp.mpz bin(int k)`

Description

  Return the binomial coefficient `n` over k , where `n` is the value of this mpz object. Negative values of `n` are supported using the identity

  (-n)->bin(k) == (-1)->pow(k) * (n+k-1)->bin(k)

(See Knuth volume 1, section 1.2.6 part G.)

Throws

  The k value can't be arbitrarily large. An error is thrown if it's too large.

Note

  This function is currently (Pike 7.8) not available with old releases of the gmp libraries.

Method `&

  `Gmp.mpz `&(int|float|Gmp.mpz ... x)`

Method `|

  `Gmp.mpz `|(int|float|Gmp.mpz ... x)`

Method `^

  `Gmp.mpz `^(int|float|Gmp.mpz ... x)`

Method `~

  `Gmp.mpz `~()`

Method `>

  `int(0..1) `>(mixed with)`

Method `<

  `int(0..1) `<(mixed with)`

Method `>=

  `int(0..1) `>=(mixed with)`

Method `<=

  `int(0..1) `<=(mixed with)`

Method `==

  `int(0..1) `==(mixed with)`

Method `!=

  `int(0..1) `!=(mixed with)`

Method probably_prime_p

  `int(0..1) probably_prime_p()`

Description

  Return 1 if this mpz object is a prime, and 0 most of the time if it is not.

Method small_factor

  `int small_factor(void|int(1..) limit)`

Method next_prime

  `Gmp.mpz next_prime(void|int count, void|int limit)`

Method sgn

  `int sgn()`

Method sqrt

  `Gmp.mpz sqrt()`

Description

  Return the the truncated integer part of the square root of this mpz object.

Method sqrtrem

  `array(Gmp.mpz) sqrtrem()`

Method `<<

  `Gmp.mpz `<<(int|float|Gmp.mpz x)`

Method `>>

  `Gmp.mpz `>>(int|float|Gmp.mpz x)`

Method ``<<

  `Gmp.mpz ``<<(int|float|Gmp.mpz x)`

Method ``>>

  `Gmp.mpz ``>>(int|float|Gmp.mpz x)`

Method powm

  `Gmp.mpz powm(int|string|float|Gmp.mpz exp, int|string|float|Gmp.mpz mod)`

Description

  Return `( this->pow(<font face='courier'>exp` ) ) % <font face='courier'>mod .

See also

  pow

Method pow

  `Gmp.mpz pow(int|float|Gmp.mpz x)`

Description

  Return this mpz object raised to x . The case when zero is raised to zero yields one.

See also

  powm

Method `!

  `int(0..1) `!()`

Method popcount

  `int popcount()`

Description

  For values >= 0, returns the population count (the number of set bits). For negative values (who have an infinite number of leading ones in a binary representation), -1 is returned.

Method _random

  `Gmp.mpz _random()`

Method _encode

  `string _encode()`

Method _decode

  `void _decode(string)`

Module MIME

  Description

    RFC1521, the Multipurpose Internet Mail Extensions memo, defines a structure which is the base for all messages read and written by modern mail and news programs. It is also partly the base for the HTTP protocol. Just like RFC822, MIME declares that a message should consist of two entities, the headers and the body. In addition, the following properties are given to these two entities:

    Headers

      - A MIME-Version header must be present to signal MIME compatibility

      - A Content-Type header should be present to describe the nature of the data in the message body. Seven major types are defined, and an extensive number of subtypes are available. The header can also contain attributes specific to the type and subtype.

      - A Content-Transfer-Encoding may be present to notify that the data of the body is encoded in some particular encoding.

    Body

      - Raw data to be interpreted according to the Content-Type header

      - Can be encoded using one of several Content-Transfer-Encodings to allow transport over non 8bit clean channels

    The MIME module can extract and analyze these two entities from a stream of bytes. It can also recreate such a stream from these entities. To encapsulate the headers and body entities, the class MIME.Message is used. An object of this class holds all the headers as a mapping from string to string, and it is possible to obtain the body data in either raw or encoded form as a string. Common attributes such as message type and text char set are also extracted into separate variables for easy access.

    The Message class does not make any interpretation of the body data, unless the content type is `multipart`. A multipart message contains several individual messages separated by boundary strings. The Message->create method of the Message class will divide a multipart body on these boundaries, and then create individual Message objects for each part. These objects will be collected in the array Message->body_parts within the original Message object. If any of the new Message objects have a body of type multipart, the process is of course repeated recursively.

  Method decode_base64

    `string decode_base64(string encoded_data)`

  Description

    This function decodes data encoded using the `base64` transfer encoding.

  See also

    MIME.encode_base64() , MIME.decode()

  Method encode_base64

    `string encode_base64(string data, void|int no_linebreaks)`

  Description

    This function encodes data using the `base64` transfer encoding.

    If a nonzero value is passed as no_linebreaks , the result string will not contain any linebreaks.

  See also

    MIME.decode_base64() , MIME.encode()

  Method decode_qp

    `string decode_qp(string encoded_data)`

  Description

    This function decodes data encoded using the `quoted-printable` (a.k.a. quoted-unreadable) transfer encoding.

  See also

    MIME.encode_qp() , MIME.decode()

  Method encode_qp

    `string encode_qp(string data, void|int no_linebreaks)`

  Description

    This function encodes data using the `quoted-printable` (a.k.a. quoted-unreadable) transfer encoding.

    If a nonzero value is passed as no_linebreaks , the result string will not contain any linebreaks.

  Note

    Please do not use this function. QP is evil, and there's no excuse for using it.

  See also

    MIME.decode_qp() , MIME.encode()

  Method decode_uue

    `string decode_uue(string encoded_data)`

  Description

    This function decodes data encoded using the `x-uue` transfer encoding. It can also be used to decode generic UUEncoded files.

  See also

    MIME.encode_uue() , MIME.decode()

  Method encode_uue

    `string encode_uue(string encoded_data, void|string filename)`

  Description

    This function encodes data using the `x-uue` transfer encoding.

    The optional argument filename specifies an advisory filename to include in the encoded data, for extraction purposes.

    This function can also be used to produce generic UUEncoded files.

  See also

    MIME.decode_uue() , MIME.encode()

  Method tokenize

    `array(string|int) tokenize(string header, int|void flags)`

  Description

    A structured header field, as specified by RFC822, is constructed from a sequence of lexical elements.

  Parameter `header`

    The header value to parse.

  Parameter `flags`

    An optional set of flags. Currently only one flag is defined:

    `TOKENIZE_KEEP_ESCAPES` | Keep backslash-escapes in quoted-strings.

    The lexical elements parsed are:

      individual special characters

      quoted-strings

      domain-literals

      comments

      atoms

    This function will analyze a string containing the header value, and produce an array containing the lexical elements.

    Individual special characters will be returned as characters (i.e. `int`s).

    Quoted-strings, domain-literals and atoms will be decoded and returned as strings.

    Comments are not returned in the array at all.

  Note

    As domain-literals are returned as strings, there is no way to tell the domain-literal `[127.0.0.1]` from the quoted-string `"[127.0.0.1]"`. Hopefully this won't cause any problems. Domain-literals are used seldom, if at all, anyway...

    The set of special-characters is the one specified in RFC1521 (i.e. `"<", ">", "@", ",", ";", ":", "\", "/", "?", "="`), and not the set specified in RFC822.

  See also

    MIME.quote() , tokenize_labled() , decode_words_tokenized_remapped() .

  Method tokenize_labled

    `array(array(string|int)) tokenize_labled(string header, int|void flags)`

  Description

    Similar to tokenize() , but labels the contents, by making arrays with two elements; the first a label, and the second the value that tokenize() would have put there, except for that comments are kept.

  Parameter `header`

    The header value to parse.

  Parameter `flags`

    An optional set of flags. Currently only one flag is defined:

    `TOKENIZE_KEEP_ESCAPES` | Keep backslash-escapes in quoted-strings.

    The following labels exist:

    `"encoded-word"` | Word encoded according to =?...
    `"special"` | Special character.
    `"word"` | Word.
    `"domain-literal"` | Domain literal.
    `"comment"` | Comment.

  See also

    MIME.quote() , tokenize() , decode_words_tokenized_labled_remapped()

  Method quote

    `string quote(array(string|int) lexical_elements)`

  Description

    This function is the inverse of the MIME.tokenize function.

    A header field value is constructed from a sequence of lexical elements. Characters (`int`s) are taken to be special-characters, whereas strings are encoded as atoms or quoted-strings, depending on whether they contain any special characters.

  Note

    There is no way to construct a domain-literal using this function. Neither can it be used to produce comments.

  See also

    MIME.tokenize()

  Method quote_labled

    `string quote_labled(array(array(string|int)) tokens)`

  Description

    This function performs the reverse operation of tokenize_labled() .

  See also

    MIME.quote() , MIME.tokenize_labled()

  Inherit ___MIME

    inherit ___MIME : ___MIME

  Method generate_boundary

    `string generate_boundary()`

  Description

    This function will create a string that can be used as a separator string for multipart messages. The generated string is guaranteed not to appear in `base64`, `quoted-printable`, or `x-uue` encoded data. It is also unlikely to appear in normal text. This function is used by the cast method of the `Message` class if no boundary string is specified.

  Method decode

    `string|StringRange decode(string|StringRange data, string encoding)`

  Description

    Extract raw data from an encoded string suitable for transport between systems.

    The encoding can be any of

    `"7bit"`
    `"8bit"`
    `"base64"`
    `"binary"`
    `"quoted-printable"`
    `"x-uue"`
    `"x-uuencode"`

    The encoding string is not case sensitive.

  See also

    MIME.encode()

  Method encode

    `string encode(string data, string encoding, void|string filename, void|int no_linebreaks)`

  Description

    Encode raw data into something suitable for transport to other systems.

    The encoding can be any of

    `"7bit"`
    `"8bit"`
    `"base64"`
    `"binary"`
    `"quoted-printable"`
    `"x-uue"`
    `"x-uuencode"`

    The encoding string is not case sensitive. For the `x-uue` encoding, an optional filename string may be supplied.

    If a nonzero value is passed as no_linebreaks , the result string will not contain any linebreaks (`base64` and `quoted-printable` only).

  See also

    MIME.decode()

  Method decode_word

    `array(string) decode_word(string word)`

  Description

    Extracts the textual content and character set from an encoded word as specified by RFC1522. The result is an array where the first element is the raw text, and the second element the name of the character set. If the input string is not an encoded word, the result is still an array, but the char set element will be set to 0.

  Note

    Note that this function can only be applied to individual encoded words.

  See also

    MIME.encode_word()

  Method encode_word

    `string encode_word(string|array(string) word, string encoding)`

  Description

    Create an encoded word as specified in RFC1522 from an array containing a raw text string and a char set name.

    The text will be transfer encoded according to the encoding argument, which can be either `"base64"` or `"quoted-printable"` (or either `"b"` or `"q"` for short).

    If either the second element of the array (the char set name), or the encoding argument is 0, the raw text is returned as is.

  See also

    MIME.decode_word()

  Method decode_words_text

    `array(array(string)) decode_words_text(string txt)`

  Description

    Separates a header value containing text into units and calls MIME.decode_word() on them. The result is an array where each element is a result from decode_word() .

  See also

    MIME.decode_words_tokenized MIME.decode_words_text_remapped

  Method decode_words_text_remapped

    `string decode_words_text_remapped(string txt)`

  Description

    Like MIME.decode_words_text() , but the extracted strings are also remapped from their specified character encoding into UNICODE, and then pasted together. The result is thus a string in the original text format, without RFC1522 escapes, and with all characters in UNICODE encoding.

  See also

    MIME.decode_words_tokenized_remapped

  Method decode_words_tokenized

    `array(array(string)|int) decode_words_tokenized(string phrase, int|void flags)`

  Description

    Tokenizes a header value just like MIME.tokenize() , but also converts encoded words using MIME.decode_word() . The result is an array where each element is either an `int` representing a special character, or an `array` as returned by decode_word() representing an atom or a quoted string.

  See also

    MIME.decode_words_tokenized_labled MIME.decode_words_tokenized_remapped MIME.decode_words_text

  Method decode_words_tokenized_remapped

    `array(string|int) decode_words_tokenized_remapped(string phrase, int|void flags)`

  Description

    Like MIME.decode_words_tokenized() , but the extracted atoms are also remapped from their specified character encoding into UNICODE. The result is thus identical to that of MIME.tokenize() , but without RFC1522 escapes, and with all characters in UNICODE encoding.

  See also

    MIME.decode_words_tokenized_labled_remapped MIME.decode_words_text_remapped

  Method decode_words_tokenized_labled

    `array(array(string|int|array(array(string)))) decode_words_tokenized_labled(string phrase, int|void flags)`

  Description

    Tokenizes and labels a header value just like MIME.tokenize_labled() , but also converts encoded words using MIME.decode_word() . The result is an array where each element is an array of two or more elements, the first being the label. The rest of the array depends on the label:

    `"special"` | One additional element, containing the character code for the special character as an `int`.
    `"word"` | Two additional elements, the first being the word, and the second being the character set of this word (or 0 if it did not originate from an encoded word).
    `"domain-literal"` | One additional element, containing the domain literal as a string.
    `"comment"` | One additional element, containing an array as returned by MIME.decode_words_text() .

  See also

    MIME.decode_words_tokenized_labled_remapped

  Method decode_words_tokenized_labled_remapped

    `array(array(string|int)) decode_words_tokenized_labled_remapped(string phrase, int|void flags)`

  Description

    Like MIME.decode_words_tokenized_labled() , but the extracted words are also remapped from their specified character encoding into UNICODE. The result is identical to that of MIME.tokenize_labled() , but without RFC1522 escapes, and with all characters in UNICODE encoding.

  Method encode_words_text

    `string encode_words_text(array(string|array(string)) phrase, string encoding)`

  Description

    The inverse of decode_words_text() , this function accepts an array of strings or pairs of strings which will each be encoded by encode_word() , after which they are all pasted together.

  Parameter `encoding`

    Either `"base64"` or `"quoted-printable"` (or either `"b"` or `"q"` for short).

  See also

    MIME.encode_words_text_remapped

  Method encode_words_text_remapped

    `string encode_words_text_remapped(string text, string encoding, string|function(string:string) charset, string|void replacement, function(string:string)|void repcb)`

  Description

    This is the reverse of MIME.decode_words_text_remapped() . A single UNICODE string is provided, which is separated into fragments and transcoded to selected character sets by this function as needed.

  Parameter `encoding`

    Either `"base64"` or `"quoted-printable"` (or either `"b"` or `"q"` for short).

  Parameter `charset`

    Either the name of a character set to use, or a function returning a character set to use given a text fragment as input.

  Parameter `replacement`

    The replacement argument to use when calling Locale.Charset.encoder

  Parameter `repcb`

    The repcb argument to use when calling Locale.Charset.encoder

  See also

    MIME.encode_words_tokenized_remapped

  Method encode_words_quoted

    `string encode_words_quoted(array(array(string)|int) phrase, string encoding)`

  Description

    The inverse of decode_words_tokenized() , this functions accepts an array like the argument to quote() , but instead of simple strings for atoms and quoted-strings, it will also accept pairs of strings to be passed to encode_word() .

  Parameter `encoding`

    Either `"base64"` or `"quoted-printable"` (or either `"b"` or `"q"` for short).

  See also

    MIME.encode_words_quoted_remapped() MIME.encode_words_quoted_labled()

  Method encode_words_quoted_remapped

    `string encode_words_quoted_remapped(array(string|int) phrase, string encoding, string|function(string:string) charset, string|void replacement, function(string:string)|void repcb)`

  Description

    The inverse of decode_words_tokenized_remapped() , this functions accepts an array equivalent to the argument of quote() , but also performs on demand word encoding in the same way as encode_words_text_remapped() .

  See also

    MIME.encode_words_text_remapped() MIME.encode_words_quoted_labled_remapped()

  Method encode_words_quoted_labled

    `string encode_words_quoted_labled(array(array(string|int|array(string|array(string)))) phrase, string encoding)`

  Description

    The inverse of decode_words_tokenized_labled() , this functions accepts an array like the argument to quote_labled() , but "word" labled elements can optionally contain an additional string element specifying a character set, in which case an encoded-word will be used. Also, the format for "comment" labled elements is entirely different; instead of a single string, an array of strings or pairs like the first argument to encode_words_text() is expected.

  Parameter `encoding`

    Either `"base64"` or `"quoted-printable"` (or either `"b"` or `"q"` for short).

  See also

    MIME.encode_words_quoted() MIME.encode_words_quoted_labled_remapped()

  Method encode_words_quoted_labled_remapped

    `string encode_words_quoted_labled_remapped(array(array(string|int)) phrase, string encoding, string|function(string:string) charset, string|void replacement, function(string:string)|void repcb)`

  Description

    The inverse of decode_words_tokenized_labled_remapped() , this function accepts an array equivalent to the argument of quote_labled() , but also performs on demand word encoding in the same way as encode_words_text_remapped() .

  Method guess_subtype

    `string guess_subtype(string type)`

  Description

    Provide a reasonable default for the subtype field.

    Some pre-RFC1521 mailers provide only a type and no subtype in the Content-Type header field. This function can be used to obtain a reasonable default subtype given the type of a message. (This is done automatically by the MIME.Message class.)

    Currently, the function uses the following guesses:

    `"text"` | `"plain"`
    `"message"` | `"rfc822"`
    `"multipart"` | `"mixed"`

  Method parse_headers

    `array(mapping(string:string)|string) parse_headers(string message)`
    `array(mapping(string:array(string))|string) parse_headers(string message, int(1..1) use_multiple)`

  Description

    This is a low level function that will separate the headers from the body of an encoded message. It will also translate the headers into a mapping. It will however not try to analyze the meaning of any particular header. This means that the body is returned as is, with any transfer-encoding intact.

    It is possible to call this function with just the header part of a message, in which case an empty body will be returned.

    The result is returned in the form of an array containing two elements. The first element is a mapping containing the headers found. The second element is a string containing the body.

    Headers that occurr multiple times will have their contents NUL separated, unless use_multiple has been specified, in which case the contents will be arrays.

  Method reconstruct_partial

    `int|object reconstruct_partial(array(object) collection)`

  Description

    This function will attempt to reassemble a fragmented message from its parts.

    The array collection should contain MIME.Message objects forming a complete set of parts for a single fragmented message. The order of the messages in the array is not important, but every part must exist at least once.

    Should the function succeed in reconstructing the original message, a new MIME.Message object will be returned.

    If the function fails to reconstruct an original message, an integer indicating the reason for the failure will be returned:

    `0` | Returned if empty collection is passed in, or one that contains messages which are not of type `message/partial`, or parts of different fragmented messages.
    `1..` | If more fragments are needed to reconstruct the entire message, the number of additional messages needed is returned.
    `-1` | If more fragments are needed, but the function can't determine exactly how many.

  Note

    Note that the returned message may in turn be a part of another, larger, fragmented message.

  See also

    MIME.Message->is_partial()

  Method ext_to_media_type

    `string ext_to_media_type(string extension)`

  Description

    Returns the MIME media type for the provided filename extension . Currently 469 file extensions are known to this method. Zero will be returned on unknown file extensions.

  CLASS MIME.StringRange

    Description

      Class representing a substring of a larger string.

      This class is used to reduce the number of string copies during parsing of MIME.Message s.

  CLASS MIME.Message

    Description

      This class is used to hold a decoded MIME message.

    Variable headers

      `mapping(string:string) MIME.Message.headers`

    Description

      This mapping contains all the headers of the message.

      The key is the header name (in lower case) and the value is the header value.

      Although the mapping contains all headers, some particular headers get special treatment by the module and should not be accessed through this mapping. These fields are currently:

      `"content-type"`
      `"content-disposition"`
      `"content-length"`
      `"content-transfer-encoding"`

      The contents of these fields can be accessed and/or modified through a set of variables and methods available for this purpose.

    See also

      type , subtype , charset , boundary , transfer_encoding , params , disposition , disp_params , setencoding() , setparam() , setdisp_param() , setcharset() , setboundary()

    Variable body_parts

      `array(object) MIME.Message.body_parts`

    Description

      If the message is of type `multipart`, this is an array containing one Message object for each part of the message. If the message is not a multipart, this field is `0` (zero).

    See also

      type , boundary

    Variable boundary

      `string MIME.Message.boundary`

    Description

      For multipart messages, this `Content-Type` parameter gives a delimiter string for separating the individual messages. As multiparts are handled internally by the module, you should not need to access this field.

    See also

      setboundary()

    Variable charset

      `string MIME.Message.charset`

    Description

      One of the possible parameters of the `Content-Type` header is the charset attribute. It determines the character encoding used in bodies of type `text`.

      If there is no `Content-Type` header, the value of this field is `"us-ascii"`.

    See also

      type

    Variable type

      `string MIME.Message.type`

    Description

      The `Content-Type` header contains a type, a subtype, and optionally some parameters. This field contains the type attribute extracted from the header.

      If there is no `Content-Type` header, the value of this field is `"text"`.

    See also

      subtype , params

    Variable subtype

      `string MIME.Message.subtype`

    Description

      The `Content-Type` header contains a type, a subtype, and optionally some parameters. This field contains the subtype attribute extracted from the header.

      If there is no `Content-Type` header, the value of this field is `"plain"`.

    See also

      type , params

    Variable transfer_encoding

      `string MIME.Message.transfer_encoding`

    Description

      The contents of the `Content-Transfer-Encoding` header.

      If no `Content-Transfer-Encoding` header is given, this field is `0` (zero).

      Transfer encoding and decoding is done transparently by the module, so this field should be interesting only to applications wishing to do auto conversion of certain transfer encodings.

    See also

      setencoding()

    Variable params

      `mapping(string:string) MIME.Message.params`

    Description

      A mapping containing all the additional parameters to the `Content-Type` header.

      Some of these parameters have fields of their own, which should be accessed instead of this mapping wherever applicable.

    See also

      charset , boundary , setparam()

    Variable disposition

      `string MIME.Message.disposition`

    Description

      The first part of the `Content-Disposition` header, hinting on how this part of a multipart message should be presented in an interactive application.

      If there is no `Content-Disposition` header, this field is `0`.

    Variable disp_params

      `mapping(string:string) MIME.Message.disp_params`

    Description

      A mapping containing all the additional parameters to the `Content-Disposition` header.

    See also

      setdisp_param() , get_filename()

    Method get_filename

      `string get_filename()`

    Description

      This method tries to find a suitable filename should you want to save the body data to disk.

      It will examine the `filename` attribute of the `Content-Disposition` header, and failing that the `name` attribute of the `Content-Type` header. If neither attribute is set, the method returns 0.

    Note

      An interactive application should always query the user for the actual filename to use. This method may provide a reasonable default though.

    Method is_partial

      `array(string|int) is_partial()`

    Description

      If this message is a part of a fragmented message (i.e. has a Content-Type of `message/partial`), an array with three elements is returned.

      The first element is an identifier string. This string should be used to group this message with the other fragments of the message (which will have the same id string).

      The second element is the sequence number of this fragment. The first part will have number 1, the next number 2 etc.

      The third element of the array is either the total number of fragments that the original message has been split into, or 0 of this information is not available.

      If this method is called in a message that is not a part of a fragmented message, it will return 0.

    See also

      MIME.reconstruct_partial()

    Method setdata

      `void setdata(string data)`

    Description

      Replaces the body entity of the data with a new piece of raw data.

      The new data should comply to the format indicated by the type and subtype attributes.

    Note

      Do not use this method unless you know what you are doing.

    See also

      getdata() , setencoded , data

    Variable data

      `string MIME.Message.data`

    Description

      This variable contains the raw data of the message body entity.

      The type and subtype attributes indicate how this data should be interpreted.

    Note

      In Pike 7.6 and earlier you had to use getdata() and setdata() to access this value.

    See also

      getdata() , setdata()

    Method getdata

      `string getdata()`

    Description

      This method returns the raw data of the message body entity.

      The type and subtype attributes indicate how this data should be interpreted.

    See also

      setdata() , getencoded() , data

    Method getencoded

      `string getencoded()`

    Description

      This method returns the data of the message body entity, encoded using the current transfer encoding.

      You should never have to call this function.

    See also

      getdata()

    Method setencoding

      `void setencoding(string encoding)`

    Description

      Select a new transfer encoding for this message.

      The `Content-Transfer-Encoding` header will be modified accordingly, and subsequent calls to getencoded will produce data encoded using the new encoding.

      See MIME.encode() for a list of valid encodings.

    See also

      getencoded() , MIME.encode()

    Method setparam

      `void setparam(string param, string value)`

    Description

      Set or modify the named parameter of the `Content-Type` header.

      Common parameters include `charset` for text messages, and `boundary` for multipart messages.

    Note

      It is not allowed to modify the `Content-Type` header directly, please use this function instead.

    See also

      setcharset() , setboundary() , setdisp_param()

    Method setdisp_param

      `void setdisp_param(string param, string value)`

    Description

      Set or modify the named parameter of the `Content-Disposition` header.

      A common parameters is e.g. `filename`.

    Note

      It is not allowed to modify the `Content-Disposition` header directly, please use this function instead.

    See also

      setparam() , get_filename()

    Method setcharset

      `void setcharset(string charset)`

    Description

      Sets the `charset` parameter of the `Content-Type` header.

      This is equivalent of calling `setparam("charset", <font face='courier'>charset` ).

    See also

      setparam()

    Method setboundary

      `void setboundary(string boundary)`

    Description

      Sets the `boundary` parameter of the `Content-Type` header.

      This is equivalent of calling `setparam("boundary", <font face='courier'>boundary` ).

    See also

      setparam()

    Method cast

      `string cast(string dest_type)`

    Description

      Casting the message object to a string will yield a byte stream suitable for transmitting the message over protocols such as ESMTP and NNTP.

      The body will be encoded using the current transfer encoding, and subparts of a multipart will be collected recursively. If the message is a multipart and no boundary string has been set, one will be generated using generate_boundary() .

    See also

      create()

    Method parse_param

      `void parse_param(mapping(string:string) params, array(string|int) entry, string header, int|void guess, array(string|int)|void entry2)`

    Description

      Parse a Content-Type or Content-Disposition parameter.

    Parameter `params`

      Mapping to add parameters to.

    Parameter `entry`

      Array of tokens containing a parameter declaration.

    Parameter `header`

      Name of the header from which entry originated. This is only used to report errors.

    Parameter `guess`

      Make a best-effort attempt to parse broken entries.

    Parameter `entry2`

      Same as entry , but tokenized with MIME.TOKENIZE_KEEP_ESCAPES .

    See also

      create()

    Method create

      `void MIME.Message()`
      `void MIME.Message(string message)`
      `void MIME.Message(string message, mapping(string:string|array(string)) headers, array(object)|void parts)`
      `void MIME.Message(string message, mapping(string:string|array(string)) headers, array(object)|void parts, int(0..1) guess)`

    Description

      There are several ways to call the constructor of the Message class:

      - With zero arguments, you will get a dummy message with neither headers nor body. Not very useful.

      - With one argument, the argument is taken to be a byte stream containing a message in encoded form. The constructor will analyze the string and extract headers and body.

      - With two or three arguments, the first argument is taken to be the raw body data, and the second argument a desired set of headers. The keys of this mapping are not case-sensitive. If the given headers indicate that the message should be of type multipart, an array of Message objects constituting the subparts should be given as a third argument.

      - With the guess argument set to 1 (headers and parts may be 0 if you don't want to give any), you get a more forgiving MIME Message that will do its best to guess what broken input data really meant. It won't always guess right, but for applications like mail archives and similar where you can't get away with throwing an error at the user, this comes in handy. Only use the guess mode only for situations where you need to process broken MIME messages silently; the abuse of overly lax tools is what poisons standards.

    See also

      cast()

Module Search

  Method do_query_phrase

    `ResultSet do_query_phrase(array(string) words, array(int) field_coefficients, function(int:string) blobfeeder)`

  Parameter `words`

    Arrays of word ids. Note that the order is significant for the ranking.

  Parameter `field_coefficients`

    An array of ranking coefficients for the different fields. In the range of [0x0000-0xffff]. The array (always) has 65 elements:

    Array
    `int 0` | body
    `int 1..64` | Special field 0..63.

  Parameter `blobfeeder`

    This function returns a Pike string containing the word hits for a certain word_id. Call repeatedly until it returns `0`.

  Method do_query_and

    `ResultSet do_query_and(array(string) words, array(int) field_coefficients, array(int) proximity_coefficients, function(int:string) blobfeeder)`

  Parameter `words`

    Arrays of word ids. Note that the order is significant for the ranking.

  Parameter `field_coefficients`

    An array of ranking coefficients for the different fields. In the range of [0x0000-0xffff]. The array (always) has 65 elements:

    Array
    `int 0` | body
    `int 1..64` | Special field 0..63.

  Parameter `proximity_coefficients`

    An array of ranking coefficients for the different proximity categories. Always has 8 elements, in the range of [0x0000-0xffff].

    Array
    `int 0` | spread: 0 (Perfect hit)
    `int 1` | spread: 1-5
    `int 2` | spread: 6-10
    `int 3` | spread: 11-20
    `int 4` | spread: 21-40
    `int 5` | spread: 41-80
    `int 6` | spread: 81-160
    `int 7` | spread: 161-

  Parameter `blobfeeder`

    This function returns a Pike string containing the word hits for a certain word_id. Call repeatedly until it returns `0`.

  Method do_query_or

    `ResultSet do_query_or(array(string) words, array(int) field_coefficients, array(int) proximity_coefficients, function(int:string) blobfeeder)`

  Parameter `words`

    Arrays of word ids. Note that the order is significant for the ranking.

  Parameter `field_coefficients`

    An array of ranking coefficients for the different fields. In the range of [0x0000-0xffff]. The array (always) has 65 elements:

    Array
    `int 0` | body
    `int 1..64` | Special field 0..63.

  Parameter `proximity_coefficients`

    An array of ranking coefficients for the different proximity categories. Always has 8 elements, in the range of [0x0000-0xffff].

    Array
    `int 0` | spread: 0 (Perfect hit)
    `int 1` | spread: 1-5
    `int 2` | spread: 6-10
    `int 3` | spread: 11-20
    `int 4` | spread: 21-40
    `int 5` | spread: 41-80
    `int 6` | spread: 81-160
    `int 7` | spread: 161-

  Parameter `blobfeeder`

    This function returns a Pike string containing the word hits for a certain word_id. Call repeatedly until it returns `0`.

  CLASS Search.Blob

    Method create

      `void Search.Blob(void|string initial)`

    Method merge

      `void merge(string data)`

    Method remove

      `void remove(int doc_id)`

    Method remove_list

      `void remove_list(array(int) docs)`

    Method add

      `void add(int docid, int field, int offset)`

    Method memsize

      `int memsize()`

    Method data

      `string data()`

  CLASS Search.Blobs

    Method add_words

      `void add_words(int docid, array(string) words, int field_id)`

    Description

      Add all the words in the 'words' array to the blobs

    Method memsize

      `int memsize()`

    Description

      Returns the in-memory size of the blobs

    Method read

      `array read()`

    Description

      returns ({ string word_id, string blob }) or ({0,0}) As a side-effect, this function frees the blob and the word_id, so you can only read the blobs struct once. Also, once you have called read , add_words will no longer work as expected.

    Method read_all_sorted

      `array(array(string)) read_all_sorted()`

    Description

      returns ({({ string word1_id, string blob1 }),...}), sorted by word_id in octed order.

      As a side-effect, this function frees the blobs and the word_ids, so you can only read the blobs struct once. Also, once you have called read or read_all_sorted , add_words will no longer work as expected.

  CLASS Search.LinkFarm

    Method add

      `void add(int, array, int, int)`

    Method memsize

      `int memsize()`

    Description

      Returns the in-memory size of the linkfarm

    Method read

      `array read()`

    Description

      returns ({ int word_id, Blob b }) or 0

  CLASS Search.ResultSet

    Description

      A resultset is basically an array of hits from the search.

      Note: inheriting this class is _not_ supported (for performance reasons)

    Method cast

      `string cast(string type)`

    Description

      Only works when type == `"array"`. Returns the resultset data as a array.

    Method memsize

      `int memsize()`

    Description

      Return the size of this resultset, in bytes.

    Method test

      `ResultSet test(int nelems, int start, int incr)`

    Description

      Fills the resulttest with nelems entries, the document IDs are strictly raising, starting with start , ending with start +nelems *incr .

      Used for debug and testing.

    Method slice

      `array(array(int)) slice(int first, int nelems)`

    Description

      Return nelems entries from the result-set, starting with first. If 'first' is outside the resultset, or nelems is 0, 0 is returned.

    Method sort

      `void sort()`

    Description

      Sort this ResultSet according to ranking.

    Method sort

      `void sort()`

    Description

      Sort this ResultSet according to ranking.

    Method sort_docid

      `void sort_docid()`

    Description

      Sort this ResultSet according to document id.

    Method dup

      `ResultSet dup()`

    Description

      Return a new resultset with the same contents as this one.

    Method _sizeof
    Method size

      `int _sizeof()`
      `int size()`

    Description

      Return the size of this resultset, in entries.

    Method overhead

      `int overhead()`

    Description

      Return the size of the memory overhead, in bytes.

      You can minimize the overhead by calling dup(), which will create a new resultset with the exact size needed.

    Method `|
    Method `+
    Method or

      `ResultSet `|(ResultSet a)`
      `ResultSet `+(ResultSet a)`
      `ResultSet or(ResultSet a)`

    Description

      Add the given resultsets together, to generate a resultset with both sets included. The rankings will be added if a document exists in both resultsets.

    Method intersect
    Method `&

      `ResultSet intersect(ResultSet a)`
      `ResultSet `&(ResultSet a)`

    Description

      Return a new resultset with all entries that are present in _both_ sets. Only the document_id is checked, the resulting ranking is the sum of the rankings if the two sets.

    Method add_ranking

      `ResultSet add_ranking(ResultSet a)`

    Description

      Return a new resultset. All entries are the same as in this set, but if an entry exists in a , the ranking from a is added to the ranking of the entry

    Method sub
    Method `-

      `ResultSet sub(ResultSet a)`
      `ResultSet `-(ResultSet a)`

    Description

      Return a new resultset with all entries in a removed from the current ResultSet.

      Only the document_id is checked, the ranking is irrelevalt.

  CLASS Search.RankingProfile

    Variable field_ranking

      `array(int) Search.RankingProfile.field_ranking`

    Variable proximity_ranking

      `array(int) Search.RankingProfile.proximity_ranking`

    Variable cutoff

      `int Search.RankingProfile.cutoff`

    Method create

      `void Search.RankingProfile(void|int cutoff, void|array(int) proximity_ranking, void|Search.Database.Base db, void|array(int)|mapping(string:int) field_ranking)`

    Description

      cutoff defaults to 8, proximity_ranking defaults to `({ 8, 7, 6, 5, 4, 3, 2, 1, })` and field_ranking defaults to `({ 17, 0, 147 }) + allocate(62)`. db is only needed if field_ranking is provided as a mapping.

    Method copy

      `this_program copy()`

    Description

      Returns a copy of this object.

  CLASS Search.MergeFile

    Method create

      `void Search.MergeFile(Stdio.File _fd)`

    Method write_blobs

      `void write_blobs(_WhiteFish.Blobs blobs)`

    Method merge_mergefiles

      `void merge_mergefiles(Search.MergeFile a, Search.MergeFile b)`

  Module Search.Database

    CLASS Search.Database.Base

      Description

        Base class for Search database storage abstraction implementations.

      Method create

        `void Search.Database.Base(string db_url)`

      Description

        Initialize the database object.

      Parameter `path`

        The URL that identifies the underlying database storage

      Method get_uri_id

        `int get_uri_id(string uri, void|int do_not_create)`

      Description

        Retrieve and possibly creates the URI id corresponding to the given URI.

      Parameter `uri`

        The URI to be retrieved or created.

      Parameter `do_not_create`

        If non-zero, do not create the URI.

      Returns

        The non-zero numeric identifier if uri exists, or 0 otherwise.

      Method get_document_id

        `int get_document_id(string uri, void|string language, void|int do_not_create)`

      Description

        Retrieve and possibly creates the document id corresponding to the given URI and language code.

      Parameter `uri`

        The URI to be retrieved or created.

      Parameter `language`

        A two letter ISO-639-1 language code, or 0 if the document is language neutral.

      Parameter `do_not_create`

        If non-zero, do not create the document.

      Returns

        The non-zero numeric identifier if the document identified by uri and language_code exists, or 0 otherwise.

      Method get_uri_and_language

        `mapping get_uri_and_language(int|array(int) doc_id)`

      Description

        Retrieve the URI and language code associated with doc_id .

      Returns

        `"uri" : string` | The URI of the document.
        `"language" : void|string` | The ISO-639-1 language code of the document, or 0 if not set.

      Method insert_words

        `void insert_words(Standards.URI|string uri, void|string language, string field, array(string) words)`

      Description

        Index words into the database. The data may be buffered until the next sync call.

      Parameter `uri`

        The URI of the resource being indexed.

      Parameter `language`

        A two letter ISO-639-1 language code, or 0 if the document is language neutral.

      Parameter `field`

        The field name for the words being indexed.

      Parameter `words`

        The words being indexed. Possibly in wide-string format. (Not UTF8 encoded.)

      Method set_metadata

        `void set_metadata(Standards.URI|string uri, void|string language, mapping(string:string) metadata)`

      Description

        Set a metadata collection for a document.

      Parameter `uri`

        The URI of the resource being indexed.

      Parameter `language`

        A two letter ISO-639-1 language code, or 0 if the document is language neutral.

      Parameter `metadata`

        A collection of metadata strings to be set for a document. The strings may be wide. The "body" metadata may be cut off at 64K.

      Method remove_metadata

        `void remove_metadata(Standards.URI|string uri, void|string language)`

      Description

        Remove all metadata for a document

      Parameter `uri`

        The URI of the resource whose metadata should be removed.

      Parameter `language`

        A two letter ISO-639-1 language code, or 0 if the document is language neutral.

      Method get_metadata

        `mapping(string:string) get_metadata(int|Standards.URI|string uri, void|string language, void|array(string) wanted_fields)`

      Description

        Retrieve a metadata collection for a document.

      Parameter `uri`

        The URI of the resource being indexed.

      Parameter `language`

        A two letter ISO-639-1 language code, or 0 if the document is language neutral.

      Parameter `wanted_fields`

        An array containing the wanted metadata field names, or 0.

      Returns

        The metadata fields in wanted_fields or all existing fields if wanted_fields is 0.

      Method set_lastmodified

        `void set_lastmodified(Standards.URI|string uri, void|string language, int when)`

      Description

        Set last modification time for uri , language to mtime (seconds since `1970-01-01T00:00:00 UTC`).

      Method get_lastmodified

        `int get_lastmodified(Standards.URI|string|array(Standards.URI|string) uri, void|string language)`

      Description

        Get last modification time for uri , language .

      Returns

        Returns modification time in seconds since `1970-01-01T00:00:00 UTC`) if known, and `0` (zero) otherwise.

      Method remove_uri

        `void remove_uri(string|Standards.URI uri)`

      Description

        Remove URI from the database.

      Parameter `uri`

        The URI of the resource being removed.

      Method remove_uri_prefix

        `void remove_uri_prefix(string|Standards.URI uri)`

      Description

        Remove URI prefix from the database.

      Parameter `uri`

        The URI prefix of the resource being removed.

      Method remove_document

        `void remove_document(string|Standards.URI uri, void|string language)`

      Description

        Remove a document from the database.

      Parameter `uri`

        The URI of the resource being indexed.

      Parameter `language`

        A two letter ISO-639-1 language code. If zero, delete all existing language forks with the URI of uri .

      Method remove_document_prefix

        `void remove_document_prefix(string|Standards.URI uri)`

      Description

        Removes all documents that matches the provided uri prefix.

      Parameter `uri`

        The URI prefix of the documents to delete.

      Method sync

        `void sync()`

      Description

        Writes the data stored in temporary buffers to permanent storage. Calls the function set by set_sync_callback ] when done.

      Method set_sync_callback

        `void set_sync_callback(function f)`

      Description

        Sets a function to be called when sync has been completed.

      Method get_blob

        `string get_blob(string word, int num, void|mapping(string:mapping(int:string)) blobcache)`

      Description

        Retrieves a blob from the database.

      Parameter `word`

        The wanted word. Possibly in wide-string format. (Not UTF-8 encoded.)

      Parameter `num`
      Parameter `blobcache`
      Returns

        The blob requested, or 0 if there's no more blobs.

      Method allocate_field_id

        `int allocate_field_id(string field)`

      Description

        Allocate a field id.

      Parameter `field`

        The (possibly wide string) field name wanted.

      Returns

        An allocated numeric id, or -1 if the allocation failed.

      Method get_field_id

        `int get_field_id(string field, void|int do_not_create)`

      Description

        Retrieve and possibly creates the numeric id of a field

      Parameter `field`

        The (possibly wide string) field name wanted.

      Parameter `do_not_create`

        If non-zero, do not allocate a field id for this field

      Returns

        An allocated numeric id, or -1 if it did not exist, or allocation failed.

      Method remove_field

        `void remove_field(string field)`

      Description

        Remove a field from the database. Also removes all stored metadata with this field, but not all indexed words using this field id.

      Parameter `field`

        The (possibly wide string) field name to be removed.

      Method safe_remove_field

        `void safe_remove_field(string field)`

      Description

        Remove a field from the database if it isn't used by the filters. Also removes all stored metadata with this field, but not all indexed words using this field id.

      Parameter `field`

        The (possibly wide string) field name to be removed.

      Method list_fields

        `mapping(string:int) list_fields()`

      Description

        Lists all fields in the search database.

      Returns

        A mapping with the fields in the index part, and the corresponding numeric field id as values.

      Method get_language_stats

        `mapping(string|int:int) get_language_stats()`

      Description

        Retrieve statistics about the number of documents in different languages.

      Returns

        A mapping with the the language code in the index part, and the corresponding number of documents as values.

      Method get_num_words

        `int get_num_words()`

      Description

        Returns the number of distinct words in the database.

      Method get_database_size

        `int get_database_size()`

      Description

        Returns the size, in bytes, of the search database.

      Method get_num_deleted_documents

        `int get_num_deleted_documents()`

      Description

        Returns the number of deleted documents in the database.

      Method get_most_common_words

        `array(array) get_most_common_words(void|int count)`

      Description

        Returns a list of the count most common words in the database. count defaults to `10`.

      Method list_url_by_prefix

        `void list_url_by_prefix(string url_prefix, function(string:void) cb)`

      Description

        Calls cb for all uri:s that match uri_prefix .

  Module Search.Filter

    CLASS Search.Filter.Base

      Constant contenttypes

        `constant Search.Filter.Base.contenttypes`

      Description

        The MIME content types this class can filter.

      Method filter

        `.Output filter(Standards.URI uri, string|Stdio.File data, string content_type, mixed ... more)`

    CLASS Search.Filter.Output

      Description

        This object is returned from Search.Filter plugins.

      Variable fields

        `mapping(string:string) Search.Filter.Output.fields`

      Description

        Data extracted from input, grouped by type. Standard fields are `"body"`, `"title"`, `"description"`, `"keywords"` and `"mtime"`.

      Note

        Note that all field values (even `"mtime"`) are strings.

      Variable document_size

        `int Search.Filter.Output.document_size`

      Description

        The size of the document.

      Variable uri_anchors

        `mapping(string:string) Search.Filter.Output.uri_anchors`

      Description

        Maps un-normalized URLs to raw text, e.g. `([ "http://pike.ida.liu.se": "Pike language" ])` .

      Variable links

        `array(Standards.URI|string) Search.Filter.Output.links`

      Description

        All links collected from the document.

      Method fix_relative_links

        `void fix_relative_links(Standards.URI base_uri)`

      Description

        Modifies relative links in links to be relative to base_uri .

  Module Search.Grammar

    Method getDefaultFields

      `multiset(string) getDefaultFields()`

    Method optimize

      `ParseNode optimize(ParseNode node, string|void parentOp)`

    Method remove_stop_words

      `void remove_stop_words(ParseNode node, array(string) stop_words)`

    CLASS Search.Grammar.ParseNode

      Description

        Abstract parse tree node.

    CLASS Search.Grammar.AndNode

      Description

        And node.

      Inherit ParseNode

        inherit ParseNode : ParseNode

    CLASS Search.Grammar.OrNode

      Description

        Or node.

      Inherit ParseNode

        inherit ParseNode : ParseNode

    CLASS Search.Grammar.DateNode

      Description

        Date node.

      Inherit ParseNode

        inherit ParseNode : ParseNode

    CLASS Search.Grammar.TextNode

      Description

        Text node.

      Inherit ParseNode

        inherit ParseNode : ParseNode

    CLASS Search.Grammar.DefaultParser

      Inherit AbstractParser

        inherit .AbstractParser : AbstractParser

      Inherit Lexer

        inherit .Lexer : Lexer

      Variable options

        `mapping(string:mixed) Search.Grammar.DefaultParser.options`

      Method create

        `void Search.Grammar.DefaultParser(mapping(string:mixed)|void opt)`

      Method parse

        `ParseNode parse(string q)`

    CLASS Search.Grammar.AbstractParser

      Method create

        `void Search.Grammar.AbstractParser(void|mapping(string:mixed) options)`

      Parameter `options`

        `"implicit" : string` | Either of the strings: "and", "or". If not supplied, default to "or".
        `"fields" : multiset(string)` | The words that should be recognized as fields. If not supplied, it should default to `Search.Grammar.getDefaultFields()`

    Module Search.Grammar.Lexer

      Method tokenize

        `string|array(array(Token|string)) tokenize(string query)`

      Description

        Tokenizes a query into tokens for later use by a parser.

      Parameter `query`

        The query to tokenize.

      Returns

        An array containing the tokens: `({ ({ TOKEN_WORD, "foo" }), ... })` Or, in case of an error, a string with the error message.

  Module Search.Indexer

    Method index_document

      `void index_document(Search.Database.Base db, string|Standards.URI uri, void|string language, mapping fields)`

    Method extension_to_type

      `string extension_to_type(string extension)`

    Method filename_to_type

      `string filename_to_type(string filename)`

    Method filter_and_index

      `Search.Filter.Output filter_and_index(Search.Database.Base db, string|Standards.URI uri, void|string language, string|Stdio.File data, string content_type, void|mapping headers, void|string default_charset)`

    Method remove_document

      `void remove_document(Search.Database.Base db, string|Standards.URI uri, void|string language)`

  Module Search.Utils

    Method tokenize_and_normalize

      `array(string) tokenize_and_normalize(string what)`

    Description

      This can be optimized quite significantly when compared to tokenize( normalize( x ) ) in the future, currently it's not all that much faster, but still faster.

    Method tokenize

      `array(string) tokenize(string in)`

    Description

      Tokenize the input string (Note: You should first call normalize on it)

    Method normalize

      `string normalize(string in)`

    Description

      Normalize the input string. Performs unicode NFKD normalization and then lowercases the whole string

    Method get_profile_cache

      `ProfileCache get_profile_cache(string db_name)`

    Description

      Returns a ProfileCache for the profiles stored in the database db_name .

    Method flush_profile

      `void flush_profile(int p)`

    Description

      Flushes the profile p from all ProfileCache objects obtained with get_profile_cache .

    Method get_profile_storage

      `mapping get_profile_storage(string db_name)`

    Description

      Returns a profile storage mapping, which will be shared between all callers with the same db_name given.

    Method get_scheduler

      `Scheduler get_scheduler(string db_name)`

    Description

      Returns a scheduler for the given profile database.

    CLASS Search.Utils.ProfileEntry

      Description

        A result entry from the ProfileCache .

      Method create

        `void Search.Utils.ProfileEntry(int database_profile_id, int query_profile_id, ProfileCache cache)`

      Parameter `cache`

        The parent cache object.

      Method check_timeout

        `int(0..1) check_timeout()`

      Description

        Checks if it is time to check if the profile values are to old.

      Method get_database_value

        `mixed get_database_value(string index)`

      Description

        Returns the database profile value index .

      Method get_query_value

        `mixed get_query_value(string index)`

      Description

        Returns the query profile value index .

      Method get_database

        `Search.Database.MySQL get_database()`

      Description

        Returns a cached search database for the current database profile.

      Method get_ranking

        `Search.RankingProfile get_ranking()`

      Description

        Returns a cached ranking profile for the current database and query profile.

      Method get_stop_words

        `array(string) get_stop_words()`

      Description

        Returns a cached array of stop words for the current query profile.

    CLASS Search.Utils.ProfileCache

      syntax

        `string Search.Utils.ProfileCache.db_name` `void Search.Utils.ProfileCache(string db_name)`

      Method up_to_datep

        `int(-1..1) up_to_datep(int profile_id)`

      Description

        Checks if the profile profile_id has been changed, and clears related caches if so.

      Returns

        `-1` | The profile is deleted.
        `0` | The profile is not up to date.
        `1` | The profile is up to date.

      Method get_db_profile_number

        `int get_db_profile_number(string name)`

      Description

        Returns the profile number for the given database profile.

      Method get_query_profile_number

        `int get_query_profile_number(string name)`

      Description

        Returns the profile number for the given query profile.

      Method list_db_profiles

        `array(string) list_db_profiles()`

      Description

        Returns a list of available database profiles.

      Method list_query_profiles

        `array(string) list_query_profiles()`

      Description

        Returns a list of available query profiles.

      Method get_value_mapping

        `mapping get_value_mapping(int profile)`

      Description

        Returns the value mapping for the given profile.

      Method get_profile_entry

        `ProfileEntry get_profile_entry(string db_name, void|string query_name)`

      Description

        Returns a ProfileEntry object with the states needed for commiting searches in the database profile db_name with the rules from query profile query_name .

      Method flush_profile

        `void flush_profile(int p)`

      Description

        Flushes profile entry p from the profile cache.

      Method flush_cache

        `void flush_cache()`

      Description

        Empty the whole cache.

    CLASS Search.Utils.Scheduler

      Method new_entry

        `void new_entry(int latency, array(int) profiles)`

      Description

        Call this method to indicate that a new entry has been added to the queue. The scheduler will delay indexing with at most latency minutes.

    CLASS Search.Utils.Logger

      Method create

        `void Search.Utils.Logger(Sql.Sql db_object, int profile, int stderr_logging)`
        `void Search.Utils.Logger(string db_url, int profile, int stderr_logging)`

      Method log_event

        `void log_event(int code, string type, void|string extra, void|int log_profile)`

      Method log_error

        `void log_error(int code, void|string extra, void|int log_profile)`

      Method log_warning

        `void log_warning(int code, void|string extra, void|int log_profile)`

      Method log_notice

        `void log_notice(int code, void|string extra, void|int log_profile)`

      Method add_program_name

        `int add_program_name(int code, string name)`

      Method get_log

        `array(array(string|int)) get_log(int profile, array(string) types, int from, int to)`

  Module Search.Query

    Method execute

      `array(Search.ResultSet|array(string)) execute(Search.Database.Base db, Search.Grammar.AbstractParser parser, string query, Search.RankingProfile ranking, void|array(string) stop_words, void|search_order order)`

    Parameter `query`

      The query string entered by user.

    Parameter `db`

      The search database.

    Parameter `defaultRanking`

      Used when searching in the field "any:".

    Returns

      An array with three elements:

      Array
      `Search.ResultSet 0` | The ResultSet containing the hits.
      `array(string) 1` | All wanted words in the query. (I.e. not the words that were preceded by minus.)
      `array(mapping) 2` | All wanted globs in the query. (I.e. not the globs that were preceded by minus.)

Module CommonLog

  Description

    The CommonLog module is used to parse the lines in a www server's logfile, which must be in "common log" format -- such as used by default for the access log by Roxen, Caudium, Apache et al.

  Method read

    `int read(function(array(int|string):void) callback, Stdio.File|string logfile, void|int offset)`

  Description

    Reads the log file and calls the callback function for every parsed line. For lines that fails to be parsed the callback is not called not is any error thrown. The number of bytes read are returned.

  Parameter `callback`

    The callbacks first argument is an array with the different parts of the log entry.

    Array
    `string remote_host` |
    `int(0..0)|string ident_user` |
    `int(0..0)|string auth_user` |
    `int year` |
    `int month` |
    `int day` |
    `int hours` |
    `int minutes` |
    `int seconds` |
    `int timezone` |
    `int(0..0)|string method` | One of "GET", "POST", "HEAD" etc.
    `int(0..0)|string path` |
    `string protocol` | E.g. "HTTP/1.0"
    `int reply_code` | One of 200, 404 etc.
    `int bytes` |

    The second callback argument is the current offset to the end of the current line.

  Parameter `offset`

    The position in the file where the parser should begin.

Module SANE

  Description

    This module enables access to the SANE (Scanner Access Now Easy) library from pike

  Method list_scanners

    `array(mapping) list_scanners()`

  Description

    Returns an array with all available scanners.

  Example

        Pike v0.7 release 120 running Hilfe v2.0 (Incremental Pike Frontend)
           > SANE.list_scanners();
             Result: ({
                    ([
                      "model":"Astra 1220S     ",
                      "name":"umax:/dev/scg1f",
                      "type":"flatbed scanner",
                      "vendor":"UMAX    "
                    ]),
                    ([
                      "model":"Astra 1220S     ",
                      "name":"net:lain.idonex.se:umax:/dev/scg1f",
                      "type":"flatbed scanner",
                      "vendor":"UMAX    "
                    ])
                })

    `constant SANE.FrameGray`
    `constant SANE.FrameRGB`
    `constant SANE.FrameRed`
    `constant SANE.FrameGreen`
    `constant SANE.FrameBlue`

  CLASS SANE.Scanner

    Method create

      `void SANE.Scanner(string name)`

    Method list_options

      `array(mapping) list_options()`

    Description

      This method returns an array where every element is a mapping, layed out as follows.

      `"name" : string` |
      `"title" : string` |
      `"desc" : string` |

      `"type" : string`

      `"boolean"`
      `"int"`
      `"float"`
      `"string"`
      `"button"`
      `"group"`

      `"unit" : string`

      `"none"`
      `"pixel"`
      `"bit"`
      `"mm"`
      `"dpi"`
      `"percent"`
      `"microsend"`

      `"size" : int` |

      `"cap" : multiset`

      `"soft_select"`
      `"hard_select"`
      `"emulate"`
      `"automatic"`
      `"inactive"`
      `"advanced"`

      `"constraint" : int(0..0)|mapping`

      Constraints can be of three different types; range, word list or string list. Constraint contains 0 if there are no constraints.

      `"type" : string` | Contains the value "range".
      `"max" : int` |
      `"min" : int` |
      `"quant" : int` |

      `"type" : string` | Contains the value "list".
      `"list" : array(float|int)` |

      `"type" : string` | Contains the value "list".
      `"list" : array(string)` |

    Method set_option

      `void set_option(string name, mixed new_value)`
      `void set_option(string name)`

    Description

      If no value is specified, the option is set to it's default value

    Method get_option

      `mixed get_option(string name)`

    Method get_parameters

      `mapping(string:int) get_parameters()`

    Returns

      `"format" : int`
      `"last_frame" : int`
      `"lines" : int`
      `"depth" : int`
      `"pixels_per_line" : int`
      `"bytes_per_line" : int`

    Method simple_scan

      `Image.Image simple_scan()`

    Method row_scan

      `void row_scan(function(Image.Image:void) callback)`

    Method nonblocking_row_scan

      `void nonblocking_row_scan(function(Image.Image:void) callback)`

    Method cancel_scan

      `void cancel_scan()`

Module Yp

  Description

    This module is an interface to the Yellow Pages functions. Yp is also known as NIS (Network Information System) and is most commonly used to distribute passwords and similar information within a network.

  Inherit "___Yp"

    inherit "___Yp"

  Method default_domain

    `string default_domain()`

  Description

    Returns the default yp-domain.

  CLASS Yp.Map

    Description

      Network Information Service aka YP map.

    Method create

      `void Yp.Map(string map, string|void domain)`

    Description

      Create a new YP-map object.

      map is the YP-map to bind to. This may be a nickname, such as `passwd` instead of just `passwd.byname`.

      If domain is not specified, the default domain will be used.

    Note

      If there is no YP server available for the domain, this function call will block until there is one. If no server appears in about ten minutes or so, an error will be returned. The timeout is not configurable.

    Method match
    Method `[]

      `string match(string key)`
      `string `[](string key)`

    Description

      Search for the key key . If there is no key in the map, 0 (zero) will be returned, otherwise the string matching the key will be returned.

    Note

      key must match exactly, no pattern matching of any kind is done.

    Method all
    Method cast_to_mapping

      `mapping(string:string) all()`
      `mapping(string:string) cast_to_mapping()`

    Description

      Returns the whole map as a mapping.

    Method map

      `void map(function(string:void) fun)`

    Description

      Call a function for each entry in the map.

      For each entry in the map, call the function fun .

      The function will be called like `void fun(string key, string value)`.

    Method server

      `string server()`

    Description

      Return the server that provides this map.

    Method order

      `int order()`

    Description

      Return the order number for this map.

    Method _sizeof

      `int _sizeof()`

    Description

      Return the number of entries in this map.

    Method _indices

      `array(string) _indices()`

    Description

      Return the keys of the map.

    Method _values

      `array(string) _values()`

    Description

      Return the values of the map.

  CLASS Yp.Domain

    Method server

      `string server(string map)`

    Description

      Returns the hostname of the server serving the map map . map is the YP-map to search in. This must be the full map name. eg `passwd.byname` instead of just `passwd`.

    Method create
    Method bind

      `void Yp.Domain(string|void domain)`
      `void bind(string domain)`

    Description

      If domain is not specified , the default domain will be used. (As returned by Yp.default_domain() ).

      If there is no YP server available for the domain, this function call will block until there is one. If no server appears in about ten minutes or so, an error will be returned. This timeout is not configurable.

    See also

      Yp.default_domain()

    Method all

      `mapping(string:string) all(string map)`

    Description

      Returns the whole map as a mapping.

      map is the YP-map to search in. This must be the full map name, you have to use `passwd.byname` instead of just `passwd`.

    Method map

      `void map(string map, function(string:void) fun)`

    Description

      For each entry in map , call the function specified by fun .

      fun will get two arguments, the first being the key, and the second the value.

      map is the YP-map to search in. This must be the full map name. eg `passwd.byname` instead of just `passwd`.

    Method order

      `int order(string map)`

    Description

      Returns the 'order' number for the map map .

      This is usually the number of seconds since Jan 1 1970 (see time() ). When the map is changed, this number will change as well.

      map is the YP-map to search in. This must be the full map name. eg `passwd.byname` instead of just `passwd`.

    Method match

      `string match(string map, string key)`

    Description

      Search for the key key in the Yp-map map .

    Returns

      If there is no key in the map, 0 (zero) will be returned, otherwise the string matching the key will be returned.

    Note

      key must match exactly, no pattern matching of any kind is done.

Module Fuse

  Description

    Fuse - Filesystem in USErspace

    FUSE (Filesystem in USErspace) provides a simple interface for userspace programs to export a virtual filesystem to the Linux kernel. FUSE also aims to provide a secure method for non privileged users to create and mount their own filesystem implementations.

    FUSE is only available on Linux.

    See http://sourceforge.net/projects/fuse/ for more information

    This module maps the Fuse library more or less directly to pike.

    A tip: /usr/include/asm/errno.h can be included in pike programs on Linux.

  Inherit "___Fuse"

    inherit "___Fuse"

  Method run

    `void run(Operations handler, array(string) args)`

  Description

    Start fuse. Args is as in argv in main(). The first argument (argv[0], program name) is used as the filesystem name. The first non-flag argument after argv[0] is used as the mountpoint. Otherwise these arguments are supported:

             -d                  enable debug output (implies -f)
             -f                  foreground operation
             -s                  disable multithreaded operation
             -r                  mount read only (equivalent to '-o ro')
             -o opt,[opt...]     mount options
             -h                  print help

    Mount options:

             default_permissions    enable permission checking
             allow_other            allow access to other users
             allow_root             allow access to root
             kernel_cache           cache files in kernel
             large_read             issue large read requests (2.4 only)
             direct_io              use direct I/O
             max_read=N             set maximum size of read requests (default 128K)
             hard_remove            immediate removal (don't hide files)
             debug                  enable debug output
             fsname=NAME            set filesystem name in mtab (overrides argv[0])

  CLASS Fuse.Operations

    Description

      This is the interface you have to implement to write a FUSE filesystem If something goes wrong in your callback, always return errno. Unless the function returns a specific value (Stat, string or similar), return 0 if all is well.

      You do not have to implement all functions. Unimplemented functions have a default implementation that returns -ENOIMPL.

    Constant DT_UNKNOWN

      `constant Fuse.Operations.DT_UNKNOWN`

    Description

      Unkown directory entry type

    Constant DT_FIFO

      `constant Fuse.Operations.DT_FIFO`

    Description

      FIFO directory entry

    Constant DT_CHR

      `constant Fuse.Operations.DT_CHR`

    Description

      Character special directory entry

    Constant DT_DIR

      `constant Fuse.Operations.DT_DIR`

    Description

      Directory directory entry

    Constant DT_BLK

      `constant Fuse.Operations.DT_BLK`

    Description

      Block special directory entry

    Constant DT_REG

      `constant Fuse.Operations.DT_REG`

    Description

      Normal file directory entry

    Constant DT_LNK

      `constant Fuse.Operations.DT_LNK`

    Description

      Symlink directory entry

    Constant DT_SOCK

      `constant Fuse.Operations.DT_SOCK`

    Description

      Socket directory entry

    Constant O_APPEND

      `constant Fuse.Operations.O_APPEND`

    Description

      Open for append

    Constant O_ACCMODE

      `constant Fuse.Operations.O_ACCMODE`

    Description

      Mask for read/write/rdwr

    Constant O_RDONLY

      `constant Fuse.Operations.O_RDONLY`

    Description

      Open read only

    Constant O_WRONLY

      `constant Fuse.Operations.O_WRONLY`

    Description

      Open write only

    Constant O_RDWR

      `constant Fuse.Operations.O_RDWR`

    Description

      Open read/write only

    Method getattr

      `Stdio.Stat|int(1..) getattr(string path)`

    Description

      Stat a file.

    Note

      This function is required.

    Returns

      The symlink contents or errno

    Method readlink

      `string|int(1..) readlink(string path)`

    Description

      Read a symlink.

    Returns

      The symlink contents or errno

    Method readdir

      `int readdir(string path, function(string:void) callback)`

    Description

      Get directory contents. The callback get the filename.

    Note

      This function is required.

    Returns

      errno or 0

    Method mknod

      `int mknod(string path, int mode, int rdev)`

    Description

      Create a node (file, device special, or named pipe). See man 2 mknod

    Returns

      errno or 0

    Method mkdir

      `int mkdir(string path, int mode)`

    Description

      Create a directory.

    Returns

      errno or 0

    Method unlink

      `int unlink(string path)`

    Description

      Remove a file

    Returns

      errno or 0

    Method rmdir

      `int rmdir(string path)`

    Description

      Remove a directory

    Returns

      errno or 0

    Method symlink

      `int symlink(string source, string destination)`

    Description

      Create a symlink from source to destination.

    Returns

      errno or 0

    Method link

      `int link(string source, string destination)`

    Description

      Create a hard link from source to destination.

    Returns

      errno or 0

    Method rename

      `int rename(string source, string destination)`

    Description

      Rename source to destination .

    Returns

      errno or 0

    Method chmod

      `int chmod(string path, int mode)`

    Description

      Change mode

    Returns

      errno or 0

    Method chown

      `int chown(string path, int uid, int gid)`

    Description

      Change owner

    Returns

      errno or 0

    Method truncate

      `int truncate(string path, int new_length)`

    Description

      Shrink or enlarge file

    Returns

      errno or 0

    Method utime

      `int utime(string path, int atime, int mtime)`

    Description

      Set access and modification time

    Returns

      errno or 0

    Method open

      `int open(string path, int mode)`

    Description

      Open path . mode is as for the system call open. (mode & O_ACCMODE) is one of O_RDONLY, O_WRONLY and O_RDWR. The mode can also contain other flags, most notably O_APPEND.

    Note

      You do not really have to implement this function. It's useful to start prefetch and to cache open files, and check that the user has permission to read/write the file.

    Returns

      errno or 0

    Method read

      `string|int(1..) read(string path, int len, int offset)`

    Description

      Read data from a file. You have to return at most len bytes, unless an error occurs.

    Returns

      errno or data

    Method write

      `int write(string path, string data, int offset)`

    Description

      Write data to the file. Should write all data.

    Returns

      errno or amount written (bytes)

    Method statfs

      `mapping(string:int) statfs(string path)`

    Description

      Stat a filesystem. Mapping as from filesystem_stat

    Note

      required for `'df'` support, without this function there is an error each time `'df'` is run.

    Method release

      `int release(string path)`

    Description

      The inverse of open.

    Note

      The file might very well be openend multiple times. Keep reference counts.

    Method fsync

      `int fsync(string path, int datasync)`

    Description

      Flush data and user-data to disk. Not required. If the datasync parameter is non-zero, then only the user data should be flushed, not the meta data.

    Method listxattr

      `array(string)|int listxattr(string path)`

    Description

      Return a list of all available extended attributes on path

    Method removexattr

      `int removexattr(string path, string name)`

    Description

      Remove the extended attribute name from path

    Method getxattr

      `string getxattr(string path, string name)`

    Description

      Get the extended attribute name on path

    Method setxattr

      `int setxattr(string path, string name, string value, int flags)`

    Description

      Set the extended attribute name on path to value

    Method creat

      `int creat(string path, int mode, int flag)`

    Description

      Create and open or just open the given path

    Method access

      `int access(string path, int mode)`

    Description

      Return if the user is allowed to access the path . If the 'default_permissions' mount option is given, this method is not called.

    Method flush

      `int flush(string path, int flags)`

    Description

      Write unwritten data.

Module Math

  Constant pi

    `constant Math.pi`

  Description

    The constant pi (3.14159265358979323846).

  Constant e

    `constant Math.e`

  Description

    The constant e (2.7182818284590452354).

  Constant inf

    `constant Math.inf`

  Description

    Floating point infinity.

  Constant nan

    `constant Math.nan`

  Description

    Floating point not-a-number (e.g. inf/inf).

  Inherit "___Math"

    inherit "___Math"

  Method convert_angle

    `int|float convert_angle(int|float angle, string from, string to)`

  Description

    This function converts between degrees, radians and gons. The from and to arguments may be any of the follwoing strings: "deg", "rad", "gon" and "str" for degrees, radians, gon and streck respectivly. The output is not guaranteed to be within the first turn, e.g. converting 10 radians yields almost 573 degrees as output.

  Method choose

    `int choose(int n, int k)`

  Description

    Calculate binomial koefficient n choose k .

    This is equvivalent to `n !/(k !*(n -k )!)`.

  Method log10

    `float log10(float x)`

  Description

    The 10-logarithm of x .

  Method log2

    `float log2(float x)`

  Description

    The 2-logarithm of x .

  Method logn

    `float logn(float n, float x)`

  Description

    The n -logatirhm of x .

  Method factor

    `array(int) factor(int x)`

  Description

    Factorize the integer x . The returned list of factors will be sorted biggest to smallest factor.

  Note

    This function is only available when Pike has been compiled with bignums.

  CLASS Math.Angle

    Description

      Represents an angle.

    Variable angle

      `int|float Math.Angle.angle`

    Description

      The actual keeper of the angle value.

    Variable type

      `string Math.Angle.type`

    Description

      The type of the angle value. Is either "deg", "rad", "gon" or "str".

    Method create

      `void Math.Angle()`
      `void Math.Angle(int|float radians)`
      `void Math.Angle(int|float angle, string type)`

    Description

      If an angle object is created without arguments it will have the value 0 radians.

    Method clone_me

      `Angle clone_me()`

    Description

      Returns a copy of the object.

    Method get

      `int|float get(string type)`

    Description

      Gets the value in the provided type.

    Method set

      `Angle set(string type, int|float _angle)`

    Description

      Sets the angle value and type to the given value and type.

    Method normalize

      `void normalize()`

    Description

      Normalizes the angle to be within one turn.

    Method degree

      `int|float degree()`

    Description

      Returns the number of degrees, including minutes and seconds as decimals.

    Method minute

      `int minute()`

    Description

      Returns the number of minute.

    Method second

      `float second()`

    Description

      Returns the number of seconds.

    Method set_dms

      `Angle set_dms(int degrees)`
      `Angle set_dms(int degrees, int minutes)`
      `Angle set_dms(int degrees, int minutes, float seconds)`

    Description

      Set degrees, minues and seconds. Returns the current angle object.

    Method format_dms

      `string format_dms()`

    Description

      Returns degrees, minutes and seconds as a string, e.g. 47°6'36.00".

    Method set_degree

      `Angle set_degree(int|float degree)`

    Description

      Sets the angle to the provided degree. Alters the type to degrees. Returns the current object.

    Method gon

      `int|float gon()`

    Description

      Returns the number of gons.

    Method set_gon

      `Angle set_gon(int|float gon)`

    Description

      Set the angle to the provided gons. Alters the type to gons. Returns the current angle object.

    Method rad

      `float rad()`

    Description

      Returns the number of radians.

    Method set_rad

      `Angle set_rad(int|float rad)`

    Description

      Set the angle to the provided radians. Alters the type to radians. Returns the current angle object.

    Method streck

      `float|int streck()`

    Description

      Returns the number of strecks.

    Method set_streck

      `Angle set_streck(int|float str)`

    Description

      Set the angle to the provided strecks. Alters the type to streck. Returns the current angle object.

    Method about_face

      `void about_face()`

    Description

      Turns the direction of the angle half a turn. Equal to `add(180,"deg")`.

    Method right_face

      `void right_face()`

    Description

      Turns the direction of the angle a quarter of a turn to the right. Equal to `subtract(90,"deg")`.

    Method left_face

      `void left_face()`

    Description

      Turns the direction of the angle a quarter of a turn to the left. Equal to `add(90,"deg")`.

    Method sin

      `float sin()`

    Description

      Returns the sinus for the angle.

    Method cos

      `float cos()`

    Description

      Returns the cosinus for the angle.

    Method tan

      `float tan()`

    Description

      Returns the tangen for the angle.

    Method cast

      `float|int|string cast(string to)`

    Description

      An angle can be casted to float, int and string.

    Method `+

      `float|int|Angle `+(float|int|Angle _angle)`

    Description

      Returns the sum of this angle and what it is added with. If added with an angle, a new angle object is returnes.

    Method add

      `Angle add(float|int angle)`
      `Angle add(float|int angle, string type)`
      `Angle add(Angle angle)`

    Description

      Adds the provided angle to the current angle. The result is normalized within 360 degrees.

    Method `-

      `float|int|Angle `-(float|int|Angle _angle)`

    Description

      Returns the difference between this angle and the provided value. If differenced with an angle, a new angle object is returned.

    Method subtract

      `Angle subtract(float|int angle)`
      `Angle subtract(float|int angle, string type)`
      `Angle subtract(Angle angle)`

    Description

      Subtracts the provided angle from the current angle. The result is normalized within 360 degrees.

    Method `*

      `float|int|Angle `*(float|int|Angle _angle)`

    Description

      Returns the product between this angle and the provided value. If differenced with an angle, a new angle object is returned.

    Method `/

      `float|int|Angle `/(float|int|Angle _angle)`

    Description

      Returns the fraction between this angle and the provided value. If differenced with an angle, a new angle object is returned.

    Method `%

      `float|int|Angle `%(float|int|Angle _angle)`

    Description

      Returns this result of this angle modulo the provided value. If differenced with an angle, a new angle object is returned.

    Method __hash

      `int __hash()`

    Method `==

      `int `==(Angle _angle)`

    Description

      Compares the unnormalized angle of two Angle objects.

    Method `<

      `int `<(Angle _angle)`

    Description

      Compares the unnormalized angle of two Angle objects.

    Method `>

      `int `>(Angle _angle)`

    Description

      Compares the unnormalized angle of two Angle objects.

  CLASS Math.Matrix

    Description

      Matrix representation with double precision floating point values.

    Method create

      `void Math.Matrix(array(array(int|float)) matrix_2d)`
      `void Math.Matrix(array(int|float) matrix_1d)`

    Description

      Initializes the matrix as a 1D or 2D matrix, e.g. `Math.Matrix( ({({1,2}),({3,4})}) )`.

    Method create

      `void Math.Matrix(int n, int m)`
      `void Math.Matrix(int n, int m, string type)`
      `void Math.Matrix(int n, int m, float|int init)`

    Description

      Initializes the matrix as to be a n *m matrix with init in every value. If no third argument is given, or the third argument is `"identity"`, the matrix will be initialized with all zeroes except for the diagonal which will be `1`.

    Method create

      `void Math.Matrix(string type, int size)`

    Description

      When type is `"identity"` the matrix is initializes as a square identity matrix.

    Method create

      `void Math.Matrix(string type, int size, float rads, Matrix axis)`
      `void Math.Matrix(string type, int size, float rads, float x, float y, float z)`

    Description

      When type is `"rotate"` the matrix is initialized as a rotation matrix.

    Method cast

      `array(array) cast(string to_what)`
      `array(array) cast(string to_what)`

    Description

      It is possible to cast the matrix to an array and get back a double array of floats with the matrix values.

    See also

      vect

    Method vect

      `array vect()`

    Description

      Return all the elements of the matrix as an array of numbers

    Method transpose

      `Matrix transpose()`

    Description

      Returns the transpose of the matrix as a new object.

    Method norm
    Method norm2
    Method normv

      `float norm()`
      `float norm2()`
      `Matrix normv()`

    Description

      Norm of the matrix, and the square of the norm of the matrix. (The later method is because you may skip a square root sometimes.)

      This equals |A| or sqrt( A02 + A12 + ... + An2 ).

      It is only usable with 1xn or nx1 matrices.

      `m->normv()` is equal to `m*(1.0/m->norm())`, with the exception that the zero vector will still be the zero vector (no error).

    Method `+
    Method ``+
    Method add

      `Matrix `+(object with)`
      `Matrix ``+(object with)`
      `Matrix add(object with)`

    Description

      Add this matrix to another matrix. A new matrix is returned. The matrices must have the same size.

    Method `-
    Method ``-
    Method sub

      `Matrix `-()`
      `Matrix `-(object with)`
      `Matrix ``-(object with)`
      `Matrix sub(object with)`

    Description

      Subtracts this matrix from another. A new matrix is returned. `-m` is equal to `-1*m`.

    Method sum

      `Matrix sum()`

    Description

      Produces the sum of all the elements in the matrix.

    Method max
    Method min

      `Matrix max()`
      `Matrix min()`

    Description

      Produces the maximum or minimum value of all the elements in the matrix.

    Method `*
    Method ``*
    Method mult

      `Matrix `*(object with)`
      `Matrix ``*(object with)`
      `Matrix mult(object with)`

    Description

      Matrix multiplication.

    Method cross

      `Matrix cross(object with)`

    Description

      Matrix cross-multiplication.

    Method dot_product

      `float dot_product(object with)`

    Description

      Matrix dot product.

    Method convolve

      `Matrix convolve(object with)`

    Description

      Convolve called matrix with the argument.

    Method xsize

      `int xsize()`

    Description

      Returns the width of the matrix.

    Method ysize

      `int ysize()`

    Description

      Returns the height of the matrix.

  CLASS Math.FMatrix

    Description

      Matrix representation with single precision floating point values.

    Inherit Matrix

      inherit Matrix : Matrix

  CLASS Math.LMatrix

    Description

      Matrix representation with 64 bit integer values.

    Inherit Matrix

      inherit Matrix : Matrix

  CLASS Math.IMatrix

    Description

      Matrix representation with 32 bit integer values.

    Inherit Matrix

      inherit Matrix : Matrix

  CLASS Math.SMatrix

    Description

      Matrix representation with 16 bit integer values.

    Inherit Matrix

      inherit Matrix : Matrix

  Module Math.Transforms

    CLASS Math.Transforms.FFT

      Method rFFT

        `array(array(float)) rFFT(array(int|float) real_input)`

      Description

        Returns the FFT of the input array. The input must be real and the output is complex. The output consists of an array. It's first element is the amplitudes and the second element is the phases.

      Parameter `real_input`

        The array of floats and/or ints to transform.

      Note

        rIFFT(rFFT()) returns the input array scaled by n=sizeof(input array). This is due to the nature of the DFT algorithm.

      See also

        rIFFT()

      Method rIFFT

        `array(float) rIFFT(array(array(float)) input)`

      Description

        Returns the inverse FFT of the input array. The input must be complex and guaranteed to generate a real output.

        The input is an array. It's first element is the amplitudes and the second element is the phases.

        The output is an array of the real values for the iFFT.

      Parameter `real_input`

        The array of floats and/or ints to transform.

      Note

        rIFFT(rFFT()) returns the input array scaled by n=sizeof(input array). This is due to the nature of the DFT algorithm.

      See also

        rFFT()

      Method create

        `void Math.Transforms.FFT(void|int n, void|int(0..1) exact)`

      Description

        Creates a new transform object. If n is specified, a plan is created for transformations of n-size arrays.

      Parameter `n`

        Size of the transform to be preformed. Note that the transform object will be initialized for this size, but if an array of different size is sent to the object, it will be reinitialized. This can be used to gain preformace if all transforms will be of a given size.

      Parameter `exact`

        If exact is 1, a "better" plan for the transform will be created. This will take more time though. Use only if preformance is needed.

Module Pipe

  Description

    Single socket output.

    Regular file output and (multiple, adding) socket output with no mmap input.

    Multiple socket output without regular file output illegal.

  CLASS Pipe.pipe

    Description

      Concatenation pipe.

    Method input

      `void input(object obj)`

    Description

      Add an input file to this pipe.

    Method write

      `void write(string bytes)`

    Description

      Add an input string to this pipe.

    Method output

      `void output(object obj, int|void start_pos)`

    Description

      Add an output file object.

    Method set_done_callback

      `void set_done_callback(void|function(mixed:mixed) done_cb, void|mixed id)`

    Description

      Set the callback function to be called when all the outputs have been sent.

    Method set_output_closed_callback

      `void set_output_closed_callback(void|function(mixed:mixed) close_cb, void|mixed id)`

    Description

      Set the callback function to be called when one of the outputs has been closed from the other side.

    Method finish

      `void finish()`

    Description

      Terminate and reinitialize the pipe.

    Method start

      `void start()`

    Description

      Start sending the input(s) to the output(s).

    Method bytes_sent

      `int bytes_sent()`

    Description

      Return the number of bytes sent.

    Method version

      `string version()`

    Description

      Return the version of the module.

Module Java

  Inherit "___Java"

    inherit "___Java"

  Method JString

    `jobject JString(string s)`

  Method JBoolean

    `jobject JBoolean(int i)`

  Method JInteger

    `jobject JInteger(int i)`

  Method JFloat

    `jobject JFloat(float f)`

  Method JHashMap

    `jobject JHashMap(mapping m)`

  Method JArray

    `jobject JArray(array a)`

Module Stdio

  Method get_all_active_fd

    `array(int) get_all_active_fd()`

  Description

    Returns the id of all the active file descriptors.

  Constant PROP_SEND_FD

    `constant Stdio.PROP_SEND_FD`

  Description

    The Stdio.File object might support the Stdio.File()->send_fd() operation.

  See also

    Stdio.File()->pipe() , Stdio.File()->send_fd() , Stdio.File()->receive_fd()

  Constant PROP_REVERSE

    `constant Stdio.PROP_REVERSE`

  Description

    Request reversed operation.

    Used as argument to Stdio.File()->pipe() , when PROP_BIDIRECTIONAL hasn't been specified, to request the direction of the resulting pipe to reversed.

  See also

    Stdio.File()->pipe()

  Constant PROP_BIDIRECTIONAL

    `constant Stdio.PROP_BIDIRECTIONAL`

  Description

    The file is bi-directional.

  See also

    Stdio.File()->pipe()

  Constant PROP_BUFFERED

    `constant Stdio.PROP_BUFFERED`

  Description

    The file is buffered (usually 4KB).

  See also

    Stdio.File()->pipe()

  Constant PROP_SHUTDOWN

    `constant Stdio.PROP_SHUTDOWN`

  Description

    The file supports shutting down transmission in either direction.

  See also

    Stdio.File()->close() , Stdio.File()->pipe()

  Constant PROP_NONBLOCK

    `constant Stdio.PROP_NONBLOCK`

  Description

    The file supports nonblocking I/O.

  See also

    Stdio.File()->pipe()

  Constant PROP_IPC

    `constant Stdio.PROP_IPC`

  Description

    The file may be used for inter process communication.

  See also

    Stdio.File()->pipe()

  Constant __HAVE_SEND_FD__

    `constant Stdio.__HAVE_SEND_FD__`

  Description

    Support for sending of file descriptors over Stdio.File()->pipe() objects with PROP_SEND_FD capability is supported.

  See also

    Stdio.File()->send_fd() , Stdio.File()->receive_fd() , Stdio.File()->read() , Stdio.File()->write() , Stdio.File()->pipe()

  Constant __OOB__

    `constant Stdio.__OOB__`

  Description

    Implementation level of nonblocking I/O OOB support.

    `0` | Nonblocking OOB support is not supported.
    `1` | Nonblocking OOB works a little.
    `2` | Nonblocking OOB almost works.
    `3` | Nonblocking OOB works as intended.
    `-1` | Unknown level of nonblocking OOB support.

    This constant only exists when OOB operations are available, i.e. when __HAVE_OOB__ is 1.

  Constant __HAVE_OOB__

    `constant Stdio.__HAVE_OOB__`

  Description

    Exists and has the value 1 if OOB operations are available.

  Note

    In Pike 7.5 and later OOB operations are always present.

  Method _sprintf

    `string _sprintf(int type, void|mapping flags)`

  Method gethostip

    `mapping(string:mapping) gethostip()`

  Description

    Returns the IP addresses of the host.

  Returns

    Returns a mapping that maps interface name to a mapping with more information about that interface. That information mapping looks as follows.

    `"ips" : array(string)` | A list of all IP addresses bound to this interface.

  Constant XATTR_CREATE

    `constant Stdio.XATTR_CREATE`

  Description

    Used by setxattr function and method to signify a pure create, which will fail if the attribute already exists.

  Constant XATTR_REPLACE

    `constant Stdio.XATTR_REPLACE`

  Description

    Used by setxattr function and method to signify a replace, which will fail the the attribute does not already exists.

  Constant DN_ACCESS

    `constant Stdio.DN_ACCESS`

  Description

    Used in File.notify() to get a callback when files within a directory are accessed.

  Constant DN_MODIFY

    `constant Stdio.DN_MODIFY`

  Description

    Used in File.notify() to get a callback when files within a directory are modified.

  Constant DN_CREATE

    `constant Stdio.DN_CREATE`

  Description

    Used in File.notify() to get a callback when new files are created within a directory.

  Constant DN_DELETE

    `constant Stdio.DN_DELETE`

  Description

    Used in File.notify() to get a callback when files are deleted within a directory.

  Constant DN_RENAME

    `constant Stdio.DN_RENAME`

  Description

    Used in File.notify() to get a callback when files within a directory are renamed.

  Constant DN_ATTRIB

    `constant Stdio.DN_ATTRIB`

  Description

    Used in File.notify() to get a callback when attributes of files within a directory are changed.

  Constant DN_MULTISHOT

    `constant Stdio.DN_MULTISHOT`

  Description

    Used in File.notify() . If DN_MULTISHOT is used, signals will be sent for all notifications the program has registred for. Otherwise only the first event the program is listening for will be received and then the program must reregister for the events to receive futher events.

  Inherit files

    inherit files : files

  Constant DATA_CHUNK_SIZE

    `constant Stdio.DATA_CHUNK_SIZE`

  Description

    Size used in various places to divide incoming or outgoing data into chunks.

  Constant TCSANOW

    `constant Stdio.TCSANOW`

  Description

    Argument to Stdio.File()->tcsetattr() .

    Change immediately.

  Constant TCSADRAIN

    `constant Stdio.TCSADRAIN`

  Description

    Argument to Stdio.File()->tcsetattr() .

    Change after all output has been written.

  Constant TCSAFLUSH

    `constant Stdio.TCSAFLUSH`

  Description

    Argument to Stdio.File()->tcsetattr() .

    Change after all output has been written, and empty the input buffers.

  Variable stderr

    `FILE Stdio.stderr`

  Description

    An instance of `FILE("stderr")`, the standard error stream. Use this when you want to output error messages.

  See also

    predef::werror()

  Variable stdout

    `FILE Stdio.stdout`

  Description

    An instance of `FILE("stdout")`, the standatd output stream. Use this when you want to write anything to the standard output.

  See also

    predef::write()

  Variable stdin

    `FILE Stdio.stdin`

  Description

    An instance of `FILE("stdin")`, the standard input stream. Use this when you want to read anything from the standard input. This example will read lines from standard input for as long as there are more lines to read. Each line will then be written to stdout together with the line number. We could use Stdio.stdout.write() instead of just write() , since they are the same function.

  Example

        int main()
          {
            int line;
            while(string s=Stdio.stdin.gets())
         	 write("%5d: %s\n", line++, s);
          }

  Method read_file

    `string read_file(string filename)`
    `string read_file(string filename, int start, int len)`

  Description

    Read len lines from a regular file filename after skipping start lines and return those lines as a string. If both start and len are omitted the whole file is read.

  Throws

    Throws an error on any I/O error except when the file doesn't exist.

  Returns

    Returns `0` (zero) if the file doesn't exist or if start is beyond the end of it.

    Returns a string with the requested data otherwise.

  See also

    read_bytes() , write_file()

  Method read_bytes

    `string read_bytes(string filename, int start, int len)`
    `string read_bytes(string filename, int start)`
    `string read_bytes(string filename)`

  Description

    Read len number of bytes from a regular file filename starting at byte start , and return it as a string.

    If len is omitted, the rest of the file will be returned.

    If start is also omitted, the entire file will be returned.

  Throws

    Throws an error on any I/O error except when the file doesn't exist.

  Returns

    Returns `0` (zero) if the file doesn't exist or if start is beyond the end of it.

    Returns a string with the requested data otherwise.

  See also

    read_file , write_file() , append_file()

  Method write_file

    `int write_file(string filename, string str, int|void access)`

  Description

    Write the string str onto the file filename . Any existing data in the file is overwritten.

    For a description of access , see Stdio.File()->open() .

  Throws

    Throws an error if filename couldn't be opened for writing.

  Returns

    Returns the number of bytes written, i.e. `sizeof(str)`.

  See also

    append_file() , read_bytes() , Stdio.File()->open()

  Method append_file

    `int append_file(string filename, string str, int|void access)`

  Description

    Append the string str onto the file filename .

    For a description of access , see Stdio.File->open() .

  Throws

    Throws an error if filename couldn't be opened for writing.

  Returns

    Returns the number of bytes written, i.e. `sizeof(str)`.

  See also

    write_file() , read_bytes() , Stdio.File()->open()

  Method file_size

    `int file_size(string filename)`

  Description

    Give the size of a file. Size -1 indicates that the file either does not exist, or that it is not readable by you. Size -2 indicates that it is a directory, -3 that it is a symlink and -4 that it is a device.

  See also

    file_stat() , write_file() , read_bytes()

  Method append_path
  Method append_path_unix
  Method append_path_nt

    `string append_path(string absolute, string ... relative)`
    `string append_path_unix(string absolute, string ... relative)`
    `string append_path_nt(string absolute, string ... relative)`

  Description

    Append relative paths to an absolute path and remove any `"//"`, `"../"` or `"/."` to produce a straightforward absolute path as a result.

    `"../"` is ignorded in the relative paths if it makes the created path begin with something else than the absolute path (or so far created path).

    append_path_nt() fixes drive letter issues in relative by removing the colon separator `":"` if it exists (k:/fnord appends as k/fnord)

    append_path_nt() also makes sure that UNC path(s) in relative is appended correctly by removing any `"\\"` or `"//"` from the beginning.

    append_path() is equivalent to append_path_unix() on UNIX-like operating systems, and equivalent to append_path_nt() on NT-like operating systems.

  See also

    combine_path()

  Method simplify_path

    `string simplify_path(string path)`

  Description

    Returns a canonic representation of path (without /./, /../, // and similar path segments).

  Method perror

    `void perror(string s)`

  Description

    This function prints a message to stderr along with a description of what went wrong if available. It uses the system errno to find out what went wrong, so it is only applicable to IO errors.

  See also

    werror()

  Method is_file

    `int is_file(string path)`

  Description

    Check if a path is a file.

  Returns

    Returns true if the given path is a file, otherwise false.

  See also

    exist() , is_dir() , is_link() , file_stat()

  Method is_dir

    `int is_dir(string path)`

  Description

    Check if a path is a directory.

  Returns

    Returns true if the given path is a directory, otherwise false.

  See also

    exist() , is_file() , is_link() , file_stat()

  Method is_link

    `int is_link(string path)`

  Description

    Check if a path is a symbolic link.

  Returns

    Returns true if the given path is a symbolic link, otherwise false.

  See also

    exist() , is_dir() , is_file() , file_stat()

  Method exist

    `int exist(string path)`

  Description

    Check if a path exists.

  Returns

    Returns true if the given path exists (is a directory or file), otherwise false.

  Note

    May fail with eg errno() `EFBIG` if the file exists, but the filesystem doesn't support the file size.

  See also

    is_dir() , is_file() , is_link() , file_stat()

  Method convert_modestring2int

    `int convert_modestring2int(string mode_string)`

  Description

    Convert the mode_string string as returned by Stdio.Stat object to int suitable for chmod

  Parameter `mode_string`

    The string as return from Stdio.Stat()->mode_string

  Returns

    An int matching the permission of the mode_string string suitable for chmod

  Method cp

    `int cp(string from, string to)`

  Description

    Copies the file from to the new position to . If there is no system function for cp, a new file will be created and the old one copied manually in chunks of 65536 bytes. This function can also copy directories recursively.

  Returns

    0 on error, 1 on success

  Note

    This function keeps file and directory mode bits, unlike in Pike 7.6 and earlier.

  Method file_equal

    `int file_equal(string file_1, string file_2)`

  Description

    Returns nonzero if the given paths are files with identical content, returns zero otherwise. Zero is also returned for any sort of I/O error.

  Method async_cp

    `void async_cp(string from, string to, function(int:void) callback, mixed ... args)`

  Description

    Copy a file asynchronously.

    This function is similar to cp() , but works asynchronously.

  Parameter `from`

    Name of file to copy.

  Parameter `to`

    Name of file to create or replace with a copy of from .

  Parameter `callback`

    Function to be called on completion. The first argument will be `1` on success, and `0` (zero) otherwise. The rest of the arguments to callback are passed verbatim from args .

  Parameter `args`

    Extra arguments to pass to callback .

  Note

    For callback to be called, the backend must be active (ie main() must have returned `-1`, or Pike.DefaultBackend get called in some other way). The actual copying may start before the backend has activated.

  Bugs

    Currently the file sizes are not compared, so the destination file (to ) may be truncated.

  See also

    cp() , sendfile()

  Method mkdirhier

    `int mkdirhier(string pathname, void|int mode)`

  Description

    Creates zero or more directories to ensure that the given pathname is a directory.

    If a mode is given, it's used for the new directories after being &'ed with the current umask (on OS'es that support this).

  Returns

    Returns zero on failure and nonzero on success.

  See also

    mkdir()

  Method recursive_rm

    `int recursive_rm(string path)`

  Description

    Remove a file or a directory tree.

  Returns

    Returns 0 on failure, nonzero otherwise.

  See also

    rm

  Method recursive_mv

    `int recursive_mv(string from, string to)`

  Description

    Copy a file or a directory tree by copying and then removing. Mode bits are preserved in the copy. It's not the fastest but works on every OS and works well across different file systems.

  Returns

    Returns 0 on failure, nonzero otherwise.

  See also

    recursive_rm cp

  Method sendfile

    `object sendfile(array(string) headers, File from, int offset, int len, array(string) trailers, File to)`
    `object sendfile(array(string) headers, File from, int offset, int len, array(string) trailers, File to, function(int:void) callback, mixed ... args)`

  Description

    Sends headers followed by len bytes starting at offset from the file from followed by trailers to the file to . When completed callback will be called with the total number of bytes sent as the first argument, followed by args .

    Any of headers , from and trailers may be left out by setting them to `0`.

    Setting offset to `-1` means send from the current position in from .

    Setting len to `-1` means send until from 's end of file is reached.

  Note

    The sending is performed asynchronously, and may complete both before and after the function returns.

    For callback to be called, the backend must be active (ie main() must have returned `-1`, or Pike.DefaultBackend get called in some other way).

    In some cases, the backend must also be active for any sending to be performed at all.

    In Pike 7.4.496, Pike 7.6.120 and Pike 7.7 and later the backend associated with to will be used rather than the default backend. Note that you usually will want from to have the same backend as to .

  Bugs

    FIXME: Support for timeouts?

  See also

    Stdio.File->set_nonblocking()

  Method werror

    `void werror(string s)`

  Description

    Write a message to stderr. Stderr is normally the console, even if the process output has been redirected to a file or pipe.

  Note

    This function is identical to predef::werror() .

  See also

    predef::werror()

  CLASS Stdio.File

    Description

      This is the basic I/O object, it provides socket and pipe communication as well as file access. It does not buffer reads and writes or provide line-by-line reading, that is done with Stdio.FILE object.

    Note

      The file or stream will normally be closed when this object is destructed (unless there are more objects that refer to the same file through use of assign or dup ). Objects do not contain cyclic references in themselves, so they will be destructed timely when they run out of references.

    See also

      Stdio.FILE

    Method tcgetattr
    Method tcsetattr

      `mapping tcgetattr()`
      `int tcsetattr(mapping attr)`
      `int tcsetattr(mapping attr, string when)`

    Description

      Gets/sets term attributes. The returned value/the attr parameter is a mapping on the form

      `"ispeed" : int(-1..)` | In baud rate.
      `"ospeed" : int(-1..)` | Out baud rate.
      `"csize" : int(-1..-1)|int(5..8)` | Character size in bits.
      `"rows" : int` | Terminal rows.
      `"columns" : int` | Terminal columns.

      `flag_name : int(0..1)`

      The value of a named flag. The flag name is the string describing the termios flags (IGNBRK, BRKINT, IGNPAR, PARMRK, INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IUCLC, IXON, IXANY, IXOFF, IMAXBEL, OPOST, OLCUC, ONLCR, OCRNL, ONOCR, ONLRET, OFILL, OFDEL, OXTABS, ONOEOT, CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL, CRTSCTS, ISIG, ICANON, XCASE, ECHO, ECHOE, ECHOK, ECHONL, ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, NOFLSH, TOSTOP, PENDIN). See the manpage for termios or other documentation for more information. All flags are not available on all platforms.

      `character_name : int(0..255)` | Sets the value of a control character (VINTR, VQUIT, VERASE, VKILL, VEOF, VTIME, VMIN, VSWTC, VSTART, VSTOP, VSUSP, VEOL, VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOL2). All control characters are not available on all platforms.

      Negative values are not allowed as indata, but might appear in the result from tcgetattr when the actual value is unknown. tcsetattr returns 0 if failed.

      The argument when to tcsetattr describes when the changes are to take effect:

      `"TCSANOW"` | The change occurs immediately (default).
      `"TCSADRAIN"` | The change occurs after all output has been written.
      `"TCSAFLUSH"` | The change occurs after all output has been written, and empties input buffers.

    Example

          // setting the terminal in raw mode:
             Stdio.stdin->tcsetattr((["ECHO":0,"ICANON":0,"VMIN":0,"VTIME":0]));

    Note

      Unknown flags are ignored by tcsetattr() . tcsetattr always changes the attribute, so only include attributes that actually should be altered in the attribute mapping.

    Bugs

      Terminal rows and columns setting by tcsetattr() is not currently supported.

    Method receive_fd

      `void receive_fd(Stdio.Fd fd)`

    Description

      Remote file descriptor reception handler.

    Parameter `fd`

      File descriptor received from the remote end of a pipe() . This object has been created by fd_factory() .

      This function is called from read() when a remote file descriptor has been received over a PROP_SEND_FD capable pipe() .

      The default implementation is just a prototype.

      Overload this function to enable reception of remote file descriptors.

    Note

      The capability of sending and receiving remote file descriptors is only available on some operating systems. This capability is indicated by the precence of __HAVE_SEND_FD__ .

    See also

      send_fd() , read() , fd_factory() , __HAVE_SEND_FD__

    Method read

      `string read()`
      `string read(int len)`
      `string read(int len, int(0..1) not_all)`

    Description

      Read data from a file or a stream.

      Attempts to read len bytes from the file, and return it as a string. Less than len bytes can be returned if:

      - end-of-file is encountered for a normal file, or

      - it's a stream that has been closed from the other end, or

      - it's a stream in nonblocking mode, or

      - it's a stream and not_all is set, or

      - not_all isn't set and an error occurred (see below).

      If not_all is nonzero, read() does not try its best to read as many bytes as you have asked for, but merely returns as much as the system read function returns. This is mainly useful with stream devices which can return exactly one row or packet at a time. If not_all is used in blocking mode, read() only blocks if there's no data at all available.

      If something goes wrong and not_all is set, zero is returned. If something goes wrong and not_all is zero or left out, then either zero or a string shorter than len is returned. If the problem persists then a later call to read() fails and returns zero, however.

      If everything went fine, a call to errno() directly afterwards returns zero. That includes an end due to end-of-file or remote close.

      If no arguments are given, read() reads to the end of the file or stream.

      If any file descriptors have been sent by the other side of the stream, receive_fd() will be called once for every sent file descriptor.

    Note

      It's not necessary to set not_all to avoid blocking reading when nonblocking mode is used.

    Note

      When at the end of a file or stream, repeated calls to read() will return the empty string since it's not considered an error. The empty string is never returned in other cases, unless nonblocking mode is used or len is zero.

    See also

      read_oob() , write() , receive_fd() , send_fd()

    Method peek

      `int(-1..1) peek()`
      `int(-1..1) peek(int|float timeout)`
      `int(-1..1) peek(int|float timeout, int not_eof)`

    Description

      Check if there is data available to read, or wait some time for available data to read.

      More specifically, a later call to read() will return immediately, either due to data being present, or due to some error (eg if a socket has been closed).

    Parameter `timeout`

      Timeout in seconds.

    Parameter `not_eof`

      Flag for specifying handling of end of file. The following values are currently defined:

      `0` | Traditional (and default) behaviour. Return `1` at EOF.
      `1` | Regard EOF as an error. Return `-1` and set errno() to return `EPIPE` at EOF.

    Returns

      `1` | There is data available to read() , or not_eof is `0` (zero) and we're at EOF. A later call to read() will not block.
      `0` | There is no data available (ie timeout).
      `-1` | Error condition. The error code returned by errno() has been updated.

    See also

      errno() , read()

    Note

      The function may be interrupted prematurely of the timeout (due to signals); check the timing manually if this is imporant.

    Note

      The not_eof parameter was added in Pike 7.7.

    Note

      This function was not available on NT in Pike 7.6 and earlier.

    Method read_oob

      `string read_oob()`
      `string read_oob(int len)`
      `string read_oob(int len, int(0..1) not_all)`

    Description

      Attempts to read len bytes of out-of-band data from the stream, and returns it as a string. Less than len bytes can be returned if:

      - the stream has been closed from the other end, or

      - nonblocking mode is used, or

      - not_all is set, or

      - not_all isn't set and an error occurred (see below).

      If not_all is nonzero, read_oob() only returns as many bytes of out-of-band data as are currently available.

      If something goes wrong and not_all is set, zero is returned. If something goes wrong and not_all is zero or left out, then either zero or a string shorter than len is returned. If the problem persists then a later call to read_oob() fails and returns zero, however.

      If everything went fine, a call to errno() directly afterwards returns zero. That includes an end due to remote close.

      If no arguments are given, read_oob() reads to the end of the stream.

    Note

      Out-of-band data was not supported in Pike 0.5 and earlier, and not in Pike 0.6 through 7.4 if they were compiled with the option `'--without-oob'`.

    Note

      It is not guaranteed that all out-of-band data sent from the other end is received. Most streams only allow for a single byte of out-of-band data at a time.

    Note

      It's not necessary to set not_all to avoid blocking reading when nonblocking mode is used.

    Note

      When at the end of a file or stream, repeated calls to read() returns the empty string since it's not considered an error. The empty string is never returned in other cases, unless nonblocking mode is used or len is zero.

    See also

      read() , write_oob()

    Method write

      `int write(string data)`
      `int write(string format, mixed ... extras)`
      `int write(array(string) data)`
      `int write(array(string) format, mixed ... extras)`

    Description

      Write data to a file or a stream.

      Writes data and returns the number of bytes that were actually written. It can be less than the size of the given data if

      - some data was written successfully and then something went wrong, or

      - nonblocking mode is used and not all data could be written without blocking.

      -1 is returned if something went wrong and no bytes were written. If only some data was written due to an error and that error persists, then a later call to write() fails and returns -1.

      If everything went fine, a call to errno() directly afterwards returns zero.

      If data is an array of strings, they are written in sequence.

      If more than one argument is given, sprintf() is used to format them using format . If format is an array, the strings in it are concatenated and the result is used as format string.

      If there are any file descriptors that have been queued for sending (with send_fd() ), they will be sent.

    Note

      Writing of wide strings is not supported. You have to encode the data somehow, e.g. with string_to_utf8 or with one of the charsets supported by Locale.Charset.encoder .

    See also

      read() , write_oob() , send_fd()

    Method write_oob

      `int write_oob(string data)`
      `int write_oob(string format, mixed ... extras)`

    Description

      Write out-of-band data to a stream.

      Writes out-of-band data to a stream and returns how many bytes that were actually written. It can be less than the size of the given data if some data was written successfully and then something went wrong.

      -1 is returned if something went wrong and no bytes were written. If only some data was written due to an error and that error persists, then a later call to write_oob() fails and returns -1.

      If everything went fine, a call to errno() directly afterwards returns zero.

      If more than one argument is given, sprintf() is used to format them.

    Note

      Out-of-band data was not supported in Pike 0.5 and earlier, and not in Pike 0.6 through 7.4 if they were compiled with the option `'--without-oob'`.

    Note

      It is not guaranteed that all out-of-band data sent from the other end is received. Most streams only allow for a single byte of out-of-band data at a time. Some streams sends the rest of the data as ordinary data.

    See also

      read_oob() , write()

    Method send_fd

      `void send_fd(Stdio.Fd fd)`

    Description

      Queues an open file descriptor for sending to the other end of a stream.

    Note

      The actual sending is performed at the next successful call to write() , this is due to limitations in the system calls. This means that it isn't possible to send a file descriptor without also sending some in-band data.

      This operation is only supported on pipe() 's created with PROP_SEND_FD .

      This function is not available on all operating systems, check for __HAVE_SEND_FD__ .

      The queue is emptied on successful write() and when the write direction is close() 'd.

    See also

      receive_fd() , write() , pipe() , read() , __HAVE_SEND_FD__

    Method grantpt

      `string grantpt()`

    Description

      If this file has been created by calling openpt() , return the filename of the associated pts-file. This function should only be called once.

    Note

      This function is only available on some platforms.

    Method close

      `int close()`
      `int close(string direction)`

    Description

      Close a file or stream.

      If direction is not specified, both the read and the write direction is closed. Otherwise only the directions specified is closed.

    Returns

      Nonzero is returned if the file or stream wasn't open in the specified direction, zero otherwise.

    Throws

      An exception is thrown if an I/O error occurs.

    Note

      close() has no effect if this file object has been associated with an already opened file, i.e. if open() was given an integer as the first argument.

    See also

      open() , open_socket()

    Method open

      `int open(string filename, string mode)`
      `int open(string filename, string mode, int access)`
      `int open(int fd, string mode)`

    Description

      Open a file, or use an existing fd.

      If filename is given, attempt to open the named file. If fd is given instead, it should be the file descriptor for an already opened file, which will then be used by this object.

      mode describes how the file is opened. It's a case-insensitive string consisting of one or more of the following letters:

      "r"

        Open for reading.

      "w"

        Open for writing.

      "a"

        Append new data to the end.

      "c"

        Create the file if it doesn't exist already.

      "t"

        Truncate the file to zero length if it already contains data. Use only together with `"w"`.

      "x"

        Open exclusively - the open fails if the file already exists. Use only together with `"c"`. Note that it's not safe to assume that this is atomic on some systems.

      access specifies the permissions to use if a new file is created. It is a UNIX style permission bitfield:

      0400

        User has read permission.

      0200

        User has write permission.

      0100

        User has execute permission.

      0040

        Group has read permission.

      0020

        Group has write permission.

      0010

        Group has execute permission.

      0004

        Others have read permission.

      0002

        Others have write permission.

      0001

        Others have execute permission.

      It's system dependent on which of these bits that are actually heeded. If access is not specified, it defaults to `00666`, but note that on UNIX systems it's masked with the process umask before use.

    Returns

      Returns nonzero on success and `0` (zero) on failure. If there is a failure then errno returns the error code.

    See also

      close()

    Method openat

      `Stdio.File openat(string filename, string mode)`
      `Stdio.File openat(string filename, string mode, int access)`

    Description

      Open a file relative to an opened directory.

    Returns

      Returns a new file object on success, and `0` (zero) on failure.

    Note

      Not available on all architectures, or in Pike 7.6 and earlier.

    See also

      open() , statat() , unlinkat()

    Method openpt

      `int openpt(string mode)`

    Description

      Open the master end of a pseudo-terminal pair.

    Returns

      This function returns `1` for success, `0` otherwise.

    See also

      grantpt()

    Method sync

      `int(0..1) sync()`

    Description

      Flush buffers to disk.

    Returns

      Returns `0` (zero) and sets errno on failure.

      Returns `1` on success.

    Method seek

      `int seek(int pos)`
      `int seek(int unit, int mult)`
      `int seek(int unit, int mult, int add)`

    Description

      Seek to a specified offset in a file.

      If mult or add are specified, pos is calculated as `<font face='courier'>pos` = <font face='courier'>unit *<font face='courier'>mult + <font face='courier'>add .

      If pos is negative then it is relative to the end of the file, otherwise it's an absolute offset from the start of the file.

    Returns

      Returns the new offset, or `-1` on failure.

    Note

      The arguments mult and add are considered obsolete, and should not be used.

    See also

      tell()

    Method tell

      `int tell()`

    Description

      Returns the current offset in the file.

    See also

      seek()

    Method truncate

      `int(0..1) truncate(int length)`

    Description

      Truncate a file.

      Truncates the file to the specified length length .

    Returns

      Returns `1` on success, and `0` (zero) on failure.

    See also

      open()

    Method stat

      `Stat stat()`

    Description

      Get status for an open file.

      This function returns the same information as the function file_stat() , but for the file it is called in. If file is not an open file, `0` (zero) is returned. Zero is also returned if file is a pipe or socket.

    Returns

      See file_stat() for a description of the return value.

    Note

      Prior to Pike 7.1 this function returned an array(int).

    See also

      file_stat() , statat()

    Method statat

      `Stat statat(string path, void|int(0..1) symlink)`

    Description

      Get status for a file relative an open directory.

      This function returns the same information as the function file_stat() , but relative to the file it is called in. If file is not an open file, `0` (zero) is returned. Zero is also returned if file is a pipe or socket.

    Returns

      See file_stat() for a description of the return value.

    Note

      Not available on all architectures, or in Pike 7.6 and earlier.

    See also

      file_stat() , stat() , openat() , unlinkat()

    Method unlinkat

      `int unlinkat(string f)`

    Description

      Remove a file or directory relative to an open file.

    Returns

      Returns `0` (zero) on failure, `1` otherwise.

    See also

      rm() , openat() , statat()

    Method listxattr

      `array(string) listxattr()`

    Description

      Return an array of all extended attributes set on the file

    Method getxattr

      `string getxattr(string attr)`

    Description

      Return the value of a specified attribute, or 0 if it does not exist

    Method removexattr

      `void removexattr(string attr)`

    Description

      Remove the specified extended attribute.

    Method setxattr

      `void setxattr(string attr, string value, int flags)`

    Description

      Set the attribute attr to the value value .

      The flags parameter can be used to refine the semantics of the operation.

      Stdio.XATTR_CREATE specifies a pure create, which fails if the named attribute exists already.

      Stdio.XATTR_REPLACE specifies a pure replace operation, which fails if the named attribute does not already exist.

      By default (no flags), the extended attribute will be created if need be, or will simply replace the value if the attribute exists.

    Returns

      1 if successful, 0 otherwise, setting errno.

    Method errno

      `int errno()`

    Description

      Return the errno for the latest failed file operation.

    Method mode

      `int mode()`

    Description

      Returns the open mode and capabilities for the file.

    Returns

      Returns an `|() of the following flags:

      `0x1000` | FILE_READ
      `0x2000` | FILE_WRITE
      `0x4000` | FILE_APPEND
      `0x8000` | FILE_CREATE
      `0x0100` | FILE_TRUNC
      `0x0200` | FILE_EXCLUSIVE
      `0x0400` | FILE_NONBLOCKING
      `0x0040` | PROP_SEND_FD
      `0x0010` | PROP_BIDIRECTIONAL
      `0x0008` | PROP_BUFFERED
      `0x0004` | PROP_SHUTDOWN
      `0x0002` | PROP_NONBLOCK
      `0x0001` | PROP_IPC

    Note

      In some versions of Pike 7.7 and 7.8 the `PROP_` flags were filtered from the result.

    See also

      open()

    Method set_backend

      `void set_backend(Pike.Backend backend)`

    Description

      Set the backend used for the callbacks.

    Note

      The backend keeps a reference to this object only when it is in callback mode. So if this object hasn't got any active callbacks and it runs out of other references, it will still be destructed quickly (after closing, if necessary).

      Also, this object does not keep a reference to the backend.

    See also

      query_backend , set_nonblocking , set_read_callback , set_write_callback

    Method query_backend

      `Pike.Backend query_backend()`

    Description

      Return the backend used for the callbacks.

    See also

      set_backend

    Method set_nonblocking

      `void set_nonblocking()`

    Description

      Sets this file to nonblocking operation.

    Note

      Nonblocking operation is not supported on all Stdio.File objects. Notably it is not guaranteed to be supported on objects returned by pipe() unless PROP_NONBLOCK was specified in the call to pipe() .

    See also

      set_blocking()

    Method set_blocking

      `void set_blocking()`

    Description

      Sets this file to blocking operation.

      This is the inverse operation of set_nonblocking() .

    See also

      set_nonblocking()

    Method set_close_on_exec

      `void set_close_on_exec(int(0..1) yes_no)`

    Description

      Marks the file as to be closed in spawned processes.

      This function determines whether this file will be closed when calling exec().

      Default is that the file WILL be closed on exec except for stdin, stdout and stderr.

    See also

      Process.create_process() , exec()

    Method is_open

      `int is_open()`

    Description

      Returns true if the file is open.

    Note

      If the file is a socket that has been closed from the remote side, this function might still return true.

    Note

      Most methods can't be called for a file descriptor that isn't open. Notable exceptions errno , mode , and the set and query functions for callbacks and backend.

    Method query_fd

      `int query_fd()`

    Description

      Returns the file descriptor number associated with this object.

    Method release_fd

      `int release_fd()`

    Description

      Returns the file descriptor number associated with this object, in addition to releasing it so that this object behaves as if closed. Other settings like callbacks and backend remain intact. take_fd can later be used to reinstate the file descriptor so that the state is restored.

    See also

      query_fd() , take_fd()

    Method take_fd

      `void take_fd(int fd)`

    Description

      Rehooks the given file descriptor number to be associated with this object. As opposed to using open with a file descriptor number, it will be closed by this object upon destruct or when close is called.

    See also

      release_fd()

    Method set_buffer

      `void set_buffer(int bufsize, string mode)`
      `void set_buffer(int bufsize)`

    Description

      Set internal socket buffer.

      This function sets the internal buffer size of a socket or stream.

      The second argument allows you to set the read or write buffer by specifying `"r"` or `"w"`.

    Note

      It is not guaranteed that this function actually does anything, but it certainly helps to increase data transfer speed when it does.

    See also

      open_socket() , accept()

    Method pipe

      `Stdio.File pipe()`
      `Stdio.File pipe(int flags)`

    Method dup2

      `int dup2(Stdio.File to)`

    Description

      Duplicate a file over another.

      This function works similarly to assign() , but instead of making the argument a reference to the same file, it creates a new file with the same properties and places it in the argument.

    Returns

      Returns `1` on success and `0` (zero) on failure.

    Note

      In Pike 7.7 and later to need not be open, in which case a new fd is allocated.

    Note

      Note also that to is also assigned to the same backend (if any) as this object.

    See also

      assign() , dup()

    Method dup

      `Stdio.Fd dup()`

    Description

      Duplicate the file.

    See also

      dup2()

    Method open_socket

      `int(0..1) open_socket(int|void port, string|void addr, int|string|void family_hint)`

    Method set_keepalive

      `int(0..1) set_keepalive(int(0..1) on_off)`

    Method connect_unix

      `int(0..1) connect_unix(string filename)`

    Description

      Open a UNIX domain socket connection to the specified destination.

    Parameter `filename`

      Filename to create.

      In nonblocking mode, success is indicated with the write-callback, and failure with the close-callback or the read_oob-callback.

    Returns

      Returns `1` on success, and `0` on failure.

    Note

      In nonblocking mode `0` (zero) may be returned and errno() set to `EWOULDBLOCK` or `WSAEWOULDBLOCK`. This should not be regarded as a connection failure.

    Note

      path had a quite restrictive length limit (~100 characters) prior to Pike 7.8.334.

    Method connect

      `int(0..1) connect(string dest_addr, int dest_port)`
      `int(0..1) connect(string dest_addr, int dest_port, string src_addr, int src_port)`

    Description

      Open a TCP/IP connection to the specified destination.

      In nonblocking mode, success is indicated with the write-callback, and failure with the close-callback or the read_oob-callback.

    Returns

      Returns `1` on success, and `0` on failure.

    Note

      In nonblocking mode `0` (zero) may be returned and errno() set to `EWOULDBLOCK` or `WSAEWOULDBLOCK`. This should not be regarded as a connection failure.

    Method query_address

      `string query_address()`
      `string query_address(int(0..1) local)`

    Description

      Get address and port of a socket end-point.

    Parameter `local`

      If the argument local is not specified, or is `0` (zero), the remote end-point is returned. Otherwise, if local is `1`, the local end-point is returned.

    Returns

      This function returns the address and port of a socket end-point on the form `"x.x.x.x port"` (IPv4) or `"x:x:x:x:x:x:x:x port"` (IPv6). IPv6 addresses may use the contracted syntax.

      If this file is not a socket, is not connected, or some other error occurs, `0` (zero) is returned and errno() will return the error code.

    Throws

      An error is thrown if the socket (or file) isn't open.

    See also

      connect()

    Method `<<

      `Stdio.File `<<(string data)`
      `Stdio.File `<<(mixed data)`

    Description

      Write some data to a file.

      If data is not a string, it is casted to string, and then written to the file.

    Note

      Throws an error if not all data could be written.

    See also

      write()

    Method create

      `void Stdio.File(string filename)`
      `void Stdio.File(string filename, string mode)`
      `void Stdio.File(string filename, string mode, int access)`
      `void Stdio.File(int fd)`
      `void Stdio.File(int fd, string mode)`

    Description

      See open() .

    See also

      open()

    Method proxy

      `void proxy(Stdio.File from)`

    Description

      Starts a thread that asynchronously copies data from from to this file.

    See also

      Stdio.sendfile()

    Method lock

      `Stdio.FileLockKey lock()`
      `Stdio.FileLockKey lock(int(0..1) is_recursive)`

    Description

      Makes an exclusive file lock on this file.

    See also

      trylock()

    Method trylock

      `Stdio.FileLockKey trylock()`
      `Stdio.FileLockKey trylock(int(0..1) is_recursive)`

    Description

      Attempts to place a file lock on this file.

    See also

      lock()

    Method notify

      `void notify(void|int notification, function(void:void) callback)`

    Description

      Receive notification when change occur within the fd. To use, create a Stdio.File object of a directory like Stdio.File(".") and then call notify() with the appropriate parameters.

    Note

      When a program registers for some notification, only the first notification will be received unless DN_MULTISHOT is specified as part of the notification argument.

    Note

      At present, this function is Linux-specific and requires a kernel which supports the F_NOTIFY fcntl() call.

    Parameter `notification`

      What to notify the callback of. See the Stdio.DN_* constants for more information about possible notifications.

    Parameter `callback`

      Function which should be called when notification is received. The function gets the signal used to indicate the notification as its argument and shouldn't return anyting.

    Inherit Fd_ref

      inherit Fd_ref : Fd_ref

    Inherit Fd

      inherit Fd : Fd

    Method errno

      `int errno()`

    Description

      Returns the error code for the last command on this file. Error code is normally cleared when a command is successful.

    Method open

      `int open(string filename, string mode)`
      `int open(string filename, string mode, int mask)`

    Description

      Open a file for read, write or append. The parameter mode should contain one or more of the following letters:

      `"r"` | Open file for reading.
      `"w"` | Open file for writing.
      `"a"` | Open file for append (use with `"w"`).
      `"t"` | Truncate file at open (use with `"w"`).
      `"c"` | Create file if it doesn't exist (use with `"w"`).
      `"x"` | Fail if file already exists (use with `"c"`).

      mode should always contain at least one of the letters `"r"` or `"w"`.

      The parameter mask is protection bits to use if the file is created. Default is `0666` (read+write for all in octal notation).

    Returns

      This function returns `1` for success, `0` otherwise.

    See also

      close() , create()

    Method openpt

      `int openpt(string mode)`

    Description

      Open the master end of a pseudo-terminal pair. The parameter mode should contain one or more of the following letters:

      `"r"` | Open terminal for reading.
      `"w"` | Open terminal for writing.

      mode should always contain at least one of the letters `"r"` or `"w"`.

    See also

      grantpt()

    Method open_socket

      `int open_socket(int|string|void port, string|void address, int|string|void family_hint)`

    Description

      This makes this file into a socket ready for connections. The reason for this function is so that you can set the socket to nonblocking or blocking (default is blocking) before you call connect() .

    Parameter `port`

      If you give a port number to this function, the socket will be bound to this port locally before connecting anywhere. This is only useful for some silly protocols like FTP. The port can also be specified as a string, giving the name of the service associated with the port.

    Parameter `address`

      You may specify an address to bind to if your machine has many IP numbers.

    Parameter `family_hint`

      A protocol family for the socket can be specified. If no family is specified, one which is appropriate for the address is automatically selected. Thus, there is normally no need to specify it. If you do not want to specify a bind address, you can provide the address as a hint here instead, to allow the automatic selection to work anyway.

    Returns

      This function returns 1 for success, 0 otherwise.

    See also

      connect() , set_nonblocking() , set_blocking()

    Method connect

      `int connect(string host, int|string port, void|string client, void|int|string client_port)`

    Description

      This function connects a socket previously created with open_socket() to a remote socket through TCP/IP. The host argument is the hostname or IP number of the remote machine. A local IP and port can be explicitly bound by specifying client and client_port .

    Returns

      This function returns 1 for success, 0 otherwise.

    Note

      In nonblocking mode `0` (zero) may be returned and errno() set to `EWOULDBLOCK` or `WSAEWOULDBLOCK`. This should not be regarded as a connection failure. In nonblocking mode you need to wait for a write or close callback before you know if the connection failed or not.

    See also

      query_address() , async_connect() , connect_unix()

    Method connect_unix

      `int connect_unix(string path)`

    Description

      Open a UNIX domain socket connection to the specified destination.

    Returns

      Returns `1` on success, and `0` on failure.

    Note

      Nonblocking mode is not supported while connecting

    Method read_function

      `function(:string) read_function(int nbytes)`

    Description

      Returns a function that when called will call read with nbytes as argument. Can be used to get various callback functions, eg for the fourth argument to String.SplitIterator .

    Method line_iterator

      `String.SplitIterator|LineIterator line_iterator(int|void trim)`

    Description

      Returns an iterator that will loop over the lines in this file. If trim is true, all `'\r'` characters will be removed from the input.

    Method async_connect

      `int async_connect(string host, int|string port, function(int:void) callback, mixed ... args)`

    Description

      Open a TCP/IP connection asynchronously.

      This function is similar to connect() , but works asynchronously.

    Parameter `host`

      Hostname or IP to connect to.

    Parameter `port`

      Port number or service name to connect to.

    Parameter `callback`

      Function to be called on completion. The first argument will be `1` if a connection was successfully estabished, and `0` (zero) on failure. The rest of the arguments to callback are passed verbatim from args .

    Parameter `args`

      Extra arguments to pass to callback .

    Returns

      Returns `0` on failure, and `1` if callback will be used.

    Note

      The socket may be opened with open_socket() ahead of the call to this function, but it is not required.

    Note

      This object is put in callback mode by this function. For callback to be called, the backend must be active. See e.g. set_read_callback for more details about backends and callback mode.

    Note

      The socket will be in nonblocking state if the connection is successful, and any callbacks will be cleared.

    See also

      connect() , open_socket() , set_nonblocking()

    Method pipe

      `File pipe(void|int required_properties)`

    Description

      This function creates a pipe between the object it was called in and an object that is returned.

    Parameter `required_properties`

      Binary or (predef::`|() ) of required `PROP_` properties.

      `PROP_IPC` | The resulting pipe may be used for inter process communication.
      `PROP_NONBLOCK` | The resulting pipe supports nonblocking I/O.
      `PROP_SHUTDOWN` | The resulting pipe supports shutting down transmission in either direction (see close() ).
      `PROP_BUFFERED` | The resulting pipe is buffered (usually 4KB).
      `PROP_BIDIRECTIONAL` | The resulting pipe is bi-directional.
      `PROP_SEND_FD` | The resulting pipe might support sending of file descriptors (see send_fd() and receive_fd() for details).
      `PROP_REVERSE` | The resulting pipe supports communication "backwards" (but not necessarily "forwards", see PROP_BIDIRECTIONAL ).

      The default is `PROP_NONBLOCK|PROP_BIDIRECTIONAL`.

      If PROP_BIDIRECTIONAL isn't specified, the read-end is this object, and the write-end is the returned object (unless PROP_REVERSE has been specified, in which case it is the other way around).

      The two ends of a bi-directional pipe are indistinguishable.

      If the File object this function is called in was open to begin with, it will be closed before the pipe is created.

    Note

      Calling this function with an argument of `0` is not the same as calling it with no arguments.

    See also

      Process.create_process() , send_fd() , receive_fd() , PROP_IPC , PROP_NONBLOCK , PROP_SEND_FD , PROP_SHUTDOWN , PROP_BUFFERED , PROP_REVERSE , PROP_BIDIRECTIONAL

    Method openat

      `File openat(string filename, string mode)`
      `File openat(string filename, string mode, int mask)`

    Description

      Open a file relative to an open directory.

    See also

      File.statat() , File.unlinkat()

    Method send_fd

      `int(0..1) send_fd(File|Fd file)`

    Method create

      `void Stdio.File()`
      `void Stdio.File(string filename)`
      `void Stdio.File(string filename, string mode)`
      `void Stdio.File(string filename, string mode, int mask)`
      `void Stdio.File(string descriptorname)`
      `void Stdio.File(int fd)`
      `void Stdio.File(int fd, string mode)`

    Description

      There are four basic ways to create a Stdio.File object. The first is calling it without any arguments, in which case the you'd have to call open() , connect() or some other method which connects the File object with a stream.

      The second way is calling it with a filename and open mode . This is the same thing as cloning and then calling open() , except shorter and faster.

      The third way is to call it with descriptorname of `"stdin"`, `"stdout"` or `"stderr"`. This will open the specified standard stream.

      For the advanced users, you can use the file descriptors of the systems (note: emulated by pike on some systems - like NT). This is only useful for streaming purposes on unix systems. This is not recommended at all if you don't know what you're into. Default mode for this is `"rw"`.

    Note

      Open mode will be filtered through the system UMASK. You might need to use chmod() later.

    See also

      open() , connect() , Stdio.FILE ,

    Method assign

      `int assign(File|Fd o)`

    Description

      This function takes a clone of Stdio.File and assigns all variables of this file from it. It can be used together with dup() to move files around.

    See also

      dup()

    Method dup

      `File dup()`

    Description

      This function returns a clone of Stdio.File with all variables copied from this file.

    Note

      All variables, even `id`, are copied.

    See also

      assign()

    Method close

      `int close()`
      `int close(string direction)`

    Description

      Close the file. Optionally, specify "r", "w" or "rw" to close just the read, just the write or both read and write directions of the file respectively.

      An exception is thrown if an I/O error occurs.

    Returns

      Nonzero is returned if the file wasn't open in the specified direction, zero otherwise.

    Note

      This function will not call the `close_callback`.

    See also

      open , open_socket

    Method set_read_callback
    Method set_write_callback
    Method set_read_oob_callback
    Method set_write_oob_callback
    Method set_close_callback

      `void set_read_callback(function(mixed:int) read_cb)`
      `void set_write_callback(function(mixed:int) write_cb)`
      `void set_read_oob_callback(function(mixed:int) read_oob_cb)`
      `void set_write_oob_callback(function(mixed:int) write_oob_cb)`
      `void set_close_callback(function(mixed:int) close_cb)`

    Description

      These functions set the various callbacks, which will be called when various events occur on the stream. A zero as argument will remove the callback.

      A Pike.Backend object is responsible for calling the callbacks. It requires a thread to be waiting in it to execute the calls. That means that only one of the callbacks will be running at a time, so you don't need mutexes between them.

      Unless you've specified otherwise with the set_backend function, the default backend Pike.DefaultBackend will be used. It's normally activated by returning `-1` from the `main` function and will then execute in the main thread.

      - When data arrives on the stream, read_cb will be called with some or all of that data as the second argument.

      - When the stream has buffer space over for writing, write_cb will be called so that you can write more data to it.

        This callback is also called after the remote end of a socket connection has closed the write direction. An attempt to write data to it in that case will generate a System.EPIPE errno. If the remote end has closed both directions simultaneously (the usual case), Pike will first attempt to call close_cb , then this callback (unless close_cb has closed the stream).

      - When out-of-band data arrives on the stream, read_oob_cb will be called with some or all of that data as the second argument.

      - When the stream allows out-of-band data to be sent, write_oob_cb will be called so that you can write more out-of-band data to it.

        If the OS doesn't separate the write events for normal and out-of-band data, Pike will try to call write_oob_cb first. If it doesn't write anything, then write_cb will be tried. This also means that write_oob_cb might get called when the remote end of a connection has closed the write direction.

      - When an error or an end-of-stream in the read direction occurs, close_cb will be called. errno will return the error, or zero in the case of an end-of-stream.

        The name of this callback is rather unfortunate since it really has nothing to do with a close: The stream is still open when close_cb is called (you might not be able to read and/or write to it, but you can still use things like query_address , and the underlying file descriptor is still allocated). Also, this callback will not be called for a local close, neither by a call to close or by destructing this object.

        Also, close_cb will not be called if a remote close only occurs in the write direction; that is handled by write_cb (or possibly write_oob_cb ).

        Events to read_cb and close_cb will be automatically deregistered if an end-of-stream occurs, and all events in the case of an error. I.e. there won't be any more calls to the callbacks unless they are reinstalled. This doesn't affect the callback settings - query_read_callback et al will still return the installed callbacks.

      If the stream is a socket performing a nonblocking connect (see open_socket and connect ), a connection failure will call close_cb , and a successful connect will call either read_cb or write_cb as above.

      All callbacks will receive the `id` set by set_id as first argument.

      If a callback returns `-1`, no other callback or call out will be called by the backend in that round. I.e. the caller of the backend will get control back right away. For the default backend that means it will immediately start another round and check files and call outs anew.

    Note

      These functions do not set the file nonblocking.

    Note

      Callbacks are also set by set_callbacks and set_nonblocking() .

    Note

      After a callback has been called, it's disabled until it has accessed the stream accordingly, i.e. the write_cb callback is disabled after it's been called until something has been written with write , and the write_oob_cb callback is likewise disabled until something has been written with write_oob . Since the data already has been read when the read callbacks are called, this effect is not noticeable for them.

    Note

      Installing callbacks means that you will start doing I/O on the stream from the thread running the backend. If you are running these set functions from another thread you must be prepared that the callbacks can be called immediately by the backend thread, so it might not be safe to continue using the stream in this thread.

      Because of that, it's useful to talk about "callback mode" when any callback is installed. In callback mode the stream should be seen as "bound" to the backend thread. For instance, it's only the backend thread that reliably can end callback mode before the stream is "handed over" to another thread.

    Note

      Callback mode has nothing to do with nonblocking mode - although the two often are used together they don't have to be.

    Note

      The file object will stay referenced from the backend object as long as there are callbacks that can receive events.

    Bugs

      Setting a close callback without a read callback currently only works when there's no risk of getting more data on the stream. Otherwise the close callback will be silently deregistered if data arrives.

    See also

      set_callbacks , set_nonblocking() , set_id() , set_backend , query_read_callback , query_write_callback , query_read_oob_callback , query_write_oob_callback , query_close_callback

    Method set_callbacks

      `void set_callbacks(void|function(mixed:int) read_cb, void|function(mixed:int) write_cb, void|function(mixed:int) close_cb, void|function(mixed:int) read_oob_cb, void|function(mixed:int) write_oob_cb)`

    Description

      Installs all the specified callbacks at once. Use UNDEFINED to keep the current setting for a callback.

      Like set_nonblocking , the callbacks are installed atomically. As opposed to set_nonblocking , this function does not do anything with the stream, and it doesn't even have to be open.

    See also

      set_read_callback , set_write_callback , set_read_oob_callback , set_write_oob_callback , set_close_callback , query_callbacks

    Method query_read_callback
    Method query_write_callback
    Method query_read_oob_callback
    Method query_write_oob_callback
    Method query_close_callback
    Method query_callbacks

      `function(mixed:int) query_read_callback()`
      `function(mixed:int) query_write_callback()`
      `function(mixed:int) query_read_oob_callback()`
      `function(mixed:int) query_write_oob_callback()`
      `function(mixed:int) query_close_callback()`
      `array(function(mixed:int)) query_callbacks()`

    Description

      These functions return the currently installed callbacks for the respective events.

      query_callbacks returns the callbacks in the same order as set_callbacks and set_nonblocking expect them.

    See also

      set_nonblocking() , set_read_callback , set_write_callback , set_read_oob_callback , set_write_oob_callback , set_close_callback , set_callbacks

    Method set_id

      `void set_id(mixed id)`

    Description

      This function sets the `id` of this file. The `id` is mainly used as an identifier that is sent as the first argument to all callbacks. The default `id` is `0` (zero). Another possible use of the `id` is to hold all data related to this file in a mapping or array.

    See also

      query_id()

    Method query_id

      `mixed query_id()`

    Description

      This function returns the `id` that has been set with set_id() .

    See also

      set_id()

    Method set_nonblocking

      `void set_nonblocking(function(mixed:int) read_callback, function(mixed:int) write_callback, function(mixed:int) close_callback)`
      `void set_nonblocking(function(mixed:int) read_callback, function(mixed:int) write_callback, function(mixed:int) close_callback, function(mixed:int) read_oob_callback, function(mixed:int) write_oob_callback)`
      `void set_nonblocking()`

    Description

      This function sets a stream to nonblocking mode and installs the specified callbacks. See the `set_*_callback` functions for details about them. If no arguments are given, the callbacks will be cleared.

    Note

      As opposed to calling the set callback functions separately, this function will set all the callbacks and nonblocking mode atomically so that no callback gets called in between. That avoids races in case the backend is executed by another thread.

    Note

      Out-of-band data was not be supported on Pike 0.5 and earlier, and not on Pike 0.6 through 7.4 if they were compiled with the option `'--without-oob'`.

    See also

      set_blocking() , set_callbacks , set_read_callback() , set_write_callback() , set_read_oob_callback() , set_write_oob_callback() , set_close_callback() set_nonblocking_keep_callbacks() , set_blocking_keep_callbacks()

    Method set_blocking

      `void set_blocking()`

    Description

      This function clears all callbacks and sets a stream to blocking mode. i.e. reading, writing and closing will wait until data has been transferred before returning.

    Note

      The callbacks are cleared and blocking mode is set in one atomic operation, so no callback gets called in between if the backend is running in another thread.

      Even so, if the stream is in callback mode (i.e. if any callbacks are installed) then only the backend thread can use this function reliably; it might otherwise already be running in a callback which is about to call e.g. write when the stream becomes blocking.

    See also

      set_nonblocking() , set_nonblocking_keep_callbacks() , set_blocking_keep_callbacks()

    Method set_nonblocking_keep_callbacks
    Method set_blocking_keep_callbacks

      `void set_nonblocking_keep_callbacks()`
      `void set_blocking_keep_callbacks()`

    Description

      Toggle between blocking and nonblocking, without changing the callbacks.

    See also

      set_nonblocking() , set_blocking()

  CLASS Stdio.Fd_ref

    Description

      Proxy class that contains stub functions that call the corresponding functions in Fd .

      Used by File .

    Variable _fd

      `Fd Stdio.Fd_ref._fd`

    Description

      Object to which called functions are relayed.

  CLASS Stdio.Fd

    Description

      Low level I/O operations. Use File instead.

    Method fd_factory

      `Fd fd_factory()`

    Description

      Factory creating Stdio.Fd objects.

      This function is called by openat() , pipe() , dup() and other functions creating new file objects.

      The default implementation calls `object_program(this_object())()` to create the new object, and returns the Fd inherit in it.

    Note

      Note that this function must return the Fd inherit in the object.

    See also

      Stdio.Port()->fd_factory() , openat() , pipe()

  CLASS Stdio.Stat

    Description

      This object is used to represent file status information from e.g. file_stat() .

      It contains the following items usually found in a C `struct stat`:

      mode

        File mode (see `mknod(2)`).

      size

        File size in bytes.

      uid

        User ID of the file's owner.

      gid

        Group ID of the file's owner.

      atime

        Time of last access in seconds since 00:00:00 UTC, 1970-01-01.

      mtime

        Time of last data modification.

      ctime

        Time of last file status change.

      ino

        Inode number.

      nlink

        Number of links.

      dev

        ID of the device containing a directory entry for this file.

      rdev

        ID of the device.

      It also contains some items that correspond to the C `IS*` macros:

      isreg

        Set if the file is a regular file.

      isdir

        Set if the file is a directory.

      islnk

        Set if the file is a symbolic link. Note that symbolic links are normally followed by the stat functions, so this might only be set if you turn that off, e.g. by giving a nonzero second argument to file_stat() .

      isfifo

        Set if the file is a FIFO (aka named pipe).

      issock

        Set if the file is a socket.

      ischr

        Set if the file is a character device.

      isblk

        Set if the file is a block device.

      There are also some items that provide alternative representations of the above:

      type

        The type as a string, can be any of `"reg"`, `"dir"`, `"lnk"`, `"fifo"`, `"sock"`, `"chr"`, `"blk"`, and `"unknown"`.

      mode_string

        The file mode encoded as a string in `ls -l` style, e.g. `"drwxr-xr-x"`.

      Note that some items might not exist or have meaningful values on some platforms.

      Additionally, the object may be initialized from or casted to an `array` on the form of a 'traditional' LPC stat-array, and it's also possible to index the object directly with integers as if it were such an array. The stat-array has this format:

      Array
      `int 0` | File mode, same as `mode`.
      `int 1` | If zero or greater, the file is a regular file and this is its size in bytes. If less than zero it gives the type: -2=directory, -3=symlink and -4=device.
      `int 2` | Time of last access, same as `atime`.
      `int 3` | Time of last data modification, same as `mtime`.
      `int 4` | Time of last file status change, same as `ctime`.
      `int 5` | User ID of the file's owner, same as `uid`.
      `int 6` | Group ID of the file's owner, same as `gid`.

      It's possible to modify the stat struct by assigning values to the items. They essentially work as variables, although some of them affect others, e.g. setting `isdir` clears `isreg` and setting `mode_string` changes many of the other items.

    Method create

      `void Stdio.Stat(void|object|array stat)`

    Description

      A new Stdio.Stat object can be initialized in two ways:

      - stat is an object, typically another Stdio.Stat . The stat info is copied from the object by getting the values of `mode`, `size`, `atime`, `mtime`, `ctime`, `uid`, `gid`, `dev`, `ino`, `nlink`, and `rdev`.

      - stat is a seven element array on the 'traditional' LPC stat-array form (see the class doc).

  CLASS Stdio.Port

    Description

      Handles listening to socket ports. Whenever you need a bound socket that is open and listens for connections you should use this program.

    Method set_id

      `mixed set_id(mixed id)`

    Description

      This function sets the id used for accept_callback by this port. The default id is this_object() .

    See also

      query_id

    Method query_id

      `mixed query_id()`

    Description

      This function returns the id for this port. The id is normally the first argument to accept_callback.

    See also

      set_id

    Method errno

      `int errno()`

    Description

      If the last call done on this port failed, this function will return an integer describing what went wrong. Refer to your unix manual for further information.

    Method listen_fd

      `int listen_fd(int fd, void|function accept_callback)`

    Description

      This function does the same as bind , except that instead of creating a new socket and bind it to a port, it expects the file descriptor fd to be an already open port.

    Note

      This function is only for the advanced user, and is generally used when sockets are passed to Pike at exec time.

    See also

      bind , accept

    Method bind

      `int bind(int|string port, void|function accept_callback, void|string ip)`

    Description

      Opens a socket and binds it to port number on the local machine. If the second argument is present, the socket is set to nonblocking and the callback funcition is called whenever something connects to it. The callback will receive the id for this port as argument and should typically call accept to establish a connection.

      If the optional argument ip is given, bind will try to bind to an interface with that host name or IP number.

    Returns

      1 is returned on success, zero on failure. errno provides further details about the error in the latter case.

    See also

      accept , set_id

    Method bind_unix

      `int bind_unix(string path, void|function accept_callback)`

    Description

      Opens a Unix domain socket at the given path in the file system. If the second argument is present, the socket is set to nonblocking and the callback funcition is called whenever something connects to it. The callback will receive the id for this port as argument and should typically call accept to establish a connection.

    Returns

      1 is returned on success, zero on failure. errno provides further details about the error in the latter case.

    Note

      This function is only available on systems that support Unix domain sockets.

    Note

      path had a quite restrictive length limit (~100 characters) prior to Pike 7.8.334.

    See also

      accept , set_id

    Method close

      `void close()`

    Description

      Closes the socket.

    Method create

      `void Stdio.Port(int|string port, void|function accept_callback, void|string ip)`
      `void Stdio.Port("stdin", void|function accept_callback)`

    Description

      When called with an int or any string except `"stdin"` as first argument, this function does the same as bind() would do with the same arguments.

      When called with `"stdin"` as argument, a socket is created out of the file descriptor 0. This is only useful if that actually IS a socket to begin with.

    See also

      bind , listen_fd

    Method accept

      `Stdio.File accept()`

    Description

      Get the first connection request waiting for this port and return it as a connected socket.

      If no connection request is waiting and the port is in nonblocking mode (i.e. an accept callback is installed) then zero is returned. Otherwise this function waits until a connection has arrived.

      In Pike 7.8 and later the returned object is created via fd_factory() .

    Note

      In Pike 7.7 and later the resulting file object will be assigned to the same backend as the port object.

    Method query_address

      `string query_address()`

    Description

      Get the address and port of the local socket end-point.

    Returns

      This function returns the address and port of a socket end-point on the form `"x.x.x.x port"` (IPv4) or `"x:x:x:x:x:x:x:x port"` (IPv6).

      If there is some error querying or formatting the address, `0` (zero) is returned and errno() will return the error code.

    Throws

      An error is thrown if the socket isn't bound.

    Method set_backend

      `void set_backend(Pike.Backend backend)`

    Description

      Set the backend used for the accept callback.

    Note

      The backend keeps a reference to this object as long as the port is accepting connections, but this object does not keep a reference to the backend.

    See also

      query_backend

    Method query_backend

      `Pike.Backend query_backend()`

    Description

      Return the backend used for the accept callback.

    See also

      set_backend

    Inherit _port

      inherit _port : _port

    Method fd_factory

      `Fd fd_factory()`

    Description

      Factory creating empty Fd objects.

      This function is called by accept() when it needs to create a new file.

    Method create

      `void Stdio.Port()`
      `void Stdio.Port(int|string port)`
      `void Stdio.Port(int|string port, function accept_callback)`
      `void Stdio.Port(int|string port, function accept_callback, string ip)`
      `void Stdio.Port("stdin")`
      `void Stdio.Port("stdin", function accept_callback)`

    Description

      If the first argument is other than `"stdin"` the arguments will be passed to bind() .

      When create is called with `"stdin"` as the first argument, a socket is created out of the file descriptor `0`. This is only useful if it actually is a socket to begin with.

    See also

      bind

    Method accept

      `File accept()`

    Description

      This function completes a connection made from a remote machine to this port. It returns a two-way stream in the form of a clone of Stdio.File . The new file is by initially set to blocking mode.

    See also

      Stdio.File

  CLASS Stdio.UDP

    Description

      UDP (User Datagram Protocol) handling.

    Method close

      `int(0..1) close()`

    Description

      Closes an open UDP port.

    Note

      This method was introduced in Pike 7.5.

    Method bind

      `UDP bind(int|string port)`
      `UDP bind(int|string port, string address)`

    Description

      Binds a port for receiving or transmitting UDP.

    Throws

      Throws error when unable to bind port.

    Method enable_broadcast

      `int(0..1) enable_broadcast()`

    Description

      Set the broadcast flag. If enabled then sockets receive packets sent to a broadcast address and they are allowed to send packets to a broadcast address.

    Returns

      Returns `1` on success, `0` (zero) otherwise.

    Note

      This is normally only avalable to root users.

    Method enable_multicast

      `int(0..1) enable_multicast(string reply_address)`

    Description

      Set the local device for a multicast socket. See also the Unix man page for setsocketopt IPPROTO_IP IP_MULTICAST_IF.

    Method set_multicast_ttl

      `int set_multicast_ttl(int ttl)`

    Description

      Set the time-to-live value of outgoing multicast packets for this socket. It is very important for multicast packets to set the smallest TTL possible. The default is 1 which means that multicast packets don't leacl the local network unless the user program explicitly request it. See also the Unix man page for setsocketopt IPPROTO_IP IP_MULTICAST_TTL.

    Method add_membership

      `int add_membership(string group, void|string address)`

    Description

      Join a multicast group. group contains the address of the multicast group the application wants to join or leave. It must be a valid multicast address. address is the address of the local interface with wich the system should join to the multicast group. If not provided the system will select an appropriate interface. See also the Unix man page for setsocketopt IPPROTO_IP ADD_MEMBERSHIP.

    See also

      drop_membership

    Method drop_membership

      `int drop_membership(string group, void|string address)`

    Description

      Leave a multicast group.

    See also

      add_membership

    Method wait

      `int(0..1) wait(int|float timeout)`

    Description

      Check for data and wait max. timeout seconds.

    Returns

      Returns `1` if data are ready, `0` (zero) otherwise.

    Method read

      `mapping(string:int|string) read()`
      `mapping(string:int|string) read(int flag)`

    Description

      Read from the UDP socket.

      Flag flag is a bitfield, 1 for out of band data and 2 for peek

    Returns

      mapping(string:int|string) in the form ([ "data" : string received data "ip" : string received from this ip "port" : int ...and this port ])

    See also

      set_read_callback() , MSG_OOB , MSG_PEEK

    Method send

      `int send(string to, int|string port, string message)`
      `int send(string to, int|string port, string message, int flags)`

    Description

      Send data to a UDP socket. The recipient address will be to and port will be port .

      Flag flag is a bitfield, 1 for out of band data and 2 for don't route flag.

    Returns

      The number of bytes that were actually written.

    Method set_blocking

      `object set_blocking()`

    Description

      Sets this object to be blocking.

    Method connect

      `int(0..1) connect(string address, int|string port)`

    Description

      Establish an UDP connection.

      This function connects an UDP socket previously created with Stdio.UDP() to a remote socket. The address is the IP name or number for the remote machine.

    Returns

      Returns `1` on success, `0` (zero) otherwise.

    Note

      If the socket is in nonblocking mode, you have to wait for a write or close callback before you know if the connection failed or not.

    See also

      bind() , query_address()

    Method query_address

      `string query_address()`

    Description

      Returns the local address of a socket on the form "x.x.x.x port". If this file is not a socket, not connected or some other error occurs, zero is returned.

    Method set_backend

      `void set_backend(Pike.Backend backend)`

    Description

      Set the backend used for the read callback.

    Note

      The backend keeps a reference to this object as long as there can be calls to the read callback, but this object does not keep a reference to the backend.

    See also

      query_backend

    Method query_backend

      `Pike.Backend query_backend()`

    Description

      Return the backend used for the read callback.

    See also

      set_backend

    Method errno

      `int errno()`

    Description

      Returns the error code for the last command on this object. Error code is normally cleared when a command is successful.

    Method set_type

      `UDP set_type(int sock_type)`
      `UDP set_type(int sock_type, int family)`

    Description

      Sets socket type and protocol family.

    Method get_type

      `array(int) get_type()`

    Description

      Returns socket type and protocol family.

    Constant MSG_OOB

      `constant Stdio.UDP.MSG_OOB`

    FIXME

      Document this constant.

    Constant MSG_PEEK

      `constant Stdio.UDP.MSG_PEEK`

    FIXME

      Document this constant.

    Inherit UDP

      inherit files.UDP : UDP

    Method set_nonblocking

      `UDP set_nonblocking()`
      `UDP set_nonblocking(function(mapping(string:int|string):void) read_cb, mixed ... extra_args)`

    Description

      Set this object to nonblocking mode.

      If read_cb and extra_args are specified, they will be passed on to set_read_callback() .

    Returns

      The called object.

    Method set_read_callback

      `UDP set_read_callback(function(mapping(string:int|string):) read_cb, mixed ... extra_args)`

    Description

      The read_cb function will receive a mapping similar to the mapping returned by read() :

      `"data" : string` | Received data.
      `"ip" : string` | Data was sent from this IP.
      `"port" : int` | Data was sent from this port.

    Returns

      The called object.

    See also

      read()

  CLASS Stdio.Readline

    Method get_output_controller

      `OutputController get_output_controller()`

    Description

      get current output control object

    Returns

      Terminal output controller object

    Method get_input_controller

      `InputController get_input_controller()`

    Description

      get current input control object

    Returns

      Terminal input controller object

    Method get_prompt

      `string get_prompt()`

    Description

      Return the current prompt string.

    Method set_prompt

      `string set_prompt(string newp, array(string)|void newattrs)`

    Description

      Set the prompt string.

    Parameter `newp`

      New prompt string

    Parameter `newattrs`

      Terminal attributes

    Method set_echo

      `void set_echo(int onoff)`

    Description

      Set text echo on or off.

    Parameter `onoff`

      1 for echo, 0 for no echo.

    Method gettext

      `string gettext()`

    FIXME

      Document this function

    Method getcursorpos

      `int getcursorpos()`

    FIXME

      Document this function

    Method setcursorpos

      `int setcursorpos(int p)`

    FIXME

      Document this function

    Method setmark

      `int setmark(int p)`

    FIXME

      Document this function

    Method getmark

      `int getmark()`

    FIXME

      Document this function

    Method insert

      `void insert(string s, int p)`

    FIXME

      Document this function

    Method delete

      `void delete(int p1, int p2)`

    FIXME

      Document this function

    Method pointmark

      `array(int) pointmark()`

    FIXME

      Document this function

    Method region

      `string region(int ... args)`

    FIXME

      Document this function

    Method kill

      `void kill(int p1, int p2)`

    FIXME

      Document this function

    Method add_to_kill_ring

      `void add_to_kill_ring(string s)`

    FIXME

      Document this function

    Method kill_ring_yank

      `string kill_ring_yank()`

    FIXME

      Document this function

    Method history

      `void history(int n)`

    FIXME

      Document this function

    Method delta_history

      `void delta_history(int d)`

    Description

      Changes the line to a line from the history d steps from the current entry (0 being the current line, negative values older, and positive values newer).

    Note

      Only effective if you have a history object.

    Method redisplay

      `void redisplay(int clear, int|void nobackup)`

    FIXME

      Document this function

    Method newline

      `string newline()`

    FIXME

      Document this function

    Method eof

      `void eof()`

    FIXME

      Document this function

    Method message

      `void message(string msg)`

    Description

      Print a message to the output device

    Method write

      `void write(string msg, void|int word_wrap)`

    FIXME

      Document this function

    Method list_completions

      `void list_completions(array(string) c)`

    FIXME

      Document this function

    Method set_nonblocking

      `void set_nonblocking(function f)`

    FIXME

      Document this function

    Method set_blocking

      `void set_blocking()`

    FIXME

      Document this function

    Method edit

      `string edit(string data, string|void local_prompt, array(string)|void attrs)`

    FIXME

      Document this function

    Method read

      `string read(string|void prompt, array(string)|void attrs)`

    FIXME

      Document this function

    Method enable_history

      `void enable_history(array(string)|History|int hist)`

    FIXME

      Document this function

    Method get_history

      `History get_history()`

    FIXME

      Document this function

    Method create

      `void Stdio.Readline(object|void infd, object|string|void interm, object|void outfd, object|string|void outterm)`

    Description

      Creates a Readline object, that takes input from infd and has output on outfd .

    Parameter `infd`

      Defaults to Stdio.stdin .

    Parameter `interm`

      Defaults to Stdio.Terminfo.getTerm() .

    Parameter `outfd`

      Defaults to infd , unless infd is 0, in which case outfd defaults to Stdio.stdout .

    Parameter `outterm`

      Defaults to interm .

    CLASS Stdio.Readline.OutputController

      FIXME

        Ought to have support for charset conversion.

      Method turn_on

        `void turn_on(string ... atts)`

      Description

        Set the provided attributes to on.

      Method turn_off

        `void turn_off(string ... atts)`

      Description

        Set the provided attributes to off.

      Method disable

        `void disable()`

      Method enable

        `void enable()`

      Method check_columns

        `int check_columns()`

      Description

        Check and return the terminal width.

      Note

        In Pike 7.4 and earlier this function returned `void`.

      See also

        get_number_of_columns

      Method get_number_of_columns

        `int get_number_of_columns()`

      Description

        Returns the width of the terminal.

      Note

        Does not check the width of the terminal.

      See also

        check_columns

      Method low_write

        `void low_write(string s, void|int word_break)`

      Method write

        `void write(string s, void|int word_break, void|int hide)`

      Method low_move_downward

        `void low_move_downward(int n)`

      Method low_move_upward

        `void low_move_upward(int n)`

      Method low_move_forward

        `void low_move_forward(int n)`

      Method low_move_backward

        `void low_move_backward(int n)`

      Method low_erase

        `void low_erase(int n)`

      Method move_forward

        `void move_forward(string s)`

      Method move_backward

        `void move_backward(string s)`

      Method erase

        `void erase(string s)`

      Method newline

        `void newline()`

      Method bol

        `void bol()`

      Method clear

        `void clear(int|void partial)`

      Method beep

        `void beep()`

      Method create

        `void Stdio.Readline.OutputController(.File|void _outfd, .Terminfo.Termcap|string|void _term)`

    CLASS Stdio.Readline.InputController

      FIXME

        Ought to have support for charset conversion.

      Method isenabled

        `int isenabled()`

      Method enable

        `int enable(int ... e)`

      Method disable

        `int disable()`

      Method run_blocking

        `int run_blocking()`

      Method set_close_callback

        `void set_close_callback(function(:int) ccb)`

      Method nullbindings

        `void nullbindings()`

      Description

        Clears the bindings.

      Method grabnextkey

        `void grabnextkey(function g)`

      Method bindstr

        `function bindstr(string str, function f)`

      Method unbindstr

        `function unbindstr(string str)`

      Method getbindingstr

        `function getbindingstr(string str)`

      Method bindtc

        `function bindtc(string cap, function f)`

      Method unbindtc

        `function unbindtc(string cap)`

      Method getbindingtc

        `function getbindingtc(string cap)`

      Method parsekey

        `string parsekey(string k)`

      Method bind

        `function bind(string k, function f)`

      Method unbind

        `function unbind(string k)`

      Method getbinding

        `function getbinding(string k, string cap)`

      Method getbindings

        `mapping(string:function) getbindings()`

      Method create

        `void Stdio.Readline.InputController(object|void _infd, object|string|void _term)`

    CLASS Stdio.Readline.DefaultEditKeys

      Method self_insert_command

        `void self_insert_command(string str)`

      Method quoted_insert

        `void quoted_insert()`

      Method newline

        `void newline()`

      Method up_history

        `void up_history()`

      Method down_history

        `void down_history()`

      Method backward_delete_char

        `void backward_delete_char()`

      Method delete_char

        `void delete_char()`

      Method delete_char_or_eof

        `void delete_char_or_eof()`

      Method forward_char

        `void forward_char()`

      Method backward_char

        `void backward_char()`

      Method beginning_of_line

        `void beginning_of_line()`

      Method end_of_line

        `void end_of_line()`

      Method transpose_chars

        `void transpose_chars()`

      Method capitalize_word

        `void capitalize_word()`

      Method upcase_word

        `void upcase_word()`

      Method downcase_word

        `void downcase_word()`

      Method forward_word

        `void forward_word()`

      Method backward_word

        `void backward_word()`

      Method kill_word

        `void kill_word()`

      Method backward_kill_word

        `void backward_kill_word()`

      Method kill_line

        `void kill_line()`

      Method kill_whole_line

        `void kill_whole_line()`

      Method yank

        `void yank()`

      Method kill_ring_save

        `void kill_ring_save()`

      Method kill_region

        `void kill_region()`

      Method set_mark

        `void set_mark()`

      Method swap_mark_and_point

        `void swap_mark_and_point()`

      Method redisplay

        `void redisplay()`

      Method clear_screen

        `void clear_screen()`

      Method set_default_bindings

        `void set_default_bindings()`

      Method create

        `void Stdio.Readline.DefaultEditKeys(object readline)`

    CLASS Stdio.Readline.History

      Method encode

        `string encode()`

      Method get_history_num

        `int get_history_num()`

      Method history

        `string history(int n, string text)`

      Method initline

        `void initline()`

      Method finishline

        `void finishline(string text)`

      Method set_max_history

        `void set_max_history(int maxhist)`

      Method create

        `void Stdio.Readline.History(int maxhist, void|array(string) hist)`

  CLASS Stdio.Stream

    Description

      The Stdio.Stream API.

      This class exists purely for typing reasons.

      Use in types in place of Stdio.File where only blocking stream-oriented I/O is done with the object.

    See also

      NonblockingStream , BlockFile , File , FILE

  CLASS Stdio.NonblockingStream

    Description

      The Stdio.NonblockingStream API.

      This class exists purely for typing reasons.

      Use in types in place of Stdio.File where nonblocking and/or blocking stream-oriented I/O is done with the object.

    See also

      Stream , BlockFile , File , FILE

    Inherit Stream

      inherit Stream : Stream

  CLASS Stdio.BlockFile

    Description

      The Stdio.BlockFile API.

      This class exists purely for typing reasons.

      Use in types in place of Stdio.File where only blocking I/O is done with the object.

    See also

      Stream , NonblockingStream , File , FILE

    Inherit Stream

      inherit Stream : Stream

  CLASS Stdio.FILE

    Description

      Stdio.FILE is a buffered version of Stdio.File , it inherits Stdio.File and has most of the functionality of Stdio.File . However, it has an input buffer that allows line-by-line input.

      It also has support for automatic charset conversion for both input and output (see Stdio.FILE()->set_charset() ).

    Note

      The output part of Stdio.FILE is currently not buffered.

    Inherit file

      inherit File : file

    Method set_charset

      `void set_charset(string charset)`

    Description

      Sets the input and output charset of this file to the specified charset .

      The default charset is `"ISO-8859-1"`.

    FIXME

      Consider using one of ISO-IR-196 (`"\e%G"` - switch to UTF-8 with return) or ISO-IR-190 (`"\e%/G"` - switch to UTF-8 level 1 no return) or ISO-IR-191 (`"\e%/H"` - switch to UTF-8 level 2 no return) or ISO-IR-192 (`"\e%/I"` - switch to UTF-8 level 3 no return) or ISO-IR-193 (`"\e%/J"` - switch to UTF-16 level 1 no return) or ISO-IR-194 (`"\e%/K"` - switch to UTF-16 level 2 no return) or ISO-IR-195 (`"\e%/L"` - switch to UTF-16 level 3 no return) or ISO-IR-162 (`"\e%/@"` - switch to UCS-2 level 1) or ISO-IR-163 (`"\e%/A"` - switch to UCS-4 level 1) or ISO-IR-174 (`"\e%/C"` - switch to UCS-2 level 2) or ISO-IR-175 (`"\e%/D"` - switch to UCS-4 level 2) or ISO-IR-176 (`"\e%/E"` - switch to UCS-2 level 3) or ISO-IR-177 (`"\e%/F"` - switch to UCS-4 level 3) or ISO-IR-178 (`"\e%B"` - switch to UTF-1) automatically to encode wide strings.

    Method gets

      `string gets(int(0..1)|void not_all)`

    Description

      Read one line of input with support for input conversion.

    Parameter `not_all`

      Set this parameter to ignore partial lines at EOF. This is useful for eg monitoring a growing logfile.

    Returns

      This function returns the line read if successful, and `0` if no more lines are available.

    See also

      ngets() , read() , line_iterator() , set_charset()

    Method ngets

      `array(string) ngets(void|int(1..) n, int(0..1)|void not_all)`

    Description

      Get n lines.

    Parameter `n`

      Number of lines to get, or all remaining if zero.

    Parameter `not_all`

      Set this parameter to ignore partial lines at EOF. This is useful for eg monitoring a growing logfile.

    Method pipe

      `File pipe(int|void flags)`

    Description

      Same as Stdio.File()->pipe() .

    Note

      Returns an Stdio.File object, NOT an Stdio.FILE object.

      In future releases of Pike this will most likely change to returning an Stdio.FILE object. This is already the case if `STDIO_DIRECT_FD` has been defined.

    Method openat

      `FILE openat(string filename, string mode)`
      `FILE openat(string filename, string mode, int mask)`

    Description

      Same as Stdio.File()->openat() , but returns a Stdio.FILE object.

    See also

      Stdio.File()->openat()

    Method write

      `int write(array(string)|string what, mixed ... fmt)`

    Description

      Write what with support for output_conversion.

    See also

      Stdio.File()->write()

    Method printf

      `int printf(string format, mixed ... data)`

    Description

      This function does approximately the same as: `<font face='courier'>write` (<font face='courier'>sprintf (<font face='courier'>format ,@<font face='courier'>data )).

    See also

      write() , sprintf()

    Method _get_iterator

      `object _get_iterator()`

    Description

      Returns an iterator that will loop over the lines in this file.

    See also

      line_iterator()

    Method line_iterator

      `object line_iterator(int|void trim)`

    Description

      Returns an iterator that will loop over the lines in this file. If trim is true, all `'\r'` characters will be removed from the input.

    Note

      It's not supported to call this method more than once unless a call to seek is done in advance. Also note that it's not possible to intermingle calls to read , gets or other functions that read data with the line iterator, it will produce unexpected results since the internal buffer in the iterator will not contain sequential file-data in those cases.

    See also

      _get_iterator()

    Method read

      `string read(int|void bytes, void|int(0..1) now)`

    Description

      Read bytes (wide-) characters with buffering and support for input conversion.

    See also

      Stdio.File()->read() , set_charset() , unread()

    Method unread

      `void unread(string s)`

    Description

      This function puts a string back in the input buffer. The string can then be read with eg read() , gets() or getchar() .

    See also

      read() , gets() , getchar() , ungets()

    Method ungets

      `void ungets(string s)`

    Description

      This function puts a line back in the input buffer. The line can then be read with eg read() , gets() or getchar() .

    Note

      The string is autoterminated by an extra line-feed.

    See also

      read() , gets() , getchar() , unread()

    Method getchar

      `int getchar()`

    Description

      This function returns one character from the input stream.

    Returns

      Returns the ISO-10646 (Unicode) value of the character.

    Note

      Returns an `int` and not a `string` of length 1.

  CLASS Stdio.FakeFile

    Description

      A string wrapper that pretends to be a Stdio.File object in addition to some features of a Stdio.FILE object.

    Constant is_fake_file

      `constant Stdio.FakeFile.is_fake_file`

    Description

      This constant can be used to distinguish a FakeFile object from a real Stdio.File object.

    Method close

      `int close(void|string direction)`

    See also

      Stdio.File()->close()

    Method create

      `void Stdio.FakeFile(string data, void|string type, void|int pointer)`

    See also

      Stdio.File()->create()

    Method dup

      `this_program dup()`

    See also

      Stdio.File()->dup()

    Method errno

      `int errno()`

    Description

      Always returns 0.

    See also

      Stdio.File()->errno()

    Method stat

      `Stdio.Stat stat()`

    Description

      Returns size and the creation time of the string.

    Method line_iterator

      `String.SplitIterator line_iterator(int|void trim)`

    See also

      Stdio.File()->line_iterator()

    Method query_id

      `mixed query_id()`

    See also

      Stdio.File()->query_id()

    Method set_id

      `void set_id(mixed _id)`

    See also

      Stdio.File()->set_id()

    Method read_function

      `function(:string) read_function(int nbytes)`

    See also

      Stdio.File()->read_function()

    Method peek

      `int(-1..1) peek(int|float|void timeout)`

    See also

      Stdio.File()->peek()

    Method query_address

      `string query_address(void|int(0..1) is_local)`

    Description

      Always returns 0.

    See also

      Stdio.File()->query_address()

    Method read

      `string read(void|int(0..) len, void|int(0..1) not_all)`

    See also

      Stdio.File()->read()

    Method gets

      `string gets()`

    See also

      Stdio.FILE()->gets()

    Method getchar

      `int getchar()`

    See also

      Stdio.FILE()->getchar()

    Method unread

      `void unread(string s)`

    See also

      Stdio.FILE()->unread()

    Method seek

      `int seek(int pos, void|int mult, void|int add)`

    See also

      Stdio.File()->seek()

    Method sync

      `int(1..1) sync()`

    Description

      Always returns 1.

    See also

      Stdio.File()->sync()

    Method tell

      `int tell()`

    See also

      Stdio.File()->tell()

    Method truncate

      `int(0..1) truncate(int length)`

    See also

      Stdio.File()->truncate()

    Method write

      `int(-1..) write(string|array(string) str, mixed ... extra)`

    See also

      Stdio.File()->write()

    Method set_blocking

      `void set_blocking()`

    See also

      Stdio.File()->set_blocking

    Method set_blocking_keep_callbacks

      `void set_blocking_keep_callbacks()`

    See also

      Stdio.File()->set_blocking_keep_callbacks

    Method set_nonblocking

      `void set_nonblocking(function rcb, function wcb, function ccb, function rocb, function wocb)`

    See also

      Stdio.File()->set_blocking

    Method set_nonblocking_keep_callbacks

      `void set_nonblocking_keep_callbacks()`

    See also

      Stdio.File()->set_blocking_keep_callbacks

    Method set_close_callback

      `void set_close_callback(function cb)`

    See also

      Stdio.File()->set_close_callback

    Method set_read_callback

      `void set_read_callback(function cb)`

    See also

      Stdio.File()->set_read_callback

    Method set_read_oob_callback

      `void set_read_oob_callback(function cb)`

    See also

      Stdio.File()->set_read_oob_callback

    Method set_write_callback

      `void set_write_callback(function cb)`

    See also

      Stdio.File()->set_write_callback

    Method set_write_oob_callback

      `void set_write_oob_callback(function cb)`

    See also

      Stdio.File()->set_write_oob_callback

    Method query_close_callback

      `function query_close_callback()`

    See also

      Stdio.File()->query_close_callback

    Method query_read_callback

      `function query_read_callback()`

    See also

      Stdio.File()->query_read_callback

    Method query_read_oob_callback

      `function query_read_oob_callback()`

    See also

      Stdio.File()->query_read_oob_callback

    Method query_write_callback

      `function query_write_callback()`

    See also

      Stdio.File()->query_write_callback

    Method query_write_oob_callback

      `function query_write_oob_callback()`

    See also

      Stdio.File()->query_write_oob_callback

    Method cast

      `mixed cast(string to)`

    Description

      A FakeFile can be casted to a string.

    Method _sizeof

      `int(0..) _sizeof()`

    Description

      Sizeof on a FakeFile returns the size of its contents.

  Module Stdio.Terminfo

    Method getTermcap

      `Termcap getTermcap(string term)`

    Description

      Returns the terminal description object for term from the systems termcap database. Returns 0 if not found.

    See also

      Stdio.Terminfo.getTerm, Stdio.Terminfo.getTerminfo

    Method getTerminfo

      `Terminfo getTerminfo(string term)`

    Description

      Returns the terminal description object for term from the systems terminfo database. Returns 0 if not found.

    See also

      Stdio.Terminfo.getTerm, Stdio.Terminfo.getTermcap

    Method getTerm

      `Termcap getTerm(string|void term)`

    Description

      Returns an object describing the terminal term. If term is not specified, it will default to getenv("TERM") or if that fails to "dumb".

      Lookup of terminal information will first be done in the systems terminfo database, and if that fails in the termcap database. If neither database exists, a hardcoded entry for "dumb" will be used.

    See also

      Stdio.Terminfo.getTerminfo, Stdio.Terminfo.getTermcap, Stdio.getFallbackTerm

    Method getFallbackTerm

      `Termcap getFallbackTerm(string term)`

    Description

      Returns an object describing the fallback terminal for the terminal term . This is usually equvivalent to Stdio.Terminfo.getTerm("dumb") .

    See also

      Stdio.Terminfo.getTerm

    Method is_tty

      `int is_tty()`

    Description

      Returns 1 if Stdio.stdin is connected to an interactive terminal that can handle backspacing, carriage return without linefeed, and the like.

    CLASS Stdio.Terminfo.Termcap

      Description

        Termcap terminal description object.

      Inherit TermMachine

        inherit TermMachine : TermMachine

      Variable aliases

        `array(string) Stdio.Terminfo.Termcap.aliases`

      Method tputs

        `string tputs(string s)`

      Description

        Put termcap string

      Method create

        `void Stdio.Terminfo.Termcap(string cap, TermcapDB|void tcdb, int|void maxrecurse)`

    CLASS Stdio.Terminfo.Terminfo

      Description

        Terminfo terminal description object

      Inherit TermMachine

        inherit TermMachine : TermMachine

      Variable aliases

        `array(string) Stdio.Terminfo.Terminfo.aliases`

      Method tputs

        `string tputs(string s)`

      FIXME

        Document this function

      Method create

        `void Stdio.Terminfo.Terminfo(string filename)`

    CLASS Stdio.Terminfo.TermcapDB

      Description

        Termcap database

    CLASS Stdio.Terminfo.TerminfoDB

      Description

        Terminfo database for a single directory.

    CLASS Stdio.Terminfo.MetaTerminfoDB

      Description

        TerminfoDB that merges several directorys.

      Method create

        `void Stdio.Terminfo.MetaTerminfoDB(array(TerminfoDB|string)|void dbs)`

      Description

        Create a new Meta TerminfoDB .

      Parameter `dbs`

        Array with elements in priority order. Elements may be either

        `TerminfoDB` | An active TerminfoDB .
        `string` | A directory that may exist and contain a terminfo database.

      Returns

        If the resulting set of TerminfoDB 's is empty, the object will be destructed.

Module Gz

  Description

    The Gz module contains functions to compress and uncompress strings using the same algorithm as the program `gzip`. Compressing can be done in streaming mode or all at once.

    The Gz module consists of two classes; Gz.deflate and Gz.inflate. Gz.deflate is used to pack data and Gz.inflate is used to unpack data. (Think "inflatable boat")

  Note

    Note that this module is only available if the gzip library was available when Pike was compiled.

    Note that although these functions use the same algorithm as `gzip`, they do not use the exact same format, so you cannot directly unzip gzipped files with these routines. Support for this will be added in the future.

  Inherit "___Gz"

    inherit "___Gz"

  Method compress

    `string compress(string data, void|int(0..1) raw, void|int(0..9) level, void|int strategy, void|int(8..15) window_size)`

  Description

    Encodes and returns the input data according to the deflate format defined in RFC 1951.

  Parameter `data`

    The data to be encoded.

  Parameter `raw`

    If set, the data is encoded without the header and footer defined in RFC 1950. Example of uses is the ZIP container format.

  Parameter `level`

    Indicates the level of effort spent to make the data compress well. Zero means no packing, 2-3 is considered 'fast', 6 is default and higher is considered 'slow' but gives better packing.

  Parameter `strategy`

    The strategy to be used when compressing the data. One of the following.

    `DEFAULT_STRATEGY` | The default strategy as selected in the zlib library.
    `FILTERED` | This strategy is intented for data created by a filter or predictor and will put more emphasis on huffman encoding and less on LZ string matching. This is between DEFAULT_STRATEGY and HUFFMAN_ONLY.
    `RLE` | This strategy is even closer to the HUFFMAN_ONLY in that it only looks at the latest byte in the window, i.e. a window size of 1 byte is sufficient for decompression. This mode is not available in all zlib versions.
    `HUFFMAN_ONLY` | This strategy will turn of string matching completely, only doing huffman encoding. Window size doesn't matter in this mode and the data can be decompressed with a zero size window.
    `FIXED` | In this mode dynamic huffman codes are disabled, allowing for a simpler decoder for special applications. This mode is not available in all zlib versions.

  Parameter `window_size`

    Defines the size of the LZ77 window from 256 bytes to 32768 bytes, expressed as 2^x.

  Method uncompress

    `string uncompress(string data, void|int(0..1) raw)`

  Description

    Uncompresses the data and returns it. The raw parameter tells the decoder that the indata lacks the data header and footer defined in RFC 1950.

  Method crc32

    `int crc32(string data, void|int start_value)`

  Description

    This function calculates the standard ISO3309 Cyclic Redundancy Check.

  Note

    Data must not be wide string.

  CLASS Gz._file

    Description

      Low-level implementation of read/write support for GZip files

    Method open

      `int open(string|int|Stdio.Stream file, void|string mode)`

    Description

      Opens a file for I/O.

    Parameter `file`

      The filename or an open filedescriptor or Stream for the GZip file to use.

    Parameter `mode`

      Mode for the fileoperations. Defaults to read only.

    Note

      If the object already has been opened, it will first be closed.

    Method create

      `void Gz._file(void|string|Stdio.Stream gzFile, void|string mode)`

    Description

      Opens a gzip file for reading.

    Method close

      `int close()`

    Description

      closes the file

    Returns

      1 if successful

    Method read

      `int|string read(int len)`

    Description

      Reads len (uncompressed) bytes from the file. If read is unsuccessful, 0 is returned.

    Method write

      `int write(string data)`

    Description

      Writes the data to the file.

    Returns

      the number of bytes written to the file.

    Method seek

      `int seek(int pos, void|int type)`

    Description

      Seeks within the file.

    Parameter `pos`

      Position relative to the searchtype.

    Parameter `type`

      SEEK_SET = set current position in file to pos SEEK_CUR = new position is current+pos SEEK_END is not supported.

    Returns

      New position or negative number if seek failed.

    Method tell

      `int tell()`

    Returns

      the current position within the file.

    Method eof

      `int(0..1) eof()`

    Returns

      1 if EOF has been reached.

    Method setparams

      `int setparams(int level, int strategy)`

    Description

      Sets the encoding level and strategy

    Parameter `level`

      Level of the compression. 0 is the least compression, 9 is max. 8 is default.

    Parameter `strategy`

      Set strategy for encoding to one of the following: DEFAULT_STRATEGY FILTERED HUFFMAN_ONLY

  CLASS Gz.File

    Description

      Allows the user to open a Gzip archive and read and write it's contents in an uncompressed form, emulating the Stdio.File interface.

    Note

      An important limitation on this class is that it may only be used for reading or writing, not both at the same time. Please also note that if you want to reopen a file for reading after a write, you must close the file before calling open or strange effects might be the result.

    Inherit _file

      inherit _file : _file

    Method create

      `void Gz.File(void|string|int|Stdio.Stream file, void|string mode)`

    Parameter `file`

      Filename or filedescriptor of the gzip file to open, or an already open Stream.

    Parameter `mode`

      mode for the file. Defaults to "rb".

    See also

      open Stdio.File

    Method open

      `int open(string|int|Stdio.Stream file, void|string mode)`

    Parameter `file`

      Filename or filedescriptor of the gzip file to open, or an already open Stream.

    Parameter `mode`

      mode for the file. Defaults to "rb". May be one of the following:

      rb

        read mode

      wb

        write mode

      ab

        append mode

      For the wb and ab mode, additional parameters may be specified. Please se zlib manual for more info.

    Returns

      non-zero if successful.

    Method read

      `int|string read(void|int length)`

    Description

      Reads data from the file. If no argument is given, the whole file is read.

  CLASS Gz.deflate

    Description

      Gz_deflate is a builtin program written in C. It interfaces the packing routines in the libz library.

    Note

      This class is only available if libz was available and found when Pike was compiled.

    See also

      Gz.inflate()

    Method create

      `void Gz.deflate(int(-9..9)|void level, int|void strategy, int(8..15)|void window_size)`

    Description

      This function can also be used to re-initialize a Gz.deflate object so it can be re-used.

    Parameter `level`

      Indicates the level of effort spent to make the data compress well. Zero means no packing, 2-3 is considered 'fast', 6 is default and higher is considered 'slow' but gives better packing.

      If the argument is negative, no headers will be emitted. This is needed to produce ZIP-files, as an example. The negative value is then negated, and handled as a positive value.

    Parameter `strategy`

      The strategy to be used when compressing the data. One of the following.

      `DEFAULT_STRATEGY` | The default strategy as selected in the zlib library.
      `FILTERED` | This strategy is intented for data created by a filter or predictor and will put more emphasis on huffman encoding and less on LZ string matching. This is between DEFAULT_STRATEGY and HUFFMAN_ONLY.
      `RLE` | This strategy is even closer to the HUFFMAN_ONLY in that it only looks at the latest byte in the window, i.e. a window size of 1 byte is sufficient for decompression. This mode is not available in all zlib versions.
      `HUFFMAN_ONLY` | This strategy will turn of string matching completely, only doing huffman encoding. Window size doesn't matter in this mode and the data can be decompressed with a zero size window.
      `FIXED` | In this mode dynamic huffman codes are disabled, allowing for a simpler decoder for special applications. This mode is not available in all zlib versions.

    Parameter `window_size`

      Defines the size of the LZ77 window from 256 bytes to 32768 bytes, expressed as 2^x.

    Method deflate

      `string deflate(string data, int|void flush)`

    Description

      This function performs gzip style compression on a string data and returns the packed data. Streaming can be done by calling this function several times and concatenating the returned data.

      The optional argument flush should be one of the following:

      `Gz.NO_FLUSH` | Only data that doesn't fit in the internal buffers is returned.
      `Gz.PARTIAL_FLUSH` | All input is packed and returned.
      `Gz.SYNC_FLUSH` | All input is packed and returned.
      `Gz.FINISH` | All input is packed and an 'end of data' marker is appended.

    Note

      Data must not be wide string.

    See also

      Gz.inflate->inflate()

  CLASS Gz.inflate

    Description

      Gz_deflate is a builtin program written in C. It interfaces the unpacking routines in the libz library.

    Note

      This program is only available if libz was available and found when Pike was compiled.

    See also

      deflate

    Method create

      `void Gz.inflate(int|void window_size)`

    Description

      The window_size value is passed down to inflateInit2 in zlib.

      If the argument is negative, no header checks are done, and no verification of the data will be done either. This is needed for uncompressing ZIP-files, as an example. The negative value is then negated, and handled as a positive value.

      Positive arguments set the maximum dictionary size to an exponent of 2, such that 8 (the minimum) will cause the window size to be 256, and 15 (the maximum, and default value) will cause it to be 32Kb. Setting this to anything except 15 is rather pointless in Pike.

      It can be used to limit the amount of memory that is used to uncompress files, but 32Kb is not all that much in the great scheme of things.

      To decompress files compressed with level 9 compression, a 32Kb window size is needed. level 1 compression only requires a 256 byte window.

    Method inflate

      `string inflate(string data)`

    Description

      This function performs gzip style decompression. It can inflate a whole file at once or in blocks.

    Example

          // whole file
           write(Gz.inflate()->inflate(stdin->read(0x7fffffff));
           // streaming (blocks)
           function inflate=Gz.inflate()->inflate;
           while(string s=stdin->read(8192))
             write(inflate(s));

    See also

      Gz.deflate->deflate()

    Method end_of_stream

      `string end_of_stream()`

    Description

      This function returns 0 if the end of stream marker has not yet been encountered, or a string (possibly empty) containg any extra data received following the end of stream marker if the marker has been encountered. If the extra data is not needed, the result of this function can be treated as a logical value.

Module Mysql

  Description

    This module enables access to the Mysql database from within Pike. Use Sql.Sql for general database access.

    Mysql is available from http://www.mysql.com.

  See also

    Mysql.mysql , Mysql.mysql_result , Sql.Sql

  CLASS Mysql.mysql

    Description

      Interface to the Mysql database.

      This class enables access to the Mysql database from within Pike.

      Mysql is available from http://www.mysql.com.

    See also

      Mysql.mysql_result , Sql.Sql

    Method create

      `void Mysql.mysql()`
      `void Mysql.mysql(string host)`
      `void Mysql.mysql(string host, string database)`
      `void Mysql.mysql(string host, string database, string user)`
      `void Mysql.mysql(string host, string database, string user, string password)`
      `void Mysql.mysql(string host, string database, string user, string password, mapping(string:string|int) options)`

    Description

      Connect to a Mysql database.

      To access the Mysql database, you must first connect to it. This is done with this function.

    Parameter `host`

      If you give no argument, or give `""` as host it will connect with a UNIX-domain socket, which can be a big performance gain.

    Parameter `options`

      This optional mapping can contain zero or more of the following parameters:

      `"init_command" : string` | Command to execute on connect.
      `"timeout" : int` | Timeout in seconds.
      `"compress" : int(0..1)` | Enable compressed protocol.
      `"mysql_config_file" : string` | Change config file from `"my.cnf"`.
      `"mysql_group" : string` | Specify additional group to read from config file.
      `"mysql_named_pipe" : int(0..1)` | Use named pipe to connect to server.
      `"mysql_local_infile" : int(0..1)` | Enable use of LOCAL INFILE (security).
      `"mysql_charset_dir" : string` | Change charset directory.
      `"mysql_charset_name" : string` | Set connection charset - see set_charset for details. The default is `"latin1"`. As opposed to set_charset , this way of specifying the connection charset doesn't require MySQL 4.1.0.
      `"unicode_decode_mode" : int` | Enable unicode decode mode for the connection if nonzero. In this mode non-binary string results are automatically converted to (possibly wide) unicode strings. An error is thrown if the server doesn't support this. See set_unicode_decode_mode .
      `"ssl_key" : string` | Path to SSL-key for use in SSL-communication.
      `"ssl_cert" : string` | Path to SSL-cert for use in SSL-communication.
      `"ssl_ca" : string` | Path to SSL-CA for use in SSL-communication.
      `"ssl_capath" : string` | Path to SSL-CAPATH for use in SSL-communication.
      `"ssl_cipher" : string` | FIXME
      `"connect_options" : int` | Options used when connecting to the server. See mysql documentation for more information.

    Note

      Some options may not be implemented. Unimplemented options are silently ignored.

    Note

      To use SSL-connections, set the SSL-parameters correctly. They correspond to the parameters given to the mysql-client with the same name so make sure that the mysql-client works with SSL and set these parameters to the same values and everything should work. If SSL-options are loaded from a config-file, one may set the connect_options to include CLIENT_SSL.

    Note

      If Pike has been built with an old MySQL client lib then it might not be possible to specify some charsets that the server supports with the `"mysql_charset_name"` option. In such cases it's possible that set_charset works better (provided the server is 4.1 or newer).

    Method _sprintf

      `string _sprintf(int type, void|mapping flags)`

    Method is_open

      `int is_open()`

    Description

      Returns true if the connection seems to be open.

    Note

      This function only checks that there's an open connection, and that the other end hasn't closed it yet. No data is sent over the connection.

      For a more reliable check of whether the connection is alive, please use ping() .

    See also

      ping()

    Method ping

      `int ping()`

    Description

      Check whether the connection is alive.

    Returns

      Returns one of the following:

      `0` | Everything ok.
      `1` | The connection reconnected automatically.
      `-1` | The server has gone away, and the connection is dead.

    See also

      is_open()

    Method affected_rows

      `int affected_rows()`

    Description

      Returns the number of rows affected by the last query.

    Method insert_id

      `int insert_id()`

    Description

      Returns the id of the last INSERT query into a table with an AUTO INCREMENT field.

    Method error

      `string error()`

    Description

      Returns a string describing the last error from the Mysql-server.

      Returns `0` (zero) if there was no error.

    Method select_db

      `void select_db(string database)`

    Description

      Select database.

      The Mysql-server can hold several databases. You select which one you want to access with this function.

    See also

      create() , create_db() , drop_db()

    Method create_db

      `void create_db(string database)`

    Description

      Create a new database

      This function creates a new database named database in the Mysql-server.

    See also

      select_db() , drop_db()

    Method drop_db

      `void drop_db(string database)`

    Description

      Drop a database

      This function drops the database named database from the Mysql-server.

    See also

      create_db() , select_db()

    Method shutdown

      `void shutdown()`

    Description

      Shutdown the Mysql-server

      This function shuts down a running Mysql-server.

    See also

      reload()

    Method reload

      `void reload()`

    Description

      Reload security tables

      This function causes the Mysql-server to reload its access tables.

    See also

      shutdown()

    Method statistics

      `string statistics()`

    Description

      Some Mysql-server statistics

      This function returns some server statistics.

    See also

      server_info() , host_info() , protocol_info()

    Method server_info

      `string server_info()`

    Description

      Get the version number of the Mysql-server.

    See also

      statistics() , host_info() , protocol_info()

    Method host_info

      `string host_info()`

    Description

      Get information about the Mysql-server connection

    See also

      statistics() , server_info() , protocol_info()

    Method protocol_info

      `int protocol_info()`

    Description

      Give the Mysql protocol version

      This function returns the version number of the protocol the Mysql-server uses.

    See also

      statistics() , server_info() , host_info()

    Method list_dbs

      `Mysql.mysql_result list_dbs()`
      `Mysql.mysql_result list_dbs(string wild)`

    Description

      List databases

      Returns a table containing the names of all databases in the Mysql-server. If the argument wild is specified, only those matching it will be returned.

    See also

      list_tables() , list_fields() , list_processes() , Mysql.mysql_result

    Method list_tables

      `Mysql.mysql_result list_tables()`
      `Mysql.mysql_result list_tables(string wild)`

    Description

      List tables in the current database

      Returns a table containing the names of all tables in the current database. If the argument wild is given, only those matching it will be returned.

    See also

      list_dbs() , list_fields() , list_processes() , Mysql.mysql_result

    Method list_fields

      `array(int|mapping(string:mixed)) list_fields(string table)`
      `array(int|mapping(string:mixed)) list_fields(string table, string wild)`

    Description

      List all fields.

      Returns an array of mappings with information about the fields in the table named table . If the argument wild is given, only those fields matching it will be returned

      The mappings contain the following entries:

      `"name" : string` | The name of the field.
      `"table" : string` | The name of the table.
      `"default" : string` | The default value for the field.
      `"type" : string` | The SQL type of the field.
      `"length" : int` | The length of the longest possible value that can be stored in the field. Note that this measures the display length in string form.
      `"flags" : multiset(string)` | Some flags.
      `decimals : int` | The number of decimalplaces.

      The type of the field can be any of: `"decimal"`, `"char"`, `"short"`, `"long"`, `"float"`, `"double"`, `"null"`, `"time"`, `"longlong"`, `"int24"`, `"tiny blob"`, `"medium blob"`, `"long blob"`, `"var string"`, `"string"` or `"unknown"`.

      The flags multiset can contain any of:

      `"primary_key"` | This field is part of the primary key for this table.
      `"not_null"` | This field may not be NULL.
      `"blob"` | This field is a blob field.

    Note

      Michael Widenius recomends use of the following query instead: `show fields in 'table' like "wild"`.

    See also

      list_dbs() , list_tables() , list_processes() , Mysql.mysql_result.fetch_field()

    Method list_processes

      `Mysql.mysql_result list_processes()`

    Description

      List all processes in the Mysql-server

      Returns a table containing the names of all processes in the Mysql-server.

    See also

      list_dbs() , list_tables() , list_fields() , Mysql.mysql_result

    Method binary_data

      `int binary_data()`

    Description

      Inform if this version of Mysql.mysql supports binary data

      This function returns non-zero if binary data can be reliably stored and retreived with this version of the mysql-module.

      Usually, there is no problem storing binary data in mysql-tables, but data containing `'\0'` (NUL) couldn't be fetched with old versions (prior to 3.20.5) of the mysql-library.

  CLASS Mysql.mysql_result

    Description

      Objects of this class contain the result from Mysql queries.

    See also

      Mysql.mysql , Mysql.mysql->big_query()

    Method create

      `void Mysql.mysql_result(Mysql.mysql connection)`

    Description

      Make a new Mysql.mysql_result object.

    See also

      Mysql.mysql->big_query() , Mysql.mysql->list_dbs() , Mysql.mysql->list_tables() , Mysql.mysql->list_processes() , Mysql.mysql

    Method num_rows

      `int num_rows()`

    Description

      Number of rows in the result.

    See also

      num_fields()

    Method num_fields

      `int num_fields()`

    Description

      Number of fields in the result.

    See also

      num_rows()

    Method field_seek

      `void field_seek(int field_no)`

    Description

      Skip to specified field.

      Places the field cursor at the specified position. This affects which field mysql_result->fetch_field() will return next.

      Fields are numbered starting with 0.

    Note

      This function is usually not enabled. To enable it `SUPPORT_FIELD_SEEK` must be defined when compiling the mysql-module.

    See also

      fetch_field() , fetch_fields()

    Method eof

      `int(0..1) eof()`

    Description

      Sense end of result table.

      Returns `1` when all rows have been read, and `0` (zero) otherwise.

    See also

      fetch_row()

    Method fetch_field

      `int|mapping(string:mixed) fetch_field()`

    Description

      Return specification of the current field.

      Returns a mapping with information about the current field, and advances the field cursor one step. Returns `0` (zero) if there are no more fields.

      The mapping contains the same entries as those returned by Mysql.mysql->list_fields() , except that the entry `"default"` is missing.

    Note

      This function is usually not enabled. To enable it `SUPPORT_FIELD_SEEK` must be defined when compiling the mysql-module.

    See also

      fetch_fields() , field_seek() , Mysql.mysql->list_fields()

    Method fetch_fields

      `array(int|mapping(string:mixed)) fetch_fields()`

    Description

      Get specification of all remaining fields.

      Returns an array with one mapping for every remaining field in the result table.

      The returned data is similar to the data returned by Mysql.mysql->list_fields() , except for that the entry `"default"` is missing.

    Note

      Resets the field cursor to `0` (zero).

      This function always exists even when fetch_field() and field_seek() don't.

    See also

      fetch_field() , field_seek() , Mysql.mysql->list_fields()

    Method seek

      `void seek(int rows)`

    Description

      Skip ahead rows rows.

    Note

      Can only seek forward.

    See also

      fetch_row()

    Method fetch_row

      `int|array(string) fetch_row()`

    Description

      Fetch the next row from the result.

      Returns an array with the contents of the next row in the result. Advances the row cursor to the next now.

      Returns `0` (zero) at the end of the table.

    See also

      seek()

    Method fetch_json_result

      `string fetch_json_result()`

    Description

      Fetch all remaining rows and return them as `JSON`-encoded data.

    See also

      fetch_row()

    FIXME

      Ensure that all fields (including binary fields) are UTF-8 encoded.

Module Msql

  Description

    This is an interface to the mSQL database server. This module may or may not be available on your Pike, depending whether the appropriate include and library files (msql.h and libmsql.a respectively) could be found at compile-time. Note that you do not need to have a mSQL server running on your host to use this module: you can connect to the database over a TCP/IP socket

    Please notice that unless you wish to specifically connect to a mSQL server, you'd better use the Sql.Sql program instead. Using Sql.Sql ensures that your Pike applications will run with any supported SQL server without changing a single line of code.

    Also notice that some functions may be mSQL/2.0-specific, and thus missing on hosts running mSQL/1.0.*

  Note

    The mSQL C API has some extermal dependencies. They take the form of certain environment variables which, if defined in the environment of the pike interpreter, influence the interface's behavior. Those are "MSQL_TCP_PORT" which forces the server to connect to a port other than the default, "MSQL_UNIX_PORT", same as above, only referring to the UNIX domain sockets. If you built your mSQL server with the default setttings, you shouldn't worry about these. The variable MINERVA_DEBUG can be used to debug the mSQL API (you shouldn't worry about this either). Refer to the mSQL documentation for further details.

    Also note that THIS MODULE USES BLOCKING I/O to connect to the server. mSQL should be reasonably fast, but you might want to consider this particular aspect. It is thread-safe, and so it can be used in a multithread environment.

  FIXME

    Although it seems that mSQL/2.0 has some support for server statistics, it's really VERY VERY primitive, so it won't be added for now.

  See also

    Sql.Sql

  Constant version

    `constant Msql.version`

  Description

    Should you need to report a bug to the author, please submit along with the report the driver version number, as returned by this call.

  CLASS Msql.msql

    Method shutdown

      `void shutdown()`

    Description

      This function shuts a SQL-server down.

    Method reload_acl

      `void reload_acl()`

    Description

      This function forces a server to reload its ACLs.

    Note

      This function is not part of the standard interface, so it is not available through the Sql.Sql interface, but only through Sql.msql and Msql.msql programs.

    See also

      create

    Method create

      `void Msql.msql(void|string dbserver, void|string dbname, void|string username, void|string passwd)`

    Description

      With one argument, this function tries to connect to the specified (use hostname or IP address) database server. To connect to a server running on the local host via UNIX domain sockets use `"localhost"`. To connect to the local host via TCP/IP sockets you have to use the IP address `"127.0.0.1"`. With two arguments it also selects a database to use on the server. With no arguments it tries to connect to the server on localhost, using UNIX sockets.

    Throws

      You need to have a database selected before using the sql-object, otherwise you'll get exceptions when you try to query it. Also notice that this function can raise exceptions if the db server doesn't respond, if the database doesn't exist or is not accessible by you.

    Note

      You don't need bothering about syncronizing the connection to the database: it is automatically closed (and the database is sync-ed) when the msql object is destroyed.

    See also

      select_db

    Method list_dbs

      `array list_dbs(void|string wild)`

    Description

      Returns an array containing the names of all databases available on the system. Will throw an exception if there is no server connected. If an argument is specified, it will return only those databases whose name matches the given glob.

    Method list_tables

      `array list_tables(void|string wild)`

    Description

      Returns an array containing the names of all the tables in the currently selected database. Will throw an exception if we aren't connected to a database. If an argument is specified, it will return only those tables whose name matches the given glob.

    Method select_db

      `void select_db(string dbname)`

    Description

      Before querying a database you have to select it. This can be accomplished in two ways: the first is calling the create function with two arguments, another is calling it with one or no argument and then calling select_db . You can also use this function to change the database you're querying, as long as it is on the same server you are connected to.

    Throws

      This function CAN raise exceptions in case something goes wrong (for example: unexistant database, insufficient permissions, whatever).

    See also

      create , error

    Method query

      `array(mapping(string:mixed)) query(string sqlquery)`

    Description

      This is all you need to query the database. It takes as argument an SQL query string (i.e.: "SELECT foo,bar FROM baz WHERE name like '%kinkie%'" or "INSERT INTO baz VALUES ('kinkie','made','this')") and returns a data structure containing the returned values. The structure is an array (one entry for each returned row) of mappings which have the column name as index and the column contents as data. So to access a result from the first example you would have to do "results[0]->foo".

      A query which returns no data results in an empty array (and NOT in a 0). Also notice that when there is a column name clash (that is: when you join two or more tables which have columns with the same name), the clashing columns are renamed to <tablename>+"."+<column name>. To access those you'll have to use the indexing operator '[] (i.e.: results[0]["foo.bar"]).

    Throws

      Errors (both from the interface and the SQL server) are reported via exceptions, and you definitely want to catch them. Error messages are not particularly verbose, since they account only for errors inside the driver. To get server-related error messages, you have to use the error function.

    Note

      Note that if the query is NOT a of SELECT type, but UPDATE or MODIFY, the returned value is an empty array. This is not an error. Errors are reported only via exceptions.

    See also

      error

    Method server_info

      `string server_info()`

    Description

      This function returns a string describing the server we are talking to. It has the form "servername/serverversion" (like the HTTP protocol description) and is most useful in conjunction with the generic SQL-server module.

    Method host_info

      `string host_info()`

    Description

      This function returns a string describing what host are we talking to, and how (TCP/IP or UNIX sockets).

    Method error

      `string error()`

    Description

      This function returns the textual description of the last server-related error. Returns 0 if no error has occurred yet. It is not cleared upon reading (can be invoked multiple times, will return the same result until a new error occurs).

    See also

      query

    Method create_db

      `void create_db(string dbname)`

    Description

      This function creates a new database with the given name (assuming we have enough permissions to do this).

    See also

      drop_db

    Method drop_db

      `void drop_db(string dbname)`

    Description

      This function destroys a database and all the data it contains (assuming we have enough permissions to do so). USE WITH CAUTION!

    See also

      create_db

    Method list_fields

      `mapping(string:mapping(string:mixed)) list_fields(string table, void|string glob)`

    Description

      Returns a mapping describing the fields of a table in the database. The returned value is a mapping, indexed on the column name, of mappings.The glob argument, if present, filters out the fields not matching the glob. These contain currently the fields:

      `"type" : string` | Describes the field's mSQL data type ("char","integer",...)
      `"length" : int` | It describes the field's length. It is only interesting for char() fields, in fact. Also notice that the strings returned by msql->query() have the correct length. This field only specifies the _maximum_ length a "char()" field can have.
      `"table" : string` | The table this field is in. Added only for interface compliancy.
      `"flags" : multiset(string)` | It's a multiset containing textual descriptions of the server's flags associated with the current field. Currently it can be empty, or contain "unique" or "not null".

    Note

      The version of this function in the Msql.msql() program is not sql-interface compliant (this is the main reason why using that program directly is deprecated). Use Sql.Sql instead.

    See also

      query

    Method affected_rows

      `int affected_rows()`

    Description

      This function returns how many rows in the database were affected by our last SQL query.

    Note

      This function is available only if you're using mSQL version 2 or later. (That means: if the includes and library of version 2 of mSQL were available when the module was compiled).

      This function is not part of the standard interface, so it is not available through the Sql.Sql interface, but only through Sql.msql and Msql.msql programs

    Method list_index

      `array list_index(string tablename, string indexname)`

    Description

      This function returns an array describing the index structure for the given table and index name, as defined by the non-standard SQL query 'create index' (see the mSQL documentation for further informations). More than one index can be created for a table. There's currently NO way to have a listing of the indexes defined for a table (blame it on the mSQL API).

    Note

      This function is available if you're using mSQL version 2 or later.

      This function is not part of the standard interface, so it is not available through the Sql.Sql interface, but only through Sql.msql and Msql.msql programs.

Module Standards

  CLASS Standards.URI

    Description

      This class implements URI parsing and resolving of relative references to absolute form, as defined in RFC 2396 and RFC 3986.

    Variable scheme

      `string Standards.URI.scheme`

    Description

      Scheme component of URI

    Variable authority

      `string Standards.URI.authority`

    Description

      Authority component of URI (formerly called net_loc, from RFC 2396 known as authority)

    Variable path

      `string Standards.URI.path`

    Description

      Path component of URI. May be empty, but not undefined.

    Variable query

      `string Standards.URI.query`

    Description

      Query component of URI. May be 0 if not present.

    Variable fragment

      `string Standards.URI.fragment`

    Description

      The fragment part of URI. May be 0 if not present.

      `string Standards.URI.host`
      `string Standards.URI.user`
      `string Standards.URI.password`

    Description

      Certain classes of URI (e.g. URL) may have these defined

    Variable port

      `int Standards.URI.port`

    Description

      If no port number is present in URI, but the scheme used has a default port number, this number is put here.

    Variable base_uri

      `this_program Standards.URI.base_uri`

    Description

      The base URI object, if present

    Method `==

      `int `==(mixed something)`

    Description

      Compare this URI to something, in a canonical way.

    Parameter `something`

      Compare the URI to this

    Method reparse_uri

      `void reparse_uri()`
      `void reparse_uri(URI base_uri)`
      `void reparse_uri(string base_uri)`

    Description

      Reparse the URI with respect to a new base URI. If no base_uri was supplied, the old base_uri is thrown away. The resolving is performed according to the guidelines outlined by RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax.

    Parameter `base_uri`

      Set the new base URI to this.

    Method create

      `void Standards.URI(URI uri)`
      `void Standards.URI(URI uri, URI base_uri)`
      `void Standards.URI(URI uri, string base_uri)`
      `void Standards.URI(string uri)`
      `void Standards.URI(string uri, URI base_uri)`
      `void Standards.URI(string uri, string base_uri)`

    Parameter `base_uri`

      When supplied, will root the URI a the given location. This is needed to correctly verify relative URIs, but may be left out otherwise. If left out, and uri is a relative URI, an error is thrown.

    Parameter `uri`

      When uri is another URI object, the created URI will inherit all properties of the supplied uri except, of course, for its base_uri.

    Method `->=
    Method `[]=

      `mixed `->=(string property, mixed value)`
      `mixed `[]=(string property, mixed value)`

    Description

      Assign a new value to a property of URI

    Parameter `property`

      When any of the following properties are used, properties that depend on them are recalculated: user, password, host, port, authority, base_uri.

    Parameter `value`

      The value to assign to property

    Method cast

      `string|mapping cast(string to)`

    Description

      When cast to string, return the URI (in a canonicalized form). When cast to mapping, return a mapping with scheme, authority, user, password, host, port, path, query, fragment, raw_uri, base_uri as documented above.

    Method get_path_query

      `string get_path_query()`

    Description

      Returns path and query part of the URI if present.

    Method get_query_variables

      `mapping(string:string) get_query_variables()`

    Description

      Returns the query variables as a `mapping(string:string)`.

    Method set_query_variables

      `void set_query_variables(mapping(string:string) vars)`

    Description

      Sets the query variables from the provided mapping.

    Method add_query_variable

      `void add_query_variable(string name, string value)`

    Description

      Adds the provided query variable to the already existing ones. Will overwrite an existing variable with the same name.

    Method add_query_variables

      `void add_query_variables(mapping(string:string) vars)`

    Description

      Appends the provided set of query variables with the already existing ones. Will overwrite all existing variables with the same names.

    Method get_http_query

      `string get_http_query()`

    Description

      Return the query part, coded according to RFC 1738.

    Method get_http_path_query

      `string get_http_path_query()`

    Description

      Return the path and query part of the URI, coded according to RFC 1738.

  Module Standards.JSON

    Description

      Tools for handling the JSON structured data format. See http://www.json.org/ and RFC 4627.

      `constant Standards.JSON.ASCII_ONLY`
      `constant Standards.JSON.HUMAN_READABLE`
      `constant Standards.JSON.PIKE_CANONICAL`

    Description

      Bit field flags for use with encode :

      Standards.JSON.ASCII_ONLY

        Use `\uxxxx` escapes for all non-ascii characters and DEL (U+007f). The default is to escape only the characters that must be escaped. The flag value is 1.

        Characters above U+FFFF are encoded using escaped surrogate pairs, as per RFC 4627.

      Standards.JSON.HUMAN_READABLE

        Pretty print with indentation to make the result easier on human eyes. The default is to use no extra whitespace at all. The flag value is 2.

      Standards.JSON.PIKE_CANONICAL

        Make the output canonical, so that the same value always generates the same char-by-char equal string. In practice this means that mapping elements are sorted on their indices. Note that the other flags take precedence, so e.g. the canonical form with HUMAN_READABLE is not the same as the canonical form without it. The flag value is 4.

        This canonical form is stable for the encode function, providing floats aren't used (their formatting is currently affected by float size and libc formatting code). In the future there may be a standardized canonical form which quite likely will be different from this one. In that case a separate flag has to be added so this one doesn't change - hence the name PIKE_CANONICAL .

    Method encode

      `string encode(int|float|string|array|mapping|object val, void|int flags)`

    Description

      Encodes a value to a JSON string.

    Parameter `val`

      The value to encode. It can contain integers, floats (except the special numbers NaN and infinity), strings, arrays, mappings with string indices, and the special object values null , true and false defined in this module (or really any object that implements an `encode_json` callback).

    Parameter `flags`

      Flag bit field to control formatting. See ASCII_ONLY , HUMAN_READABLE and PIKE_CANONICAL for further details.

    Note

      8-bit and wider characters in input strings are neither escaped nor utf-8 encoded by default. string_to_utf8 can be used safely on the returned string to get a valid transport encoded JSON string. See escape_string for further details on string escaping.

    See also

      escape_string

    Method escape_string

      `string escape_string(string str, void|int flags)`

    Description

      Escapes string data for use in a JSON string.

      8-bit and wider characters in input strings are neither escaped nor utf-8 encoded by default. string_to_utf8 can be used safely on the returned string to get a valid transport encoded JSON string.

      The characters U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) are exceptions - they are encoded with \u escapes for compatibility. The reason is that those characters are not allowed in Javascript strings, so JSON parsers built in Javascript may have trouble with them otherwise.

    Parameter `val`

      The string to escape.

    Parameter `flags`

      Flag bit field to control formatting. ASCII_ONLY is the only flag that has any effect for this function.

    Note

      The difference between using this function and encode on a string is that encode returns quotations marks around the result.

    See also

      encode

    Method validate

      `int validate(string s)`

    Description

      Checks if a string is valid JSON.

    Returns

      In case the string contains valid JSON `-1` is returned. It is then guaranteed to be parsed without errors by decode() . In case the string is not valid JSON, the error position is returned.

    Method decode

      `array|mapping|string|float|int|object decode(string s)`

    Description

      Decodes a JSON string.

    Throws

      Throws an exception in case the data contained in `s` is not valid JSON.

    Method validate_utf8

      `int validate_utf8(string s)`

    Description

      Checks if a string is valid utf8 encoded JSON.

    Returns

      In case the string contains valid JSON `-1` is returned. It is then guaranteed to be parsed without errors by decode() . In case the string is not valid JSON, the integer position inside the string where the error occurs is returned.

    Method decode_utf8

      `array|mapping|string|float|int|object decode_utf8(string s)`

    Description

      Decodes an utf8 encoded JSON string. Should give the same result as `Standards.JSON.decode(utf8_to_string(s))`.

    Throws

      Throws an exception in case the data contained in `s` is not valid JSON.

      `Val.True Standards.JSON.true`
      `Val.False Standards.JSON.false`
      `Val.Null Standards.JSON.null`

    Description

      Compat aliases for the corresponding Val objects. These are used to represent the three JSON literals `true`, `false` and `null`.

    Deprecated

    CLASS Standards.JSON.DecodeError

      Description

        Error thrown when JSON decode fails.

      Inherit Generic

        inherit Error.Generic : Generic

      Variable err_str

        `string Standards.JSON.DecodeError.err_str`

      Description

        The string that failed to be decoded.

      Variable err_pos

        `int Standards.JSON.DecodeError.err_pos`

      Description

        The failing position in err_str .

  Module Standards.PKCS

    Module Standards.PKCS.Signature

      Method build_digestinfo

        `string build_digestinfo(string msg, Crypto.Hash hash)`

      Description

        Construct a PKCS-1 digestinfo.

      Parameter `msg`

        message to digest

      Parameter `hash`

        crypto hash object such as Crypto.SHA1 or Crypto.MD5

      See also

        Crypto.RSA()->sign, Crypto.RSA()->cooked_sign

    Module Standards.PKCS.Certificate

      Description

        Handle PKCS-6 and PKCS-10 certificates and certificate requests.

      Method build_distinguished_name

        `Sequence build_distinguished_name(mapping(string:object) ... args)`

      Method get_certificate_issuer

        `Sequence get_certificate_issuer(string cert)`

      Description

        Return the certificate issuer RDN from a certificate string.

      Parameter `cert`

        A string containing an X509 certificate.

        Note that the certificate normally must be decoded using MIME.decode_base64 .

      Returns

        An Standards.ASN1.Sequence object containing the certificate issuer Distinguished Name (DN).

      Method get_dn_string

        `string get_dn_string(Sequence dnsequence)`

      Description

        Converts an RDN (relative distinguished name) Seqeunce object to a human readable string in X500 format.

      Parameter `cert`

        A string containing an X509 certificate.

        Note that the certificate normally must be decoded using MIME.decode_base64 .

      Returns

        A string containing the certificate issuer Distinguished Name (DN) in human readable X500 format.

      Note

        We don't currently handle attributes with multiple values, not all attribute types are understood.

      Method get_certificate_subject

        `Sequence get_certificate_subject(string cert)`

      Description

        Return the certificate subject RDN from a certificate string.

      Parameter `cert`

        A string containing an X509 certificate.

        Note that the certificate normally must be decoded using MIME.decode_base64 .

      Returns

        An Standards.ASN1.Sequence object containing the certificate subject Distinguished Name (DN).

    Module Standards.PKCS.DSA

      Description

        DSA operations as defined in RFC-2459.

      Method algorithm_identifier

        `Sequence algorithm_identifier(Crypto.DSA|void dsa)`

      Method public_key

        `string public_key(Crypto.DSA dsa)`

      Method private_key

        `string private_key(Crypto.DSA dsa)`

      Method parse_private_key

        `Crypto.DSA parse_private_key(string key)`

    Module Standards.PKCS.Identifiers

      Description

        Various ASN.1 identifiers used by PKCS.

    Module Standards.PKCS.RSA

      Description

        RSA operations and types as described in PKCS-1.

      Method public_key

        `string public_key(Crypto.RSA rsa)`

      Description

        Create a DER-coded RSAPublicKey structure

      Parameter `rsa`

        Crypto.RSA object

      Returns

        ASN1 coded RSAPublicKey structure

      Method private_key

        `string private_key(Crypto.RSA rsa)`

      Description

        Create a DER-coded RSAPrivateKey structure

      Parameter `rsa`

        Crypto.RSA object

      Returns

        ASN1 coded RSAPrivateKey structure

      Method parse_public_key

        `Crypto.RSA parse_public_key(string key)`

      Description

        Decode a DER-coded RSAPublicKey structure

      Parameter `key`

        RSAPublicKey provided in ASN1 encoded format

      Returns

        Crypto.RSA object

      Method parse_private_key

        `Crypto.RSA parse_private_key(string key)`

      Description

        Decode a DER-coded RSAPrivateKey structure

      Parameter `key`

        RSAPrivateKey provided in ASN1 encoded format

      Returns

        Crypto.RSA object

    Module Standards.PKCS.CSR

      Description

        Handling of Certifikate Signing Requests (PKCS-10)

      Method build_csr

        `Sequence build_csr(Crypto.RSA rsa, object name, mapping(string:array(object)) attributes)`

  Module Standards.ASN1

    Method encode_der_oid

      `string encode_der_oid(string dotted_decimal)`

    Description

      Convenience function to convert an oid (object identifier) on dotted-decimal form (e.g. `"1.3.6.1.4.1.1466.115.121.1.38"`) to its DER (and hence also BER) encoded form.

    See also

      decode_der_oid

    Method decode_der_oid

      `string decode_der_oid(string der_oid)`

    Description

      Convenience function to convert a DER/BER encoded oid (object identifier) to the human readable dotted-decimal form.

    See also

      encode_der_oid

    Module Standards.ASN1.Types

      Description

        Encodes various asn.1 objects according to the Distinguished Encoding Rules (DER)

      Method make_combined_tag

        `int make_combined_tag(int cls, int tag)`

      Description

        Combines tag and class as a single integer, in a somewhat arbitrary way. This works also for tags beyond 31 (although not for tags beyond 2^30.

      Parameter `cls`

        ASN1 type class

      Parameter `tag`

        ASN1 type tag

      Returns

        combined tag

      See also

        Standards.ASN1.Types.extract_tag Standards.ASN1.Types.extract_cls

      Method extract_tag

        `int extract_tag(int i)`

      Description

        extract ASN1 type tag from a combined tag

      See also

        Standards.ASN1.Types.make_combined_tag

      Method extract_cls

        `int extract_cls(int i)`

      Description

        extract ASN1 type class from a combined tag

      See also

        Standards.ASN1.Types.make_combined_tag

      Method asn1_utf8_valid

        `int(1..1) asn1_utf8_valid(string s)`

      Description

        Checks if a Pike string can be encoded with UTF8. That is always the case...

      Method asn1_printable_valid

        `int(0..1) asn1_printable_valid(string s)`

      Description

        Checks if a Pike string can be encoded as a PrintableString .

      Method asn1_teletex_valid

        `int(0..1) asn1_teletex_valid(string s)`

      Method asn1_broken_teletex_valid

        `int(0..1) asn1_broken_teletex_valid(string s)`

      Method asn1_IA5_valid

        `int(0..1) asn1_IA5_valid(string s)`

      Method asn1_universal_valid

        `int(0..0) asn1_universal_valid(string s)`

      Method asn1_bmp_valid

        `int(0..1) asn1_bmp_valid(string s)`

      CLASS Standards.ASN1.Types.Object

        Description

          Generic, abstract base class for ASN1 data types.

        Method get_cls

          `int get_cls()`

        Description

          Get the class of this object.

        Returns

          The class of this object.

        Method get_tag

          `int get_tag()`

        Description

          Get the tag for this object.

        Returns

          The tag for this object.

        Method get_combined_tag

          `int get_combined_tag()`

        Description

          Get the combined tag (tag + class) for this object.

        Returns

          the combined tag header

        Method get_der

          `string get_der()`

        Description

          Get the DER encoded version of this object.

        Returns

          DER encoded representation of this object.

      CLASS Standards.ASN1.Types.Compound

        Description

          Compound object primitive

        Inherit Object

          inherit Object : Object

        Variable elements

          `array(Object) Standards.ASN1.Types.Compound.elements`

        Description

          contents of compound object, elements are from Standards.ASN1.Types

      CLASS Standards.ASN1.Types.String

        Description

          string object primitive

        Inherit Object

          inherit Object : Object

        Variable value

          `string Standards.ASN1.Types.String.value`

        Description

          value of object

      CLASS Standards.ASN1.Types.Boolean

        Description

          boolean object

        Inherit Object

          inherit Object : Object

        Variable value

          `int Standards.ASN1.Types.Boolean.value`

        Description

          value of object

      CLASS Standards.ASN1.Types.Integer

        Description

          Integer object All integers are represented as bignums, for simplicity

        Inherit Object

          inherit Object : Object

        Variable value

          `Gmp.mpz Standards.ASN1.Types.Integer.value`

        Description

          value of object

      CLASS Standards.ASN1.Types.Enumerated

        Description

          Enumerated object

        Inherit Integer

          inherit Integer : Integer

      CLASS Standards.ASN1.Types.BitString

        Description

          Bit string object

        Inherit Object

          inherit Object : Object

        Variable value

          `string Standards.ASN1.Types.BitString.value`

        Description

          value of object

        Method set_from_ascii

          `this_program set_from_ascii(string s)`

        Description

          Set the bitstring value as a string with `"1"` and `"0"`.

        Method set_length

          `int set_length(int len)`

        Description

          Sets the length of the bit string to len number of bits.

      CLASS Standards.ASN1.Types.OctetString

        Description

          Octet string object

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.Null

        Description

          Null object

        Inherit Object

          inherit Object : Object

      CLASS Standards.ASN1.Types.Identifier

        Description

          Object identifier object

        Inherit Object

          inherit Object : Object

        Variable id

          `array(int) Standards.ASN1.Types.Identifier.id`

        Description

          value of object

        Method append

          `this_program append(int ... args)`

        Description

          Returns a new Identifier object with args appended to the ID path.

      CLASS Standards.ASN1.Types.UTF8String

        Description

          UTF8 string object

          Character set: ISO/IEC 10646-1 (compatible with Unicode).

          Variable width encoding, see rfc2279.

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.Sequence

        Description

          Sequence object

        Inherit Compound

          inherit Compound : Compound

      CLASS Standards.ASN1.Types.Set

        Description

          Set object

        Inherit Compound

          inherit Compound : Compound

      CLASS Standards.ASN1.Types.PrintableString

        Description

          PrintableString object

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.TeletexString

        Description

          TeletexString object

          Avoid this one; it seems to be common that this type is used to label strings encoded with the ISO 8859-1 character set (use asn1_broken_teletex_string for that). From http://www.mindspring.com/~asn1/nlsasn.htm:

          /.../ Types GeneralString, VideotexString, TeletexString (T61String), and GraphicString exist in earlier versions [pre-1994] of ASN.1. They are considered difficult to use correctly by applications providing national language support. Varying degrees of application support for T61String values seems to be most common in older applications. Correct support is made more difficult, as character values available in type T61String have changed with the addition of new register entries from the 1984 through 1997 versions.

          This implementation is based on the description of T.61 and T.51 in "Some functions for representing T.61 characters from the X.500 Directory Service in ISO 8859 terminals (Version 0.2. July 1994.)" by Enrique Silvestre Mora (mora@si.uji.es), Universitat Jaume I, Spain, found in the package ftp://pereiii.uji.es/pub/uji-ftp/unix/ldap/iso-t61.translation.tar.Z

          The translation is only complete for 8-bit latin 1 strings. It encodes strictly to T.61, but decodes from the superset T.51.

        Note

          CCITT Recommendation T.61 is also known as ISO-IR 103:1985 (graphic characters) and ISO-IR 106:1985 and ISO-IR 107:1985 (control characters).

        See also

          Locale.Charset

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.BrokenTeletexString

        Description

          (broken) TeletexString object

          Encodes and decodes latin1, but labels it TeletexString, as is common in many broken programs (e.g. Netscape 4.0X).

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.IA5String

        Description

          IA5 String object

          Character set: ASCII. Fixed width encoding with 1 octet per character.

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.VisibleString

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.UTC

        Inherit String

          inherit String : String

      CLASS Standards.ASN1.Types.UniversalString

        Description

          Universal String object

          Character set: ISO/IEC 10646-1 (compatible with Unicode). Fixed width encoding with 4 octets per character.

        FIXME

          The encoding is very likely UCS-4, but that's not yet verified.

        Inherit OctetString

          inherit OctetString : OctetString

      CLASS Standards.ASN1.Types.BMPString

        Description

          BMP String object

          Character set: ISO/IEC 10646-1 (compatible with Unicode). Fixed width encoding with 2 octets per character.

          FIXME: The encoding is very likely UCS-2, but that's not yet verified.

        Inherit OctetString

          inherit OctetString : OctetString

      CLASS Standards.ASN1.Types.MetaExplicit

        Description

          Meta-instances handle a particular explicit tag and set of types.

        FIXME

          document me!

    Module Standards.ASN1.Decode

      Description

        Decodes a DER object.

      Method der_decode

        `.Types.Object der_decode(ADT.struct data, mapping(int:program) types)`

      Parameter `data`

        an instance of ADT.struct

      Parameter `types`

        a mapping from combined tag numbers to classes from or derived from Standards.ASN1.Types . Combined tag numbers may be generated using Standards.ASN1.Types.make_combined_tag .

      Returns

        an object from Standards.ASN1.Types or either Standards.ASN1.Decode.Primitive or Standards.ASN1.Decode.constructed if the type is unknown. Throws an exception if the data could not be decoded.

      FIXME

        Handling of implicit and explicit ASN.1 tagging, as well as other context dependence, is next to non_existant.

      Method simple_der_decode

        `.Types.Object simple_der_decode(string data)`

      Description

        decode a DER encoded object using universal data types

      Parameter `data`

        a DER encoded object

      Returns

        an object from Standards.ASN1.Types or either Standards.ASN1.Decode.Primitive or Standards.ASN1.Decode.constructed if the type is unknown.

      CLASS Standards.ASN1.Decode.Primitive

        Description

          Primitive unconstructed ASN1 data type.

        Inherit Object

          inherit Types.Object : Object

        Method get_der
        Method get_combined_tag

          `string get_der()`
          `int get_combined_tag()`

        Description

          get raw encoded contents of object

        Method get_tag

          `int get_tag()`

        Description

          get tag

        Method get_cls

          `int get_cls()`

        Description

          get class

      CLASS Standards.ASN1.Decode.Constructed

        Description

          Constructed type

        Inherit Object

          inherit Types.Object : Object

        Variable raw

          `string Standards.ASN1.Decode.Constructed.raw`

        Description

          raw encoded contents

        Variable elements

          `array Standards.ASN1.Decode.Constructed.elements`

        Description

          elements of object

        Method get_tag

          `int get_tag()`

        Description

          get tag

        Method get_cls

          `int get_cls()`

        Description

          get class

  Module Standards.XML

    Module Standards.XML.Wix

      Description

        Helper module for generating Windows Installer XML structures.

      See also

        Parser.XML.Tree.SimpleNode

      Method get_module_xml

        `WixNode get_module_xml(Directory dir, string id, string version, string|void manufacturer, string|void description, string|void guid, string|void comments, string|void installer_version)`

      Note

        Modifies dir if it contains files at the root level.

  Module Standards.TLD

    Constant cc

      `constant Standards.TLD.cc`

    Description

      A mapping between country TLDs and the name of the country.

    Variable generic

      `multiset Standards.TLD.generic`

    Description

      A multiset containing the generic TLDs, such as "com" and "info".

  Module Standards.EXIF

    Description

      This module implements EXIF (Exchangeable image file format for Digital Still Cameras) 2.2 parsing.

    Method get_properties

      `mapping get_properties(Stdio.File file)`

    Description

      Retrieve the EXIF properties of the given file.

    Parameter `file`

      The Stdio.File object containing wanted EXIF properties.

    Returns

      A mapping with all found EXIF properties.

  Module Standards.ID3

    Description

      ID3 decoder/encoder. Supports versions 1.0, 1.1, 2.2-2.4. For more info see http://www.id3.org

    Note

      Note that this implementation is far from complete and that interface changes might be neccessary during the implementation of the full standard.

    Method synchsafe_to_int

      `int synchsafe_to_int(array(int) bytes)`

    Description

      Decodes a synchsafe integer, generated according to ID3v2.4.0-structure section 6.2.

    See also

      int_to_synchsafe

    Method int_to_synchsafe

      `array(int) int_to_synchsafe(int in, void|int no_bytes)`

    Description

      Encodes a integer to a synchsafe integer according to ID3v2.4.0-structure section 6.2.

    See also

      synchsafe_to_int

    Method resynchronise

      `string resynchronise(string in)`

    Description

      Reverses the effects of unsyncronisation done according to ID3v2.4.0-structure section 6.1.

    See also

      unsynchronise

    Method unsynchronise

      `string unsynchronise(string in)`

    Description

      Unsynchronises the string according to ID3v2.4.0-structure section 6.1.

    See also

      resynchronise

    Method decode_string

      `string decode_string(string in, int type)`

    Description

      Decodes the string in from the type , according to ID3v2.4.0-structure section 4, into a wide string.

    See also

      encode_string

    Method encode_string

      `array(string|int) encode_string(string in)`

    Description

      Encodes the string in to an int-string pair, where the integer is the encoding mode, according to ID3v2.4.0-structure, and the string is the encoded string. This function tries to minimize the size of the encoded string by selecting the most apropriate encoding method.

    See also

      decode_string , encode_strings

    Method encode_strings

      `array(string|int) encode_strings(array(string) in)`

    Description

      Encodes several strings in the same way as encode_string , but encodes all the strings with the same method, selected as in encode_string . The first element in the resulting array is the selected method, while the following elements are the encoded strings.

    See also

      decode_string , encode_string

    CLASS Standards.ID3.Buffer

      Description

        A wrapper around a Stdio.File object that provides a read limit capability.

      syntax

        `Stdio.File Standards.ID3.Buffer.buffer` `void Standards.ID3.Buffer(Stdio.File buffer)`

      Method read

        `string read(int bytes)`

      Description

        Read bytes bytes from the buffer. Throw an exception if bytes is bigger than the number of bytes left in the buffer before reaching the limit set by set_limit .

      Method peek

        `string peek()`

      Description

        Preview the next byte. Technically it is read from the encapsulated buffer and put locally to avoid seeking.

      Method set_limit

        `void set_limit(int bytes)`

      Description

        Set an artificial EOF bytes bytes further into the buffer.

      Method bytes_left

        `int bytes_left()`

      Description

        The number of bytes left before reaching the limit set by set_limit .

    CLASS Standards.ID3.TagHeader

      Description

        Represents an ID3v2 header.

      Method create

        `void Standards.ID3.TagHeader(void|Buffer buffer)`

      Method decode

        `void decode(Buffer buffer)`

      Description

        Decode a tag header from buffer and store its data in this object.

      Method encode

        `string encode()`

      Description

        Encode the data in this tag and return as a string.

      Method set_flag_unsynchronisation

        `int(0..1) set_flag_unsynchronisation(array(Frame) frames)`

      Description

        Should the unsynchronisation flag be set or not?

    CLASS Standards.ID3.ExtendedHeader

      Method create

        `void Standards.ID3.ExtendedHeader(void|Buffer buffer)`

      Method decode

        `void decode(Buffer buffer)`

      Method encode

        `string encode()`

    CLASS Standards.ID3.FrameData

      Description

        Abstract class for frame data.

      Method create

        `void Standards.ID3.FrameData(void|string data)`

      Method changed

        `int(0..1) changed()`

      Description

        Is the content altered?

    CLASS Standards.ID3.Frame

      Description

        Manages the common frame information.

      Method create

        `void Standards.ID3.Frame(string|Buffer in, TagHeader thd)`

    CLASS Standards.ID3.Tagv2

      Description

        ID3 version 2 (2.2, 2.3, 2.4) Tags

      Method create

        `void Standards.ID3.Tagv2(void|Buffer|Stdio.File buffer, void|int(0..1) _best_effort)`

    CLASS Standards.ID3.Tagv1

      Description

        ID3 version 1.0 or 1.1 tag. This is really a clumsy way of reading ID3v1 tags, but it has the same interface as the v2 reader.

    CLASS Standards.ID3.Tag

      Description

        This is a ID3 tag super object, which encapsulates all versions ID3 tags. This is useful if you are only interested in the metadata of a file, and care not about how it is stored or have no interest in changing the data.

      Note

        Version 1 tag is searched only if version 2 isn't found.

      See also

        Tagv2 , Tagv1

      Method create

        `void Standards.ID3.Tag(Stdio.File fd)`

      Description

        The file object fd is searched for version 2 tags, and if not found, version 1 tags.

      Throws

        If no tag was found in the file an error is thrown.

      Method `[]
      Method `->

        `mixed `[](string index)`
        `mixed `->(string index)`

      Description

        The index operators are overloaded to index the encapsulated Tagv1 or Tagv2 object.

      Constant version

        `constant Standards.ID3.Tag.version`

      Description

        The version of the encapsulated tag in the form `"%d.%d.%d"`.

      Method _indices

        `array _indices()`

      Description

        Indices will return the indices of the tag object.

      Method _values

        `array _values()`

      Description

        Values will return the values of the tag object.

      Method friendly_values

        `mapping(string:string) friendly_values()`

      Description

        Returns tag values in a mapping. Only tag values that exists in ID3v1.1 is used. Nonexisting or undefined values will not appear in the mapping.

        `"artist" : string` | Takes its value from TPE1 or TP1 frames.
        `"album" : string` | Takes its value from TALB or TAL frames.
        `"title" : string` | Takes its value from TIT2 or TT2 frames.
        `"genre" : string` | Takes its value from TCON or TCM frames.
        `"year" : string` | Takes its value from TYER or TYE frames.
        `"track" : string` | Takes its value from TRCK or TRK frames. The string may be either in the `"%d"` form or in the `"%d/%d"` form.

  Module Standards.IDNA

    Description

      This module implements various algorithms specified by the Internationalizing Domain Names in Applications (IDNA) memo by the Internet Engineering Task Force (IETF), see ftp://ftp.rfc-editor.org/in-notes/rfc3490.txt.

    Variable Punycode

      `object Standards.IDNA.Punycode`

    Description

      Punycode transcoder, see ftp://ftp.rfc-editor.org/in-notes/rfc3492.txt. Punycode is used by to_ascii as an "ASCII Compatible Encoding" when needed.

    Method nameprep

      `string nameprep(string s, int(0..1)|void allow_unassigned)`

    Description

      Prepare a Unicode string for ACE transcoding. Used by to_ascii . Nameprep is a profile of Stringprep, which is described in RFC 3454.

    Parameter `s`

      The string to prep.

    Parameter `allow_unassigned`

      Set this flag the the string to transform is a "query string", and not a "stored string". See RFC 3454.

    Method to_ascii

      `string to_ascii(string s, int(0..1)|void allow_unassigned, int(0..1)|void use_std3_ascii_rules)`

    Description

      The to_ascii operation takes a sequence of Unicode code points that make up one label and transforms it into a sequence of code points in the ASCII range (0..7F). If to_ascci succeeds, the original sequence and the resulting sequence are equivalent labels.

    Parameter `s`

      The sequence of Unicode code points to transform.

    Parameter `allow_unassigned`

      Set this flag if the the string to transform is a "query string", and not a "stored string". See RFC 3454.

    Parameter `use_std3_ascii_rules`

      Set this flag to enforce the restrictions on ASCII characters in host names imposed by STD3.

    Method to_unicode

      `string to_unicode(string s)`

    Description

      The to_unicode operation takes a sequence of Unicode code points that make up one label and returns a sequence of Unicode code points. If the input sequence is a label in ACE form, then the result is an equivalent internationalized label that is not in ACE form, otherwise the original sequence is returned unaltered.

    Parameter `s`

      The sequence of Unicode code points to transform.

    Method zone_to_ascii

      `string zone_to_ascii(string s, int(0..1)|void allow_unassigned, int(0..1)|void use_std3_ascii_rules)`

    Description

      Takes a sequence of labels separated by '.' and applies to_ascii on each.

    Method zone_to_unicode

      `string zone_to_unicode(string s)`

    Description

      Takes a sequence of labels separated by '.' and applies to_unicode on each.

  Module Standards.UUID

    Description

      Support for Universal Unique Identifiers (UUID) and Globally Unique Identifiers (GUID).

    See also

      RFC4122: A Universally Unique IDentifier (UUID) URN Namespace ITU-T X.667: Generation and registration of Universally Unique Identifiers (UUIDs) and their use as ASN.1 object identifier components

    Method get_clock_state

      `array(int) get_clock_state()`

    Description

      Returns the internal clock state. Can be used for persistent storage when an application is terminated.

    See also

      set_clock_state

    Method set_clock_state

      `void set_clock_state(int last_time, int seq)`

    Description

      Sets the internal clock state.

    See also

      get_clock_state

    Method make_version1

      `UUID make_version1(int node)`

    Description

      Creates a new version 1 UUID.

    Parameter `node`

      Either the 48 bit IEEE 802 (aka MAC) address of the system or -1.

    Method make_version3

      `UUID make_version3(string name, string|UUID namespace)`

    Description

      Creates a version 3 UUID with a name string and a binary representation of a name space UUID.

    Method make_version4

      `UUID make_version4()`

    Description

      Creates a version 4 (random) UUID.

    Method make_version5

      `UUID make_version5(string name, string|UUID namespace)`

    Description

      Creates a version 5 UUID with a name string and a binary representation of a name space UUID.

    Method format_uuid

      `string format_uuid(string uuid)`

    Description

      Returns the string representation of the binary UUID uuid .

    Method parse_uuid

      `string parse_uuid(string uuid)`

    Description

      Returns the binary representation of the UUID uuid .

    Constant Nil_UUID

      `constant Standards.UUID.Nil_UUID`

    Description

      The Nil UUID.

    Constant NameSpace_DNS

      `constant Standards.UUID.NameSpace_DNS`

    Description

      Name space UUID for DNS.

    Constant NameSpace_URL

      `constant Standards.UUID.NameSpace_URL`

    Description

      Name space UUID for URL.

    Constant NameSpace_OID

      `constant Standards.UUID.NameSpace_OID`

    Description

      Name space UUID for OID.

    Constant NameSpace_X500

      `constant Standards.UUID.NameSpace_X500`

    Description

      Name space UUID for X500.

    Method make_null

      `UUID make_null()`

    Description

      Creates a null UUID object.

    Method make_dns

      `UUID make_dns(string name)`

    Description

      Creates a DNS UUID with the given DNS name.

    Method make_url

      `UUID make_url(string name)`

    Description

      Creates a URL UUID with the given URL.

    Method make_oid

      `UUID make_oid(string name)`

    Description

      Creates an OID UUID with the given OID.

    Method make_x500

      `UUID make_x500(string name)`

    Description

      Creates an X500 UUID with the gived X500 address.

    Method make_dns

      `UUID make_dns(string name)`

    Description

      Creates a DNS UUID with the given DNS name.

    Method make_url

      `UUID make_url(string name)`

    Description

      Creates a URL UUID with the given URL.

    Method make_oid

      `UUID make_oid(string name)`

    Description

      Creates an OID UUID with the given OID.

    Method make_x500

      `UUID make_x500(string name)`

    Description

      Creates an X500 UUID with the gived X500 address.

    CLASS Standards.UUID.UUID

      Description

        Represents an UUID

      Variable timestamp

        `int Standards.UUID.UUID.timestamp`

      Description

        60 bit value representing the time stamp.

      Method posix_time

        `int posix_time()`

      Description

        Returns the posix time of the UUID.

      Variable version

        `int Standards.UUID.UUID.version`

      Description

        The version of the UUID.

      Method str_version

        `string str_version()`

      Description

        Returns a string representation of the version, e.g. `"Name-based (MD5)"`.

      Variable var

        `int Standards.UUID.UUID.var`

      Description

        The variant of the UUID.

      Method str_variant

        `string str_variant()`

      Description

        Returns a string representation of the variant, e.g. `"IETF draft variant"`.

      Variable clk_seq

        `int Standards.UUID.UUID.clk_seq`

      Description

        The clock sequence. Should be 13 to 15 bits depending on UUID version.

      Variable node

        `int Standards.UUID.UUID.node`

      Description

        The UUID node. Should be 48 bit.

      Method validate

        `void validate()`

      Description

        Validates the current UUID.

      Method time_low

        `int time_low()`

      Description

        Returns the time_low field.

      Method time_mid

        `int time_mid()`

      Description

        Returns the time_mid field.

      Method time_hi_and_version

        `int time_hi_and_version()`

      Description

        Returns the time_hi_and_version field.

      Method encode

        `string encode()`

      Description

        Encodes a binary representation of the UUID.

      Method str

        `string str()`

      Description

        Creates a string representation of the UUID.

      Method urn

        `string urn()`

      Description

        Creates a URN representation of the UUID.

      Method create

        `void Standards.UUID.UUID(void|string in)`

      Description

        Optionally created with a string or binary representation of a UUID.

  Module Standards.ISO639_2

    Method get_language

      `string get_language(string code)`

    Description

      Look up the language name given an ISO 639-2 code in lower case. It will first be looked up in the ISO 639-2/T table and then in ISO 639-2/B if the first lookup failed. Returns zero typed zero on failure.

    Method get_language_t

      `string get_language_t(string code)`

    Description

      Look up the language name given an ISO 639-2/T code in lower case. Returns zero typed zero on failure.

    Method get_language_b

      `string get_language_b(string code)`

    Description

      Look up the language name given an ISO 639-2/B code in lower case. Returns zero typed zero on failure.

    Method list_languages

      `mapping(string:string) list_languages()`

    Description

      Return a mapping from ISO 639-2/T + ISO 639-2/B codes to language names.

    Method list_languages_t

      `mapping(string:string) list_languages_t()`

    Description

      Return a mapping from ISO 639-2/T codes to language names.

    Method list_languages_b

      `mapping(string:string) list_languages_b()`

    Description

      Return a mapping from ISO 639-2/B codes to language names.

    Method convert_b_to_t

      `string convert_b_to_t(string code)`

    Description

      Converts an ISO 639-2/B code to an ISO 639-2/T code.

    Method convert_t_to_b

      `string convert_t_to_b(string code)`

    Description

      Converts an ISO 639-2/T code to an ISO 639-2/B code.

    Method map_639_1

      `string map_639_1(string code)`

    Description

      Look up the ISO 639-2/T code given an ISO 639-1 code in lower case.

    Method map_to_639_1

      `string map_to_639_1(string code)`

    Description

      Look up the ISO 639-1 code given an ISO 639-2/T code in lower case.

    Method list_639_1

      `mapping(string:string) list_639_1()`

    Description

      Return a mapping from ISO 639-1 code to ISO 639-2/T code.

Module _Ffmpeg

    `constant _Ffmpeg.CODEC_ID_NONE`
    `constant _Ffmpeg.CODEC_ID_AC3`
    `constant _Ffmpeg.CODEC_ID_ADPCM_IMA_QT`
    `constant _Ffmpeg.CODEC_ID_ADPCM_IMA_WAV`
    `constant _Ffmpeg.CODEC_ID_ADPCM_MS`
    `constant _Ffmpeg.CODEC_ID_H263`
    `constant _Ffmpeg.CODEC_ID_H263I`
    `constant _Ffmpeg.CODEC_ID_H263P`
    `constant _Ffmpeg.CODEC_ID_MJPEG`
    `constant _Ffmpeg.CODEC_ID_MPEG1VIDEO`
    `constant _Ffmpeg.CODEC_ID_MPEG4`
    `constant _Ffmpeg.CODEC_ID_MP2`
    `constant _Ffmpeg.CODEC_ID_MP3LAME`
    `constant _Ffmpeg.CODEC_ID_MSMPEG4V1`
    `constant _Ffmpeg.CODEC_ID_MSMPEG4V2`
    `constant _Ffmpeg.CODEC_ID_MSMPEG4V3`
    `constant _Ffmpeg.CODEC_ID_PCM_ALAW`
    `constant _Ffmpeg.CODEC_ID_PCM_MULAW`
    `constant _Ffmpeg.CODEC_ID_PCM_S16BE`
    `constant _Ffmpeg.CODEC_ID_PCM_S16LE`
    `constant _Ffmpeg.CODEC_ID_PCM_S8`
    `constant _Ffmpeg.CODEC_ID_PCM_U16BE`
    `constant _Ffmpeg.CODEC_ID_PCM_U16LE`
    `constant _Ffmpeg.CODEC_ID_PCM_U8`
    `constant _Ffmpeg.CODEC_ID_RAWVIDEO`
    `constant _Ffmpeg.CODEC_ID_RV10`
    `constant _Ffmpeg.CODEC_ID_SVQ1`
    `constant _Ffmpeg.CODEC_ID_VORBIS`
    `constant _Ffmpeg.CODEC_ID_WMV1`
    `constant _Ffmpeg.CODEC_ID_WMV2`

  Description

    Various audio and video codecs.

  Note

    The list of supported codecs depends on Ffmpeg library.

    `constant _Ffmpeg.CODEC_TYPE_AUDIO`
    `constant _Ffmpeg.CODEC_TYPE_VIDEO`

  Description

    Type of codec.

  CLASS _Ffmpeg.ffmpeg

    Description

      Implements support of all codecs from a nice project Ffmpeg. You can find more info about it at http://ffmpeg.sf.net/.

    Method create

      `void _Ffmpeg.ffmpeg(int codec_name, int encoder)`

    Description

      Create decoder or encoder object.

    Parameter `codec_name`

      Internal number of codec, eg. CODEC_ID_MP2 .

    Parameter `encoder`

      If `true`, encoder object will be created, decoder object otherwise.

    Method get_codec_info

      `mapping|int get_codec_info()`

    Description

      Returns mapping with info of used codec.

    See also

      list_codecs()

    Method set_codec_param

      `int set_codec_param(string name, mixed value)`

    Description

      Sets one codec parameter

    Parameter `name`

      The name of parameter. One of `"sample_rate"`, `"bit_rate"`, `"channels"`.

    Returns

      Returns 1 on success, 0 otherwise (parameter not known).

    See also

      get_codec_params()

    Method get_codec_status

      `mapping|int get_codec_status()`

    Description

      Returns a mapping with the actual codec parameters.

    See also

      set_codec_param()

    Method decode

      `mapping|int decode(string data)`

    Description

      Returns a mapping with the new decoded frame and lenght of data which was used for decoding.

    Method decode

      `int decode(string data, function shuffler)`

    Description

      Decode all data buffer and pass result to shuffler . Returns `1` on success, `0` otherwise.

    Note

      Shuffler variant isn't implemented, yet.

    Note

      Usable only in decoder.

    See also

      create()

    Method list_codecs

      `array(mapping) list_codecs()`

    Description

      Gets all supported codecs.

    Returns

      Array of mapping with codec features.

Module System

  Description

    This module embodies common operating system calls, making them available to the Pike programmer.

  Method RegGetValue_76

    `string|int|array(string) RegGetValue_76(int hkey, string key, string index)`

  Description

    Get a single value from the register (COMPAT).

    Pike 7.6 compatibility implementation of RegGetValue() . The difference being that this function throws errors when keys are missing.

  Note

    This function is only available on Win32 systems.

  See also

    RegGetKeyNames_76() , RegGetValues_76() , RegGetValue()

  Method RegGetKeyNames_76

    `array(string) RegGetKeyNames_76(int hkey, string key)`

  Description

    Get a list of value key names from the register (COMPAT).

    Pike 7.6 compatibility implementation of RegGetKeyNames() . The difference being that this function throws errors when keys are missing.

  Note

    This function is only available on Win32 systems.

  See also

    RegGetValue() , RegGetValues_76() , RegGetKeyNames()

  Method RegGetValues_76

    `mapping(string:string|int|array(string)) RegGetValues_76(int hkey, string key)`

  Description

    Get multiple values from the register (COMPAT).

    Pike 7.6 compatibility implementation of RegGetValues() . The difference being that this function throws errors when keys are missing.

  Note

    This function is only available on Win32 systems.

  See also

    RegGetValue_76() , RegGetKeyNames_76() , RegGetValues()

  Method LogonUser

    `object LogonUser(string username, string|int(0..0) domain, string password, int|void logon_type, int|void logon_provider)`

  Description

    Logon a user.

  Parameter `username`

    User name of the user to login.

  Parameter `domain`

    Domain to login on, or zero if local logon.

  Parameter `password`

    Password to login with.

  Parameter `logon_type`

    One of the following values:

    `LOGON32_LOGON_BATCH` |
    `LOGON32_LOGON_INTERACTIVE` |
    `LOGON32_LOGON_SERVICE` |
    `LOGON32_LOGON_NETWORK` | This is the default.

  Parameter `logon_provider`

    One of the following values:

    `LOGON32_PROVIDER_DEFAULT` | This is the default.

  Returns

    Returns a login token object on success, and zero on failure.

  Note

    This function is only available on some Win32 systems.

  Method NetUserGetInfo

    `string|array(string|int) NetUserGetInfo(string username, string|int(0..0) server, int|void level)`

  Description

    Get information about a network user.

  Parameter `username`

    User name of the user to get information about.

  Parameter `server`

    Server the user exists on.

  Parameter `level`

    Information level. One of:

    `0`
    `1`
    `2`
    `3`
    `10`
    `11`
    `20`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserEnum() , NetGroupEnum() NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetUserEnum

    `array(string|array(string|int)) NetUserEnum(string|int(0..0)|void server, int|void level, int|void filter)`

  Description

    Get information about network users.

  Parameter `server`

    Server the users exist on.

  Parameter `level`

    Information level. One of:

    `0`
    `1`
    `2`
    `3`
    `10`
    `11`
    `20`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetGroupEnum() NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetGroupEnum

    `array(string|array(string|int)) NetGroupEnum(string|int(0..0)|void server, int|void level)`

  Description

    Get information about network groups.

  Parameter `server`

    Server the groups exist on.

  Parameter `level`

    Information level. One of:

    `0`
    `1`
    `2`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetLocalGroupEnum

    `array(array(string|int)) NetLocalGroupEnum(string|int(0..0)|void server, int|void level)`

  Description

    Get information about local network groups.

  Parameter `server`

    Server the groups exist on.

  Parameter `level`

    Information level. One of:

    `0`
    `1`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetUserGetGroups

    `array(array(string|int)) NetUserGetGroups(string|int(0..0) server, string user, int|void level)`

  Description

    Get information about group membership for a network user.

  Parameter `server`

    Server the groups exist on.

  Parameter `user`

    User to retrieve groups for.

  Parameter `level`

    Information level. One of:

    `0`
    `1`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetLocalGroupEnum() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetUserGetLocalGroups

    `array(string) NetUserGetLocalGroups(string|int(0..0) server, string user, int|void level, int|void flags)`

  Description

    Get information about group membership for a local network user.

  Parameter `server`

    Server the groups exist on.

  Parameter `user`

    User to retrieve groups for.

  Parameter `level`

    Information level. One of:

    `0`

  Parameter `flags`

    Zero, of one of the following:

    `LG_INCLUDE_INDIRECT`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetLocalGroupEnum() , NetUserGetGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetGroupGetUsers

    `array(string|array(int|string)) NetGroupGetUsers(string|int(0..0) server, string group, int|void level)`

  Description

    Get information about group membership for a network group.

  Parameter `server`

    Server the groups exist on.

  Parameter `group`

    Group to retrieve members for.

  Parameter `level`

    Information level. One of:

    `0`
    `1`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetLocalGroupGetMembers() , NetGetDCName() , NetGetAnyDCName()

  Method NetLocalGroupGetMembers

    `array(string|array(int|string)) NetLocalGroupGetMembers(string|int(0..0) server, string group, int|void level)`

  Description

    Get information about group membership for a network group.

  Parameter `server`

    Server the groups exist on.

  Parameter `group`

    Group to retrieve members for.

  Parameter `level`

    Information level. One of:

    `0`
    `1`
    `2`
    `3`

  Returns

    Returns an array on success. Throws errors on failure.

  FIXME

    Document the return value.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetGetDCName() , NetGetAnyDCName()

  Method NetGetDCName

    `string NetGetDCName(string|int(0..0) server, string domain)`

  Description

    Get name of the domain controller from a server.

  Parameter `server`

    Server the domain exists on.

  Parameter `domain`

    Domain to get the domain controller for.

  Returns

    Returns the name of the domain controller on success. Throws errors on failure.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetAnyDCName()

  Method NetGetAnyDCName

    `string NetGetAnyDCName(string|int(0..0) server, string domain)`

  Description

    Get name of a domain controller from a server.

  Parameter `server`

    Server the domain exists on.

  Parameter `domain`

    Domain to get a domain controller for.

  Returns

    Returns the name of a domain controller on success. Throws errors on failure.

  Note

    This function is only available on some Win32 systems.

  See also

    NetUserGetInfo() , NetUserEnum() , NetGroupEnum() , NetLocalGroupEnum() , NetUserGetGroups() , NetUserGetLocalGroups() , NetGroupGetUsers() , NetLocalGroupGetMembers() , NetGetDCName()

  Method NetSessionEnum

    `array(int|string) NetSessionEnum(string|int(0..0) server, string|int(0..0) client, string|int(0..0) user, int level)`

  Description

    Get session information.

  Parameter `level`

    One of

    `0`
    `1`
    `2`
    `10`
    `502`

  Note

    This function is only available on some Win32 systems.

  Method NetWkstaUserEnum

    `array(mixed) NetWkstaUserEnum(string|int(0..0) server, int level)`

  Parameter `level`

    One of

    `0`
    `1`

  Note

    This function is only available on some Win32 systems.

  Method normalize_path

    `string normalize_path(string path)`

  Description

    Normalize an existing Windows file system path.

    The following transformations are currently done:

    - Forward slashes (`'/'`) are converted to backward slashes (`'\'`).

    - Trailing slashes are removed, except a single slash after a drive letter (e.g. `"C:\"` is returned instead of `"C:"`).

    - Extraneous empty extensions are removed.

    - Short filenames are expanded to their corresponding long variants.

    - Relative paths are expanded to absolute paths.

    - Current- and parent-directory path components (`"."` and `".."`) are followed, similar to combine_path .

    - Case-information in directory and file names is restored.

    - Drive letters are returned in uppercase.

    - The host and share parts of UNC paths are returned in lowercase.

  Returns

    A normalized absolute path without trailing slashes.

    Throws errors on failure, e.g. if the file or directory doesn't exist.

  Note

    File fork information is currently not supported (invalid data).

  Note

    In Pike 7.6 and earlier, this function didn't preserve a single slash after drive letters, and it didn't convert the host and share parts of an UNC path to lowercase.

  See also

    combine_path() , combine_path_nt()

  Method GetFileAttributes

    `int GetFileAttributes(string filename)`

  Description

    Get the file attributes for the specified file.

  Note

    This function is only available on Win32 systems.

  See also

    SetFileAttributes()

  Method SetFileAttributes

    `int SetFileAttributes(string filename)`

  Description

    Set the file attributes for the specified file.

  Note

    This function is only available on Win32 systems.

  See also

    GetFileAttributes()

  Method LookupAccountName

    `array(mixed) LookupAccountName(string|int(0..0) sys, string account)`

  Note

    This function is only available on some Win32 systems.

  Method SetNamedSecurityInfo

    `array(mixed) SetNamedSecurityInfo(string name, mapping(string:mixed) options)`

  Note

    This function is only available on some Win32 systems.

  See also

    GetNamedSecurityInfo()

  Method GetNamedSecurityInfo

    `mapping(mixed:mixed) GetNamedSecurityInfo(string name, int|void type, int|void flags)`

  Note

    This function is only available on some Win32 systems.

  See also

    SetNamedSecurityInfo()

  Method GetComputerName

    `string GetComputerName()`

  Description

    Retrieves the NetBIOS name of the local computer.

  Note

    This function is Windows specific, and is not available on all systems.

  Method GetUserName

    `string GetUserName()`

  Description

    Retrieves the name of the user associated with the current thread.

  Note

    This function is Windows specific, and is not available on all systems.

  Method hardlink

    `void hardlink(string from, string to)`

  Description

    Create a hardlink named to from the file from .

  Note

    This function is not available on all platforms.

  See also

    symlink() , mv() , rm()

  Method symlink

    `void symlink(string from, string to)`

  Description

    Create a symbolic link named to that points to from .

  Note

    This function is not available on all platforms.

  See also

    hardlink() , readlink() , mv() , rm()

  Method readlink

    `string readlink(string path)`

  Description

    Returns what the symbolic link path points to.

  Note

    This function is not available on all platforms.

  See also

    symlink()

  Method resolvepath

    `string resolvepath(string path)`

  Description

    Resolve all symbolic links of a pathname.

    This function resolves all symbolic links, extra ``/'' characters and references to /./ and /../ in pathname , and returns the resulting absolute path, or `0` (zero) if an error occurs.

  Note

    This function is not available on all platforms.

  See also

    readlink() , symlink()

  Method umask

    `int umask(void|int mask)`

  Description

    Set the current umask to mask .

    If mask is not specified the current umask will not be changed.

  Returns

    Returns the old umask setting.

  Method chmod

    `void chmod(string path, int mode)`

  Description

    Sets the protection mode of the specified path.

  Note

    Throws errors on failure.

  See also

    Stdio.File->open() , errno()

  Method chown

    `void chown(string path, int uid, int gid, void|int symlink)`

  Description

    Sets the owner and group of the specified path.

    If symlink is set and path refers to a symlink, then the owner and group for the symlink are set. Symlinks are dereferenced otherwise.

  Note

    Throws errors on failure.

    This function is not available on all platforms. On some platforms the symlink flag isn't supported. In that case, the function does nothing if path is a symlink.

  Method utime

    `void utime(string path, int atime, int mtime, void|int symlink)`

  Description

    Set the last access time and last modification time for the path path to atime and mtime repectively. They are specified as unix timestamps with 1 second resolution.

    If symlink is set and path refers to a symlink, then the timestamps for the symlink are set. Symlinks are dereferenced otherwise.

  Note

    Throws errors on failure.

    This function is not available on all platforms. On some platforms the symlink flag isn't supported. In that case, the function does nothing if path is a symlink.

  See also

    System.set_file_atime , System.set_file_mtime

  Method initgroups

    `void initgroups(string name, int base_gid)`

  Description

    Initializes the supplemental group access list according to the system group database. base_gid is also added to the group access list.

  Note

    Throws errors on failure.

    This function is not available on all platforms.

  See also

    setuid() , getuid() , setgid() , getgid() , seteuid() , geteuid() , setegid() , getegid() , getgroups() , setgroups()

  Method cleargroups

    `void cleargroups()`

  Description

    Clear the supplemental group access list.

  Note

    Throws errors on failure.

    This function is not available on all platforms.

  See also

    setgroups() , initgroups() , getgroups()

  Method setgroups

    `void setgroups(array(int) gids)`

  Description

    Set the supplemental group access list for this process.

  Note

    Throws errors on failure.

    This function is not available on all platforms.

  See also

    initgroups() , cleargroups() , getgroups() , getgid() , getgid() , getegid() , setegid()

  Method getgroups

    `array(int) getgroups()`

  Description

    Get the current supplemental group access list for this process.

  Note

    Throws errors on failure.

    This function is not available on all platforms.

  See also

    setgroups() , cleargroups() , initgroups() , getgid() , getgid() , getegid() , setegid()

  Method innetgr

    `int(0..1) innetgr(string netgroup, string|void machine, string|void user, string|void domain)`

  Description

    Searches for matching entries in the netgroup database (usually `/etc/netgroup`). If any of the machine , user or domain arguments are zero or missing, those fields will match any value in the selected netgroup .

  Note

    This function isn't available on all platforms.

  Method setuid

    `int setuid(int uid)`

  Description

    Sets the real user ID, effective user ID and saved user ID to uid .

  Returns

    Returns the current errno.

  Note

    This function isn't available on all platforms.

  See also

    getuid() , setgid() , getgid() , seteuid() , geteuid() , setegid() , getegid()

  Method setgid

    `int setgid(int gid)`

  Description

    Sets the real group ID, effective group ID and saved group ID to gid . If gid is `-1` the uid for "nobody" will be used.

  Throws

    Throws an error if no "nobody" user when gid is `-1`.

  Returns

    Returns the current errno.

  Note

    This function is not available on all platforms.

  See also

    getuid() , setuid() , getgid() , seteuid() , geteuid() , setegid() , getegid()

  Method seteuid

    `int seteuid(int euid)`

  Description

    Set the effective user ID to euid . If euid is `-1` the uid for "nobody" will be used.

  Returns

    Returns the current errno.

  Throws

    Throws an error if there is no "nobody" user when euid is `-1`.

  Note

    This function isn't available on all platforms.

  Method setegid

    `int setegid(int egid)`

  Description

    Set the effective group ID to egid . If egid is `-1` the uid for "nobody" will be used.

  Returns

    Returns the current errno.

  Throws

    Throws an error if there is no "nobody" user when egid is `-1`.

  Note

    This function isn't available on all platforms.

  Method getpgrp

    `int getpgrp(int|void pid)`

  Description

    Get the process group id for the process pid . With no argguments or with 'pid' equal to zero, returns the process group ID of this process.

  Note

    Not all platforms support getting the process group for other processes.

    Not supported on all platforms.

  See also

    getpid , getppid

  Method setpgrp

    `int setpgrp()`

  Description

    Make this process a process group leader.

  Note

    Not supported on all platforms.

  Method getsid

    `int getsid(int|void pid)`

  Description

    Get the process session ID for the given process. If pid is not specified, the session ID for the current process will be returned.

  Note

    This function is not available on all platforms.

  Throws

    Throws an error if the system call fails.

  See also

    getpid , getpgrp , setsid

  Method setsid

    `int setsid()`

  Description

    Set a new process session ID for the current process, and return it.

  Note

    This function isn't available on all platforms.

  Throws

    Throws an error if the system call fails.

  See also

    getpid , setpgrp , getsid

  Method dumpable

    `int(0..1) dumpable(int(0..1)|void val)`

  Description

    Get and/or set whether this process should be able to dump core.

  Parameter `val`

    Optional argument to set the core dumping state.

    `0` | Disable core dumping for this process.
    `1` | Enable core dumping for this process.

  Returns

    Returns `1` if this process currently is capable of dumping core, and `0` (zero) if not.

  Note

    This function is currently only available on some versions of Linux.

  Method setresuid

    `int setresuid(int ruid, int euid, int suid)`

  Description

    Sets the real, effective and saved set-user-ID to ruid , euid and suid respectively.

  Returns

    Returns zero on success and errno on failure.

  Method setresgid

    `int setresgid(int rgid, int egid, int sgid)`

  Description

    Sets the real, effective and saved group ID to rgid , egid and sgid respectively.

  Returns

    Returns zero on success and errno on failure.

  Method getuid

    `int getuid()`

  Description

    Get the real user ID.

  See also

    setuid , setgid , getgid , seteuid , geteuid , setegid , getegid

  Method getgid

    `int getgid()`

  Description

    Get the real group ID.

  See also

    setuid , getuid , setgid , seteuid , geteuid , getegid , setegid

  Method geteuid

    `int geteuid()`

  Description

    Get the effective user ID.

  See also

    setuid , getuid , setgid , getgid , seteuid , getegid , setegid

  Method getegid

    `int getegid()`

  Description

    Get the effective group ID.

  See also

    setuid , getuid , setgid , getgid , seteuid , geteuid , setegid

  Method getpid

    `int getpid()`

  Description

    Returns the process ID of this process.

  See also

    getppid , getpgrp

  Method getppid

    `int getppid()`

  Description

    Returns the process ID of the parent process.

  See also

    getpid , getpgrp

  Method chroot

    `int chroot(string newroot)`
    `int chroot(Stdio.File newroot)`

  Description

    Changes the root directory for this process to the indicated directory.

  Returns

    A nonzero value is returned if the call is successful. If there's an error then zero is returned and errno is set appropriately.

  Note

    Since this function modifies the directory structure as seen from Pike, you have to modify the environment variables PIKE_MODULE_PATH and PIKE_INCLUDE_PATH to compensate for the new root-directory.

    This function only exists on systems that have the chroot(2) system call.

    The second variant only works on systems that also have the fchroot(2) system call.

  Method uname

    `mapping(string:string) uname()`

  Description

    Get operating system information.

  Returns

    The resulting mapping contains the following fields:

    `"sysname" : string` | Operating system name.
    `"nodename" : string` | Hostname.
    `"release" : string` | Operating system release.
    `"version" : string` | Operating system version.
    `"machine" : string` | Hardware architecture.
    `"architecture" : string` | Basic instruction set architecture.
    `"isalist" : string` | List of upported instruction set architectures. Usually space-separated.
    `"platform" : string` | Specific model of hardware.
    `"hw provider" : string` | Manufacturer of the hardware.
    `"hw serial" : string` | Serial number of the hardware.
    `"srpc domain" : string` | Secure RPC domain.

  Note

    This function only exists on systems that have the uname(2) or sysinfo(2) system calls.

    Only the first five elements are always available.

  Method gethostname

    `string gethostname()`

  Description

    Returns a string with the name of the host.

  Note

    This function only exists on systems that have the gethostname(2) or uname(2) system calls.

  Method gethostbyaddr

    `array(string|array(string)) gethostbyaddr(string addr)`

  Description

    Returns an array with information about the specified IP address.

  Returns

    The returned array contains the same information as that returned by gethostbyname() .

  Note

    This function only exists on systems that have the gethostbyaddr(2) or similar system call.

  See also

    gethostbyname()

  Method gethostbyname

    `array(string|array(string)) gethostbyname(string hostname)`

  Description

    Returns an array with information about the specified host.

  Returns

    The returned array contains the following:

    Array
    `string hostname` | Name of the host.
    `array(string) ips` | Array of IP numbers for the host.
    `array(string) aliases` | Array of alternative names for the host.

  Note

    This function only exists on systems that have the gethostbyname(2) or similar system call.

  See also

    gethostbyaddr()

  Method sleep

    `int sleep(int seconds)`

  Description

    Call the system sleep() function.

    This is not to be confused with the global function predef::sleep() that does more elaborate things and can sleep with better precision (although dependant on a normal functioning system clock).

  Note

    The system's sleep function often utilizes the alarm(2) call and might not be perfectly thread safe in combination with simultaneous sleep()'s or alarm()'s. It might also be interrupted by other signals.

    If you don't need it to be independant of the system clock, use predef::sleep() instead.

    May not be present; only exists if the function exists in the current system.

  See also

    predef::sleep() usleep() nanosleep()

  Method usleep

    `void usleep(int usec)`

  Description

    Call the system usleep() function.

    This is not to be confused with the global function predef::sleep() that does more elaborate things and can sleep with better precision (although dependant on a normal functioning system clock).

  Note

    The system's usleep function often utilizes the alarm(2) call and might not be perfectly thread safe in combination with simultaneous sleep()'s or alarm()'s. It might also be interrupted by other signals.

    If you don't need it to be independant of the system clock, use predef::sleep() instead.

    May not be present; only exists if the function exists in the current system.

  See also

    predef::sleep() sleep() nanosleep()

  Method nanosleep

    `float nanosleep(int|float seconds)`

  Description

    Call the system nanosleep() function.

    This is not to be confused with the global function predef::sleep() that does more elaborate things and can sleep with better precision (although dependant on a normal functioning system clock).

    Returns the remaining time to sleep (as the system function does).

  See also

    predef::sleep() sleep() usleep()

  Note

    May not be present; only exists if the function exists in the current system.

  Method getrlimit

    `array(int) getrlimit(string resource)`

  Description

    Returns the current process limitation for the selected resource .

  Parameter `resource`

    `cpu` | The CPU time limit in seconds.
    `fsize` | The maximum size of files the process may create.
    `data` | The maximum size of the process's data segment.
    `stack` | The maximum size of process stack, in bytes.
    `core` |
    `rss` | Specifies the limit of pages the process's resident set.
    `nproc` | The maximum number of processes that can be created for the real user ID of the calling process.
    `nofile` | The maximum number of file descriptors the process can open, +1.
    `memlock` | The maximum number of bytes of virtual memory that may be locked into RAM.
    `as` |
    `vmem` |

  Returns

    Array
    `int 0` | The soft limit for the resource. `-1` means no limit.
    `int 1` | The hard limit for the resource. `-1` means no limit.

  Note

    This function nor all the resources are available on all systems.

  See also

    getrlimits , setrlimit

  Method getrlimits

    `mapping(string:array(int)) getrlimits()`

  Description

    Returns all process limits in a mapping.

  See also

    getrlimit , setrlimit

  Method setrlimit

    `int(0..1) setrlimit(string resource, int soft, int hard)`

  Description

    Sets the soft and the hard process limit on a resource .

  See also

    getrlimit , getrlimits

  Method setproctitle

    `void setproctitle(string title, mixed ... extra)`

  Description

    Sets the processes title.

  Constant ITIMER_REAL

    `constant System.ITIMER_REAL`

  Description

    Identifier for a timer that decrements in real time.

  See also

    setitimer , getitimer

  Constant ITIMER_VIRTUAL

    `constant System.ITIMER_VIRTUAL`

  Description

    Identifier for a timer that decrements only when the process is executing.

  See also

    setitimer , getitimer

  Constant ITIMER_PROF

    `constant System.ITIMER_PROF`

  Description

    Identifier for a timer that decrements both when the process is executing and when the system is executing on behalf of the process.

  See also

    setitimer , getitimer

  Method setitimer

    `float setitimer(int timer, int|float value)`

  Description

    Sets the timer to the supplied value . Returns the current timer interval.

  Parameter `timer`

    One of ITIMER_REAL , ITIMER_VIRTUAL and ITIMER_PROF .

  Method getitimer

    `array(float) getitimer(int timer)`

  Description

    Shows the state of the selected timer .

  Returns

    Array
    `float 0` | The interval of the timer.
    `float 1` | The value of the timer.

  Parameter `timer`

    One of ITIMER_REAL , ITIMER_VIRTUAL and ITIMER_PROF .

  Method get_netinfo_property

    `array(string) get_netinfo_property(string domain, string path, string property)`

  Description

    Queries a NetInfo server for property values at the given path.

  Parameter `domain`

    NetInfo domain. Use "." for the local domain.

  Parameter `path`

    NetInfo path for the property.

  Parameter `property`

    Name of the property to return.

  Returns

    An array holding all property values. If the path or property cannot be not found 0 is returned instead. If the NetInfo domain is not found or cannot be queried an exception is thrown.

  Example

        system.get_netinfo_property(".", "/locations/resolver", "domain");
           ({
              "idonex.se"
           })

  Note

    Only available on operating systems which have NetInfo libraries installed.

  Method getloadavg

    `array(float) getloadavg()`

  Description

    Get system load averages.

  Returns

    Array
    `float 0` | Load average over the last minute.
    `float 1` | Load average over the last 5 minutes.
    `float 2` | Load average over the last 15 minutes.

  Method rdtsc

    `int rdtsc()`

  Description

    Executes the rdtsc (clock pulse counter) instruction and returns the result.

  Method gettimeofday

    `array(int) gettimeofday()`

  Description

    Calls gettimeofday(); the result is an array of seconds, microseconds, and possible tz_minuteswes, tz_dstttime as given by the gettimeofday(2) system call (read the man page).

  See also

    time() , gethrtime()

  Constant string

    `constant System.string`

  Description

    This string constant tells whether or not the CPU time, returned by e.g. gethrvtime , is thread local or not. The value is "yes" if it is and "no" if it isn't. The value is also "no" if there is no thread support.

  See also

    gethrvtime , gauge

  Constant int

    `constant System.int`

  Description

    The resolution of the CPU time, returned by e.g. gethrvtime , in nanoseconds. It is `-1` if the resolution isn't known.

  See also

    gethrvtime , gauge

  Constant string

    `constant System.string`

  Description

    This string constant identifies the internal interface used to get the CPU time. It is an implementation detail - see rusage.c for possible values and their meanings.

  See also

    gethrvtime , gauge

  Constant string

    `constant System.string`

  Description

    This string constant tells whether or not the high resolution real time returned by gethrtime , is monotonic or not. The value is "yes" if it is and "no" if it isn't.

    Monotonic time is not affected by clock adjustments that might happen to keep the calendaric clock in synch. It's therefore more suited to measure time intervals in programs.

  See also

    gethrtime

  Constant int

    `constant System.int`

  Description

    The resolution of the real time returned by gethrtime , in nanoseconds. It is `-1` if the resolution isn't known.

  See also

    gethrtime

  Constant string

    `constant System.string`

  Description

    This string constant identifies the internal interface used to get the high resolution real time. It is an implementation detail - see rusage.c for possible values and their meanings.

  See also

    gethrtime

  Method getrusage

    `mapping(string:int) getrusage()`

  Description

    Return resource usage about the current process. An error is thrown if it isn't supported or if the system fails to return any information.

  Returns

    Returns a mapping describing the current resource usage:

    `"utime" : int` | Time in milliseconds spent in user code.
    `"stime" : int` | Time in milliseconds spent in system calls.
    `"maxrss" : int` | Maximum used resident size in kilobytes. [1]
    `"ixrss" : int` | Quote from GNU libc: An integral value expressed in kilobytes times ticks of execution, which indicates the amount of memory used by text that was shared with other processes. [1]
    `"idrss" : int` | Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for data. [1]
    `"isrss" : int` | Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for stack space. [1]
    `"minflt" : int` | Minor page faults, i.e. TLB misses which required no disk I/O.
    `"majflt" : int` | Major page faults, i.e. paging with disk I/O required.
    `"nswap" : int` | Number of times the process has been swapped out entirely.
    `"inblock" : int` | Number of block input operations.
    `"oublock" : int` | Number of block output operations.
    `"msgsnd" : int` | Number of IPC messsages sent.
    `"msgrcv" : int` | Number of IPC messsages received.
    `"nsignals" : int` | Number of signals received.
    `"nvcsw" : int` | Number of voluntary context switches (usually to wait for some service).
    `"nivcsw" : int` | Number of preemptions, i.e. context switches due to expired time slices, or when processes with higher priority were scheduled.
    `"sysc" : int` | Number of system calls. [2]
    `"ioch" : int` | Number of characters read and written. [2]
    `"rtime" : int` | Elapsed real time (ms). [2]
    `"ttime" : int` | Elapsed system trap (system call) time (ms). [2]
    `"tftime" : int` | Text page fault sleep time (ms). [2]
    `"dftime" : int` | Data page fault sleep time (ms). [2]
    `"kftime" : int` | Kernel page fault sleep time (ms). [2]
    `"ltime" : int` | User lock wait sleep time (ms). [2]
    `"slptime" : int` | Other sleep time (ms). [2]
    `"wtime" : int` | Wait CPU (latency) time (ms). [2]
    `"stoptime" : int` | Time spent in stopped (suspended) state. [2]
    `"brksize" : int` | Heap size. [3]
    `"stksize" : int` | Stack size. [3]

  Note

    [1] Not if /proc rusage is used.

    [2] Only from (Solaris?) /proc rusage.

    [3] Only from /proc PRS usage.

    On some systems, only utime will be filled in.

  See also

    gethrvtime()

  Method openlog

    `void openlog(string ident, int options, facility)`

  Description

    Initializes the connection to syslogd.

  Parameter `ident.`

    The ident argument specifies an identifier to tag all logentries with.

  Parameter `options`

    A bitfield specifying the behaviour of the message logging. Valid options are:

    `LOG_PID` | Log the process ID with each message.
    `LOG_CONS` | Write messages to the console if they can't be sent to syslogd.
    `LOG_NDELAY` | Open the connection to syslogd now and not later.
    `LOG_NOWAIT` | Do not wait for subprocesses talking to syslogd.

  Parameter `facility`

    Specifies what subsystem you want to log as. Valid facilities are:

    `LOG_AUTH` | Authorization subsystem
    `LOG_AUTHPRIV` |
    `LOG_CRON` | Crontab subsystem
    `LOG_DAEMON` | System daemons
    `LOG_KERN` | Kernel subsystem (NOT USABLE)
    `LOG_LOCAL` | For local use
    `LOG_LOCAL1`
    `LOG_LOCAL2`
    `LOG_LOCAL3`
    `LOG_LOCAL4`
    `LOG_LOCAL5`
    `LOG_LOCAL6`
    `LOG_LOCAL7`
    `LOG_LPR` | Line printer spooling system
    `LOG_MAIL` | Mail subsystem
    `LOG_NEWS` | Network news subsystem
    `LOG_SYSLOG` |
    `LOG_USER` |
    `LOG_UUCP` | UUCP subsystem

  Note

    Only available on systems with syslog(3).

  Bugs

    LOG_NOWAIT should probably always be specified.

  See also

    syslog , closelog

  Method syslog

    `void syslog(int priority, string msg)`

  Description

    Writes the message msg to the log with the priorities in priority .

  Parameter `priority`

    Priority is a bit vector with the wanted priorities or:ed together.

    `0` | LOG_EMERG, system is unusable.
    `1` | LOG_ALERT, action must be taken immediately.
    `2` | LOG_CRIT, critical conditions.
    `3` | LOG_ERR, error conditions.
    `4` | LOG_WARNING, warnind conditions.
    `5` | LOG_NOTICE, normal, but significant, condition.
    `6` | LOG_INFO, informational message.
    `7` | LOG_DEBUG, debug-level message.

  Method closelog

    `void closelog()`

  FIXME

    Document this function.

  Method setpwent

    `int setpwent()`

  Description

    Resets the getpwent function to the first entry in the passwd source using the systemfunction `setpwent(3)`.

  Returns

    Always `0` (zero)

  See also

    get_all_users() getpwent() endpwent()

  Method endpwent

    `int endpwent()`

  Description

    Closes the passwd source opened by getpwent function using the systemfunction `endpwent(3)`.

  Returns

    Always `0` (zero)

  See also

    get_all_users() getpwent() setpwent()

  Method getpwent

    `array(int|string) getpwent()`

  Description

    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 .

  Returns

    An array with the information about the user

    Array
    `string 0` | Users username (loginname)
    `string 1` | User password (encrypted)
    `int 2` | Users ID
    `int 3` | Users primary group ID
    `string 4` | Users real name an possibly some other info
    `string 5` | Users home directory
    `string 6` | Users shell

    0 if EOF.

  See also

    get_all_users() getpwnam() getpwent() setpwent() endpwent()

  Method setgrent

    `int setgrent()`

  Description

    Rewinds the getgrent pointer to the first entry

  See also

    get_all_groups() getgrent() endgrent()

  Method endgrent

    `int endgrent()`

  Description

    Closes the /etc/groups file after using the getgrent function.

  See also

    get_all_groups() getgrent() setgrent()

  Method getgrent

    `array(int|string|array(string)) getgrent()`

  Description

    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 !

  Returns

    An array with the information about the group

    Array
    `string 0` | Group name
    `string 1` | Group password (encrypted)
    `int 2` | ID of the group
    `array 3..` | Array with UIDs of group members

  See also

    get_all_groups() getgrnam() getgrgid()

  Inherit _system

    inherit _system : _system

  Method get_user

    `string get_user()`

  Description

    Get the username of the user that started the process.

  Returns

    the username of the user "associated" with the current process, or zero if a method to find this information does not exist on the current system.

  Note

    On NT systems, this returns the user the current thread is running as, while on Unix-like systems this function returns the user that started the process (rather than the effective user)

  Method get_home

    `string get_home()`

  Description

    Get the full path for the current user's home directory

  Returns

    the full path to the current user's home directory, or zero if the appropriate environment variables have not been set.

  Note

    This method uses the standard environment variables for various systems to determine the home directory.

  CLASS System.Memory

    Description

      A popular demand is a class representing a raw piece of memory or a `mmap`'ed file. This is usually not the most effective way of solving a problem, but it might help in rare situations.

      Using `mmap` can lead to segmentation faults in some cases. Beware, and read about `mmap` before you try anything. Don't blame Pike if you shoot your foot off.

    Method create

      `void System.Memory()`
      `void System.Memory(string|Stdio.File filename_to_mmap)`
      `void System.Memory(int shmkey, int shmsize, int shmflg)`
      `void System.Memory(int bytes_to_allocate)`

    Description

      Will call mmap() or allocate() depending on argument, either `mmap`'ing a file (in shared mode, writeable if possible) or allocating a chunk of memory.

    Method mmap
    Method mmap_private

      `int mmap(string|Stdio.File file)`
      `int mmap(string|Stdio.File file, int offset, int size)`
      `int mmap_private(string|Stdio.File file)`
      `int mmap_private(string|Stdio.File file, int offset, int size)`

    Description

      `mmap` a file. This will always try to mmap the file in PROT_READ|PROT_WRITE, readable and writable, but if it fails it will try once more in PROT_READ only.

    Method allocate

      `void allocate(int bytes)`
      `void allocate(int bytes, int(0..255) fill)`

    Method free

      `void free()`

    Description

      Free the allocated or <tt>mmap</tt>ed memory.

    Method _sizeof

      `int _sizeof()`

    Description

      returns the size of the memory (bytes). note: throws if not allocated

    Method valid

      `int(0..1) valid()`

    Description

      returns 1 if the memory is valid, 0 if not allocated

    Method writeable

      `int(0..1) writeable()`

    Description

      returns 1 if the memory is writeable, 0 if not

    Method cast

      `string|array cast(string to)`

    Description

      Cast to string or array.

    Note

      Throws if not allocated.

    Method pread
    Method pread16
    Method pread32
    Method pread16i
    Method pread32i
    Method pread16n
    Method pread32n

      `string pread(int(0..) pos, int(0..) len)`
      `string pread16(int(0..) pos, int(0..) len)`
      `string pread32(int(0..) pos, int(0..) len)`
      `string pread16i(int(0..) pos, int(0..) len)`
      `string pread32i(int(0..) pos, int(0..) len)`
      `string pread16n(int(0..) pos, int(0..) len)`
      `string pread32n(int(0..) pos, int(0..) len)`

    Description

      Read a string from the memory. The 16 and 32 variants reads widestrings, 16 or 32 bits (2 or 4 bytes) wide, the i variants in intel byteorder, the normal in network byteorder, and the n variants in native byteorder.

      len is the number of characters, wide or not. pos is the byte position (!).

    Method pwrite
    Method pwrite16
    Method pwrite32
    Method pwrite16i
    Method pwrite32i

      `int pwrite(int(0..) pos, string data)`
      `int pwrite16(int(0..) pos, string data)`
      `int pwrite32(int(0..) pos, string data)`
      `int pwrite16i(int(0..) pos, string data)`
      `int pwrite32i(int(0..) pos, string data)`

    Description

      Write a string to the memory (and to the file, if it's mmap()ed). The 16 and 32 variants writes widestrings, 16 or 32 bits (2 or 4 bytes) wide, the 'i' variants in intel byteorder, the other in network byteorder.

      returns the number of bytes (not characters) written

    Method `[]

      `int `[](int pos)`
      `string `[](int pos1, int pos2)`

    Method `[]=

      `int `[]=(int pos, int char)`
      `string `[]=(int pos1, int pos2, string str)`

  CLASS System.Time

    Description

      The current time as a structure containing a sec and a usec member.

      `int System.Time.sec`
      `int System.Time.usec`

    Description

      The number of seconds and microseconds since the epoch and the last whole second, respectively. (See also predef::time() )

      Please note that these variables will continually update when they are requested, there is no need to create new Time() objects.

    Variable usec_full

      `int System.Time.usec_full`

    Description

      The number of microseconds since the epoch. Please note that pike has to have been compiled with bignum support for this variable to contain sensible values.

    Method create

      `void System.Time(int fast)`

    Description

      If fast is true, do not request a new time from the system, instead use the global current time variable.

      This will only work in callbacks, but can save significant amounts of CPU.

  CLASS System.Timer

    Method peek

      `float peek()`

    Description

      Return the time in seconds since the last time get was called.

    Method get

      `float get()`

    Description

      Return the time in seconds since the last time get was called. The first time this method is called the time since the object was created is returned instead.

    Method create

      `void System.Timer(int|void fast)`

    Description

      Create a new timer object. The timer keeps track of relative time with sub-second precision.

      If fast is specified, the timer will not do system calls to get the current time but instead use the one maintained by pike. This will result in faster but more or less inexact timekeeping. The pike maintained time is only updated when a Pike.Backend object stops waiting and starts executing code.

Module Locale

  Description

    The functions and classes in the top level of the Locale module implements a dynamic localization system, suitable for programs that needs to change locale often. It is even possible for different threads to use different locales at the same time.

    The highest level of the locale system is called projects. Usually one program consists of only one project, but for bigger applications, or highly modular applications it is possible for several projects to coexist.

    Every project in turn contains several unique tokens, each one representing an entity that is different depending on the currently selected locale.

  Example

        // The following line tells the locale extractor what to
          // look for.
          // <locale-token project="my_project">LOCALE</locale-token>
          // The localization macro.
          #define LOCALE(X,Y) Locale.translate("my_project", \
            get_lang(), X, Y)
          string get_lang() { return random(2)?"eng":"swe"; }
          int(0..0) main() {
            write(LOCALE(0, "This is a line.")+"\n");
            write(LOCALE(0, "This is another one.\n");
            return 0;
          }

  Method register_project

    `void register_project(string name, string path, void|string path_base)`

  Description

    Make a connection between a project name and where its localization files can be found. The mapping from project name to locale file is stored in projects.

  Method set_default_project_path

    `void set_default_project_path(string path)`

  Description

    In the event that a translation is requested in an unregistered project, this path will be used as the project path. %P will be replaced with the requested projects name.

  Method list_languages

    `array(string) list_languages(string project)`

  Description

    Returns a list of all registered languages for a specific project.

  Method get_objects

    `mapping(string:object) get_objects(string lang)`

  Description

    Reads in and returns a mapping with all the registred projects' LocaleObjects in the language 'lang'

  Method translate

    `string translate(string project, string lang, string|int id, string fallback)`

  Description

    Returns a translation for the given id, or the fallback string

  Method call

    `function call(string project, string lang, string name, void|function|string fb)`

  Description

    Returns a localized function If function not found, tries fallback function fb, or fallback language fb instead

  CLASS Locale.DeferredLocale

    Description

      This class simulates a multi-language "string". The actual language to use is determined as late as possible.

    syntax

      `protected string Locale.DeferredLocale.project`
      `protected function(:string) Locale.DeferredLocale.get_lang`
      `protected string|int Locale.DeferredLocale.key`
      `protected string Locale.DeferredLocale.fallback` `void Locale.DeferredLocale(string project, function(:string) get_lang, string|int key, string fallback)`

    Method get_identifier

      `array get_identifier()`

    Description

      Return the data nessesary to recreate this "string".

  Module Locale.Gettext

    Description

      This module enables access to localization functions from within Pike.

    Note

      The message conversion functions in this module do not handle Unicode strings. They only provide thin wrappers to `gettext(3)` etc, which means strings are assumed to be encoded according to the `LC_*` and `LANG` variables. See the docs for `gettext(3)` for details.

    Method gettext

      `string gettext(string msg)`
      `string gettext(string msg, string domain)`
      `string gettext(string msg, string domain, int category)`

    Parameter `msg`

      Message to be translated.

    Parameter `domain`

      Domain from within the message should be translated. Defaults to the current domain.

    Parameter `category`

      Category from which the translation should be taken. Defaults to Locale.Gettext.LC_MESSAGES .

      Return a translated version of msg within the context of the specified domain and current locale. If there is no translation available, msg is returned.

    Note

      Prior to Pike 7.3 this function only accepted one argument, and the other functionality was provided by dgettext() and dcgettext() .

    See also

      bindtextdomain , textdomain , setlocale , localeconv

    Method dgettext

      `string dgettext(string domain, string msg)`

    Description

      Return a translated version of msg within the context of the specified domain and current locale. If there is no translation available, msg is returned.

    Note

      Obsoleted by gettext() in Pike 7.3.

    See also

      bindtextdomain , textdomain , gettext , setlocale , localeconv

    Method dcgettext

      `string dcgettext(string domain, string msg, int category)`

    Description

      Return a translated version of msg within the context of the specified domain and current locale for the specified category . Calling dcgettext with category Locale.Gettext.LC_MESSAGES gives the same result as dgettext.

      If there is no translation available, msg is returned.

    Note

      Obsoleted by gettext() in Pike 7.3.

    See also

      bindtextdomain , textdomain , gettext , setlocale , localeconv

    Method textdomain

      `string textdomain(void|string domain)`

    Description

      The textdomain() function sets or queries the name of the current domain of the active LC_MESSAGES locale category. The domain argument is a string that can contain only the characters allowed in legal filenames.

      The domain argument is the unique name of a domain on the system. If there are multiple versions of the same domain on one system, namespace collisions can be avoided by using bindtextdomain() . If textdomain() is not called, a default domain is selected. The setting of domain made by the last valid call to textdomain() remains valid across subsequent calls to setlocale() , and gettext() .

    Returns

      The normal return value from textdomain() is a string containing the current setting of the domain. If domainname is void, textdomain() returns a string containing the current domain. If textdomain() was not previously called and domainname is void, the name of the default domain is returned.

    See also

      bindtextdomain , gettext , setlocale , localeconv

    Method bindtextdomain

      `string bindtextdomain(string|void domainname, string|void dirname)`

    Description

      Binds the path predicate for a message domainname domainname to the directory name specified by dirname .

      If domainname is a non-empty string and has not been bound previously, bindtextdomain() binds domainname with dirname .

      If domainname is a non-empty string and has been bound previously, bindtextdomain() replaces the old binding with dirname .

      The dirname argument can be an absolute or relative pathname being resolved when gettext() , dgettext() or dcgettext() are called.

      If domainname is zero or an empty string, bindtextdomain() returns 0.

      User defined domain names cannot begin with the string `"SYS_"`. Domain names beginning with this string are reserved for system use.

    Returns

      The return value from bindtextdomain() is a string containing dirname or the directory binding associated with domainname if dirname is unspecified. If no binding is found, the default locale path is returned. If domainname is unspecified or is an empty string, bindtextdomain() takes no action and returns a 0.

    See also

      textdomain , gettext , setlocale , localeconv

    Method setlocale

      `int setlocale(int category, string locale)`

    Description

      The setlocale() function is used to set the program's current locale. If locale is "C" or "POSIX", the current locale is set to the portable locale.

      If locale is "", the locale is set to the default locale which is selected from the environment variable LANG.

      The argument category determines which functions are influenced by the new locale are LC_ALL , LC_COLLATE , LC_CTYPE , LC_MONETARY , LC_NUMERIC and LC_TIME .

    Returns

      Returns 1 if the locale setting successed, 0 for failure

    See also

      bindtextdomain , textdomain , gettext , dgettext , dcgettext , localeconv

    Method localeconv

      `mapping localeconv()`

    Description

      The localeconv() function returns a mapping with settings for the current locale. This mapping contains all values associated with the locale categories LC_NUMERIC and LC_MONETARY .

      `"decimal_point" : string` | The decimal-point character used to format non-monetary quantities.
      `"thousands_sep" : string` | The character used to separate groups of digits to the left of the decimal-point character in formatted non-monetary quantities.
      `"int_curr_symbol" : string` | The international currency symbol applicable to the current locale, left-justified within a four-character space-padded field. The character sequences should match with those specified in ISO 4217 Codes for the Representation of Currency and Funds.
      `"currency_symbol" : string` | The local currency symbol applicable to the current locale.
      `"mon_decimal_point" : string` | The decimal point used to format monetary quantities.
      `"mon_thousands_sep" : string` | The separator for groups of digits to the left of the decimal point in formatted monetary quantities.
      `"positive_sign" : string` | The string used to indicate a non-negative-valued formatted monetary quantity.
      `"negative_sign" : string` | The string used to indicate a negative-valued formatted monetary quantity.
      `"int_frac_digits" : int` | The number of fractional digits (those to the right of the decimal point) to be displayed in an internationally formatted monetary quantity.
      `"frac_digits" : int` | The number of fractional digits (those to the right of the decimal point) to be displayed in a formatted monetary quantity.
      `"p_cs_precedes" : int(0..1)` | Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a non-negative formatted monetary quantity.
      `"p_sep_by_space" : int(0..1)` | Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a non-negative formatted monetary quantity.
      `"n_cs_precedes" : int(0..1)` | Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a negative formatted monetary quantity.
      `"n_sep_by_space" : int(0..1)` | Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a negative formatted monetary quantity.

      `"p_sign_posn" : int(0..4)`

      Set to a value indicating the positioning of the positive_sign for a non-negative formatted monetary quantity. The value of p_sign_posn is interpreted according to the following:

      `0` | Parentheses surround the quantity and currency_symbol.
      `1` | The sign string precedes the quantity and currency_symbol.
      `2` | The sign string succeeds the quantity and currency_symbol.
      `3` | The sign string immediately precedes the currency_symbol.
      `4` | The sign string immediately succeeds the currency_symbol.

      `"n_sign_posn" : int` | Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity. The value of n_sign_posn is interpreted according to the rules described under p_sign_posn.

    See also

      bindtextdomain , textdomain , gettext , dgettext , dcgettext , setlocale

    Constant LC_ALL

      `constant Locale.Gettext.LC_ALL`

    Description

      Locale category for all of the locale.

    Constant LC_COLLATE

      `constant Locale.Gettext.LC_COLLATE`

    Description

      Locale category for the functions strcoll() and strxfrm() (used by pike, but not directly accessible).

    Constant LC_CTYPE

      `constant Locale.Gettext.LC_CTYPE`

    Description

      Locale category for the character classification and conversion routines.

    Constant LC_MESSAGES

      `constant Locale.Gettext.LC_MESSAGES`

    FIXME

      Document this constant.

    Note

      This category isn't available on all platforms.

    Constant LC_MONETARY

      `constant Locale.Gettext.LC_MONETARY`

    Description

      Locale category for localeconv().

    Constant LC_NUMERIC

      `constant Locale.Gettext.LC_NUMERIC`

    Description

      Locale category for the decimal character.

    Constant LC_TIME

      `constant Locale.Gettext.LC_TIME`

    Description

      Locale category for strftime() (currently not accessible from Pike).

  Module Locale.Language

    CLASS Locale.Language.abstract

      Description

        Abstract language locale class, inherited by all the language locale classes.

      Constant months

        `constant Locale.Language.abstract.months`

      Description

        Array(string) with the months of the year, beginning with January.

      Constant days

        `constant Locale.Language.abstract.days`

      Description

        Array(string) with the days of the week, beginning with Sunday.

      Constant iso_639_1

        `constant Locale.Language.abstract.iso_639_1`

      Description

        String with the language code in ISO-639-1 (two character code). Note that all languages does not have a ISO-639-1 code.

      Constant iso_639_2

        `constant Locale.Language.abstract.iso_639_2`

      Description

        String with the language code in ISO-639-2/T (three character code).

      Constant iso_639_2B

        `constant Locale.Language.abstract.iso_639_2B`

      Description

        String with the language code in ISO-639-2/B (three character code). This is usually the same as the ISO-639-2/T code (iso_639_2 ).

      Constant english_name

        `constant Locale.Language.abstract.english_name`

      Description

        The name of the language in english.

      Constant name

        `constant Locale.Language.abstract.name`

      Description

        The name of the langauge. E.g. "svenska" for Swedish.

      Constant languages

        `constant Locale.Language.abstract.languages`

      Description

        Mapping(string:string) that maps an ISO-639-2/T id code to the name of that language.

      Method month

        `string month(int(1..12) num)`

      Description

        Returns the name of month number num .

      Method short_month

        `string short_month(int(1..12) num)`

      Description

        Returns an abbreviated month name from the month number num .

      Method day

        `string day(int(1..7) num)`

      Description

        Returns the name of weekday number num .

      Method short_day

        `string short_day(int(1..7) num)`

      Description

        Returns an abbreviated weekday name from the weekday number num .

      Method number

        `string number(int i)`

      Description

        Returns the number i as a string.

      Method ordered

        `string ordered(int i)`

      Description

        Returns the ordered number i as a string.

      Method date

        `string date(int timestamp, string|void mode)`

      Description

        Returns the date for posix time timestamp as a textual string.

      Parameter `mode`

        Determines what kind of textual string should be produced.

        `"time"` | I.e. "06:36"
        `"date"` | I.e. "January the 17th in the year of 2002"
        `"full"` | I.e. "06:37, January the 17th, 2002"

      Example

            > Locale.Language.eng()->date(time());
             Result: "today, 06:36"

    Module Locale.Language.fra

      Description

        French language locale by Patrick Kremer.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.fin

      Description

        Finnish language locale created by Janne Edelman, Turku Unix Users Group ry, Turku, Finland

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.ces

      Description

        Czech language locale by Jan Petrous 16.10.1997, based on Slovenian language module by Iztok Umek.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.rus

      Description

        Russian language locale

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.slv

      Description

        Slovenian language locale by Iztok Umek 7. 8. 1997

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.hun

      Description

        Hungarian language locale by Zsolt Varga.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.jpn

      Description

        Japanese language locale.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.por

      Description

        Portuguese language locale

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.cat

      Description

        Catalan language locale.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.nld

      Description

        Dutch language locale by Stephen R. van den Berg

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.deu

      Description

        German language locale by Tvns Böker.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.swe

      Description

        Swedish language locale

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.spa

      Description

        Spanish language locale

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.mri

      Description

        Maaori (New Zealand) language locale by Jason Rumney

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.eng

      Description

        English language locale.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.hrv

      Description

        Croatian language locale by Klara Makovac 1997/07/02

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.srp

      Description

        Serbian language locale by Goran Opacic 1996/12/11

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.ita

      Description

        Italian language locale by Francesco Chemolli

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.pol

      Description

        Polish language locale by Piotr Klaban <makler@man.torun.pl>.

      Inherit "abstract"

        inherit "abstract"

    Module Locale.Language.nor

      Description

        Norwegian language locale

      Inherit "abstract"

        inherit "abstract"

  Module Locale.Charset

    Description

      The Charset module supports a wide variety of different character sets, and it is flexible in regard of the names of character sets it accepts. The character case is ignored, as are the most common non-alaphanumeric characters appearing in character set names. E.g. `"iso-8859-1"` works just as well as `"ISO_8859_1"`. All encodings specified in RFC 1345 are supported.

      First of all the Charset module is capable of handling the following encodings of Unicode:

      - utf7, utf8, utf16, utf16be, utf16le, utf32, utf32be, utf32le, utf75 and utf7½

        UTF encodings

      - shiftjis, euc-kr, euc-cn and euc-jp

      Most, if not all, of the relevant code pages are represented, as the following list shows. Prefix the numbers as noted in the list to get the wanted codec:

      - 037, 038, 273, 274, 275, 277, 278, 280, 281, 284, 285, 290, 297, 367, 420, 423, 424, 437, 500, 819, 850, 851, 852, 855, 857, 860, 861, 862, 863, 864, 865, 866, 868, 869, 870, 871, 880, 891, 903, 904, 905, 918, 932, 936, 950 and 1026

        These may be prefixed with `"cp"`, `"ibm"` or `"ms"`.

      - 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257 and 1258

        These may be prefixed with `"cp"`, `"ibm"`, `"ms"` or `"windows"`

      - mysql-latin1

        The default charset in MySQL, similar to `cp1252`.

      +359 more.

    Method normalize

      `string normalize(string in)`

    Description

      All character set names are normalized through this function before compared.

    Method set_decoder

      `void set_decoder(string name, Decoder decoder)`

    Description

      Adds a custom defined character set decoder. The name is normalized through the use of normalize .

    Method decoder

      `Decoder decoder(string name)`

    Description

      Returns a charset decoder object.

    Parameter `name`

      The name of the character set to decode from. Supported charsets include (not all supported charsets are enumerable): "iso_8859-1:1987", "iso_8859-1:1998", "iso-8859-1", "iso-ir-100", "latin1", "l1", "ansi_x3.4-1968", "iso_646.irv:1991", "iso646-us", "iso-ir-6", "us", "us-ascii", "ascii", "cp367", "ibm367", "cp819", "ibm819", "iso-2022" (of various kinds), "utf-7", "utf-8" and various encodings as described by RFC1345.

    Throws

      If the asked-for name was not supported, an error is thrown.

    Method set_encoder

      `void set_encoder(string name, Encoder encoder)`

    Description

      Adds a custom defined character set encoder. The name is normalized through the use of normalize .

    Method encoder

      `Encoder encoder(string name, string|void replacement, function(string:string)|void repcb)`

    Description

      Returns a charset encoder object.

    Parameter `name`

      The name of the character set to encode to. Supported charsets include (not all supported charsets are enumerable): "iso_8859-1:1987", "iso_8859-1:1998", "iso-8859-1", "iso-ir-100", "latin1", "l1", "ansi_x3.4-1968", "iso_646.irv:1991", "iso646-us", "iso-ir-6", "us", "us-ascii", "ascii", "cp367", "ibm367", "cp819", "ibm819", "iso-2022" (of various kinds), "utf-7", "utf-8" and various encodings as described by RFC1345.

    Parameter `replacement`

      The string to use for characters that cannot be represented in the charset. It's used when repcb is not given or when it returns zero. If no replacement string is given then an error is thrown instead.

    Parameter `repcb`

      A function to call for every character that cannot be represented in the charset. If specified it's called with one argument - a string containing the character in question. If it returns a string then that one will replace the character in the output. If it returns something else then the replacement argument will be used to decide what to do.

    Throws

      If the asked-for name was not supported, an error is thrown.

    Method decoder_from_mib

      `Decoder decoder_from_mib(int mib)`

    Description

      Returns a decoder for the encoding schema denoted by MIB mib .

    Method encoder_from_mib

      `Encoder encoder_from_mib(int mib, string|void replacement, function(string:string)|void repcb)`

    Description

      Returns an encoder for the encoding schema denoted by MIB mib .

    Method decode_error

      `void decode_error(string err_str, int err_pos, string charset, void|string reason, void|mixed ... args)`

    Description

      Throws a DecodeError exception. See DecodeError.create for details about the arguments. If args is given then the error reason is formatted using `sprintf(<font face='courier'>reason` , @<font face='courier'>args ).

    Method encode_error

      `void encode_error(string err_str, int err_pos, string charset, void|string reason, void|mixed ... args)`

    Description

      Throws an EncodeError exception. See EncodeError.create for details about the arguments. If args is given then the error reason is formatted using `sprintf(<font face='courier'>reason` , @<font face='courier'>args ).

    CLASS Locale.Charset.Decoder

      Description

        Virtual base class for charset decoders.

      Example

            string win1252_to_string( string data )
               {
                 return Locale.Charset.decoder("windows-1252")->feed( data )->drain();
               }

      Variable charset

        `string Locale.Charset.Decoder.charset`

      Description

        Name of the charset - giving this name to decoder returns an instance of the same class as this object.

      Note

        This is not necessarily the same name that was actually given to decoder to produce this object.

      Method feed

        `this_program feed(string s)`

      Description

        Feeds a string to the decoder.

      Parameter `s`

        String to be decoded.

      Returns

        Returns the current object, to allow for chaining of calls.

      Method drain

        `string drain()`

      Description

        Get the decoded data, and reset buffers.

      Returns

        Returns the decoded string.

      Method clear

        `this_program clear()`

      Description

        Clear buffers, and reset all state.

      Returns

        Returns the current object to allow for chaining of calls.

    CLASS Locale.Charset.Encoder

      Description

        Virtual base class for charset encoders.

      Inherit Decoder

        inherit Decoder : Decoder

      Description

        An encoder only differs from a decoder in that it has an extra function.

      Variable charset

        `string Locale.Charset.Encoder.charset`

      Description

        Name of the charset - giving this name to encoder returns an instance of the same class as this one.

      Note

        This is not necessarily the same name that was actually given to encoder to produce this object.

      Method set_replacement_callback

        `void set_replacement_callback(function(string:string) rc)`

      Description

        Change the replacement callback function.

      Parameter `rc`

        Function that is called to encode characters outside the current character encoding.

    CLASS Locale.Charset.DecodeError

      Description

        Error thrown when decode fails (and no replacement char or replacement callback has been registered).

      FIXME

        This error class is not actually used by this module yet - decode errors are still thrown as untyped error arrays. At this point it exists only for use by other modules.

      Inherit Generic

        inherit Error.Generic : Generic

      Variable err_str

        `string Locale.Charset.DecodeError.err_str`

      Description

        The string that failed to be decoded.

      Variable err_pos

        `int Locale.Charset.DecodeError.err_pos`

      Description

        The failing position in err_str .

      Variable charset

        `string Locale.Charset.DecodeError.charset`

      Description

        The decoding charset, typically as known to Locale.Charset.decoder .

      Note

        Other code may produce errors of this type. In that case this name is something that Locale.Charset.decoder does not accept (unless it implements exactly the same charset), and it should be reasonably certain that Locale.Charset.decoder never accepts that name in the future (unless it is extended to implement exactly the same charset).

    CLASS Locale.Charset.EncodeError

      Description

        Error thrown when encode fails (and no replacement char or replacement callback has been registered).

      FIXME

        This error class is not actually used by this module yet - encode errors are still thrown as untyped error arrays. At this point it exists only for use by other modules.

      Inherit Generic

        inherit Error.Generic : Generic

      Variable err_str

        `string Locale.Charset.EncodeError.err_str`

      Description

        The string that failed to be encoded.

      Variable err_pos

        `int Locale.Charset.EncodeError.err_pos`

      Description

        The failing position in err_str .

      Variable charset

        `string Locale.Charset.EncodeError.charset`

      Description

        The encoding charset, typically as known to Locale.Charset.encoder .

      Note

        Other code may produce errors of this type. In that case this name is something that Locale.Charset.encoder does not accept (unless it implements exactly the same charset), and it should be reasonably certain that Locale.Charset.encoder never accepts that name in the future (unless it is extended to implement exactly the same charset).

    Module Locale.Charset.Tables

      Module Locale.Charset.Tables.iso88591

        Description

          Codec for the ISO-8859-1 character encoding.

Module Gdbm

  CLASS Gdbm.gdbm

    Method create

      `void Gdbm.gdbm(void|string file, void|string mode)`

    Description

      Without arguments, this function does nothing. With one argument it opens the given file as a gdbm database, if this fails for some reason, an error will be generated. If a second argument is present, it specifies how to open the database using one or more of the follow flags in a string:

      `r` | Open database for reading
      `w` | Open database for writing
      `c` | Create database if it does not exist
      `t` | Overwrite existing database
      `f` | Fast mode
      `s` | Synchronous mode
      `l` | Locking mode

      The fast mode prevents the database from syncronizing each change in the database immediately. This is dangerous because the database can be left in an unusable state if Pike is terminated abnormally.

      The default mode is `"rwc"`.

    Note

      The gdbm manual states that it is important that the database is closed properly. Unfortunately this will not be the case if Pike calls exit() or returns from main(). You should therefore make sure you call close or destruct your gdbm objects when exiting your program. This will probably be done automatically in the future.

    Method fetch
    Method `[]

      `string fetch(string key)`
      `string `[](string key)`

    Description

      Return the data associated with the key 'key' in the database. If there was no such key in the database, zero is returned.

    Method delete

      `int(0..1) delete(string key)`

    Description

      Remove a key from the database. Returns 1 if successful, otherwise 0, e.g. when the item is not present or the database is read only.

    Method firstkey

      `string firstkey()`

    Description

      Return the first key in the database, this can be any key in the database.

    Method nextkey

      `string nextkey(string key)`

    Description

      This returns the key in database that follows the key 'key' key. This is of course used to iterate over all keys in the database.

    Example

          // Write the contents of the database
            for(key=gdbm->firstkey(); k; k=gdbm->nextkey(k))
              write(k+":"+gdbm->fetch(k)+"\n");

    Method `[]=

      `string `[]=(string key, string data)`

    Description

      Associate the contents of 'data' with the key 'key'. If the key 'key' already exists in the database the data for that key will be replaced. If it does not exist it will be added. An error will be generated if the database was not open for writing.

    Example

          gdbm[key] = data;

    Returns

      Returns data on success.

    See also

      store()

    Method store

      `int store(string key, string data)`

    Description

      Associate the contents of 'data' with the key 'key'. If the key 'key' already exists in the database the data for that key will be replaced. If it does not exist it will be added. An error will be generated if the database was not open for writing.

    Example

          gdbm->store(key, data);

    Returns

      Returns `1` on success.

    Note

      Note that the returned value differs from that of `[]=() .

    See also

      `[]=()

    Method reorganize

      `int reorganize()`

    Description

      Deletions and insertions into the database can cause fragmentation which will make the database bigger. This routine reorganizes the contents to get rid of fragmentation. Note however that this function can take a LOT of time to run.

    Method sync

      `void sync()`

    Description

      When opening the database with the 'f' flag writings to the database can be cached in memory for a long time. Calling sync will write all such caches to disk and not return until everything is stored on the disk.

    Method close

      `void close()`

    Description

      Closes the database.

Module spider

  Method parse_accessed_database

    `array(mapping(string:int)|int) parse_accessed_database(string database)`

  Method parse_html

    `string parse_html(string html, mapping(string:function(string:string|array)) tag_callbacks, mapping(string:function(string:string|array)) container_callbacks, mixed ... extras)`

  Method parse_html_lines

    `string parse_html_lines(string html, mapping(string:function(string:string|array)) tag_callbacks, mapping(string:function(string:string|array)) container_callbacks, mixed ... extras)`

  Method set_end_quote

    `void set_end_quote(int quote)`

  Method set_start_quote

    `void set_start_quote(int quote)`

  Method get_all_active_fds

    `array(int) get_all_active_fds()`

  Method fd_info

    `string fd_info(int fd)`

  Method _low_program_name

    `string _low_program_name(program prog)`

  Method _dump_obj_table

    `array(array(string|int)) _dump_obj_table()`

  Method discdate

    `string discdate(int time)`

  Method stardate

    `string stardate(int time, int precision)`

Module Parser

  Method get_xml_parser

    `HTML get_xml_parser()`

  Description

    Returns a Parser.HTML initialized for parsing XML. It has all the flags set properly for XML syntax and callbacks to ignore comments, CDATA blocks and unknown PI tags, but it has no registered tags and doesn't decode any entities.

  Method decode_numeric_xml_entity

    `string decode_numeric_xml_entity(string chref)`

  Description

    Decodes the numeric XML entity chref , e.g. `"&#x34;"` and returns the character as a string. chref is the name part of the entity, i.e. without the leading '&' and trailing ';'. Returns zero if chref isn't on a recognized form or if the character number is too large to be represented in a string.

  Method html_entity_parser
  Method parse_html_entities

    `HTML html_entity_parser()`
    `string parse_html_entities(string in)`
    `HTML html_entity_parser(int noerror)`
    `string parse_html_entities(string in, int noerror)`

  Description

    Parse any HTML entities in the string to unicode characters. Either return a complete parser (to build on or use) or parse a string. Throw an error if there is an unrecognized entity in the string if noerror is not set.

  Note

    Currently using XHTML 1.0 tables.

  Method encode_html_entities

    `string encode_html_entities(string raw)`

  Description

    Encode characters to HTML entities, e.g. turning `"<"` into `"&lt;"`.

    The characters that will be encoded are characters <= 32, `"\"&'<>"` and characters >= 127 and <= 160 and characters >= 255.

  CLASS Parser.HTML

    Description

      This is a simple parser for SGML structured markups. It's not really HTML, but it's useful for that *! purpose.

      The simple way to use it is to give it some information about available tags and containers, and what callbacks those is to call.

      The object is easily reused, by calling the clone() function.

    See also

      add_tag , add_container , finish

    Method _set_tag_callback
    Method _set_entity_callback
    Method _set_data_callback

      `Parser.HTML _set_tag_callback(function|string|array to_call)`
      `Parser.HTML _set_entity_callback(function|string|array to_call)`
      `Parser.HTML _set_data_callback(function|string|array to_call)`

    Description

      These functions set up the parser object to call the given callbacks upon tags, entities and/or data. The callbacks will only be called if there isn't another tag/container/entity handler for these.

      The callback function will be called with the parser object as first argument, and the active string as second. Note that no parsing of the contents has been done. Both endtags and normal tags are called; there is no container parsing.

      The return values from the callbacks are handled in the same way as the return values from callbacks registered with add_tag and similar functions.

      The data callback will be called as seldom as possible with the longest possible string, as long as it doesn't get called out of order with any other callback. It will never be called with a zero length string.

      If a string or array is given instead of a function, it will act as the return value from the function. Arrays or empty strings is probably preferable to avoid recursion.

    Returns

      Returns the object being called.

    Method add_tag
    Method add_container
    Method add_entity
    Method add_quote_tag
    Method add_tags
    Method add_containers
    Method add_entities

      `Parser.HTML add_tag(string name, mixed to_do)`
      `Parser.HTML add_container(string name, mixed to_do)`
      `Parser.HTML add_entity(string entity, mixed to_do)`
      `Parser.HTML add_quote_tag(string name, mixed to_do, string end)`
      `Parser.HTML add_tags(mapping(string:mixed) tags)`
      `Parser.HTML add_containers(mapping(string:mixed) containers)`
      `Parser.HTML add_entities(mapping(string:mixed) entities)`

    Description

      Registers the actions to take when parsing various things. Tags, containers, entities are as usual. add_quote_tag() adds a special kind of tag that reads any data until the next occurrence of the end string immediately before a tag end.

    Parameter `to_do`

      This argument can be any of the following.

      `function`

      The function will be called as a callback function. It will get the following arguments, depending on the type of callback.

           mixed tag_callback(Parser.HTML parser,mapping args,mixed ... extra)
           mixed container_callback(Parser.HTML parser,mapping args,string content,mixed ... extra)
           mixed entity_callback(Parser.HTML parser,mixed ... extra)
           mixed quote_tag_callback(Parser.HTML parser,string content,mixed ... extra)

      `string` | This tag/container/entity is then replaced by the string. The string is normally not reparsed, i.e. it's equivalent to writing a function that returns the string in an array (but a lot faster). If reparse_strings is set the string will be reparsed, though.
      `array` | The first element is a function as above. It will receive the rest of the array as extra arguments. If extra arguments are given by set_extra() , they will appear after the ones in this array.
      `int(0..)` | If there is a tag/container/entity with the given name in the parser, it's removed.

      The callback function can return:

      `string` | This string will be pushed on the parser stack and be parsed. Be careful not to return anything in this way that could lead to a infinite recursion.
      `array` | The element(s) of the array is the result of the function. This will not be parsed. This is useful for avoiding infinite recursion. The array can be of any size, this means the empty array is the most effective to return if you don't care about the result. If the parser is operating in mixed_mode , the array can contain anything. Otherwise only strings are allowed.
      `int(0..0)` | This means "don't do anything", ie the item that generated the callback is left as it is, and the parser continues.
      `int(1..1)` | Reparse the last item again. This is useful to parse a tag as a container, or vice versa: just add or remove callbacks for the tag and return this to jump to the right callback.

    Returns

      Returns the object being called.

    See also

      tags , containers , entities

    Method clear_tags
    Method clear_containers
    Method clear_entities
    Method clear_quote_tags

      `Parser.HTML clear_tags()`
      `Parser.HTML clear_containers()`
      `Parser.HTML clear_entities()`
      `Parser.HTML clear_quote_tags()`

    Description

      Removes all registered definitions in the different categories.

    Returns

      Returns the object being called.

    See also

      add_tag , add_tags , add_container , add_containers , add_entity , add_entities

    Method tags
    Method containers
    Method entities

      `mapping(string:mixed) tags()`
      `mapping(string:mixed) containers()`
      `mapping(string:mixed) entities()`

    Description

      Returns the current callback settings. When matching is done case insensitively, all names will be returned in lowercase.

      Implementation note: These run in constant time since they return copy-on-write mappings.

    See also

      add_tag , add_tags , add_container , add_containers , add_entity , add_entities

    Method quote_tags

      `mapping(string:array(mixed|string)) quote_tags()`

    Description

      Returns the current callback settings. The values are arrays ({callback, end_quote}). When matching is done case insensitively, all names will be returned in lowercase.

      Implementation note: quote_tags() allocates a new mapping for every call and thus, unlike e.g. tags() runs in linear time.

    See also

      add_quote_tag

    Method feed

      `Parser.HTML feed()`
      `Parser.HTML feed(string s, void|int do_parse)`

    Description

      Feed new data to the Parser.HTML object. This will start a scan and may result in callbacks. Note that it's possible that all data fed isn't processed - to do that, call finish() .

      If the function is called without arguments, no data is fed, but the parser is run. If the string argument is followed by a `0`, `->feed(s,0);`, the string is fed, but the parser isn't run.

    Returns

      Returns the object being called.

    See also

      finish , read , feed_insert

    Method feed_insert

      `Parser.HTML feed_insert(string s)`

    Description

      This pushes a string on the parser stack.

    Returns

      Returns the object being called.

    Note

      Don't use!

    Method finish

      `Parser.HTML finish()`
      `Parser.HTML finish(string s)`

    Description

      Finish a parser pass. A string may be sent here, similar to feed().

    Returns

      Returns the object being called.

    Method read

      `string|array(mixed) read()`
      `string|array(mixed) read(int max_elems)`

    Description

      Read parsed data from the parser object.

    Returns

      Returns a string of parsed data if the parser isn't in mixed_mode , an array of arbitrary data otherwise.

    Method write_out

      `Parser.HTML write_out(mixed ... args)`

    Description

      Send data to the output stream, i.e. it won't be parsed and it won't be sent to the data callback, if any.

      Any data is allowed when the parser is running in mixed_mode . Only strings are allowed otherwise.

    Returns

      Returns the object being called.

    Method at
    Method at_line
    Method at_char
    Method at_column

      `array(int) at()`
      `int at_line()`
      `int at_char()`
      `int at_column()`

    Description

      Returns the current position. Characters and columns count from `0`, lines count from `1`.

      at() gives an array with the following layout.

      Array
      `int 0` | Line.
      `int 1` | Character.
      `int 2` | Column.

    Method current

      `string current()`

    Description

      Gives the current range of data, ie the whole tag/entity/etc being parsed in the current callback. Returns zero if there's no current range, i.e. when the function is not called in a callback.

    Method tag_name

      `string tag_name()`

    Description

      Gives the name of the current tag, or zero. If used from an entity callback, it gives the string inside the entity.

    Method tag_args

      `mapping(string:mixed) tag_args(void|mixed default_value)`

    Description

      Gives the arguments of the current tag, parsed to a convenient mapping consisting of key:value pairs. If the current thing isn't a tag, it gives zero. default_value is used for arguments which have no value in the tag. If default_value isn't given, the value is set to the same string as the key.

    Method tag_content

      `string tag_content()`

    Description

      Gives the content of the current tag, if it's a container or quote tag. Otherwise returns zero.

    Method tag

      `array tag(void|mixed default_value)`

    Description

      Returns the equivalent of the following calls.

      Array
      `string 0` | `tag_name()`
      `mapping(string:mixed) 1` | `tag_args(default_value)`
      `string 2` | `tag_content()`

    Method context

      `string context()`

    Description

      Returns the current output context as a string.

      `"data"` | In top level data. This is always returned when called from tag or container callbacks.
      `"arg"` | In an unquoted argument.
      `"splice_arg"` | In a splice argument.

      The return value can also be a single character string, in which case the context is a quoted argument. The string contains the starting quote character.

      This function is typically only useful in entity callbacks, which can be called both from text and argument values of different sorts.

    See also

      splice_arg

    Method parse_tag_name

      `string parse_tag_name(string tag)`

    Description

      Parses the tag name from a tag string without the surrounding brackets, i.e. a string on the form `"tagname some='tag' args"`.

    Returns

      Returns the tag name or an empty string if none.

    Method parse_tag_args

      `mapping parse_tag_args(string tag)`

    Description

      Parses the tag arguments from a tag string without the name and surrounding brackets, i.e. a string on the form `"some='tag' args"`.

    Returns

      Returns a mapping containing the tag arguments.

    See also

      tag_args

    Method _inspect

      `mapping _inspect()`

    Description

      This is a low-level way of debugging a parser. This gives a mapping of the internal state of the Parser.HTML object.

      The format and contents of this mapping may change without further notice.

    Method clone

      `Parser.HTML clone(mixed ... args)`

    Description

      Clones the Parser.HTML object. A new object of the same class is created, filled with the parse setup from the old object.

      This is the simpliest way of flushing a parse feed/output.

      The arguments to clone is sent to the new object, simplifying work for custom classes that inherits Parser.HTML .

    Returns

      Returns the new object.

    Note

      create is called _before_ the setup is copied.

    Method set_extra

      `Parser.HTML set_extra(mixed ... args)`

    Description

      Sets the extra arguments passed to all tag, container and entity callbacks.

    Returns

      Returns the object being called.

    Method get_extra

      `array get_extra()`

    Description

      Gets the extra arguments set by set_extra() .

    Returns

      Returns the object being called.

    Method splice_arg

      `string splice_arg(void|string name)`

    Description

      If given a string, it sets the splice argument name to it. It returns the old splice argument name.

      If a splice argument name is set, it's parsed in all tags, both those with callbacks and those without. Wherever it occurs, its value (after being parsed for entities in the normal way) is inserted directly into the tag. E.g:

          <foo arg1="val 1" splice="arg2='val 2' arg3" arg4>

      becomes

          <foo arg1="val 1" arg2='val 2' arg3 arg4>

      if `"splice"` is set as the splice argument name.

    Method case_insensitive_tag

      `int case_insensitive_tag(void|int value)`

    Description

      All tags and containers are matched case insensitively, and argument names are converted to lowercase. Tags added with add_quote_tag() are not affected, though. Switching to case insensitive mode and back won't preserve the case of registered tags and containers.

    Method ignore_tags

      `int ignore_tags(void|int value)`

    Description

      Do not look for tags at all. Normally tags are matched even when there's no callbacks for them at all. When this is set, the tag delimiters `'<'` and `'>'` will be treated as any normal character.

    Method ignore_unknown

      `int ignore_unknown(void|int value)`

    Description

      Treat unknown tags and entities as text data, continuing parsing for tags and entities inside them.

    Note

      When functions are specified with _set_tag_callback() or _set_entity_callback() , all tags or entities, respectively, are considered known. However, if one of those functions return 1 and ignore_unknown is set, they are treated as text data instead of making another call to the same function again.

    Method lazy_argument_end

      `int lazy_argument_end(void|int value)`

    Description

      A `'>'` in a tag argument closes both the argument and the tag, even if the argument is quoted.

    Method lazy_entity_end

      `int lazy_entity_end(void|int value)`

    Description

      Normally, the parser search indefinitely for the entity end character (i.e. `';'`). When this flag is set, the characters `'&'`, `'<'`, `'>'`, `'"'`, `'''`, and any whitespace breaks the search for the entity end, and the entity text is then ignored, i.e. treated as data.

    Method match_tag

      `int match_tag(void|int value)`

    Description

      Unquoted nested tag starters and enders will be balanced when parsing tags. This is the default.

    Method max_parse_depth

      `int max_parse_depth(void|int value)`

    Description

      Maximum recursion depth during parsing. Recursion occurs when a tag/container/entity/quote tag callback function returns a string to be reparsed. The default value is `10`.

    Method mixed_mode

      `int mixed_mode(void|int value)`

    Description

      Allow callbacks to return arbitrary data in the arrays, which will be concatenated in the output.

    Method reparse_strings

      `int reparse_strings(void|int value)`

    Description

      When a plain string is used as a tag/container/entity/quote tag callback, it's not reparsed if this flag is unset. Setting it causes all such strings to be reparsed.

    Method ws_before_tag_name

      `int ws_before_tag_name(void|int value)`

    Description

      Allow whitespace between the tag start character and the tag name.

    Method xml_tag_syntax

      `int xml_tag_syntax(void|int value)`

    Description

      Whether or not to use XML syntax to tell empty tags and container tags apart.

      `0` | Use HTML syntax only. If there's a `'/'` last in a tag, it's just treated as any other argument.
      `1` | Use HTML syntax, but ignore a `'/'` if it comes last in a tag. This is the default.
      `2` | Use XML syntax, but when a tag that does not end with `'/>'` is found which only got a non-container tag callback, treat it as a non-container (i.e. don't start to seek for the container end).

      `3`

      Use XML syntax only. If a tag got both container and non-container callbacks, the non-container callback is called when the empty element form (i.e. the one ending with `'/>'`) is used, and the container callback otherwise. If only a container callback exists, it gets the empty string as content when there's none to be parsed. If only a non-container callback exists, it will be called (without the content argument) for both kinds of tags.

    Method nestling_entity_end

      `int nestling_entity_end(void|int value)`

    Method ignore_comments

      `int ignore_comments(void|int value)`

  CLASS Parser.SGML

    Description

      This is a handy simple parser of SGML-like syntax like HTML. It doesn't do anything advanced, but finding the corresponding end-tags.

      It's used like this:

      array res=Parser.SGML()->feed(string)->finish()->result();

    The resulting structure is an array of atoms, where the atom can be a string or a tag. A tag contains a similar array, as data.

  Example

        A string
             "<gat>&nbsp;<gurka>&nbsp;</gurka>&nbsp;<banan>&nbsp;<kiwi>&nbsp;</gat>"
             results in

    ({ tag "gat" object with data: ({ tag "gurka" object with data: ({ " " }) tag "banan" object with data: ({ " " tag "kiwi" object with data: ({ " " }) }) }) })

  ie, simple "tags" (not containers) are not detected, but containers are ended implicitely by a surrounding container _with_ an end tag.

  The 'tag' is an object with the following variables:

      	 string name;           - name of tag
      	 mapping args;          - argument to tag
      	 int line,char,column;  - position of tag
      	 string file;           - filename (see <ref>create</ref>)
      	 array(SGMLatom) data;  - contained data

Variable file

  `string Parser.SGML.file`

Method create

  `void Parser.SGML()`
  `void Parser.SGML(string filename)`

Description

  This object is created with this filename. It's passed to all created tags, for debug and trace purposes.

Note

  No, it doesn't read the file itself. See feed() .

Method feed
Method finish
Method result

  `object feed(string s)`
  `array(SGMLatom|string) finish()`
  `array(SGMLatom|string) result(string s)`

Description

  Feed new data to the object, or finish the stream. No result can be used until finish() is called.

  Both finish() and result() return the computed data.

  feed() returns the called object.

CLASS Parser.SGML.SGMLatom

    `string Parser.SGML.SGMLatom.name`
    `mapping Parser.SGML.SGMLatom.args`
    `int Parser.SGML.SGMLatom.line`
    `int Parser.SGML.SGMLatom.char`
    `int Parser.SGML.SGMLatom.column`
    `string Parser.SGML.SGMLatom.file`
    `array(SGMLatom) Parser.SGML.SGMLatom.data`

CLASS Parser.Tabular

  Description

    This is a parser for line and block oriented data. It provides a flexible yet concise record-description language to parse character/column/delimiter-organised records.

  See also

    Parser.LR

  Method create

    `void Parser.Tabular(void|string|Stdio.File|Stdio.FILE input, void|array|mapping|string|Stdio.File|Stdio.FILE format, void|int verbose)`

  Description

    This function initialises the parser.

  Parameter `input`

    The input stream or string.

  Parameter `format`

    The format to be used (either precompiled or not). The format description language is documented under compile() .

  Parameter `verbose`

    If `>1`, it specifies the number of characters to display of the beginning of each record as a progress indicator. Special values are:

    `-4` | Turns on format debugging with visible mismatches.
    `-3` | Turns on format debugging with named field contents.
    `-2` | Turns on format debugging with field contents.
    `-1` | Turns on basic format debugging.
    `0` | Turns off verbosity. Default.
    `1` | Is the same as setting it to `70`.

  See also

    compile() , setformat() , fetch()

  Method skipemptylines

    `int skipemptylines()`

  Description

    This function can be used to manually skip empty lines in the input. This is unnecessary if no argument is specified for fetch() .

  Returns

    It returns true if EOF has been reached.

  See also

    fetch()

  Method fetch

    `mapping fetch(void|array|mapping format)`

  Description

    This function consumes as much input as needed to parse the full tabular structures at once.

  Parameter `format`

    Describes (precompiled only) formats to be parsed. If no format is specified, the format specified on create() is used, and empty lines are automatically skipped.

  Returns

    A nested mapping that contains the complete structure as described in the specified format.

    If nothing matches the specified format, no input is consumed (except empty lines, if the default format is used), and zero is returned.

  See also

    compile() , create() , setformat() , skipemptylines()

  Method feed

    `object feed(string content)`

  Parameter `content`

    Is injected into the input stream.

  Returns

    This object.

  See also

    fetch()

  Method setformat

    `array|mapping setformat(array|mapping format)`

  Parameter `format`

    Replaces the default (precompiled only) format.

  Returns

    The previous default format.

  See also

    compile() , fetch()

  Method compile

    `array|mapping compile(string|Stdio.File|Stdio.FILE input)`

  Description

    Compiles the format description language into a compiled structure that can be fed to setformat , fetch , or create .

    - The format description is case sensitive.

    - The format description starts with a single line containing: `[Tabular description begin]`

    - The format description ends with a single line containing: `[Tabular description end]`

    - Any lines before the startline are skipped.

    - Any lines after the endline are not consumed.

    - Empty lines are skipped.

    - Comments start after a `#` or `;`.

    - The depth level of a field is indicated by the number of leading spaces or colons at the beginning of the line.

    - The fieldname must not contain any whitespace.

    - An arbitrary number of single character field delimiters can be specified between brackets, e.g. `[,;]` or `[,]` would be for CSV.

    - When field delimiters are being used: in case of CSV type delimiters `[\t,; ]` the standard CSV quoting rules apply, in case other delimiters are used, no quoting is supported and the last field on a line should not specify a delimiter, but should specify a 0 fieldwidth instead.

    - A fixed field width can be specified by a plain decimal integer, a value of 0 indicates a field with arbitrary length that extends till the end of the line.

    - A matching regular expression can be enclosed in `""`, it has to match the complete field content and uses Regexp.SimpleRegexp syntax.

    - On records the following options are supported:

      mandatory

        This record is required.

      fold

        Fold this record's contents in the enclosing record.

      single

        This record is present at most once.

    - On fields the following options are supported:

      drop

        After reading and matching this field, drop the field content from the resulting mappingstructure.

  See also

    setformat() , create() , fetch()

  Example

        Example of the description language:
        [Tabular description begin]
        csv
        :gtz
        ::mybankno           [,]
        ::transferdate       [,]
        ::mutatiesoort       [,]
        ::volgnummer         [,]
        ::bankno             [,]
        ::name               [,]
        ::kostenplaats       [,]                     drop
        ::amount             [,]
        ::afbij              [,]
        ::mutatie            [,]
        ::reference          [,]
        ::valutacode         [,]
        mt940
        :messageheader1                     mandatory
        ::exporttime            "0000"               drop
        ::CS1                   " "                  drop
        ::exportday             "01"                 drop
        ::exportaddress      12
        ::exportnumber       5  "[0-9]+"
        :messageheader3                     mandatory fold single
        ::messagetype           "940"                drop
        ::CS1                   " "                  drop
        ::messagepriority       "00"                 drop
        :TRN                             fold
        ::tag                   ":20:"               drop
        ::reference             "GTZPB|MPBZ|INGEB"
        :accountid                     fold
        ::tag                   ":25:"               drop
        ::accountno          10
        :statementno                     fold
        ::tag                   ":28C:"              drop
        ::settlementno       0                       drop
        :openingbalance                     mandatory      single
        ::tag                   ":60F:"              drop
        ::creditdebit        1
        ::date               6
        ::currency              "EUR"
        ::amount             0  "[0-9]+,[0-9][0-9]"
        :statements
        ::statementline                     mandatory fold single
        :::tag                  ":61:"               drop
        :::valuedate         6
        :::creditdebit       1
        :::amount               "[0-9]+,[0-9][0-9]"
        :::CS1                  "N"                  drop
        :::transactiontype   3                          # 3 for Postbank, 4 for ING
        :::paymentreference  0
        ::informationtoaccountowner                   fold single
        :::tag                  ":86:"               drop
        :::accountno            "[0-9]*( |)"
        :::accountname       0
        ::description         fold
        :::description       0  "|[^:].*"
        :closingbalance                     mandatory      single
        ::tag                   ":62[FM]:"           drop
        ::creditdebit        1
        ::date               6
        ::currency              "EUR"
        ::amount             0  "[0-9]+,[0-9][0-9]"
        :informationtoaccountowner                    fold single
        ::tag                   ":86:"               drop
        ::debit                 "D"                  drop
        ::debitentries       6
        ::credit                "C"                  drop
        ::creditentries      6
        ::debit                 "D"                  drop
        ::debitamount           "[0-9]+,[0-9][0-9]"
        ::credit                "C"                  drop
        ::creditamount          "[0-9]+,[0-9][0-9]"  drop
        ::accountname           "(\n[^-:][^\n]*)*"   drop
        :messagetrailer                     mandatory      single
        ::start                 "-"
        ::end                   "XXX"
        [Tabular description end]

CLASS Parser.RCS

  Description

    A RCS file parser that eats a RCS *,v file and presents nice pike data structures of its contents.

  Inherit _RCS

    inherit Parser._RCS : _RCS

  Variable head

    `string Parser.RCS.head`

  Description

    Version number of the head version of the file.

  Variable branch

    `string|int(0..0) Parser.RCS.branch`

  Description

    The default branch (or revision), if present, `0` otherwise.

  Variable access

    `array(string) Parser.RCS.access`

  Description

    The usernames listed in the ACCESS section of the RCS file.

  Variable comment

    `string|int(0..0) Parser.RCS.comment`

  Description

    The RCS file comment if present, `0` otherwise.

  Variable expand

    `string Parser.RCS.expand`

  Description

    The keyword expansion options (as named by RCS) if present, `0` otherwise.

  Variable description

    `string Parser.RCS.description`

  Description

    The RCS file description.

  Variable locks

    `mapping(string:string) Parser.RCS.locks`

  Description

    Maps from username to revision for users that have acquired locks on this file.

  Variable strict_locks

    `int(0..1) Parser.RCS.strict_locks`

  Description

    `1` if strict locking is set, `0` otherwise.

  Variable tags

    `mapping(string:string) Parser.RCS.tags`

  Description

    Maps tag names (indices) to tagged revision numbers (values).

  Note

    This mapping typically contains raw revision numbers for branches (ie `"1.1.0.2"` and not `"1.1.2"`).

  Variable branches

    `mapping(string:string) Parser.RCS.branches`

  Description

    Maps branch numbers (indices) to branch names (values).

  Note

    The indices are short branch revision numbers (ie `"1.1.2"` and not `"1.1.0.2"`).

  Variable revisions

    `mapping(string:Revision) Parser.RCS.revisions`

  Description

    Data for all revisions of the file. The indices of the mapping are the revision numbers, whereas the values are the data from the corresponding revision.

  Variable trunk

    `array(Revision) Parser.RCS.trunk`

  Description

    Data for all revisions on the trunk, sorted in the same order as the RCS file stored them - ie descending, most recent first, I'd assume (rcsfile(5), of course, fails to state such irrelevant information).

  Variable rcs_file_name

    `string Parser.RCS.rcs_file_name`

  Description

    The filename of the RCS file as sent to create() .

  Method create

    `void Parser.RCS(string|void file_name, string|int(0..0)|void file_contents)`

  Description

    Initializes the RCS object.

  Parameter `file_name`

    The path to the raw RCS file (includes trailing ",v"). Used mainly for error reporting (truncated RCS file or similar). Stored in rcs_file_name .

  Parameter `file_contents`

    If a string is provided, that string will be parsed to initialize the RCS object. If a zero (`0`) is sent, no initialization will be performed at all. If no value is given at all, but file_name was provided, that file will be loaded and parsed for object initialization.

  Method parse_admin_section

    `array parse_admin_section(string|array raw)`

  Description

    Lower-level API function for parsing only the admin section (the initial chunk of an RCS file, see manpage rcsfile(5)) of an RCS file. After running parse_admin_section , the RCS object will be initialized with the values for head , branch , access , branches , tokenize , tags , locks , strict_locks , comment and expand .

  Parameter `raw`

    The tokenized RCS file, or the raw RCS-file data.

  Returns

    The rest of the RCS file, admin section removed.

  See also

    parse_delta_sections , parse_deltatext_sections , parse , create

  FIXME

    Does not handle rcsfile(5) newphrase skipping.

  Method parse_delta_sections

    `array parse_delta_sections(array raw)`

  Description

    Lower-level API function for parsing only the delta sections (the second chunk of an RCS file, see manpage rcsfile(5)) of an RCS file. After running parse_delta_sections , the RCS object will be initialized with the value of description and populated revisions mapping and trunk array. Their Revision members are however only populated with the members Revision->revision , Revision->branch , Revision->time , Revision->author , Revision->state , Revision->branches , Revision->rcs_next , Revision->ancestor and Revision->next .

  Parameter `raw`

    The tokenized RCS file, with admin section removed. (See parse_admin_section .)

  Returns

    The rest of the RCS file, delta sections removed.

  See also

    parse_admin_section , tokenize , parse_deltatext_sections , parse , create

  FIXME

    Does not handle rcsfile(5) newphrase skipping.

  Method tokenize

    `array(array(string)) tokenize(string data)`

  Description

    Tokenize an RCS file into tokens suitable as argument to the various parse functions

  Parameter `data`

    The RCS file data

  Returns

    An array with arrays of tokens

  Method parse_deltatext_sections

    `void parse_deltatext_sections(array raw, void|function(string:void) progress_callback, array|void callback_args)`

  Description

    Lower-level API function for parsing only the deltatext sections (the final and typically largest chunk of an RCS file, see manpage rcsfile(5)) of an RCS file. After a parse_deltatext_sections run, the RCS object will be fully populated.

  Parameter `raw`

    The tokenized RCS file, with admin and delta sections removed. (See parse_admin_section , tokenize and parse_delta_sections .)

  Parameter `progress_callback`

    This optional callback is invoked with the revision of the deltatext about to be parsed (useful for progress indicators).

  Parameter `args`

    Optional extra trailing arguments to be sent to progress_callback

  See also

    parse_admin_section , parse_delta_sections , parse , create

  FIXME

    Does not handle rcsfile(5) newphrase skipping.

  Method parse

    `this_program parse(array raw, void|function(string:void) progress_callback)`

  Description

    Parse the RCS file raw and initialize all members of this object fully initialized.

  Parameter `raw`

    The unprocessed RCS file.

  Parameter `progress_callback`

    Passed on to parse_deltatext_sections .

  Returns

    The fully initialized object (only returned for API convenience; the object itself is destructively modified to match the data extracted from raw )

  See also

    parse_admin_section , parse_delta_sections , parse_deltatext_sections , create

  Method get_contents_for_revision

    `string get_contents_for_revision(string|Revision rev, void|int(0..1) dont_cache_data)`

  Description

    Returns the file contents from the revision rev , without performing any keyword expansion. If dont_cache_data is set we will not keep intermediate revisions in memory unless they already existed. This will cut down memory use at the expense of slow access to older revisions.

  See also

    expand_keywords_for_revision()

  Method expand_keywords_for_revision

    `string expand_keywords_for_revision(string|Revision rev, string|void text, int|void expansion_mode)`

  Description

    Expand keywords and return the resulting text according to the expansion rules set for the file.

  Parameter `rev`

    The revision to apply the expansion for.

  Parameter `text`

    If supplied, substitute keywords for that text instead using values that would apply for the given revision. Otherwise, revision rev is used.

  Parameter `expansion_mode`

    Expansion mode

    `1` | Perform expansion even if the file was checked in as binary.
    `0` | Perform expansion only if the file was checked in as non-binary with expansion enabled.
    `-1` | Perform contraction if the file was checked in as non-binary.

  Note

    The Log keyword (which lacks sane quoting rules) is not expanded. Keyword expansion rules set in CVSROOT/cvswrappers are ignored. Only implements the `-kkv`, `-ko` and `-kb` expansion modes.

  Note

    Does not perform any line-ending conversion.

  See also

    get_contents_for_revision

  CLASS Parser.RCS.DeltatextIterator

    Description

      Iterator for the deltatext sections of the RCS file. Typical usage:

    Example

          string raw = Stdio.read_file(my_rcs_filename);
             Parser.RCS rcs = Parser.RCS(my_rcs_filename, 0);
             raw = rcs->parse_delta_sections(rcs->parse_admin_section(raw));
             foreach(rcs->DeltatextIterator(raw); int n; Parser.RCS.Revision rev)
               do_something(rev);

    Method create

      `void Parser.RCS.DeltatextIterator(array deltatext_section, void|function(string:void) progress_callback, void|array(mixed) progress_callback_args)`

    Parameter `deltatext_section`

      the deltatext section of the RCS file in its entirety

    Parameter `progress_callback`

      This optional callback is invoked with the revision of the deltatext about to be parsed (useful for progress indicators).

    Parameter `progress_callback_args`

      Optional extra trailing arguments to be sent to progress_callback

    See also

      the `rcsfile(5)` manpage outlines the sections of an RCS file

    syntax

      `int Parser.RCS.DeltatextIterator.n` `int(0..1) read_next()`

    Description

      Drops the leading whitespace before next revision's deltatext entry and sets this_rev to the revision number we're about to read.

    Method index

      `int index()`

    Returns

      the number of deltatext entries processed so far (0..N-1, N being the total number of revisions in the rcs file)

    Method value

      `Revision value()`

    Returns

      the Revision at whose deltatext data we are, updated with its info

    Method `!

      `int(0..1) `!()`

    Returns

      1 if the iterator has processed all deltatext entries, 0 otherwise.

    Method `+=

      `this_program `+=(int nsteps)`

    Description

      Advance nsteps sections.

    Returns

      Returns the iterator object.

    Method next

      `int(0..1) next()`

    Description

      like `<font face='courier'>`+=` (1), but returns 0 if the iterator is finished

    Method first

      `int(0..1) first()`

    Description

      Restart not implemented; always returns 0 (==failed)

    Method parse_deltatext_section

      `int parse_deltatext_section(array raw, int o)`

    Description

      Chops off the first deltatext section from the token array raw and returns the rest of the string, or the value `0` (zero) if we had already visited the final deltatext entry. The deltatext's data is stored destructively in the appropriate entry of the revisions array.

    Note

      raw +o must start with a deltatext entry for this method to work

    FIXME

      does not handle rcsfile(5) newphrase skipping

    FIXME

      if the rcs file is truncated, this method writes a descriptive error to stderr and then returns 0 - some nicer error handling wouldn't hurt

  CLASS Parser.RCS.Revision

    Description

      All data tied to a particular revision of the file.

    Variable revision

      `string Parser.RCS.Revision.revision`

    Description

      The revision number (i e `rcs_file->revisions["1.1"]->revision == "1.1"`).

    Variable author

      `string Parser.RCS.Revision.author`

    Description

      The userid of the user that committed the revision.

    Variable branches

      `array(string) Parser.RCS.Revision.branches`

    Description

      When there are branches from this revision, an array with the first revision number for each of the branches, otherwise `0`.

      Follow the next fields to get to the branch head.

    Variable state

      `string Parser.RCS.Revision.state`

    Description

      The state of the revision - typically `"Exp"` or `"dead"`.

    Variable time

      `Calendar.TimeRange Parser.RCS.Revision.time`

    Description

      The (UTC) date and time when the revision was committed (second precision).

    Variable branch

      `string Parser.RCS.Revision.branch`

    Description

      The branch name on which this revision was committed (calculated according to how cvs manages branches).

    Variable rcs_next

      `string Parser.RCS.Revision.rcs_next`

    Description

      The revision stored next in the RCS file, or `0` if none exists.

    Note

      This field is straight from the RCS file, and has somewhat weird semantics. Usually you will want to use one of the derived fields next or prev or possibly rcs_prev .

    See also

      next , prev , rcs_prev

    Variable rcs_prev

      `string Parser.RCS.Revision.rcs_prev`

    Description

      The revision that this revision is based on, or `0` if it is the HEAD.

      This is the reverse pointer of rcs_next and branches , and is used by get_contents_for_revision() when applying the deltas to set text .

    See also

      rcs_next

    Variable ancestor

      `string Parser.RCS.Revision.ancestor`

    Description

      The revision of the ancestor of this revision, or `0` if this was the initial revision.

    See also

      next

    Variable next

      `string Parser.RCS.Revision.next`

    Description

      The revision that succeeds this revision, or `0` if none exists (ie if this is the HEAD of the trunk or of a branch).

    See also

      ancestor

    Variable log

      `string Parser.RCS.Revision.log`

    Description

      The log message associated with the revision.

    Variable lines

      `int Parser.RCS.Revision.lines`

    Description

      The number of lines this revision contained, altogether (not of particular interest for binary files).

    See also

      added , removed

    Variable added

      `int Parser.RCS.Revision.added`

    Description

      The number of lines that were added from the previous revision to make this revision (for the initial revision too).

    See also

      lines , removed

    Variable removed

      `int Parser.RCS.Revision.removed`

    Description

      The number of lines that were removed from the previous revision to make this revision.

    See also

      lines , added

    Variable rcs_text

      `string Parser.RCS.Revision.rcs_text`

    Description

      The raw delta as stored in the RCS file.

    See also

      text , get_contents_for_revision()

    Variable text

      `string Parser.RCS.Revision.text`

    Description

      The text as committed or `0` if get_contents_for_revision() hasn't been called for this revision yet.

      Typically you don't access this field directly, but use get_contents_for_revision() to retrieve it.

    See also

      get_contents_for_revision() , rcs_text

Module Parser._parser

  Description

    Low-level helpers for parsers.

  Note

    You probably don't want to use the modules contained in this module directly, but instead use the other Parser modules. See instead the modules below.

  See also

    Parser , Parser.C , Parser.Pike , Parser.RCS , Parser.HTML , Parser.XML

  Module Parser._parser._RCS

    Description

      Low-level helpers for Parser.RCS .

    Note

      You probably want to use Parser.RCS instead of this module.

    See also

      Parser.RCS

    Method tokenize

      `array(array(string)) tokenize(string code)`

    Description

      Tokenize a string of RCS tokens.

    Note

      Don't use this function directly. Use Parser.RCS.tokenize() instead.

    See also

      Parser.RCS.tokenize()

  Module Parser._parser._Pike

    Description

      Low-level helpers for Parser.Pike .

    Note

      You probably want to use Parser.Pike instead of this module.

    See also

      Parser.Pike , _C .

    Method tokenize

      `array(array(string)|string) tokenize(string code)`

    Description

      Tokenize a string of Pike tokens.

    Returns

      Returns an array with Pike-level tokens and the remainder (a partial token), if any.

  Module Parser._parser._C

    Description

      Low-level helpers for Parser.C .

    Note

      You probably want to use Parser.C instead of this module.

    See also

      Parser.C , _Pike .

    Method tokenize

      `array(array(string)|string) tokenize(string code)`

    Description

      Tokenize a string of C tokens.

    Note

      Don't use this function directly. Use Parser.C.tokenize() instead.

    Returns

      Returns an array with an array with C-level tokens, and the remainder (a partial token), if any.

Module Parser.XML

  Method autoconvert

    `string autoconvert(string xml)`

  CLASS Parser.XML.Simple

    Method parse

      `array parse(string xml, string context, function cb, mixed ... extra_args)`
      `array parse(string xml, function cb, mixed ... extra_args)`

    Note

      The context argument was introduced in Pike 7.8.

    Method parse_dtd

      `mixed parse_dtd(string dtd, string context, function cb, mixed ... extras)`
      `mixed parse_dtd(string dtd, function cb, mixed ... extras)`

    Note

      The context argument was introduced in Pike 7.8.

    Method lookup_entity

      `string lookup_entity(string entity)`

    Returns

      Returns the verbatim expansion of the entity.

    Note

      Added in Pike 7.7.

    Method define_entity_raw

      `void define_entity_raw(string entity, string raw)`

    Description

      Define an entity or an SMEG.

    Parameter `entity`

      Entity name, or SMEG name (if preceeded by a `"%"`).

    Parameter `raw`

      Verbatim expansion of the entity.

    See also

      define_entity()

    Method define_entity

      `void define_entity(string entity, string s, function cb, mixed ... extras)`

    Description

      Define an entity or an SMEG.

    Parameter `entity`

      Entity name, or SMEG name (if preceeded by a `"%"`).

    Parameter `s`

      Expansion of the entity. Entity evaluation will be performed.

    See also

      define_entity_raw()

    Method allow_rxml_entities

      `void allow_rxml_entities(int(0..1) yes_no)`

    Method compat_allow_errors

      `void compat_allow_errors(string version)`

    Description

      Set whether the parser should allow certain errors for compatibility with earlier versions. version can be:

      `"7.2"` | Allow more data after the root element.
      `"7.6"` | Allow multiple and invalidly placed "<?xml ... ?>" and "<!DOCTYPE ... >" declarations (invalid "<?xml ... ?>" declarations are otherwise treated as normal PI:s). Allow "<![CDATA[ ... ]]>" outside the root element. Allow the root element to be absent.

      version can also be zero to enable all error checks.

    CLASS Parser.XML.Simple.Context

      Method parse_xml

        `mixed parse_xml()`

      Method parse_dtd

        `mixed parse_dtd()`

      Method parse_entity

        `string parse_entity()`

      Method push_string

        `void push_string(string s)`
        `void push_string(string s, string context)`

      Description

        Add a string to parse at the current position.

      Parameter `s`

        String to insert at the current parsing position.

      Parameter `context`

        Optional context used to refer to the inserted string. This is typically an URL, but may also be an entity (preceeded by an `"&"`) or a SMEG reference (preceeded by a `"%"`). Not used by the XML parser as such, but is simply passed into the callbackinfo mapping as the field `"context"` where it can be useful for eg resolving relative URLs when parsing DTDs, or for determining where errors occur.

      Note

        The context argument was introduced in Pike 7.8.

      Method create

        `void Parser.XML.Simple.Context(string s, string context, int flags, function cb, mixed ... extra_args)`
        `void Parser.XML.Simple.Context(string s, int flags, function cb, mixed ... extra_args)`

      Parameter `s`
      Parameter `context`

        These two arguments are passed along to push_string() .

      Parameter `flags`

        Parser flags.

      Parameter `cb`

        Callback function. This function gets called at various stages during the parsing.

      Note

        The context argument was introduced in Pike 7.8.

  CLASS Parser.XML.Validating

    Description

      Validating XML parser.

      Validates an XML file according to a DTD.

      cf http://wwww.w3.org/TR/REC-xml/

      $Id: 74718ccb3f8dc66d39c8bcca45ca590427558c6a $

    Inherit Simple

      inherit .Simple : Simple

    Description

      Extends the Simple XML parser.

    Method isname

      `int isname(string s)`

    Description

      Check if s is a valid `Name`.

    Method isnmtoken

      `int isnmtoken(string s)`

    Description

      Check if s is a valid `Nmtoken`.

    Method isnames

      `int isnames(string s)`

    Description

      Check if s is a valid list of `Name`s.

    Method isnmtokens

      `int isnmtokens(string s)`

    Description

      Check if s is a valid list of `Nmtoken`s.

    Method get_external_entity

      `string get_external_entity(string sysid, string|void pubid, mapping|__deprecated__(int)|void info, mixed ... extra)`

    Description

      Get an external entity.

      Called when a `<!DOCTYPE>` with a `SYSTEM` identifier is encountered, or when an entity reference needs expanding.

    Parameter `sysid`

      The `SYSTEM` identifier.

    Parameter `pubid`

      The `PUBLIC` identifier (if any).

    Parameter `info`

      The callbackinfo mapping containing the current parser state.

    Parameter `extra`

      The `extra` arguments as passed to parse() or parse_dtd() .

    Returns

      Returns a string with a DTD fragment on success. Returns `0` (zero) on failure.

    Note

      Returning zero will cause the validator to report an error.

    Note

      In Pike 7.7 and earlier info had the value `0` (zero).

    Note

      The default implementation always returns `0` (zero). Override this function to provide other behaviour.

    See also

      parse() , parse_dtd()

    Method validate

      `mixed validate(string kind, string name, mapping attributes, array|string contents, mapping(string:mixed) info, function(string:mixed) callback, array(mixed) extra)`

    Description

      The validation callback function.

    See also

      ::parse()

    Method parse

      `array parse(string data, string|function(string:mixed) callback, mixed ... extra)`

    FIXME

      Document this function

    Method parse_dtd

      `array parse_dtd(string data, string|function(string:mixed) callback, mixed ... extra)`

    FIXME

      Document this function

    CLASS Parser.XML.Validating.Element

      Description

        XML Element node.

  Module Parser.XML.Tree

    Description

      XML parser that generates node-trees.

      Has some support for XML namespaces http://www.w3.org/TR/REC-xml-names/ RFC 2518 23.4.

    Note

      This module defines two sets of node trees; the SimpleNode -based, and the Node -based. The main difference between the two, is that the Node -based trees have parent pointers, which tend to generate circular data references and thus garbage.

      There are some more subtle differences between the two. Please read the documentation carefully.

    Constant STOP_WALK

      `constant Parser.XML.Tree.STOP_WALK`

    Constant XML_ROOT

      `constant Parser.XML.Tree.XML_ROOT`

    Constant XML_ELEMENT

      `constant Parser.XML.Tree.XML_ELEMENT`

    Constant XML_TEXT

      `constant Parser.XML.Tree.XML_TEXT`

    Constant XML_HEADER

      `constant Parser.XML.Tree.XML_HEADER`

    Constant XML_PI

      `constant Parser.XML.Tree.XML_PI`

    Constant XML_COMMENT

      `constant Parser.XML.Tree.XML_COMMENT`

    Constant XML_DOCTYPE

      `constant Parser.XML.Tree.XML_DOCTYPE`

    Constant XML_ATTR

      `constant Parser.XML.Tree.XML_ATTR`

    Description

      Attribute nodes are created on demand

    Constant DTD_ENTITY

      `constant Parser.XML.Tree.DTD_ENTITY`

    Constant DTD_ELEMENT

      `constant Parser.XML.Tree.DTD_ELEMENT`

    Constant DTD_ATTLIST

      `constant Parser.XML.Tree.DTD_ATTLIST`

    Constant DTD_NOTATION

      `constant Parser.XML.Tree.DTD_NOTATION`

    Constant XML_NODE

      `constant Parser.XML.Tree.XML_NODE`

    Method text_quote

      `string text_quote(string data)`

    Description

      Quotes the string given in data by escaping &, < and >.

    Method roxen_text_quote

      `string roxen_text_quote(string data)`

    Description

      Quotes strings just like text_quote , but entities in the form `&foo.bar;` will not be quoted.

    Method attribute_quote

      `string attribute_quote(string data)`

    Description

      Quotes the string given in data by escaping &, <, >, ' and ".

    Method roxen_attribute_quote

      `string roxen_attribute_quote(string data)`

    Description

      Quotes strings just like attribute_quote , but entities in the form `&foo.bar;` will not be quoted.

    Method simple_parse_input

      `SimpleRootNode simple_parse_input(string data, void|mapping predefined_entities, ParseFlags|void flags, string|void default_namespace)`

    Description

      Takes an XML string and produces a SimpleNode tree.

    Method simple_parse_file

      `SimpleRootNode simple_parse_file(string path, void|mapping predefined_entities, ParseFlags|void flags, string|void default_namespace)`

    Description

      Loads the XML file path , creates a SimpleNode tree representation and returns the root node.

    Method parse_input

      `RootNode parse_input(string data, void|int(0..1) no_fallback, void|int(0..1) force_lowercase, void|mapping(string:string) predefined_entities, void|int(0..1) parse_namespaces, ParseFlags|void flags)`

    Description

      Takes an XML string and produces a node tree.

    Note

      flags is not used for PARSE_WANT_ERROR_CONTEXT , PARSE_FORCE_LOWERCASE or PARSE_ENABLE_NAMESPACES since they are covered by the separate flag arguments.

    Method parse_file

      `Node parse_file(string path, int(0..1)|void parse_namespaces)`

    Description

      Loads the XML file path , creates a node tree representation and returns the root node.

    ENUM Parser.XML.Tree.ParseFlags

      Description

        Flags used together with simple_parse_input() and simple_parse_file() .

    CLASS Parser.XML.Tree.XMLNSParser

      Description

        Namespace aware parser.

      Method Enter

        `mapping(string:string) Enter(mapping(string:string) attrs)`

      Description

        Check attrs for namespaces.

      Returns

        Returns the namespace expanded version of attrs .

    CLASS Parser.XML.Tree.AbstractSimpleNode

      Description

        Base class for nodes.

      Method get_children

        `array(AbstractSimpleNode) get_children()`

      Description

        Returns all the nodes children.

      Method count_children

        `int count_children()`

      Description

        Returns the number of children of the node.

      Method low_clone

        `AbstractSimpleNode low_clone()`

      Description

        Returns an initialized copy of the node.

      Note

        The returned node has no children.

      Method clone

        `AbstractSimpleNode clone()`

      Description

        Returns a clone of the sub-tree rooted in the node.

      Method get_last_child

        `AbstractSimpleNode get_last_child()`

      Description

        Returns the last child node or zero.

      Method `[]

        `AbstractSimpleNode `[](int pos)`

      Description

        The [] operator indexes among the node children, so `node[0]` returns the first node and `node[-1]` the last.

      Note

        The [] operator will select a node from all the nodes children, not just its element children.

      Method add_child

        `AbstractSimpleNode add_child(AbstractSimpleNode c)`

      Description

        Adds the given node to the list of children of this node. The new node is added last in the list.

      Note

        The return value differs from the one returned by Node()->add_child() .

      Returns

        The current node.

      Method add_child_before

        `AbstractSimpleNode add_child_before(AbstractSimpleNode c, AbstractSimpleNode old)`

      Description

        Adds the node c to the list of children of this node. The node is added before the node old , which is assumed to be an existing child of this node. The node is added last if old is zero.

      Returns

        The current node.

      Method add_child_after

        `AbstractSimpleNode add_child_after(AbstractSimpleNode c, AbstractSimpleNode old)`

      Description

        Adds the node c to the list of children of this node. The node is added after the node old , which is assumed to be an existing child of this node. The node is added first if old is zero.

      Returns

        The current node.

      Method remove_child

        `void remove_child(AbstractSimpleNode c)`

      Description

        Removes all occurrences of the provided node from the list of children of this node.

      Method replace_children

        `void replace_children(array(AbstractSimpleNode) children)`

      Description

        Replaces the nodes children with the provided ones.

      Method replace_child

        `AbstractSimpleNode replace_child(AbstractSimpleNode old, AbstractSimpleNode new)`

      Description

        Replaces the first occurrence of the old node child with the new node child.

      Note

        The return value differs from the one returned by Node()->replace_child() .

      Returns

        Returns the current node on success, and `0` (zero) if the node old wasn't found.

      Method zap_tree

        `void zap_tree()`

      Description

        Destruct the tree recursively. When the inheriting AbstractNode or Node is used, which have parent pointers, this function should be called for every tree that no longer is in use to avoid frequent garbage collector runs.

      Method walk_preorder

        `int walk_preorder(function(AbstractSimpleNode:int|void) callback, mixed ... args)`

      Description

        Traverse the node subtree in preorder, root node first, then subtrees from left to right, calling the callback function for every node. If the callback function returns STOP_WALK the traverse is promptly aborted and STOP_WALK is returned.

      Method walk_preorder_2

        `int walk_preorder_2(function(AbstractSimpleNode:int|void) cb_1, function(AbstractSimpleNode:int|void) cb_2, mixed ... args)`

      Description

        Traverse the node subtree in preorder, root node first, then subtrees from left to right. For each node we call cb_1 before iterating through children, and then cb_2 (which always gets called even if the walk is aborted earlier). If the callback function returns STOP_WALK the traverse decend is aborted and STOP_WALK is returned once all waiting cb_2 functions have been called.

      Method walk_inorder

        `int walk_inorder(function(AbstractSimpleNode:int|void) callback, mixed ... args)`

      Description

        Traverse the node subtree in inorder, left subtree first, then root node, and finally the remaining subtrees, calling the function callback for every node. If the function callback returns STOP_WALK the traverse is promptly aborted and STOP_WALK is returned.

      Method walk_postorder

        `int walk_postorder(function(AbstractSimpleNode:int|void) callback, mixed ... args)`

      Description

        Traverse the node subtree in postorder, first subtrees from left to right, then the root node, calling the function callback for every node. If the function callback returns STOP_WALK the traverse is promptly aborted and STOP_WALK is returned.

      Method iterate_children

        `int iterate_children(function(AbstractSimpleNode:int|void) callback, mixed ... args)`

      Description

        Iterates over the nodes children from left to right, calling the function callback for every node. If the callback function returns STOP_WALK the iteration is promptly aborted and STOP_WALK is returned.

      Method get_descendants

        `array(AbstractSimpleNode) get_descendants(int(0..1) include_self)`

      Description

        Returns a list of all descendants in document order. Includes this node if include_self is set.

    CLASS Parser.XML.Tree.AbstractNode

      Description

        Base class for nodes with parent pointers.

      Inherit AbstractSimpleNode

        inherit AbstractSimpleNode : AbstractSimpleNode

      Method set_parent

        `void set_parent(AbstractNode parent)`

      Description

        Sets the parent node to parent .

      Method get_parent

        `AbstractNode get_parent()`

      Description

        Returns the parent node.

      Method low_clone

        `AbstractNode low_clone()`

      Description

        Returns an initialized copy of the node.

      Note

        The returned node has no children, and no parent.

      Method clone

        `AbstractNode clone(void|int(-1..1) direction)`

      Description

        Clones the node, optionally connected to parts of the tree. If direction is -1 the cloned nodes parent will be set, if direction is 1 the clone nodes childen will be set.

      Method get_root

        `AbstractNode get_root()`

      Description

        Follows all parent pointers and returns the root node.

      Method add_child

        `AbstractNode add_child(AbstractNode c)`

      Description

        Adds the node c to the list of children of this node. The node is added before the node old , which is assumed to be an existing child of this node. The node is added first if old is zero.

      Note

        Returns the new child node, NOT the current node.

      Returns

        The new child node is returned.

      Method add_child_before

        `AbstractNode add_child_before(AbstractNode c, AbstractNode old)`

      Description

        Adds the node c to the list of children of this node. The node is added before the node old , which is assumed to be an existing child of this node. The node is added last if old is zero.

      Returns

        The current node.

      Method add_child_after

        `AbstractNode add_child_after(AbstractNode c, AbstractNode old)`

      Description

        Adds the node c to the list of children of this node. The node is added after the node old , which is assumed to be an existing child of this node. The node is added first if old is zero.

      Returns

        The current node.

      Method tmp_add_child
      Method tmp_add_child_before
      Method tmp_add_child_after

        `AbstractNode tmp_add_child(AbstractNode c)`
        `AbstractNode tmp_add_child_before(AbstractNode c, AbstractNode old)`
        `AbstractNode tmp_add_child_after(AbstractNode c, AbstractNode old)`

      Description

        Variants of add_child , add_child_before and add_child_after that doesn't set the parent pointer in the newly added children.

        This is useful while building a node tree, to get efficient refcount garbage collection if the build stops abruptly. fix_tree has to be called on the root node when the building is done.

      Method fix_tree

        `void fix_tree()`

      Description

        Fix all parent pointers recursively in a tree that has been built with tmp_add_child .

      Method remove_child

        `void remove_child(AbstractNode c)`

      Description

        Removes all occurrences of the provided node from the called nodes list of children. The removed nodes parent reference is set to null.

      Method remove_node

        `void remove_node()`

      Description

        Removes this node from its parent. The parent reference is set to null.

      Method replace_children

        `void replace_children(array(AbstractNode) children)`

      Description

        Replaces the nodes children with the provided ones. All parent references are updated.

      Method replace_child

        `AbstractNode replace_child(AbstractNode old, AbstractNode new)`

      Description

        Replaces the first occurrence of the old node child with the new node child. All parent references are updated.

      Note

        The returned value is NOT the current node.

      Returns

        Returns the new child node.

      Method replace_node

        `AbstractNode replace_node(AbstractNode new)`

      Description

        Replaces this node with the provided one.

      Returns

        Returns the new node.

      Method get_preceding_siblings

        `array(AbstractNode) get_preceding_siblings()`

      Description

        Returns all preceding siblings, i.e. all siblings present before this node in the parents children list.

      Method get_following_siblings

        `array(AbstractNode) get_following_siblings()`

      Description

        Returns all following siblings, i.e. all siblings present after this node in the parents children list.

      Method get_siblings

        `array(AbstractNode) get_siblings()`

      Description

        Returns all siblings, including this node.

      Method get_ancestors

        `array(AbstractNode) get_ancestors(int(0..1) include_self)`

      Description

        Returns a list of all ancestors, with the top node last. The list will start with this node if include_self is set.

      Method get_preceding

        `array(AbstractNode) get_preceding()`

      Description

        Returns all preceding nodes, excluding this nodes ancestors.

      Method get_following

        `array(AbstractNode) get_following()`

      Description

        Returns all the nodes that follows after the current one.

    CLASS Parser.XML.Tree.VirtualNode

      Description

        Node in XML tree

      Method get_attributes

        `mapping(string:string) get_attributes()`

      Description

        Returns this nodes attributes, which can be altered destructivly to alter the nodes attributes.

      Method get_short_attributes

        `mapping get_short_attributes()`

      Description

        Returns this nodes name-space adjusted attributes.

      Note

        set_short_namespaces() must have been called before calling this function.

      Method get_node_type

        `int get_node_type()`

      Description

        Returns the node type. See defined node type constants.

      Method get_text

        `string get_text()`

      Description

        Returns text content in node.

      Method get_doc_order

        `int get_doc_order()`

      Method set_doc_order

        `void set_doc_order(int o)`

      Method get_tag_name

        `string get_tag_name()`

      Description

        Returns the name of the element node, or the nearest element above if an attribute node.

      Method get_any_name

        `string get_any_name()`

      Description

        Return name of tag or name of attribute node.

      Method set_tag_name

        `void set_tag_name(string name)`

      Description

        Change the tag name destructively. Can only be used on element and processing-instruction nodes.

      Method get_namespace

        `string get_namespace()`

      Description

        Return the (resolved) namespace for this node.

      Method get_full_name

        `string get_full_name()`

      Description

        Return fully qualified name of the element node.

      Method create

        `void Parser.XML.Tree.VirtualNode(int type, string name, mapping attr, string text)`

      Method value_of_node

        `string value_of_node()`

      Description

        If the node is an attribute node or a text node, its value is returned. Otherwise the child text nodes are concatenated and returned.

      Method get_first_element

        `AbstractNode get_first_element(string|void name, int(0..1)|void full)`

      Description

        Returns the first element child to this node.

      Parameter `name`

        If provided, the first element child with that name is returned.

      Parameter `full`

        If specified, name matching will be done against the full name.

      Returns

        Returns the first matching node, and 0 if no such node was found.

      Method get_elements

        `array(AbstractNode) get_elements(string|void name, int(0..1)|void full)`

      Description

        Returns all element children to this node.

      Parameter `name`

        If provided, only elements with that name is returned.

      Parameter `full`

        If specified, name matching will be done against the full name.

      Returns

        Returns an array with matching nodes.

      Method cast

        `mixed cast(string to)`

      Description

        It is possible to cast a node to a string, which will return render_xml() for that node.

      Method render_xml

        `string render_xml(void|int(0..1) preserve_roxen_entities, void|mapping(string:string) namespace_lookup)`

      Description

        Creates an XML representation of the node sub tree. If the flag preserve_roxen_entities is set, entities on the form `&foo.bar;` will not be escaped.

      Parameter `namespace_lookup`

        Mapping from namespace prefix to namespace symbol prefix.

      Method render_to_file

        `void render_to_file(Stdio.File f, void|int(0..1) preserve_roxen_entities)`

      Description

        Creates an XML representation fo the node sub tree and streams the output to the file f . If the flag preserve_roxen_entities is set, entities on the form `&foo.bar;` will not be escaped.

    CLASS Parser.XML.Tree.SimpleNode

      Description

        XML node without parent pointers and attribute nodes.

      Inherit AbstractSimpleNode

        inherit AbstractSimpleNode : AbstractSimpleNode

      Inherit VirtualNode

        inherit VirtualNode : VirtualNode

    CLASS Parser.XML.Tree.Node

      Description

        XML node with parent pointers.

      Inherit AbstractNode

        inherit AbstractNode : AbstractNode

      Inherit VirtualNode

        inherit VirtualNode : VirtualNode

      Method get_tag_name

        `string get_tag_name()`

      Description

        Returns the name of the element node, or the nearest element above if an attribute node.

      Method get_attr_name

        `string get_attr_name()`

      Description

        Returns the name of the attribute node.

      Method get_attribute_nodes

        `array(Node) get_attribute_nodes()`

      Description

        Creates and returns an array of new nodes; they will not be added as proper children to the parent node, but the parent link in the nodes are set so that upwards traversal is made possible.

    CLASS Parser.XML.Tree.XMLParser

      Description

        Mixin for parsing XML.

      Method node_factory

        `this_program node_factory(int type, string name, mapping attr, string text)`

      Description

        Factory for creating nodes.

      Parameter `type`

        Type of node to create. One of:

        `XML_TEXT` | XML text. text contains a string with the text.
        `XML_COMMENT` | XML comment. text contains a string with the comment text.
        `XML_HEADER` | `<?xml?>`-header attr contains a mapping with the attributes.
        `XML_PI` | XML processing instruction. name contains the name of the processing instruction and text the remainder.
        `XML_ELEMENT` | XML element tag. name contains the name of the tag and attr the attributes.
        `XML_DOCTYPE` | DTD information.
        `DTD_ENTITY`
        `DTD_ELEMENT`
        `DTD_ATTLIST`
        `DTD_NOTATION`

      Parameter `name`

        Name of the tag if applicable.

      Parameter `attr`

        Attributes for the tag if applicable.

      Parameter `text`

        Contained text of the tab if any.

        This function is called during parsning to create the various XML nodes.

        Overload this function to provide application-specific XML nodes.

      Returns

        Returns a node object representing the XML tag, or `0` (zero) if the subtree rooted in the tag should be cut.

      Note

        This function is not available in Pike 7.6 and earlier.

    CLASS Parser.XML.Tree.SimpleRootNode

      Description

        The root node of an XML-tree consisting of SimpleNode s.

      Inherit SimpleNode

        inherit SimpleNode : SimpleNode

      Inherit XMLParser

        inherit XMLParser : XMLParser

      Method get_element_by_id

        `SimpleElementNode get_element_by_id(string id, int|void force)`

      Description

        Find the element with the specified id.

      Parameter `id`

        The XML id of the node to search for.

      Parameter `force`

        Force a regeneration of the id lookup cache. Needed the first time after the node tree has been modified by adding or removing element nodes, or by changing the id attribute of an element node.

      Returns

        Returns the element node with the specified id if any. Returns UNDEFINED otherwise.

      See also

        flush_node_id_cache

      Method flush_node_id_cache

        `void flush_node_id_cache()`

      Description

        Clears the node id cache built and used by get_element_by_id .

    CLASS Parser.XML.Tree.RootNode

      Description

        The root node of an XML-tree consisting of Node s.

      Inherit Node

        inherit Node : Node

      Inherit XMLParser

        inherit XMLParser : XMLParser

      Method get_element_by_id

        `ElementNode get_element_by_id(string id, int|void force)`

      Description

        Find the element with the specified id.

      Parameter `id`

        The XML id of the node to search for.

      Parameter `force`

        Force a regeneration of the id lookup cache. Needed the first time after the node tree has been modified by adding or removing element nodes, or by changing the id attribute of an element node.

      Returns

        Returns the element node with the specified id if any. Returns UNDEFINED otherwise.

      See also

        flush_node_id_cache

      Method flush_node_id_cache

        `void flush_node_id_cache()`

      Description

        Clears the node id cache built and used by get_element_by_id .

  Module Parser.XML.SloppyDOM

    Description

      A somewhat DOM-like library that implements lazy generation of the node tree, i.e. it's generated from the data upon lookup. There's also a little bit of XPath evaluation to do queries on the node tree.

      Implementation note: This is generally more pragmatic than Parser.XML.DOM , meaning it's not so pretty and compliant, but more efficient.

      Implementation status: There's only enough implemented to parse a node tree from source and access it, i.e. modification functions aren't implemented. Data hiding stuff like NodeList and NamedNodeMap is not implemented, partly since it's cumbersome to meet the "live" requirement. Also, Parser.HTML is used in XML mode to parse the input. Thus it's too error tolerant to be XML compliant, and it currently doesn't handle DTD elements, like `"<!DOCTYPE"`, or the XML declaration (i.e. `"<?xml version='1.0'?>"`.

    Method parse

      `Document parse(string source, void|int raw_values)`

    Description

      Normally entities are decoded, and Node.xml_format will encode them again. If raw_values is nonzero then all text and attribute values are instead kept in their original form.

    CLASS Parser.XML.SloppyDOM.Node

      Description

        Basic node.

      Method get_text_content

        `string get_text_content()`

      Description

        If the `raw_values` flag is set in the owning document, the text is returned with entities and CDATA blocks intact.

      See also

        parse

      Method simple_path

        `mapping(string:string)|Node|array(mapping(string:string)|Node)|string simple_path(string path, void|int xml_format)`

      Description

        Access a node or a set of nodes through an expression that is a subset of an XPath RelativeLocationPath in abbreviated form.

        That means one or more Steps separated by "/" or "//". A Step consists of an AxisSpecifier followed by a NodeTest and then optionally by one or more Predicate's.

        "/" before a Step causes it to be matched only against the immediate children of the node(s) selected by the previous Step. "//" before a Step causes it to be matched against any children in the tree below the node(s) selected by the previous Step. The initial selection before the first Step is this element.

        The currently allowed AxisSpecifier NodeTest combinations are:

        - `name` to select all elements with the given name. The name can be `"*"` to select all.

        - `@name` to select all attributes with the given name. The name can be `"*"` to select all.

        - `comment()` to select all comments.

        - `text()` to select all text and CDATA blocks. Note that all entity references are also selected, under the assumption that they would expand to text only.

        - `processing-instruction("name")` to select all processing instructions with the given name. The name can be left out to select all. Either `'` or `"` may be used to delimit the name. For compatibility, it can also occur without surrounding quotes.

        - `node()` to select all nodes, i.e. the whole content of an element node.

        - `.` to select the currently selected element itself.

        A Predicate is on the form `[PredicateExpr]` where PredicateExpr currently can be in any of the following forms:

        - An integer indexes one item in the selected set, according to the document order. A negative index counts from the end of the set.

        - A RelativeLocationPath as specified above. It's executed for each element in the selected set and those where it yields an empty result are filtered out while the rest remain in the set.

        - A RelativeLocationPath as specified above followed by `="value"`. The path is executed for each element in the selected set and those where the text result of it is equal to the given value remain in the set. Either `'` or `"` may be used to delimit the value.

        If xml_format is nonzero, the return value is an xml formatted string of all the matched nodes, in document order. Otherwise the return value is as follows:

        Attributes are returned as one or more index/value pairs in a mapping. Other nodes are returned as the node objects. If the expression is on a form that can give at most one answer (i.e. there's a predicate with an integer index) then a single mapping or node is returned, or zero if there was no match. If the expression can give more answers then the return value is an array containing zero or more attribute mappings and/or nodes. The array follows document order.

      Note

        Not DOM compliant.

      Method xml_format

        `string xml_format()`

      Description

        Returns the formatted XML that corresponds to the node tree.

      Note

        Not DOM compliant.

    CLASS Parser.XML.SloppyDOM.NodeWithChildElements

      Description

        Node with child elements.

      Inherit NodeWithChildren

        inherit NodeWithChildren : NodeWithChildren

      Method get_elements

        `array(Element) get_elements(string name)`

      Description

        Lightweight variant of get_elements_by_tag_name that returns a simple array instead of a fancy live NodeList.

      Note

        Not DOM compliant.

      Method get_descendant_elements

        `array(Element) get_descendant_elements()`

      Description

        Returns all descendant elements in document order.

      Note

        Not DOM compliant.

      Method get_descendant_nodes

        `array(Node) get_descendant_nodes()`

      Description

        Returns all descendant nodes (except attribute nodes) in document order.

      Note

        Not DOM compliant.

    CLASS Parser.XML.SloppyDOM.Document

      Note

        The node tree is very likely a cyclic structure, so it might be an good idea to destruct it when you're finished with it, to avoid garbage. Destructing the Document object always destroys all nodes in it.

      Inherit NodeWithChildElements

        inherit NodeWithChildElements : NodeWithChildElements

      Method get_elements

        `array(Element) get_elements(string name)`

      Description

        Note that this one looks among the top level elements, as opposed to get_elements_by_tag_name . This means that if the document is correct, you can only look up the single top level element here.

      Note

        Not DOM compliant.

      Method get_raw_values

        `int get_raw_values()`

      Note

        Not DOM compliant.

  Module Parser.XML.NSTree

    Description

      A namespace aware version of Parser.XML.Tree. This implementation does as little validation as possible, so e.g. you can call your namespace xmlfoo without complaints.

    Inherit Tree

      inherit Parser.XML.Tree : Tree

    Method parse_input

      `NSNode parse_input(string data, void|string default_ns)`

    Description

      Takes a XML string data and produces a namespace node tree. If default_ns is given, it will be used as the default namespace.

    Throws

      Throws an error when an error is encountered during XML parsing.

    Method visualize

      `string visualize(Node n, void|string indent)`

    Description

      Makes a visualization of a node graph suitable for printing out on a terminal.

    Example

          > object x = parse_input("<a><b><c/>d</b><b><e/><f>g</f></b></a>");
             > write(visualize(x));
             Node(ROOT)
               NSNode(ELEMENT,"a")
                 NSNode(ELEMENT,"b")
                   NSNode(ELEMENT,"c")
                   NSNode(TEXT)
                 NSNode(ELEMENT,"b")
                   NSNode(ELEMENT,"e")
                   NSNode(ELEMENT,"f")
                     NSNode(TEXT)
             Result 1: 201

    CLASS Parser.XML.NSTree.NSNode

      Description

        Namespace aware node.

      Inherit Node

        inherit Node : Node

      Method get_ns

        `string get_ns()`

      Description

        Returns the namespace in which the current element is defined in.

      Method get_default_ns

        `string get_default_ns()`

      Description

        Returns the default namespace in the current scope.

      Method get_defined_nss

        `mapping(string:string) get_defined_nss()`

      Description

        Returns a mapping with all the namespaces defined in the current scope, except the default namespace.

      Note

        The returned mapping is the same as the one in the node, so destructive changes will affect the node.

      Method get_ns_attributes

        `mapping(string:string) get_ns_attributes(string namespace)`

      Description

        Returns the attributes in this node that is declared in the provided namespace.

      Method get_ns_attributes

        `mapping(string:mapping(string:string)) get_ns_attributes()`

      Description

        Returns all the attributes in all namespaces that is associated with this node.

      Note

        The returned mapping is the same as the one in the node, so destructive changes will affect the node.

      Method add_namespace

        `void add_namespace(string ns, void|string symbol, void|int(0..1) chain)`

      Description

        Adds a new namespace to this node. The preferred symbol to use to identify the namespace can be provided in the symbol argument. If chain is set, no attempts to overwrite an already defined namespace with the same identifier will be made.

      Method diff_namespaces

        `mapping(string:string) diff_namespaces()`

      Description

        Returns the difference between this nodes and its parents namespaces.

      Method get_xml_name

        `string get_xml_name()`

      Description

        Returns the element name as it occurs in xml files. E.g. "zonk:name" for the element "name" defined in a namespace denoted with "zonk". It will look up a symbol for the namespace in the symbol tables for the node and its parents. If none is found a new label will be generated by hashing the namespace.

      Method remove_child

        `void remove_child(NSNode child)`

      Description

        The remove_child is a not updated to take care of name space issues. To properly remove all the parents name spaces from the chid, call remove_node in the child.

Module Parser.LR

  Description

    LALR(1) parser generator.

  ENUM Parser.LR.SeverityLevel

    Description

      Severity level

  CLASS Parser.LR.Priority

    Description

      Specifies the priority and associativity of a rule.

    Variable value

      `int Parser.LR.Priority.value`

    Description

      Priority value

    Variable assoc

      `int Parser.LR.Priority.assoc`

    Description

      Associativity

      `-1` | Left
      `0` | None
      `1` | Right

    Method create

      `void Parser.LR.Priority(int p, int a)`

    Description

      Create a new priority object.

    Parameter `p`

      Priority.

    Parameter `a`

      Associativity.

  CLASS Parser.LR.Rule

    Description

      This object is used to represent a BNF-rule in the LR parser.

    Variable nonterminal

      `int Parser.LR.Rule.nonterminal`

    Description

      Non-terminal this rule reduces to.

    Variable symbols

      `array(string|int) Parser.LR.Rule.symbols`

    Description

      The actual rule

    Variable action

      `function|string Parser.LR.Rule.action`

    Description

      Action to do when reducing this rule. function - call this function. string - call this function by name in the object given to the parser. The function is called with arguments corresponding to the values of the elements of the rule. The return value of the function will be the value of this non-terminal. The default rule is to return the first argument.

    Variable has_tokens

      `int Parser.LR.Rule.has_tokens`

    Description

      This rule contains tokens

    Variable num_nonnullables

      `int Parser.LR.Rule.num_nonnullables`

    Description

      This rule has this many non-nullable symbols at the moment.

    Variable number

      `int Parser.LR.Rule.number`

    Description

      Sequence number of this rule (used for conflict resolving) Also used to identify the rule.

    Variable pri

      `Priority Parser.LR.Rule.pri`

    Description

      Priority and associativity of this rule.

    Method create

      `void Parser.LR.Rule(int nt, array(string|int) r, function|string|void a)`

    Description

      Create a BNF rule.

    Example

          The rule
          	   rule : nonterminal ":" symbols ";" { add_rule };
             might be created as
          	   rule(4, ({ 9, ":", 5, ";" }), "add_rule");
             where 4 corresponds to the nonterminal "rule", 9 to "nonterminal"
             and 5 to "symbols", and the function "add_rule" is too be called
             when this rule is reduced.

    Parameter `nt`

      Non-terminal to reduce to.

    Parameter `r`

      Symbol sequence that reduces to nt.

    Parameter `a`

      Action to do when reducing according to this rule. function - Call this function. string - Call this function by name in the object given to the parser. The function is called with arguments corresponding to the values of the elements of the rule. The return value of the function will become the value of this non-terminal. The default rule is to return the first argument.

  CLASS Parser.LR.ErrorHandler

    Description

      Class handling reporting of errors and warnings.

    Variable verbose

      `optional int(-1..1) Parser.LR.ErrorHandler.verbose`

    Description

      Verbosity level

      `-1` | Just errors.
      `0` | Errors and warnings.
      `1` | Also notices.

    Method create

      `void Parser.LR.ErrorHandler(int(-1..1)|void verbosity)`

    Description

      Create a new error handler.

    Parameter `verbosity`

      Level of verbosity.

    See also

      verbose

  CLASS Parser.LR.Parser

    Description

      This object implements an LALR(1) parser and compiler.

      Normal use of this object would be:

           set_error_handler
           {add_rule, set_priority, set_associativity}*
           set_symbol_to_string
           compile
           {parse}*

    Variable grammar

      `mapping(int:array(Rule)) Parser.LR.Parser.grammar`

    Description

      The grammar itself.

    Variable start_state

      `Kernel Parser.LR.Parser.start_state`

    Description

      The initial LR0 state.

    Variable lr_error

      `int Parser.LR.Parser.lr_error`

    Description

      Error code

    Variable known_states

      `mapping(string:Kernel) Parser.LR.Parser.known_states`

    Description

      LR0 states that are already known to the compiler.

    Variable error_handler

      `function(SeverityLevel:void) Parser.LR.Parser.error_handler`

    Description

      Compile error and warning handler.

    Method rule_to_string

      `string rule_to_string(Rule r)`

    Description

      Pretty-prints a rule to a string.

    Parameter `r`

      Rule to print.

    Method item_to_string

      `string item_to_string(Item i)`

    Description

      Pretty-prints an item to a string.

    Parameter `i`

      Item to pretty-print.

    Method state_to_string

      `string state_to_string(Kernel state)`

    Description

      Pretty-prints a state to a string.

    Parameter `state`

      State to pretty-print.

    Method _sprintf

      `string _sprintf()`

    Description

      Pretty-prints the current grammar to a string.

    Method cast

      `mixed cast(string type)`

    Description

      Implements casting.

    Parameter `type`

      Type to cast to.

    Method set_priority

      `void set_priority(string terminal, int pri_val)`

    Description

      Sets the priority of a terminal.

    Parameter `terminal`

      Terminal to set the priority for.

    Parameter `pri_val`

      Priority; higher = prefer this terminal.

    Method set_associativity

      `void set_associativity(string terminal, int assoc)`

    Description

      Sets the associativity of a terminal.

    Parameter `terminal`

      Terminal to set the associativity for.

    Parameter `assoc`

      Associativity; negative - left, positive - right, zero - no associativity.

    Method set_symbol_to_string

      `void set_symbol_to_string(void|function(int|string:string) s_to_s)`

    Description

      Sets the symbol to string conversion function. The conversion function is used by the various *_to_string functions to make comprehensible output.

    Parameter `s_to_s`

      Symbol to string conversion function. If zero or not specified, use the built-in function.

    Method set_error_handler

      `void set_error_handler(void|function(SeverityLevel:void) handler)`

    Description

      Sets the error report function.

    Parameter `handler`

      Function to call to report errors and warnings. If zero or not specifier, use the built-in function.

    Method add_rule

      `void add_rule(Rule r)`

    Description

      Add a rule to the grammar.

    Parameter `r`

      Rule to add.

    Variable s_q

      `StateQueue Parser.LR.Parser.s_q`

    Description

      Contains all states used. In the queue section are the states that remain to be compiled.

    Method compile

      `int compile()`

    Description

      Compiles the grammar into a parser, so that parse() can be called.

    Method parse

      `mixed parse(object|function(void:string|array(string|mixed)) scanner, void|object action_object)`

    Description

      Parse the input according to the compiled grammar. The last value reduced is returned.

    Note

      The parser must have been compiled (with compile()) prior to calling this function.

    Bugs

      Errors should be throw()n.

    Parameter `scanner`

      The scanner function. It returns the next symbol from the input. It should either return a string (terminal) or an array with a string (terminal) and a mixed (value). EOF is indicated with the empty string.

    Parameter `action_object`

      Object used to resolve those actions that have been specified as strings.

    CLASS Parser.LR.Parser.Item

      Description

        An LR(0) item, a partially parsed rule.

      Variable r

        `Rule Parser.LR.Parser.Item.r`

      Description

        The rule

      Variable offset

        `int Parser.LR.Parser.Item.offset`

      Description

        How long into the rule the parsing has come.

      Variable next_state

        `Kernel Parser.LR.Parser.Item.next_state`

      Description

        The state we will get if we shift according to this rule

      Variable master_item

        `Item Parser.LR.Parser.Item.master_item`

      Description

        Item representing this one (used for shifts).

      Variable direct_lookahead

        `multiset(string) Parser.LR.Parser.Item.direct_lookahead`

      Description

        Look-ahead set for this item.

      Variable error_lookahead

        `multiset(string) Parser.LR.Parser.Item.error_lookahead`

      Description

        Look-ahead set used for detecting conflicts

      Variable relation

        `multiset(Item) Parser.LR.Parser.Item.relation`

      Description

        Relation to other items (used when compiling).

      Variable counter

        `int Parser.LR.Parser.Item.counter`

      Description

        Depth counter (used when compiling).

      Variable number

        `int Parser.LR.Parser.Item.number`

      Description

        Item identification number (used when compiling).

      Variable item_id

        `int Parser.LR.Parser.Item.item_id`

      Description

        Used to identify the item. Equal to r->number + offset.

    CLASS Parser.LR.Parser.Kernel

      Description

        Implements an LR(1) state

      Variable rules

        `multiset(Rule) Parser.LR.Parser.Kernel.rules`

      Description

        Used to check if a rule already has been added when doing closures.

      Variable items

        `array(Item) Parser.LR.Parser.Kernel.items`

      Description

        Contains the items in this state.

      Variable item_id_to_item

        `mapping(int:Item) Parser.LR.Parser.Kernel.item_id_to_item`

      Description

        Used to lookup items given rule and offset

      Variable symbol_items

        `mapping(int:multiset(Item)) Parser.LR.Parser.Kernel.symbol_items`

      Description

        Contains the items whose next symbol is this non-terminal.

      Variable action

        `mapping(int|string:Kernel|Rule) Parser.LR.Parser.Kernel.action`

      Description

        The action table for this state

             object(kernel)    SHIFT to this state on this symbol.
             object(rule)      REDUCE according to this rule on this symbol.

      Variable closure_set

        `multiset Parser.LR.Parser.Kernel.closure_set`

      Description

        The symbols that closure has been called on.

      Method add_item

        `void add_item(Item i)`

      Description

        Add an item to the state.

      Method closure

        `void closure(int nonterminal)`

      Description

        Make the closure of this state.

      Parameter `nonterminal`

        Nonterminal to make the closure on.

      Method goto_set

        `multiset(int|string) goto_set()`

      Description

        Make the goto-set of this state.

      Method do_goto

        `Kernel do_goto(int|string symbol)`

      Description

        Generates the state reached when doing goto on the specified symbol. i.e. it compiles the LR(0) state.

      Parameter `symbol`

        Symbol to make goto on.

    CLASS Parser.LR.Parser.StateQueue

      Description

        This is a queue, which keeps the elements even after they are retrieved.

      Variable head

        `int Parser.LR.Parser.StateQueue.head`

      Description

        Index of the head of the queue.

      Variable tail

        `int Parser.LR.Parser.StateQueue.tail`

      Description

        Index of the tail of the queue.

      Variable arr

        `array(Kernel) Parser.LR.Parser.StateQueue.arr`

      Description

        The queue itself.

      Method push

        `Kernel push(Kernel state)`

      Description

        Pushes the state on the queue.

      Parameter `state`

        State to push.

      Method next

        `Kernel next()`

      Description

        Return the next state from the queue.

  Module Parser.LR.GrammarParser

    Description

      This module generates an LR parser from a grammar specified according to the following grammar:

                  directives : directive ;
          	   directives : directives directive ;
          	   directive : declaration ;
          	   directive : rule ;
          	   declaration : "%token" terminals ";" ;
          	   rule : nonterminal ":" symbols ";" ;
          	   rule : nonterminal ":" symbols action ";" ;
          	   symbols : symbol ;
          	   symbols : symbols symbol ;
          	   terminals : terminal ;
          	   terminals : terminals terminal ;
          	   symbol : nonterminal ;
          	   symbol : "string" ;
          	   action : "{" "identifier" "}" ;
          	   nonterminal : "identifier" ;
          	   terminal : "string";

    Variable lr_error

      `int Parser.LR.GrammarParser.lr_error`

    Description

      Error code from the parsing.

    Method make_parser

      `Parser make_parser(string str, object|void m)`

    Description

      Compiles the parser-specification given in the first argument. Named actions are taken from the object if available, otherwise left as is.

    Bugs

      Returns error-code in both GrammarParser.error and return_value->lr_error.

    Method make_parser_from_file

      `int|Parser make_parser_from_file(string fname, object|void m)`

    Description

      Compiles the file specified in the first argument into an LR parser.

    See also

      make_parser

Module Parser.Pike

  Description

    This module parses and tokenizes Pike source code.

  Inherit "C.pmod"

    inherit "C.pmod"

  Method split

    `array(string) split(string data, void|mapping state)`

  Description

    Splits the data string into an array of tokens. An additional element with a newline will be added to the resulting array of tokens. If the optional argument state is provided the split function is able to pause and resume splitting inside #"" and /**/ tokens. The state argument should be an initially empty mapping, in which split will store its state between successive calls.

  CLASS Parser.Pike.UnterminatedStringError

    Description

      Error thrown when an unterminated string token is encountered.

    Inherit Generic

      inherit Error.Generic : Generic

    Variable err_str

      `string Parser.Pike.UnterminatedStringError.err_str`

    Description

      The string that failed to be tokenized

Module Parser.Python

  Method split

    `array(string) split(string data)`

  Description

    Returns the provided string with Python code as an array with tokens.

Module Parser.C

  Method split

    `array(string) split(string data, void|mapping state)`

  Description

    Splits the data string into an array of tokens. An additional element with a newline will be added to the resulting array of tokens. If the optional argument state is provided the split function is able to pause and resume splitting inside /**/ tokens. The state argument should be an initially empty mapping, in which split will store its state between successive calls.

  Method tokenize

    `array(Token) tokenize(array(string) s, void|string file)`

  Description

    Returns an array of Token objects given an array of string tokens.

  Method group

    `array(Token|array) group(array(string|Token) tokens, void|mapping(string:string) groupings)`

  Description

    Fold sub blocks of an array of tokens into sub arrays, for grouping purposes.

  Parameter `tokens`

    The token array to fold.

  Parameter `groupings`

    Supplies the tokens marking the boundaries of blocks to fold. The indices of the mapping mark the start of a block, the corresponding values mark where the block ends. The sub arrays will start and end in these tokens. If no groupings mapping is provided, {}, () and [] are used as block boundaries.

  Method strip_line_statements

    `array(Token|array) strip_line_statements(array(Token|array) tokens)`

  Description

    Strips off all (preprocessor) line statements from a token array.

  Method hide_whitespaces

    `array hide_whitespaces(array tokens)`

  Description

    Folds all whitespace tokens into the previous token's trailing_whitespaces.

  Method simple_reconstitute

    `string simple_reconstitute(array(string|Token|array) tokens)`

  Description

    Reconstitutes the token array into a plain string again; essentially reversing split() and whichever of the tokenize , group and hide_whitespaces methods may have been invoked.

  Method reconstitute_with_line_numbers

    `string reconstitute_with_line_numbers(array(string|Token|array) tokens)`

  Description

    Like simple_reconstitute , but adding additional `#line n "file"` preprocessor statements in the output whereever a new line or file starts.

  CLASS Parser.C.Token

    Description

      Represents a C token, along with a selection of associated data and operations.

    Variable line

      `int Parser.C.Token.line`

    Description

      The line where the token was found.

    Variable text

      `string Parser.C.Token.text`

    Description

      The actual token.

    Variable file

      `string Parser.C.Token.file`

    Description

      The file in which the token was found.

    Variable trailing_whitespaces

      `string Parser.C.Token.trailing_whitespaces`

    Description

      Trailing whitespaces.

    Method create

      `void Parser.C.Token(string text, void|int line, void|string file, void|string trailing_whitespace)`

    Method _sprintf

      `string _sprintf(int how)`

    Description

      If the object is printed as %s it will only output its text contents.

    Method `==

      `int `==(mixed foo)`

    Description

      Tokens are considered equal if the text contents are equal. It is also possible to compare the Token object with a text string directly.

    Method `+

      `string `+(string ... s)`

    Description

      A string can be added to the Token, which will be added to the text contents.

    Method ``+

      `string ``+(string ... s)`

    Description

      A string can be added to the Token, which will be added to the text contents.

    Method cast

      `mixed cast(string to)`

    Description

      It is possible to case a Token object to a string. The text content will be returned.

    Method `[]

      `int|string `[](int a, void|int b)`

    Description

      Characters and ranges may be indexed from the text contents of the token.

Module _Roxen

  Method make_http_headers

    `string make_http_headers(mapping(string:string|array(string)) headers, int(0..1)|void no_terminator)`

  Method http_decode_string

    `string http_decode_string(string encoded)`

  Description

    Decodes an http transport-encoded string.

  Method html_encode_string

    `string html_encode_string(mixed in)`

  Description

    Encodes the in data as an HTML safe string.

  CLASS _Roxen.HeaderParser

    Description

      Class for parsing HTTP-requests.

    Method feed

      `array(string|mapping) feed(string data)`

    Returns

      Array
      `string 0` | Trailing data.
      `string 1` | First line of request.
      `mapping(string:string|array(string)) 2` | Headers.

    Method create

      `void _Roxen.HeaderParser(int throw_errors)`

Module String

  Constant __HAVE_SPRINTF_STAR_MAPPING__

    `constant String.__HAVE_SPRINTF_STAR_MAPPING__`

  Description

    Presence of this symbol indicates that sprintf() supports mappings for the `'*'`-modifier syntax.

  See also

    sprintf() , lfun::_sprintf()

  Constant __HAVE_SPRINTF_NEGATIVE_F__

    `constant String.__HAVE_SPRINTF_NEGATIVE_F__`

  Description

    Presence of this symbol indicates that sprintf() supports little endian output for the `'F'`-format specifier.

  See also

    sprintf() , lfun::_sprintf()

  Method implode_nicely

    `string implode_nicely(array(string|int|float) foo, string|void separator)`

  Description

    This function implodes a list of words to a readable string, e.g. `({"straw","berry","pie"})` becomes `"straw, berry and pie"`. If the separator is omitted, the default is `"and"`. If the words are numbers they are converted to strings first.

  See also

    `*()

  Method capitalize

    `string capitalize(string str)`

  Description

    Convert the first character in str to upper case, and return the new string.

  See also

    lower_case() , upper_case()

  Method sillycaps

    `string sillycaps(string str)`

  Description

    Convert the first character in each word (separated by spaces) in str to upper case, and return the new string.

  Method common_prefix

    `string common_prefix(array(string) strs)`

  Description

    Find the longest common prefix from an array of strings.

  Method fuzzymatch

    `int(0..100) fuzzymatch(string a, string b)`

  Description

    This function compares two strings using a fuzzy matching routine. The higher the resulting value, the better the strings match.

  See also

    Array.diff() , Array.diff_compare_table() Array.diff_longest_sequence()

  Method soundex

    `string soundex(string word)`

  Description

    Returns the soundex value of word according to the original Soundex algorithm, patented by Margaret O´Dell and Robert C. Russel in 1918. The method is based on the phonetic classification of sounds by how they are made. It was only intended for hashing of english surnames, and even at that it isn't that much of a help.

  Method int2roman

    `string int2roman(int m)`

  Description

    Converts the provided integer to a roman integer (i.e. a string).

  Throws

    Throws an error if m is outside the range 0 to 10000.

  Method int2size

    `string int2size(int size)`

  Description

    Returns the size as a memory size string with suffix, e.g. 43210 is converted into "42.2 kB". To be correct to the latest standards it should really read "42.2 KiB", but we have chosen to keep the old notation for a while. The function knows about the quantifiers kilo, mega, giga, tera, peta, exa, zetta and yotta.

  Method expand_tabs

    `string expand_tabs(string s, int|void tab_width, string|void substitute_tab, string|void substitute_space, string|void substitute_newline)`

  Description

    Expands tabs in a string to ordinary spaces, according to common tabulation rules.

  Method int2char

    `string int2char(int x)`

  Description

    Same as sprintf("%c",x);

  See also

    sprintf()

  Method int2hex

    `string int2hex(int x)`

  Description

    Same as `sprintf("%x",x);`, i.e. returns the integer x in hexadecimal base using lower cased symbols.

  See also

    sprintf()

  Method string2hex

    `string string2hex(string data)`

  Description

    Convert a string of binary data to a hexadecimal string.

  See also

    hex2string()

  Method hex2string

    `string hex2string(string hex)`

  Description

    Convert a string of hexadecimal digits to binary data.

  See also

    string2hex()

  Method secure

    `void secure(string str)`

  Description

    Marks the string as secure, which will clear the memory area before freeing the string.

  Method count

    `int count(string haystack, string needle)`

  Description

    Count the number of non-overlapping times the string needle occurs in the string haystack . The special cases for the needle `""` is that it occurs one time in the empty string, zero times in a one character string and between every character (length-1) in any other string.

  See also

    search() , `/()

  Method trim_whites

    `string trim_whites(string s)`

  Description

    Trim leading and trailing spaces and tabs from the string s .

  Method normalize_space

    `string normalize_space(string s, string|void whitespace)`

  Parameter `s`

    Is returned after white space in it has been normalised. White space is normalised by stripping leading and trailing white space and replacing sequences of white space characters with a single space.

  Parameter `whitespace`

    Defines what is considered to be white space eligible for normalisation. It has a default value that starts with `" \t\r\n\v\f"` and in addition to that contains all whitespace characters part of Unicode. The first character denotes the character for replacing whitespace sequences.

  Note

    Trailing and leading whitespace around \r and \n characters is stripped as well (only useful if they're not in the whitespace set).

  Note

    This function is a lot faster with just one argument (i.e. the builtin whitespace set has an optimised code path).

  Method trim_all_whites

    `string trim_all_whites(string s)`

  Description

    Trim leading and trailing white spaces characters (space, tab, newline, carriage return, form feed, vertical tab and all the white spaces defined in Unicode) from the string s .

  Method width

    `int(8..8)|int(16..16)|int(32..32) width(string s)`

  Description

    Returns the width of a string.

    Three return values are possible:

    `8` | The string s only contains characters <= 255.
    `16` | The string s only contains characters <= 65535.
    `32` | The string s contains characters >= 65536.

  CLASS String.Iterator

    Description

      An object of this class is returned by get_iterator() when called with a string.

    See also

      get_iterator

    Inherit predef::Iterator

      inherit predef::Iterator : predef::Iterator

  CLASS String.SplitIterator

    Description

      An iterator that iterates over substrings of a string, separated by a character or several different characters.

    Note

      Typically you don't need to explicitly use the SplitIterator. Expressions like the following are automatically optimized into using a SplitIterator.

      foreach(str/"\n", string line) write("%s\n", line);

  Inherit predef::Iterator

    inherit predef::Iterator : predef::Iterator

  Method create

    `void String.SplitIterator(string buffer, int|array(int)|multiset(int) split_set, int|void flags, function(:string)|void feed)`

  Parameter `buffer`

    The string to split.

  Parameter `split_set`

    The character or characters to split on.

  Parameter `flags`

    Skip empty elements if set.

  Parameter `feed`

    Callback function that is called once the buffer is used up and the SplitIterator wants more data.

CLASS String.Buffer

  Description

    A buffer, used for building strings. It's conceptually similar to a string, but you can only add strings to it, and you can only get the value from it once.

    There is a reason for those seemingly rather odd limitations, it makes it possible to do some optimizations that really speed things up.

    You do not need to use this class unless you add very many strings together, or very large strings.

  Example

        For the fastest possible operation, write your code like this:

    String.Buffer b = String.Buffer( );

    function add = b->add;

    .. call add several times in code ...

    string result = b->get(); // also clears the buffer

Method create

  `void String.Buffer(int initial_size)`

Description

  Initializes a new buffer.

  If no initial_size is specified, 256 is used. If you know approximately how big the buffer will be, you can optimize the operation of add() (slightly) by passing the size to this function.

Method _sprintf

  `string _sprintf(int flag, mapping flags)`

Description

  It is possible to sprintf a String.Buffer object as `%s` just as if it was a string.

Method cast

  `mixed cast(string type)`

Description

  It is possible to cast a String.Buffer object to a `string` and an `int`.

Method `+

  `String.Buffer `+(string what)`

Method `+=

  `String.Buffer `+=(string what)`

Method add

  `int add(string ... data)`

Description

  Adds data to the buffer. Returns the size of the buffer.

Method putchar

  `void putchar(int c)`

Description

  Appends the character c at the end of the string.

Method get_copy

  `string get_copy()`

Description

  Get the data from the buffer. Significantly slower than get , but does not clear the buffer.

Method get

  `string get()`

Description

  Get the data from the buffer.

Note

  This will clear the data in the buffer

Method _sizeof

  `int _sizeof()`

Description

  Returns the size of the buffer.

CLASS String.Replace

  Description

    This is a "compiled" version of the replace function applied on a string, with more than one replace string. The replace strings are given to the create method as a from and to array and are then analyzed. The ``()` is then called with a string and the replace rules in the Replace object will be applied. The Replace object is used internally by the Pike optimizer and need not be used manually.

  Method create

    `void String.Replace(array(string)|mapping(string:string)|void from, array(string)|string|void to)`

  Method `()

    `string `()(string str)`

  Method _encode

    `array(array(string)) _encode()`

  Method _decode

    `void _decode(array(array(string)) encoded)`

CLASS String.SingleReplace

  Description

    This is a "compiled" version of the replace function applied on a string, with just one replace string. The replace strings are given to the create method as a from and tom string and are then analyzed. The ``()` is then called with a string and the replace rule in the Replace object will be applied. The Replace object is used internally by the Pike optimizer and need not be used manually.

  Method create

    `void String.SingleReplace(string|void from, string|void to)`

  Note

    May be called with either zero or two arguments.

  Method `()

    `string `()(string str)`

  Method _encode

    `array(string) _encode()`

  Method _decode

    `void _decode(array(string)|int(0..0) encoded)`

CLASS String.Bootstring

  Description

    This class implements the "Bootstring" string transcoder described in ftp://ftp.rfc-editor.org/in-notes/rfc3492.txt.

  Method decode

    `string decode(string s)`

  Description

    Decodes a Bootstring encoded string of "basic" code points back to the original string space.

  Method encode

    `string encode(string s)`

  Description

    Encodes a string using Bootstring encoding into a string constisting only of "basic" code points (< initial_n).

  Method create

    `void String.Bootstring(int base, int tmin, int tmax, int skew, int damp, int initial_bias, int initial_n, int delim, string digits)`

  Description

    Creates a Bootstring transcoder instance using the specified parameters.

  Parameter `base`

    The base used by the variable-length integers.

  Parameter `tmin`

    The minimum threshold digit value for the variable-length integers. Must be >=0 and <= tmax.

  Parameter `tmax`

    The maximum threshold digit value for the variable-length integers. Must be <= base-1.

  Parameter `skew`

    The skew term for the bias adapation. Must be >= 1.

  Parameter `damp`

    The damping factor for the bias adaption. Must be >= 2.

  Parameter `initial_bias`

    The initial bias for the variable-length integer thresholding. initial_bias % base must be <= base - tmin.

  Parameter `initial_n`

    The first code point outside the "basic" set of code points.

  Parameter `delim`

    The "basic" code point used as the delimiter.

  Parameter `digits`

    The "basic" code points used as digits. The length of the string should be the same as the base parameter.

Module String.HTML

  Description

    Functions that helps generating HTML. All functions generates HTML that is XHTML compliant as well as backwards compatible with old HTML standards in what extent is possible.

  Method select

    `string select(string name, array(string)|array(array(string)) choices, void|string selected)`

  Description

    Creates an HTML select list.

  Parameter `name`

    The name of the select list. Will be used in the name attribute of the select element.

  Parameter `choices`

    May either be an array of strings, where each string is a choice, or an array of pairs. A pair is an array with two strings. The first string is the value of the choice while the second string is the presentation text associated with the value.

  Parameter `selected`

    The value that should be selected by default, if any.

  Example

        select("language",
              ({ ({ "eng", "English" }),
                 ({ "swe", "Swedish" }),
                 ({ "nor", "Norwegian" }) }),
              "swe");

  Method simple_obox

    `string simple_obox(array(array(string)) rows, void|string frame_color, void|string cell_color, void|string width, void|string padding, void|function(int:string) cell_callback)`

  Description

    This function should solve most of the obox needs that arises. It creates a table out of the array of arrays of strings fed into it. The tables will (with default settings) have a thin black outline around the table and between its cells. Much effort has gone into finding a simple HTML reresentation of such obox that is rendered in a similar way in all popular browsers. The current implementation has been tested against IE, Netscape, Mozilla, Opera and Konquest.

  Parameter `rows`

    Simply an array of arrays with strings. The strings are the values that should appear in the table cells. All rows should have equal number of cells, otherwise the result will not be very eye pleasing.

  Parameter `frame_color`

    The color of the surrounding frame. Defaults to "#000000".

  Parameter `cell_color`

    The background color of the cells. Defaults to "#ffffff".

  Parameter `width`

    The border width. Defaults to "1".

  Parameter `padding`

    The amount of padding in each cell. Defaults to "3".

  Parameter `cell_callback`

    If provided, the cell callback will be called for each cell. As in parameters it will get the current x and y coordinates in the table. The upper left cell is 0,0. In addition to the coordinates it will also receive the background color and the contents of the current cell. It is expected to return a td-element.

  Example

        function cb = lambda(int x, int y, string bgcolor, string contents) {
             if(y%2) return "<td bgcolor='#aaaaff'>"+contents+"</td>";
             return "<td bgcolor='"+bgcolor+"'>"+contents+"</td>";
           }
           simple_obox(my_rows, "#0000a0", 0, "1", "3", cb);

  See also

    pad_rows

  Method pad_rows

    `array(array(string)) pad_rows(array(array(string)) rows, void|string padding)`

  Description

    Pads out the rows in a array of rows to equal length. The new elements in the rows will have the value provided in padding , or "&nbsp;".

  CLASS String.HTML.OBox

    Description

      Provides the same functionality as the simple_obox function, in a "streaming" way. The real gain is different addtition methods as well as the possibility to change the cell callback at any time.

    See also

      simple_obox

    Method create

      `void String.HTML.OBox(void|string frame_color, void|string cell_color, void|string width, void|string padding, void|function(int:string) cell_callback)`

    Method set_cell_callback

      `void set_cell_callback(function(int:string) cell_callback)`

    Method set_extra_args

      `void set_extra_args(mapping(string:string) extra_args)`

    Description

      The argument in the mapping will be added to all created table cells.

    Method set_extra_args

      `void set_extra_args(array(mapping(string:string)) extra_args)`

    Description

      The argument in the mappings will be added to the cell in the cooresponding column of the table.

    Method add_raw_cell

      `void add_raw_cell(string cell)`

    Description

      Adds this cell to the table unmodified, e.g. it should have an enclosing td or th element.

    Method add_tagdata_cell

      `void add_tagdata_cell(string tag, mapping(string:string) args, string contents)`

    Description

      Creates a cell from the provided arguments and adds it to the table.

    Parameter `tag`

      The name of the element that should be produces. Typically "td" or "th".

    Parameter `args`

      A mapping with the elements attributes.

    Parameter `contents`

      The element contents.

    Method add_cell

      `void add_cell(string contents)`

    Description

      Adds a cell with the provided content.

    Method new_row

      `void new_row()`

    Description

      Begin a new row. Succeeding cells will be added to this row instead of the current.

    Method add_row

      `void add_row(array(string) cells)`

    Description

      Adds a complete row. If the current row is nonempty a new row will be started.

    Method pad_rows

      `void pad_rows()`

    Description

      Ensures that all rows have the same number of cells.

    Method render

      `string render()`

    Description

      Returns the result.

    Method cast

      `mixed cast(string to)`

    Description

      It is possible to case this object to a string, which does the same as calling render , and to an array, which returns the cells in an array of rows.

Module String.Elite

  Method elite_word

    `string elite_word(string in, void|int(0..100) leetp, void|int(0..2) eightbit)`

  Description

    Translates one word to 1337. The optional argument leetp is the maximum percentage of leetness (100=max leet, 0=no leet). elite_word only do character-based translation, for instance from "k" to "|<", but no language translation (no "cool" to "kewl").

  Method elite_string

    `string elite_string(string in, void|int(0..100) leetp, void|int(0..1) eightbit)`

  Description

    Translates a string to 1337. The optional argument leetp is the maximum percentage of leetness (100=max leet, 0=no leet).

    The translation is performed in three steps, first the neccesary elite translations (picture -> pic, cool->kewl etc), then optional translations (ok->k, dude->dood, -ers -> -orz), then calls elite_word on the resulting words.

Module DVB

  Description

    Implements Digital Video Broadcasting interface

  Note

    Only Linux version is supported.

  CLASS DVB.dvb

    Description

      Main class.

    Method create

      `void DVB.dvb(int card_number)`

    Description

      Create a DVB object.

    Parameter `card_number`

      The number of card equipment.

    Note

      The number specifies which device will be opened. Ie. /dev/ost/demux0, /dev/ost/demux1 ... for DVB v0.9.4 or /dev/dvb/demux0, /dev/dvb/demux1 ... for versions 2.0+

    Method fe_status

      `mapping|int fe_status()`

    Description

      Return status of a DVB object's frondend device.

    Returns

      The resulting mapping contains the following fields:

      `"power" : string` | If 1 the frontend is powered up and is ready to be used.
      `"signal" : string` | If 1 the frontend detects a signal above a normal noise level
      `"lock" : string` | If 1 the frontend successfully locked to a DVB signal
      `"carrier" : string` | If 1 carrier dectected in signal
      `"biterbi" : string` | If 1 then lock at viterbi state
      `"sync" : string` | If 1 then TS sync byte detected
      `"tuner_lock" : string` | If 1 then tuner has a frequency lock

    Method fe_info

      `mapping fe_info()`

    Description

      Return info of a frondend device.

    Note

      The information heavily depends on driver. Many fields contain dumb values.

    Method tune

      `int tune(int(0..3) lnb, int freq, int(0..1)|string pol, int sr)`

    Description

      Tunes to apropriate transponder's parameters.

    Parameter `lnb`

      DiSeQc number of LNB.

    Parameter `freq`

      Frequency divided by 1000.

    Parameter `pol`

      Polarization. `0` or `"v"` for vertical type, `1` or `"h"` for horizontal one.

    Parameter `sr`

      The service rate parameter.

    Method get_pids

      `mapping|int get_pids()`

    Description

      Returns mapping with info of currently tuned program's pids.

    See also

      tune()

    Method analyze_pat

      `mapping analyze_pat()`

    Description

      Return mapping of all PMT.

      sid:prognum

    Method analyze_pmt

      `array(mapping)|int analyze_pmt(int sid, int prognum)`

    Description

      Parse PMT table.

    See also

      analyze_pat()

    Method stream

      `DVB.Stream stream(int pid, int|function rcb, int ptype)`
      `DVB.Stream stream(int pid, int|function rcb)`
      `DVB.Stream stream(int pid)`

    Description

      Create a new stream reader object for PID.

    Parameter `pid`

      PID of stream.

    Parameter `rcb`

      Callback function called whenever there is the data to read from stream. Only for nonblocking mode.

    Parameter `ptype`

      Type of payload data to read. By default, audio data is fetched.

    Note

      Setting async callback doesn't set the object to nonblocking state.

    See also

      DVB.Stream()->read()

  CLASS DVB.Stream

    Description

      Represents an elementary data stream (PES).

    Method destroy

      `int destroy()`

    Description

      Purge a stream reader.

    See also

      DVB.dvb()->stream() , read()

    Method read

      `string|int read()`

    Description

      Read data from a stream. It reads up to read buffer size data.

    Note

      Read buffer size is 4096 by default.

    See also

      DVB.dvb()->stream() , close()

    Method close

      `void close()`

    Description

      Closes an open stream.

    See also

      read()

  CLASS DVB.Audio

    Description

      Object for controlling an audio subsystem on full featured cards.

    Method create

      `void DVB.Audio(int card_number)`
      `void DVB.Audio()`

    Description

      Create a Audio object.

    Parameter `card_number`

      The number of card equipment.

    Method mute

      `int mute(int mute)`
      `int mute()`

    Description

      Mute or unmute audio device.

    Method status

      `mapping status()`

    Description

      Returns mapping of current audio device status.

    Method mixer

      `int mixer(int left, int right)`
      `int mixer(int both)`

    Description

      Sets output level on DVB audio device.

Module Odbc

  Description

    Low-level interface to Open DataBase Connectivity SQL-drivers.

  Note

    You typically don't want to access this module directly, but instead use Sql.Sql() with an `"odbc://"` or `"dsn://"` URL.

  See also

    Sql.Sql()

  Method list_dbs

    `array(string) list_dbs()`

  Description

    List the configured ODBC database sources.

  Method connect_lock

    `int(0..1) connect_lock(void|int enable)`

  Description

    Enable or disable a mutex that serializes all ODBC SQLConnect calls (i.e. when ODBC connections are created). This lock might be necessary to work around bugs in ODBC drivers.

  Parameter `enable`

    Enables the mutex if nonzero, disables it otherwise. The state is not changed if this argument is left out.

  Returns

    The old state of the flag.

  Note

    This is currently enabled by default due to bugs in the current FreeTDS library (version 0.63), but that might change if the demand for this kludge ceases in the future. Therefore, if this setting is important to you then always set it explicitly. Hopefully most users don't need to bother with it.

  CLASS Odbc.odbc

    Description

      Low-level connection to an ODBC or DSN database.

    Note

      You typically don't want to access this module directly, but instead use the Sql.odbc or Sql.dsn created by Sql.Sql() .

    See also

      Sql.odbc , Sql.dsn

Module GSSAPI

  Description

    This is pike glue for GSS-API ver 2 as specified in RFC 2743.

    GSS-API is used to authenticate users and servers, and optionally also to encrypt communication between them. The API is generic and can be used without any knowledge of the actual implementation of these security services, which is typically provided by the operating system.

    The most common implementation at the time of writing is Kerberos, which means that the main benefit of this API is to allow clients and servers to authenticate each other using Kerberos, thereby making single sign-on possible in a Kerberized environment.

    All functions in this module that wraps GSS-API routines might throw GSSAPI.Error , and by default they do for all such errors. Only in some special cases do they return when a GSS-API error has happened, and that is noted in the documentation.

  Constant ERROR_MASK

    `constant GSSAPI.ERROR_MASK`

  Description

    Bitfield mask for the routine error part of major status codes like GSSAPI.Error.major_status . After applying this mask, the status values may be compared to any of the routine error constants.

    `constant GSSAPI.BAD_MECH`
    `constant GSSAPI.BAD_NAME`
    `constant GSSAPI.BAD_NAMETYPE`
    `constant GSSAPI.BAD_BINDINGS`
    `constant GSSAPI.BAD_STATUS`
    `constant GSSAPI.BAD_SIG`
    `constant GSSAPI.NO_CRED`
    `constant GSSAPI.NO_CONTEXT`
    `constant GSSAPI.DEFECTIVE_TOKEN`
    `constant GSSAPI.DEFECTIVE_CREDENTIAL`
    `constant GSSAPI.CREDENTIALS_EXPIRED`
    `constant GSSAPI.CONTEXT_EXPIRED`
    `constant GSSAPI.FAILURE`
    `constant GSSAPI.BAD_QOP`
    `constant GSSAPI.UNAUTHORIZED`
    `constant GSSAPI.UNAVAILABLE`
    `constant GSSAPI.DUPLICATE_ELEMENT`
    `constant GSSAPI.NAME_NOT_MN`

  Description

    Constants for routine errors in major status codes like GSSAPI.Error.major_status . See RFC 2743 section 1.2.1.1. Note that major status codes have to be masked with GSSAPI.ERROR_MASK before comparison with these.

    Brief descriptions of the flags:

    GSSAPI.BAD_BINDINGS

      Channel binding mismatch.

    GSSAPI.BAD_MECH

      Unsupported mechanism requested.

    GSSAPI.BAD_NAME

      Invalid name provided.

    GSSAPI.BAD_NAMETYPE

      Name of unsupported type provided.

    GSSAPI.BAD_STATUS

      Invalid input status selector.

    GSSAPI.BAD_MIC

      Token had invalid integrity check.

    GSSAPI.CONTEXT_EXPIRED

      Specified security context expired.

    GSSAPI.CREDENTIALS_EXPIRED

      Expired credentials detected.

    GSSAPI.DEFECTIVE_CREDENTIAL

      Defective credential detected.

    GSSAPI.DEFECTIVE_TOKEN

      Defective token detected.

    GSSAPI.FAILURE

      Failure, unspecified at GSS-API level. GSSAPI.Error.minor_status should provide further details.

    GSSAPI.NO_CONTEXT

      No valid security context specified.

    GSSAPI.NO_CRED

      No valid credentials provided.

    GSSAPI.BAD_QOP

      Unsupported QOP value.

    GSSAPI.UNAUTHORIZED

      Operation unauthorized.

    GSSAPI.UNAVAILABLE

      Operation unavailable.

    GSSAPI.DUPLICATE_ELEMENT

      Duplicate credential element requested.

    GSSAPI.NAME_NOT_MN

      Name contains multi-mechanism elements.

  Constant INFO_MASK

    `constant GSSAPI.INFO_MASK`

  Description

    Bitfield mask for the informatory part of major status codes like GSSAPI.Error.major_status .

    `constant GSSAPI.CONTINUE_NEEDED`
    `constant GSSAPI.DUPLICATE_TOKEN`
    `constant GSSAPI.OLD_TOKEN`
    `constant GSSAPI.UNSEQ_TOKEN`
    `constant GSSAPI.GAP_TOKEN`

  Description

    Bitfield flags for informatory codes in major status codes like GSSAPI.Error.major_status . See RFC 2743 section 1.2.1.1. Any combination of these might optionally be combined with one routine error constant to form a major status code.

    Brief descriptions of the flags:

    GSSAPI.CONTINUE_NEEDED

      Continuation call to routine required.

    GSSAPI.DUPLICATE_TOKEN

      Duplicate per-message token detected.

    GSSAPI.OLD_TOKEN

      Timed-out per-message token detected.

    GSSAPI.UNSEQ_TOKEN

      Reordered (early) per-message token detected.

    GSSAPI.GAP_TOKEN

      Skipped predecessor token(s) detected.

  Method major_status_messages

    `array(string) major_status_messages(int major_status)`

  Description

    Given a major status code like GSSAPI.Error.major_status (or more commonly GSSAPI.Context.last_major_status in this case), returns an array containing messages for all the status values in it. The returned string(s) presumably don't end with linefeeds.

    This wraps `GSS_Display_status` according to RFC 2743 section 2.4.1.

  Method minor_status_messages

    `array(string) minor_status_messages(int minor_status, void|string mech)`

  Description

    Given a mechanism-specific minor status code like GSSAPI.Error.minor_status , returns an array containing messages for all the status values in it. The returned string(s) presumably don't end with linefeeds.

    This wraps `GSS_Display_status` according to RFC 2743 section 2.4.1.

  Parameter `minor_status`

    The mechanism-specific minor status.

  Parameter `mech`

    The mechanism that produced the status code. If this is zero or left out, a system default mechanism is used.

    `constant GSSAPI.NT_HOSTBASED_SERVICE`
    `constant GSSAPI.NT_USER_NAME`
    `constant GSSAPI.NT_MACHINE_UID_NAME`
    `constant GSSAPI.NT_STRING_UID_NAME`
    `constant GSSAPI.NT_ANONYMOUS`
    `constant GSSAPI.NT_EXPORT_NAME`
    `constant GSSAPI.KRB5_NT_PRINCIPAL_NAME`

  Description

    String OIDs on dotted-decimal form for the GSS-API mechanism-independent name types, and some selected mechanism-specific ones:

    NT_HOSTBASED_SERVICE

      Name type for a service associated with a host computer. The syntax is `service@hostname` where the `@hostname` part may be omitted for the local host. See RFC 2743 section 4.1.

    NT_USER_NAME

      Name type for a named user on a local system. The syntax is `username`. See RFC 2743 section 4.2.

    NT_MACHINE_UID_NAME

      Name type for a numeric user identifier corresponding to a user on a local system. The string representing a name of this type should contain a locally-significant user ID, represented in host byte order. See RFC 2743 section 4.3.

    NT_STRING_UID_NAME

      Name type for a string of digits representing the numeric user identifier of a user on a local system. This name type is similar to the Machine UID Form, except that the buffer contains a string representing the user ID. See RFC 2743 section 4.4.

    NT_ANONYMOUS

      Name type to identify anonymous names. See RFC 2743 section 4.5.

    NT_EXPORT_NAME

      Name type for the Mechanism-Independent Exported Name Object type, which is the type of the names returned by GSSAPI.Name.export . See RFC 2743 section 4.7.

    KRB5_NT_PRINCIPAL_NAME

      Name type for a Kerberos principal. See RFC 1964 section 2.1.1.

    `constant GSSAPI.INITIATE`
    `constant GSSAPI.ACCEPT`
    `constant GSSAPI.BOTH`

  Description

    Flags for indicating how a GSSAPI.Cred object may be used:

    INITIATE

      The credential can only be used to initiate security contexts (i.e. using GSSAPI.InitContext ).

    ACCEPT

      The credential can only be used to accept security contexts (i.e. using GSSAPI.AcceptContext ).

    BOTH

      The credential may be used both to initiate or accept security contexts.

    `constant GSSAPI.DELEG_FLAG`
    `constant GSSAPI.MUTUAL_FLAG`
    `constant GSSAPI.REPLAY_FLAG`
    `constant GSSAPI.SEQUENCE_FLAG`
    `constant GSSAPI.CONF_FLAG`
    `constant GSSAPI.INTEG_FLAG`
    `constant GSSAPI.ANON_FLAG`
    `constant GSSAPI.PROT_READY_FLAG`
    `constant GSSAPI.TRANS_FLAG`

  Description

    Bitfield flags returned by e.g. GSSAPI.Context.services to denote various services that are available in the context.

    Brief descriptions of the flags:

    GSSAPI.DELEG_FLAG

      Delegation. See RFC 2743 section 1.2.9.

    GSSAPI.MUTUAL_FLAG

      Mutual authentication (actually, acceptor authentication). See RFC 2743 sections 1.1.1.3 and 1.2.5.

    GSSAPI.REPLAY_FLAG

      Per-message replay detection. See RFC 2743 section 1.2.3.

    GSSAPI.SEQUENCE_FLAG

      Per-message sequencing. See RFC 2743 section 1.2.3.

    GSSAPI.CONF_FLAG

      Per-message confidentiality. See RFC 2743 section 1.2.2.

    GSSAPI.INTEG_FLAG

      Per-message integrity. See RFC 2743 section 1.2.2.

    GSSAPI.ANON_FLAG

      Anonymous authentication. See RFC 2743 section 1.2.5.

    GSSAPI.PROT_READY_FLAG

      Might be set before the context establishment has finished, to denote that per-message protection already is available. See RFC 2743 section 1.2.7. Is always set in GSSAPI.Context and derived classes when the context is established.

    GSSAPI.TRANS_FLAG

      The context can be transferred between processes using GSSAPI.Context.export and GSSAPI.Context.import . See RFC 2743 section 1.2.10.

  Method describe_services

    `string describe_services(int services)`

  Description

    Returns a string that compactly describes the given services , which is taken as a bitfield of `GSSAPI.*_FLAG` flags.

    The returned string contains capitalized names for the flags reminiscent of the GSSAPI.*_FLAG constants, separated by `"|"`.

  Method indicate_mechs

    `multiset(string) indicate_mechs()`

  Description

    Returns the OIDs for the available mechanism in the GSS-API implementation. The OIDs are returned on dotted-decimal form.

    This wraps `GSS_Indicate_mechs` according to RFC 2743 section 2.4.2.

  Method names_for_mech

    `multiset(string) names_for_mech(string mech)`

  Description

    Returns the OIDs for the name types that the given mech supports. Both mech and the returned OID strings are on dotted-decimal form.

    This wraps `GSS_Inquire_names_for_mech` according to RFC 2743 section 2.4.12.

  CLASS GSSAPI.Error

    Description

      Error object used for GSS-API errors.

    Inherit Error.Generic

      inherit Error.Generic : Error.Generic

      `constant GSSAPI.Error.is_gssapi_error`
      `constant GSSAPI.Error.error_type`

    Description

      Object recognition constants.

    Variable major_status

      `int GSSAPI.Error.major_status`

    Description

      The major status code. This is a bitwise OR of one routine error code and zero or more supplementary error info bits.

      See RFC 2743 section 1.2.1.1 and RFC 2744 section 3.9.1. Note that the calling errors mentioned in RFC 2744 are never thrown.

    See also

      major_status_messages

    Variable minor_status

      `int GSSAPI.Error.minor_status`

    Description

      The minor status code specific for the mechanism.

    See also

      minor_status_messages , minor_status_mech

    Method create

      `void GSSAPI.Error(void|int major, void|int minor, void|string mech, void|string message, void|array backtrace)`

    Parameter `major`

      Initial value for major_status .

    Parameter `minor`

      Initial value for minor_status .

    Parameter `mech`

      Object identifier on dotted-decimal form for the mechanism that minor applies to.

    Parameter `message`

      Error message. This is prepended to the message generated from major_status and/or minor_status . `": "` is inserted in between.

    Parameter `backtrace`

      Backtrace. The current backtrace for the calling function is used if left out.

    Method major_status_messages

      `array(string) major_status_messages()`

    Description

      Returns an array containing messages for all the status values in major_status . See GSSAPI.major_status_messages for further details.

    Method minor_status_messages

      `array(string) minor_status_messages()`

    Description

      Returns an array containing messages for all the status values in minor_status . See GSSAPI.minor_status_messages for further details.

    Method minor_status_mech

      `string minor_status_mech()`

    Description

      Returns the OID for the mechanism that is used to interpret the minor status, or zero if no mechanism has been set. It is returned on dotted-decimal form.

  CLASS GSSAPI.MissingServicesError

    Description

      Error object used when one or more required services are missing in a GSSAPI.Context object.

    Inherit Error.Generic

      inherit Error.Generic : Error.Generic

      `constant GSSAPI.MissingServicesError.is_gssapi_missing_services_error`
      `constant GSSAPI.MissingServicesError.error_type`

    Description

      Object recognition constants.

    Variable services

      `int GSSAPI.MissingServicesError.services`

    Description

      Bitfield of `GSSAPI.*_FLAG` flags for the missing services that caused the error.

    See also

      GSSAPI.describe_services

    Method create

      `void GSSAPI.MissingServicesError(void|int missing_services)`

    Parameter `missing_services`

      Initial value for services .

  CLASS GSSAPI.Name

    Description

      An object of this class contains a name on the internal form which is required by the GSS-API functions. See RFC 2743, section 1.1.5.

    Method create

      `void GSSAPI.Name(string name, void|string name_type)`

    Description

      This wraps `GSS_Import_name` according to RFC 2743 section 2.4.5.

    Parameter `name`

      A name on string form (a contiguous string name in GSS-API parlance).

    Parameter `name_type`

      The OID on dotted-decimal form for the type of the name in name . If left out, name is parsed according to a mechanism-specific default printable syntax.

    Note

      If name is the result of export or a similar function then name_type should be GSSAPI.NT_EXPORT_NAME .

    Method display_name
    Method display_name_type

      `string display_name()`
      `string display_name_type()`

    Description

      display_name returns a representation of the name for display purposes, and display_name_type returns an OID on dotted-decimal form for the type of that name.

      If no type was given to create then display_name_type might return zero.

      This wraps `GSS_Display_name` according to RFC 2743 section 2.4.4.

    See also

      The `GSSAPI.NT_*` constants.

    Method canonicalize

      `Name canonicalize(string mech)`

    Description

      Returns a GSSAPI.Name containing the canonical mechanism name (MN) of this name. The mechanism is given as a dotted-decimal OID in mech .

      This wraps `GSS_Canonicalize_name` according to RFC 2743 section 2.4.14.

    Note

      This function might block on network connections to remote authentication servers.

    Method export

      `string export(void|string mech)`

    Description

      Returns the name on the exported format. If mech isn't given then the name has to be a mechanism name (MN). If mech is given then the name is canonicalized according to that mechanism before being exported (see canonicalize ).

      This wraps `GSS_Export_name` according to RFC 2743 section 2.4.15.

    Note

      This function might block on network connections to remote authentication servers if mech is specified.

    Method `==

      `int `==(mixed other)`

    Description

      Returns true if other is a GSSAPI.Name which contains a name that refers to the same identity as this one.

      This wraps `GSS_Compare_name` according to RFC 2743 section 2.4.3.

      If either GSSAPI.Name object is uninitialized or contains an anonymous identity then they are considered different, unless it is the very same GSSAPI.Name object (that is an inherent pike behavior).

    Throws

      An error is thrown if the names are incomparable, or if either of them are ill-formed.

    Method __hash

      `int __hash()`

    Description

      Tries to export the name (see export ) and if that succeeds returns a hash made from the exported name string. Otherwise a normal hash based on this object is returned.

      This means that mechanism names (MNs) can be used as indices in mappings without getting duplicate entries for the same identity.

    Method mechs

      `multiset(string) mechs()`

    Description

      Returns the OIDs for the mechanisms that might be able to process this name. The returned OID strings are on dotted-decimal form.

      This wraps `GSS_Inquire_mechs_for_name` according to RFC 2743 section 2.4.13.

    Note

      Some older GSS-API v2 implementations lack this funcion.

  CLASS GSSAPI.Cred

    Description

      Objects of this class hold one or more credentials that the current process can use to assert identities; see RFC 2743 section 1.1.1.

    Note

      If a Cred object is destructed, `GSS_Release_cred` (RFC 2743, section 2.1.2) is called. The RFC doesn't preclude that that function might do blocking network I/O, which due to pike's object management might occur essentially anytime in any thread if the object isn't explicitly destructed. To avoid that, it's recommended to call release in credential objects that are no longer used.

    Method acquire

      `void acquire(Name|string name, int cred_usage, void|multiset(string) desired_mechs, void|int(0..) desired_time)`

    Description

      Acquire initial credentials for this object. It is an error if it already has some credentials.

      This wraps `GSS_Acquire_cred` according to RFC 2743 section 2.1.1.

    Parameter `name`

      The name of the identity for which credentials should be acquired. It is up to the GSS-API implementation to check whether the running process is authorized to act on behalf of this identity.

      This can be either a GSSAPI.Name object or a string. In the latter case, the string is converted to a GSS-API name according to a mechanism-specific default printable syntax, i.e. just like if it would be given as the sole argument to GSSAPI.Name.create .

      If this is zero then credentials for the default principal (if any) are retrieved.

    Parameter `cred_usage`

      Specifies how the credential will be used. One of GSSAPI.INITIATE , GSSAPI.ACCEPT or GSSAPI.BOTH .

    Parameter `desired_mechs`

      The mechanisms that the credentials should cover, as a multiset containing their OIDs on dotted-decimal form. If zero or left out then a default set provided by the GSS-API implementation is used.

      It is an error to pass an empty multiset.

    Parameter `desired_time`

      Number of seconds the credentials should remain valid. The GSS-API implementation may return credentials that are valid both longer and shorter than this. Zero or left out means use the maximum permitted time.

    Note

      This function might block on network connections to remote authentication servers.

    Method add

      `void add(Name|string name, int cred_usage, string desired_mech, void|int(0..)|array(int(0..)) desired_time)`

    Description

      Adds another credential element to this object. If this object has no credentials already then it will get the default credentials in addition to this specified one.

      This wraps `GSS_Add_cred` according to RFC 2743 section 2.1.4.

    Parameter `name`

      The name of the identity for which a credential should be acquired. It is up to the GSS-API implementation to check whether the running process has sufficient privileges to act on behalf of this identity.

      This can be either a GSSAPI.Name object or a string. In the latter case, the string is converted to a GSS-API name according to a mechanism-specific default printable syntax, i.e. just like if it would be given as the sole argument to GSSAPI.Name.create .

      If this is zero then a credential for the default principal (if any) are retrieved.

    Parameter `cred_usage`

      Specifies how the credential will be used. One of GSSAPI.INITIATE , GSSAPI.ACCEPT or GSSAPI.BOTH .

    Parameter `desired_mech`

      The mechanism that the credential should cover, as an OID on dotted-decimal form.

    Parameter `desired_time`

      Number of seconds the credential should remain valid. The GSS-API implementation may return a credential that is valid both longer and shorter than this. Zero or left out means use the maximum permitted time.

      This can also be an array containing two elements. In that case the first element applies to the credential when it is used to initiate contexts, and the second element applies to use for acceptor contexts.

    Note

      This function might block on network connections to remote authentication servers.

    Method name
    Method cred_usage
    Method mechs
    Method lifetime
    Method init_lifetime
    Method accept_lifetime

      `GSSAPI.Name name(void|string mech)`
      `int cred_usage(void|string mech)`
      `multiset(string) mechs()`
      `int(0..)|Int.inf lifetime()`
      `int(0..)|Int.inf init_lifetime(string mech)`
      `int(0..)|Int.inf accept_lifetime(string mech)`

    Description

      Functions to query various properties about the credentials.

      These wrap `GSS_Inquire_cred` according to RFC 2743 section 2.1.3 if mech is not given, and `GSS_Inquire_cred_by_mech` according to section 2.1.5 otherwise.

    Parameter `mech`

      If this is given then the credential for that specific mechanism is queried. mech contains the OID of the mechanism on dotted-decimal form.

      Some of the query functions can only be used for a specific mechanism, in which case mech is required. Some can only be used on the credentials in general, and the mech argument is not applicable. Some can be used both ways, and then mech is optional.

        `name (void|string mech)` Returns the name of the identity that the credential(s) assert. If mech is given then the returned name is a Mechanism Name (MN).

        The returned GSSAPI.Name object is always a newly created one, even though it typically compares as equal with the ones given to acquire or add .

        `cred_usage (void|string mech)` Returns how the credential(s) may be used, one of GSSAPI.INITIATE , GSSAPI.ACCEPT or GSSAPI.BOTH .

        If mech is not given then the returned usage value reflects the union of the capabilities in all credentials.

        `mechs()` Returns the set of mechanisms supported by the credential. The returned value is a multiset of strings with OIDs on dotted-decimal form.

        `lifetime()` Returns the shortest validity lifetime left in any of the mechanisms that are part of the credentials, for either initiator or acceptor use.

        Returns zero if some part of the credentials has expired.

        Returns Int.inf if there is no time limit (in older pikes without Int.inf a large positive integer is returned instead).

        `init_lifetime (string mech)` Returns the validity lifetime left for initiator use.

        Returns zero if the credential has expired for this use or if its usage is GSSAPI.ACCEPT .

        Returns Int.inf if there is no time limit (in older pikes without Int.inf a large positive integer is returned instead).

        `accept_lifetime (string mech)` Returns the validity lifetime left for acceptor use.

        Returns zero if the credential has expired for this use or if its usage is GSSAPI.INITIATE .

        Returns Int.inf if there is no time limit (in older pikes without Int.inf a large positive integer is returned instead).

    Note

      RFC 2743 doesn't preclude that these functions might block on network connections to remote authentication servers.

    Method release

      `void release()`

    Description

      Frees the resources for the credential.

      This wraps `GSS_Release_cred` according to RFC 2743 section 2.1.2.

    Note

      This function might block on network connections to remote authentication servers.

  CLASS GSSAPI.Context

    Description

      Class representing a security context; see RFC 2743 section 1.1.3. The user usually instantiates one of the two inheriting classes GSSAPI.InitContext or GSSAPI.AcceptContext , based on whether the context should act as initiator or acceptor for the connection. This class is instantiated directly for imported contexts.

    Note

      If a Context object for a partly or completely established context is destructed, `GSS_Delete_sec_context` (RFC 2743, section 2.2.3) is called. That function might do blocking network I/O, which due to pike's object management might occur essentially anytime in any thread if the object isn't explicitly destructed. To avoid that, it's strongly recommended to call delete in contexts that are no longer used.

    Method create

      `void GSSAPI.Context(string interprocess_token, void|int required_services)`

    Description

      Creates a context by importing an inter-process token.

      This wraps `GSS_Import_sec_context` according to RFC 2743 section 2.2.9.

    Parameter `interprocess_token`

      The inter-process token which has been created by export or some other `GSS_Export_sec_context` wrapper.

    Parameter `required_services`

      Bitfield of `GSSAPI.*_FLAG` flags specifying all services that must be provided in the context. If the context fail to provide any of them then it is closed and a GSSAPI.MissingServicesError is thrown.

      GSSAPI.PROT_READY_FLAG is ignored in this parameter. The fact that a user calls a per-message function indicates that this service is required at that point, and a GSSAPI.MissingServicesError is thrown if it isn't.

    Note

      It is not possible to retrieve delegated credentials from an imported context. That is a GSS-API limitation.

    Method required_services

      `int required_services(void|int services)`

    Description

      Gets and optionally sets the set of services that must be provided in the context. The returned and given value is a bitfield of the `GSSAPI.*_FLAG` constants.

      This is mainly useful to change the per-message service flags that verify_mic and unwrap use to decide whether a condition is an error or not.

    Parameter `services`

      New set of required services. If this is not given then the set is not changed.

      If the context is established and services contain a service which isn't currently provided then the context is closed and a GSSAPI.MissingServicesError is thrown immediately.

      GSSAPI.PROT_READY_FLAG is ignored in this parameter.

    Returns

      Returns the current set of required services (after setting them to services , if provided).

    See also

      GSSAPI.describe_services

    Method is_established
    Method services
    Method locally_initiated
    Method source_name
    Method target_name
    Method lifetime
    Method mech

      `int is_established()`
      `int services()`
      `int locally_initiated()`
      `Name source_name()`
      `Name target_name()`
      `int(0..) lifetime()`
      `string mech()`

    Description

      Functions to query various properties about the context.

      These wrap `GSS_Inquire_context` according to RFC 2743 section 2.2.6.

      is_established()

        Returns nonzero as soon as the context has been established. That means no further rounds through GSSAPI.InitContext.init or GSSAPI.AcceptContext.accept , that the remote peer is authenticated as required, and that the set of available services is complete (see services ).

      services()

        Returns a bitfield of `GSSAPI.*_FLAG` flags for the services that the context (currently) provides. This field is complete only when the context establishment has finished, i.e. when is_established returns nonzero.

        See also GSSAPI.describe_services .

      locally_initiated()

        Returns nonzero if the context is an initiator, zero if it is an acceptor. (This is mainly useful in imported contexts.)

      source_name()

        Returns the name of the context initiator. The name is always an MN. Returns an anonymous name if used on the acceptor side and the anonymous authentication service (c.f. GSSAPI.ANON_FLAG ) was used.

      target_name()

        Returns the name of the context acceptor. If a name is returned then it is always an MN.

        Zero is returned on the initiator side if the initiator didn't specify a target name and the acceptor did not authenticate itself (should never happen if mutual authentication (c.f. GSSAPI.MUTUAL_FLAG ) is a required service).

        The returned object is not necessarily the same one as was passed to GSSAPI.InitContext.create , even though they are likely to compare as equal (they might not be equal if the passed name wasn't an MN).

      lifetime()

        Returns the validity lifetime left for the context. Returns zero if the context has expired, or Int.inf if there is no time limit (in older pikes without Int.inf a large positive integer is returned instead).

      mech()

        Returns the mechanism that provides the context. The returned value is its OID on dotted-decimal form.

      These functions don't throw errors if the context is missing or not completely established, even though they might not be able to query the proper values then (GSS-API implementations are known to not be completely reliable in handling these queries for partly established contexts). The functions instead return zero.

    Method last_major_status
    Method last_minor_status

      `int last_major_status()`
      `int last_minor_status()`

    Description

      Returns the major and minor status codes from the last operation that called a GSS-API routine, with the exception of those that wrap `GSS_Inquire_context`.

    Method last_qop

      `int last_qop()`

    Description

      Returns the quality of protection provided by the last call to verify_mic or unwrap .

    Method last_confidential

      `int last_confidential()`

    Description

      Returns nonzero if the last call to wrap or unwrap provided confidentiality for the message, i.e. if wrap encrypted it or if unwrap decrypted it. Zero is returned otherwise.

    Method process_token

      `void process_token(string remote_token)`

    Description

      Passes the given remote_token to the mechanism.

      This wraps `GSS_Process_context_token` according to RFC 2743 section 2.2.4.

      This is used for tokens that are received outside the handshaking between `GSS_Init_sec_context` (GSSAPI.InitContext.init ) and `GSS_Accept_sec_context` (GSSAPI.AcceptContext.accept ).

      An example is when GSSAPI.InitContext.init returns a final token and flags the context as established, but the acceptor context detects an error and sends a failure token back. That token is processed using this function since GSSAPI.InitContext.init doesn't handle any more tokens by then.

    Note

      This function might change context state.

    Note

      This function might block on network connections to remote authentication servers. However, if the remote token is the result of `GSS_Delete_sec_context` on the remote side then it will not block.

    Method export

      `string export()`

    Description

      Exports this context so that it can be imported in another process, providing the inter-process context transfer service is available (c.f. GSSAPI.TRANS_FLAG ).

      This wraps `GSS_Export_sec_context` according to RFC 2743 section 2.2.8.

      The returned string is intended to be fed to GSSAPI.Context.create (or some other `GSS_Import_sec_context` wrapper) in the receiving process.

      This operation frees the context in this object.

    Method get_mic

      `string get_mic(string message, void|int qop)`

    Description

      Calculates and returns a MIC (message integrity checksum) for the given message that allows the receiver to verify its origin and integrity through verify_mic or some other `GSS_VerifyMIC` wrapper.

      This wraps `GSS_GetMIC` according to RFC 2743 section 2.3.1.

      This function requires that the context is established, or that the early per-message protection service is available (c.f. GSSAPI.PROT_READY_FLAG . If not, a GSSAPI.MissingServicesError is thrown (but the context is not closed).

    Parameter `message`

      The message for which the MIC is to be calculated. It may be of zero length.

    Parameter `qop`

      The quality of protection. This is a mechanism-specific value that lets the user direct how the underlying mechanism calculates the MIC. See RFC 2743, section 1.2.4.

      Zero or left out means use the default method.

    Method verify_mic

      `int verify_mic(string message, string mic)`

    Description

      Verifies the origin and integrity of the given message using the given mic , which has been calculated by the sender using get_mic or some other `GSS_GetMIC` wrapper.

      This wraps `GSS_VerifyMIC` according to RFC 2743 section 2.3.2.

      This function requires that the context is established, or that the early per-message protection service is available (c.f. GSSAPI.PROT_READY_FLAG . If not, a GSSAPI.MissingServicesError is thrown (but the context is not closed).

    Returns

      Zero is returned if the verification fails with GSSAPI.DEFECTIVE_TOKEN or GSSAPI.BAD_MIC .

      Otherwise the message origin and integrity checks out, but it might still be considered wrong depending on whether the replay detection or sequencing services are required (see required_services ):

      If replay detection (c.f. GSSAPI.REPLAY_FLAG ) is required then zero is returned if the message is duplicated (GSSAPI.DUPLICATE_TOKEN ) or old (GSSAPI.OLD_TOKEN ).

      If sequencing (c.f. GSSAPI.SEQUENCE_FLAG ) is required then in addition to the replay detection conditions, zero is also returned if the message is out of sequence (GSSAPI.UNSEQ_TOKEN or GSSAPI.GAP_TOKEN ).

      Otherwise nonzero is returned to indicate that the message is valid according to the currently required services.

    Throws

      Any GSS-API errors except GSSAPI.DEFECTIVE_TOKEN and GSSAPI.BAD_MIC are thrown.

    Note

      This function sets the value returned by last_qop .

    Note

      Regardless whether the message is considered valid or not by the return value, last_major_status may be called to check for routine errors or the informatory codes mentioned above.

    Method wrap_size_limit

      `int(0..) wrap_size_limit(int(0..) output_size, int encrypt, void|int qop)`

    Description

      Returns the maximum size of an input string to wrap that would produce no more than output_size bytes in the resulting output.

      This wraps `GSS_Wrap_size_limit` according to RFC 2743 section 2.2.7.

      with_confidentiality and qop are the same as in the call to wrap .

    Method wrap

      `string wrap(string message, void|int encrypt, void|int qop)`

    Description

      Calculates a MIC (message integrity checksum) for the given message, and returns it together with the message, which is optionally encrypted. The returned value can be verified and (if applicable) decrypted by the receiver using unwrap or some other `GSS_Unwrap` wrapper.

      This wraps `GSS_Wrap` according to RFC 2743 section 2.3.3.

      This function requires that the context is established, or that the early per-message protection service is available (c.f. GSSAPI.PROT_READY_FLAG . If not, a GSSAPI.MissingServicesError is thrown (but the context is not closed).

    Parameter `message`

      The message to be wrapped. It may be of zero length.

    Parameter `encrypt`

      Set to nonzero to request that the message is encrypted. Otherwise only a MIC is calculated and the returned value contains the unencrypted message.

      If this is set and the confidentiality service (c.f. GSSAPI.CONF_FLAG ) is required then the returned value is always encrypted. Otherwise it might not be encrypted anyway, and a call to last_confidential will tell if it is or not.

    Parameter `qop`

      The quality of protection. This is a mechanism-specific value that lets the user direct how the underlying mechanism calculates the MIC. See RFC 2743, section 1.2.4.

      Zero or left out means use the default method.

    Note

      This function sets the value returned by last_confidential .

    See also

      wrap_size_limit

    Method unwrap

      `string unwrap(string message, void|int accept_encrypted_only)`

    Description

      Verifies the origin and integrity of the given message using the MIC included in it, and also decrypts the message if it was encrypted. The message has been calculated by the sender using wrap or some other `GSS_Wrap` wrapper.

      This wraps `GSS_Unwrap` according to RFC 2743 section 2.3.4.

      This function requires that the context is established, or that the early per-message protection service is available (c.f. GSSAPI.PROT_READY_FLAG . If not, a GSSAPI.MissingServicesError is thrown (but the context is not closed).

    Parameter `message`

      The message to be unwrapped.

    Parameter `accept_encrypted_only`

      If this is nonzero then it is an error if message isn't encrypted, and zero is returned in that case (the status returned by last_major_status will still indicate success, though).

    Returns

      Zero is returned if the verification fails with GSSAPI.DEFECTIVE_TOKEN or GSSAPI.BAD_MIC .

      Zero is also returned if message isn't encrypted and accept_encrypted_only is set.

      Otherwise the message is successfully decrypted (provided it was encrypted to begin with), and its origin and integrity checks out, but it might still be considered wrong depending on whether the replay detection or sequencing services are required (see required_services ):

      If replay detection (c.f. GSSAPI.REPLAY_FLAG ) is required then zero is returned if the message is duplicated (GSSAPI.DUPLICATE_TOKEN ) or old (GSSAPI.OLD_TOKEN ).

      If sequencing (c.f. GSSAPI.SEQUENCE_FLAG ) is required then in addition to the replay detection conditions, zero is also returned if the message is out of sequence (GSSAPI.UNSEQ_TOKEN or GSSAPI.GAP_TOKEN ).

      Otherwise the unwrapped message is returned, which is valid according to the currently required services (note however that requiring the confidentiality service does not imply that an error is signalled whenever an unencrypted message is received - see instead accept_encrypted_only above).

    Throws

      Any GSS-API errors except GSSAPI.DEFECTIVE_TOKEN and GSSAPI.BAD_MIC are thrown.

    Note

      This function sets the value returned by last_confidential and last_qop .

    Note

      Even if the message is considered valid by the return value, last_major_status may be called to check for the informatory codes mentioned above.

    Method delete

      `void delete()`

    Description

      Frees the resources for the context, provided it is in use. Does nothing otherwise.

      This wraps `GSS_Delete_sec_context` according to RFC 2743 section 2.2.3.

    Note

      This function might block on network connections to remote authentication servers.

    Note

      In compliance with recommendations in GSS-API v2, the optional output token is never used in the call to `GSS_Delete_sec_context`.

  CLASS GSSAPI.InitContext

    Description

      Variant of Context which is used on the initiator side.

    Inherit Context

      inherit Context : Context

    Method create

      `void GSSAPI.InitContext(void|Cred cred, void|Name|string target_name, void|string mech, void|int required_services, void|int desired_services, void|int(0..) desired_time)`

    Description

      Creates a context for initiator use. This function only accepts parameters to be used later during the init call. If there are semantic problems with them, such as if the credentials are stale or the mechanism isn't supported, then they will be signalled later by init .

    Parameter `cred`

      Credentials for the identity this context claims. The credentials for the default principal (if any) is used if zero or left out.

    Parameter `target_name`

      The name of the target.

      This can be either a GSSAPI.Name object or a string. In the latter case, the string is converted to a GSS-API name according to a mechanism-specific default printable syntax, i.e. just like if it would be given as the sole argument to GSSAPI.Name.create .

      Some mechanisms support unnamed targets (as allowed in GSS-API v2, update 1) and in such cases this may be zero or left out.

    Parameter `mech`

      The mechanism to use. It is given as an OID on dotted-decimal form. The GSS-API implementation chooses this using system settings if it's zero or left out, which is the recommended way.

    Parameter `required_services`

      Bitfield of `GSSAPI.*_FLAG` flags specifying all services that must be provided in the context. If the context fail to provide any of them then it is closed and a GSSAPI.MissingServicesError is thrown.

      GSSAPI.PROT_READY_FLAG is ignored in this parameter. The fact that a user calls a per-message function indicates that this service is required at that point, and a GSSAPI.MissingServicesError is thrown if it isn't.

    Parameter `desired_services`

      Bitfield of `GSSAPI.*_FLAG` flags specifying the context services that are wanted but not required. I.e. errors won't be thrown if any of these aren't provided. The services specified in required_services are implicit, so they need not be repeated here.

      GSSAPI.PROT_READY_FLAG is ignored in this parameter.

    Parameter `desired_time`

      The desired context validity time in seconds. Zero or left out means use the default.

    Note

      Channel bindings (RFC 2743, section 1.1.6) are not yet implemented since that feature appear to not be in much active use, and its format is not completely specified (RFC 2744, section 3.11).

    Method init

      `string init(void|string remote_token)`

    Description

      Initiates a security context to send to a remote peer.

      This wraps `GSS_Init_sec_context` according to RFC 2743 section 2.2.1.

      The underlying mechanism might require several tokens to be passed back and forth to establish the context. If is_established returns zero after a call to this function then the caller must wait for a token from the remote peer to feed as remote_token in another call to this function.

    Parameter `remote_token`

      A token from the remote peer, as returned by a call to GSSAPI.AcceptContext.accept (or some other `GSS_Accept_sec_context` wrapper) in it. This is zero or left out on the initial call, but used later if the remote peer sends back tokens to process as part of the context establishment.

    Returns

      If a string is returned then it must be passed to the remote peer which will feed it to GSSAPI.AcceptContext.accept or some other `GSS_Accept_sec_context` wrapper. An empty string is never returned.

      Zero is returned if there is no token to send to the remote peer. Note that is_established might still return zero in that case, meaning more remote tokens are necessary.

    Note

      This function might block on network connections to remote authentication servers.

  CLASS GSSAPI.AcceptContext

    Description

      Variant of Context which is used on the acceptor side.

    Inherit Context

      inherit Context : Context

    Method create

      `void GSSAPI.AcceptContext(void|Cred cred, void|int required_services)`

    Description

      Creates a context for acceptor use. This function only accepts parameters to be used later during the accept call. If there are semantic problems with them, such as if the credentials are stale, then they will be signalled later by accept .

    Parameter `cred`

      Credentials for the identity this context claims. The credentials for the default principal (if any) is used if zero or left out.

    Parameter `required_services`

      Bitfield of `GSSAPI.*_FLAG` flags specifying all services that must be provided in the context. If the context fail to provide any of them then it is closed and a GSSAPI.MissingServicesError is thrown.

      GSSAPI.PROT_READY_FLAG is ignored in this parameter. The fact that a user calls a per-message function indicates that this service is required at that point, and a GSSAPI.MissingServicesError is thrown if it isn't.

    Note

      Channel bindings (RFC 2743, section 1.1.6) are not yet implemented since that feature appear to not be in much active use, and its format is not completely specified (RFC 2744, section 3.11).

    Method accept

      `string accept(string remote_token)`

    Description

      Accepts a remotely initiated security context.

      This wraps `GSS_Accept_sec_context` according to RFC 2743 section 2.2.2.

      The underlying mechanism might require several tokens to be passed back and forth to establish the context. If is_established returns zero after a call to this function then the caller must wait for a token from the remote peer to feed as remote_token in another call to this function.

    Parameter `remote_token`

      A token from the remote peer, as returned by a call to GSSAPI.InitContext.init or some other `GSS_Init_sec_context` wrapper.

    Returns

      If a string is returned then it must be passed to the remote peer which will feed it to GSSAPI.InitContext.init or some other `GSS_Init_sec_context` wrapper. An empty string is never returned.

      Zero is returned if there is no token to send to the remote peer. Note that is_established might still return zero in that case, meaning more remote tokens are necessary.

    Note

      This function might block on network connections to remote authentication servers.

    Method delegated_cred

      `Cred delegated_cred()`

    Description

      Returns the delegated credentials from the initiator if the delegation (c.f. GSSAPI.DELEG_FLAG ) service is in use.

Module ZXID

  Description

    ZXID is a library that implements SAML 2.0, Liberty ID-WSF 2.0 and XACML 2.0.

    This module implements a wrapper for ZXID. The interface is similar to the C one, but using generally accepted Pike syntax.

  Inherit ZXID

    inherit "___ZXID" : ZXID

  Method mapping_to_query

    `string mapping_to_query(mapping(string:string) map)`

  Description

    Convert a mapping of query variables to a query string.

  CLASS ZXID.Configuration

    Description

      A set of configuration parameters for a ZXID context.

      This is typically overloaded with new definitions for the various callback functions.

    Inherit Configuration

      inherit ZXID::Configuration : Configuration

    Method create

      `void ZXID.Configuration(string|mapping(string:string) conf)`

    Description

      Create a new Configuration .

    Parameter `conf`

      ZXID configuration parameters. Either as a configuration string (as per the ZXID book chapter 7 and 10), or as a mapping of parameter settings. These are the most common parameters:

      `"PATH" : string` | Path to the directory containing the `"zxid.conf"` file.
      `"URL" : string` | URL of the SP.
      `"CDC_URL" : string` | The Common Domain URL.

    Method idp_list

      `mapping(string:mapping(string:string)) idp_list()`

    Description

      Return a list of known identity providers.

    Returns

      Returns a mapping from IdP EID to display name (if any).

    CLASS ZXID.Configuration.Session

      Description

        Represents the current session state for a user.

      Inherit Session

        inherit Configuration::Session : Session

      Variable auth_info

        `mapping(string:mixed) ZXID.Configuration.Session.auth_info`

      Method authenticate

        `mixed authenticate(string|mapping(string:string) query)`

      Description

        Authenticate via SAML given the query-string query .

      Returns

        `mapping(string:string)` | Returns a mapping when interaction with the browser is needed.
        `string` | Returns a string to ask for some specific actions.
        `zero` | Returns `0` (zero) on successfull authentication. auth_info will be set with the corresponding user information.

      Throws

        Throws errors on most error conditions.

      Variable session_id

        `string ZXID.Configuration.Session.session_id`

      Description

        Session id (if any).

      Method create

        `void ZXID.Configuration.Session(string|void session_id)`

      Description

        Create a new or look up an existing session.

      Method authenticate

        `string authenticate(string query)`

      Description

        Authenticate via SAML given the query-string query .

      Returns

        Returns JSON-encoded data on success, and various other strings otherwise.

Module GDK

  Constant Atom

    `constant GDK.Atom`

  CLASS GDK.Color

    Description

      The GDK.Color object is used to represent a color. When you call GDK.Color(r,g,b) the color will be allocated from the X-server. The constructor can return an exception if there are no more colors to allocate. NOIMG

    Method blue

      `int blue()`

    Description

      Returns the blue color component.

    Method create

      `GDK.Color GDK.Color(object|int color_or_r, int|void g, int|void b)`

    Description

      r g and b are in the range 0 to 255, inclusive. If color is specified, it should be an Image.Color object, and the only argument.

    Method destroy

      `GDK.Color destroy()`

    Description

      Destroys the color object. Please note that this function does not free the color from the X-colormap (in case of pseudocolor) right now.

    Method green

      `int green()`

    Description

      Returns the green color component.

    Method image_color_object

      `Image.Color.Color image_color_object()`

    Description

      Return a Image.Color.Color instance. This gives better precision than the rgb function.

    Method pixel

      `int pixel()`

    Description

      Returns the pixel value of the color. See GDK.Image->set_pixel.

    Method red

      `int red()`

    Description

      Returns the red color component.

    Method rgb

      `array rgb()`

    Description

      Returns the red green and blue color components as an array.

  CLASS GDK.Pixmap

    Description

      This class creates a GDK.Pixmap from either an GDK.Image or Image.Image object (or a numeric ID, see your X-manual for XIDs). The GDK.Pixmap object can be used in a lot of different GTK widgets. The most notable is the W(Pixmap) widget.

      NOIMG

    Inherit Drawable

      inherit GDK.Drawable : Drawable

    Method create

      `GDK.Pixmap GDK.Pixmap(int|object image)`

    Description

      Create a new GDK.Pixmap object. Argument is a GDK.Image object or a Image.Image object

    Method destroy

      `GDK.Pixmap destroy()`

    Description

      Destructor. Destroys the pixmap.

    Method ref

      `GDK.Pixmap ref()`

    Method set

      `GDK.Pixmap set(GDK.Image image)`

    Description

      Argument is a GDK.Image object or an Image.Image object. It is much faster to use an gdkImage object, especially one allocated in shared memory. This is only an issue if you are going to change the contents of the pixmap often, toggling between a small number of images.

    Method unref

      `GDK.Pixmap unref()`

  CLASS GDK.DragContext

    Description

      The drag context contains all information about the drag'n'drop connected to the signal to which it is an argument.

      NOIMG

    Method drag_abort

      `GDK.DragContext drag_abort(int time)`

    Description

      Abort the drag

    Method drag_drop

      `GDK.DragContext drag_drop(int time)`

    Method drag_finish

      `GDK.DragContext drag_finish(int success, int del, int time)`

    Description

      If success is true, the drag succeded. If del is true, the source should be deleted. time is the current time.

    Method drag_set_icon_default

      `GDK.DragContext drag_set_icon_default()`

    Description

      Use the default drag icon associated with the source widget.

    Method drag_set_icon_pixmap

      `GDK.DragContext drag_set_icon_pixmap(GDK.Pixmap p, GDK.Bitmap b, int hot_x, int hot_y)`

    Description

      Set the drag pixmap, and optionally mask. The hot_x and hot_y coordinates will be the location of the mouse pointer, relative to the upper left corner of the pixmap.

    Method drag_set_icon_widget

      `GDK.DragContext drag_set_icon_widget(GTK.Widget widget, int hot_x, int hot_y)`

    Description

      Set the drag widget. This is a widget that will be shown, and then dragged around by the user during this drag.

    Method drag_status

      `GDK.DragContext drag_status(int action, int time)`

    Description

      Setting action to -1 means use the suggested action

    Method drop_reply

      `GDK.DragContext drop_reply(int ok, int time)`

    Method get_action

      `int get_action()`

    Description

      One of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE ;

    Method get_actions

      `int get_actions()`

    Description

      A bitwise or of one or more of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE ;

    Method get_is_source

      `int get_is_source()`

    Description

      Is this application the source?

    Method get_protocol

      `int get_protocol()`

    Description

      One of GDK_DRAG_PROTO_MOTIF , GDK_DRAG_PROTO_ROOTWIN and GDK_DRAG_PROTO_XDND

    Method get_source_widget

      `GTK.Widget get_source_widget()`

    Description

      Return the drag source widget.

    Method get_start_time

      `int get_start_time()`

    Description

      The start time of this drag, as a unix time_t (seconds since 0:00 1/1 1970)

    Method get_suggested_action

      `int get_suggested_action()`

    Description

      One of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE ;

  CLASS GDK.Image

    Description

      A gdk (low level) image. Mainly used for W(Image) objects.

      NOIMG

    Method create

      `GDK.Image GDK.Image(int|void fast_mode, Image.Image|void image)`

    Description

      Create a new GDK.Image object. The firstargument is either 0, which indicates that you want a 'slow' image. If you use '1', you indicate that you want a 'fast' image. Fast images are stored in shared memory, and thus are not sent over any network. But please limit your usage of fast images, they use up a possibly limited system resource set. See the man page for shmget(2) for more information on the limits on shared segments on your system.

      A 'fast' image will automatically revert back to 'slow' mode if no shared memory is available.

      If the second argument is specified, it is the actual image data.

    Method destroy

      `GDK.Image destroy()`

    Description

      Destructor. Destroys the image. Automatically called by pike when the object is destructed.

    Method get_pixel

      `int get_pixel(int x, int y)`

    Description

      Get the pixel value of a pixel as a X-pixel value. It is usualy not very easy to convert this value to a rgb triple. See get_pnm.

    Method get_pnm

      `string get_pnm()`

    Description

      Returns the data in the image as a pnm object. Currently, this is always a P6 (true color raw) image. This could change in the future. To get a pike image object do 'Image.PNM.decode( gdkimage->get_pnm() )'

    Method grab

      `GDK.Image grab(GTK.Widget widget, int xoffset, int yoffset, int width, int height)`

    Description

      Call this function to grab a portion of a widget (argument 1) to the image. Grabbing non-toplevel widgets may produce unexpected results. To get the size of a widget use -&gt;xsize() and -&gt;ysize(). To get the offset of the upper left corner of the widget, relative to it's X-window (this is what you want for the offset arguments), use -&gt;xoffset() and -&gt;yoffset().

    Method set

      `GDK.Image set(Image.Image|int image_or_xsize, int|void ysize)`

    Description

      Call this to set this image to either the contents of a pike image or a blank image of a specified size.

    Method set_pixel

      `GDK.Image set_pixel(int x, int y, int pixel)`

    Description

      Set the pixel value of a pixel. Please note that the pixel argument is a X-pixel value, which is not easily gotten from a RGB color. See get_pixel and set.

  CLASS GDK.Drawable

    Description

      The GDK.Bitmap, GDK.Window and GDK.Pixmap classes are all GDK drawables.

      This means that you can use the same set of functions to draw in them.

      Pixmaps are offscreen drawables. They can be drawn upon with the standard drawing primitives, then copied to another drawable (such as a GDK.Window) with window->draw_pixmap(), set as the background for a window or widget, or otherwise used to show graphics (in a W(Pixmap), as an example). The depth of a pixmap is the number of bits per pixels. Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off).

      Bitmaps are mostly used as masks when drawing pixmaps, or as a shape for a GDK.Window or a W(Widget)

    Method clear

      `GDK.Drawable clear(int|void x, int|void y, int|void width, int|void height)`

    Description

      Either clears the rectangle defined by the arguments, of if no arguments are specified, the whole drawable.

    Method copy_area

      `GDK.Drawable copy_area(GDK.GC gc, int xdest, int ydest, GTK.Widget source, int xsource, int ysource, int width, int height)`

    Description

      Copies the rectangle defined by xsource,ysource and width,height from the source drawable, and places the results at xdest,ydest in the drawable in which this function is called.

    Method draw_arc

      `GDK.Drawable draw_arc(GDK.GC gc, int filledp, int x1, int y1, int x2, int y2, int angle1, int angle2)`

    Description

      Draws a single circular or elliptical arc. Each arc is specified by a rectangle and two angles. The center of the circle or ellipse is the center of the rectangle, and the major and minor axes are specified by the width and height. Positive angles indicate counterclockwise motion, and negative angles indicate clockwise motion. If the magnitude of angle2 is greater than 360 degrees, it is truncated to 360 degrees.

    Method draw_bitmap

      `GDK.Drawable draw_bitmap(GDK.GC gc, GDK.Bitmap bitmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw a GDK(Bitmap) in this drawable. NOTE: This drawable must be a bitmap as well. This will be fixed in GTK 1.3

    Method draw_image

      `GDK.Drawable draw_image(GDK.GC gc, GDK.Image image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK(Image) at xdest,ydest in the destination drawable

    Method draw_line

      `GDK.Drawable draw_line(GDK.GC gc, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK.DrawingArea()->set_usize(100,100); delay: g = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_line(g,x*10,0,100-x*10,99); img_end

    Method draw_pixmap

      `GDK.Drawable draw_pixmap(GDK.GC gc, GDK.Pixmap pixmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK(Pixmap) at xdest,ydest in the destination drawable

    Method draw_point

      `GDK.Drawable draw_point(GDK.GC gc, int x, int y)`

    Description

      img_begin w = GTK.DrawingArea()->set_usize(10,10); delay: g = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_point(g, x, x); img_end

    Method draw_rectangle

      `GDK.Drawable draw_rectangle(GDK.GC gc, int filledp, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK.DrawingArea()->set_usize(100,100); delay: g = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_rectangle(g,0,x*10,0,100-x*10,99); img_end img_begin w = GTK.DrawingArea()->set_usize(100,100); delay: g = GDK.GC(w); delay: for(int x = 0; x<30; x++) { delay: g->set_foreground(GDK.Color(random(255),random(255),random(255)) ); delay: w->draw_rectangle(g,1,x*10,0,100-x*10,99); delay: } img_end

    Method draw_text

      `GDK.Drawable draw_text(GDK.GC gc, GDK.Font font, int x, int y, string text, int forcewide)`

    Description

      y is used as the baseline for the text. If forcewide is true, the string will be expanded to a wide string even if it is not already one. This is useful when writing text using either unicode or some other 16 bit font.

    Method get_geometry

      `mapping get_geometry()`

    Description

      Get width, height position and depth of the drawable as a mapping.

      ([ "x":xpos, "y":ypos, "width":xsize, "height":ysize, "depth":bits_per_pixel ])

    Method xid

      `int xid()`

    Method xsize

      `int xsize()`

    Description

      Returns the width of the drawable specified in pixels

    Method ysize

      `int ysize()`

    Description

      Returns the height of the drawable specified in pixels

  CLASS GDK.Rectangle

    Method cast

      `mixed cast(string type)`

    Description

      Normally used like (mapping)rectangle or (array)rectangle.

    Method create

      `GDK.Rectangle GDK.Rectangle(int x, int y, int width, int height)`

    Description

      Create a new rectangle

      NOIMG

    Method destroy

      `GDK.Rectangle destroy()`

    Method set

      `GDK.Rectangle set(int x, int y, int width, int height)`

    Description

      Set the upper left corner and the size of the rectangle.

  CLASS GDK.Bitmap

    Description

      A bitmap is a black and white pixmap. Most commonly used as masks for images, widgets and pixmaps.

      NOIMG

    Inherit Drawable

      inherit GDK.Drawable : Drawable

    Method create

      `GDK.Bitmap GDK.Bitmap(int|Image.Image xsize_or_image, int|void ysize, string|void bitmap)`

    Description

      Create a new GDK.Bitmap object. Argument is either an Image.Image object, or {xsisze,ysize,xbitmapdata}.

    Method destroy

      `GDK.Bitmap destroy()`

    Description

      Destructor. Destroys the bitmap. This will free the bitmap on the X-server.

    Method ref

      `GDK.Bitmap ref()`

    Description

      Add a reference

    Method unref

      `GDK.Bitmap unref()`

    Description

      Remove a reference

  CLASS GDK._Atom

    Description

      An X-atom. You most likely want to use GDK.Atom.atom_name instead of GDK._Atom(name).

    Method create

      `GDK._Atom GDK._Atom(string atom_name, int|void only_if_exists)`

    Description

      Create a new low-level atom. You should normally not call this function directly. Use GDK.Atom[name] instead of GDK._Atom(name,0).

    Method get_name

      `string get_name()`

    Description

      Returns the name of the atom.

  CLASS GDK.Event

    Method _index

      `mixed _index(string ind)`

    Method cast

      `mixed cast(string to)`

    Method destroy

      `GDK.Event destroy()`

  CLASS GDK.Region

    Method create

      `GDK.Region GDK.Region()`

    Description

      Create a new (empty) region

      NOIMG

    Method destroy

      `GDK.Region destroy()`

    Method equal

      `int equal(GDK.Region victim)`

    Description

      Return true if the region used as an argument is equal to the current region. Also available as a==b when a is a region.

    Method intersect

      `GDK.Region intersect(GDK.Region victim)`

    Description

      Computes the intersection of the given region and the region. Also available as region &amp; region

    Method offset

      `GDK.Region offset(int dx, int dy)`

    Description

      Offset(move) the region by dx,dy pixels.

    Method point_in

      `int point_in(int x, int y)`

    Description

      Returns true if the given point resides in the given region

    Method rect_in

      `int rect_in(GDK.Rectangle r)`

    Description

      Returns true if the given rectangle resides inside the given region

    Method shrink

      `GDK.Region shrink(int dx, int dy)`

    Description

      reduces the size of a region by a specified amount. Positive values shrink the size of the region, and negative values expand the region.

    Method subtract

      `GDK.Region subtract(GDK.Region victim)`

    Description

      Computes the difference of the given region and the region. Also available as region - region

    Method union

      `GDK.Region union(GDK.Region victim)`

    Description

      Computes the union of the given rectangle or region and the region. Also available as region | rectangle, region | region, region + region and region + rectangle.

    Method xor

      `GDK.Region xor(GDK.Region victim)`

    Description

      Computes the exlusive or of the given region and the region. Also available as region ^ region

  CLASS GDK.Window

    Description

      a GDK.Window object.

      NOIMG

    Inherit Drawable

      inherit GDK.Drawable : Drawable

    Method change_property

      `GDK.Window change_property(GDK.Atom property, GDK.Atom type, int mode, string data)`

    Description

      mode is one of GDK_PROP_MODE_APPEND , GDK_PROP_MODE_PREPEND and GDK_PROP_MODE_REPLACE

    Method children

      `array children()`

    Description

      Returns an array of GDK.Window objects.

    Method create

      `GDK.Window GDK.Window(GDK.Window parent, mapping|void attributes)`

    Description

      Not for non-experts. I promise.

    Method delete_property

      `GDK.Window delete_property(GDK.Atom a)`

    Method get_geometry

      `mapping get_geometry()`

    Description

      Returns ([ "x":xpos, "y":ypos, "width":width, "height":height, "depth":bits_per_pixel ])

    Method get_property

      `mapping get_property(GDK.Atom atom, int|void offset, int|void delete_when_done)`

    Description

      Returns the value (as a string) of the specified property. The arguments are:

      property: The property atom, as an example GDK.Atom.__SWM_VROOT offset (optional): The starting offset, in elements delete_when_done (optional): If set, the property will be deleted when it has been fetched.

      Example usage: Find the 'virtual' root window (many window managers put large windows over the screen)

             GDK.Window root = GTK.root_window();
             array maybe=root->children()->
                         get_property(GDK.Atom.__SWM_VROOT)-({0});
             if(sizeof(maybe))
               root=GDK.Window( maybe[0]->data[0] );

    Method is_viewable

      `int is_viewable()`

    Description

      Return 1 if the window is mapped.

    Method is_visible

      `int is_visible()`

    Description

      Return 1 if the window, or a part of the window, is visible right now.

    Method lower

      `GDK.Window lower()`

    Description

      Lower this window if the window manager allows that.

    Method move_resize

      `GDK.Window move_resize(int x, int y, int w, int h)`

    Description

      Move and resize the window in one call.

    Method raise

      `GDK.Window raise()`

    Description

      Raise this window if the window manager allows that.

    Method set_background

      `GDK.Window set_background(GDK.Color to)`

    Description

      Set the background color or image. The argument is either a GDK.Pixmap or a GDK.Color object.

    Method set_bitmap_cursor

      `GDK.Window set_bitmap_cursor(GDK.Bitmap image, GDK.Bitmap mask, GDK.Color fg, GDK.Color bg, int xhot, int yhot)`

    Description

      xhot,yhot are the locations of the x and y hotspot relative to the upper left corner of the cursor image.

    Method set_cursor

      `GDK.Window set_cursor(int new_cursor)`

    Description

      Change the window cursor.<table border="0" cellpadding="3" cellspacing="0"> CURS(GDK.Arrow) CURS(GDK.BasedArrowDown) CURS(GDK.BasedArrowUp) CURS(GDK.Boat) CURS(GDK.Bogosity) CURS(GDK.BottomLeftCorner) CURS(GDK.BottomRightCorner) CURS(GDK.BottomSide) CURS(GDK.BottomTee) CURS(GDK.BoxSpiral) CURS(GDK.CenterPtr) CURS(GDK.Circle) CURS(GDK.Clock) CURS(GDK.CoffeeMug) CURS(GDK.Cross) CURS(GDK.CrossReverse) CURS(GDK.Crosshair) CURS(GDK.DiamondCross) CURS(GDK.Dot) CURS(GDK.Dotbox) CURS(GDK.DoubleArrow) CURS(GDK.DraftLarge) CURS(GDK.DraftSmall) CURS(GDK.DrapedBox) CURS(GDK.Exchange) CURS(GDK.Fleur) CURS(GDK.Gobbler) CURS(GDK.Gumby) CURS(GDK.Hand1) CURS(GDK.Hand2) CURS(GDK.Heart) CURS(GDK.Icon) CURS(GDK.IronCross) CURS(GDK.LeftPtr) CURS(GDK.LeftSide) CURS(GDK.LeftTee) CURS(GDK.Leftbutton) CURS(GDK.LlAngle) CURS(GDK.LrAngle) CURS(GDK.Man) CURS(GDK.Middlebutton) CURS(GDK.Mouse) CURS(GDK.Pencil) CURS(GDK.Pirate) CURS(GDK.Plus) CURS(GDK.QuestionArrow) CURS(GDK.RightPtr) CURS(GDK.RightSide) CURS(GDK.RightTee) CURS(GDK.Rightbutton) CURS(GDK.RtlLogo) CURS(GDK.Sailboat) CURS(GDK.SbDownArrow) CURS(GDK.SbHDoubleArrow) CURS(GDK.SbLeftArrow) CURS(GDK.SbRightArrow) CURS(GDK.SbUpArrow) CURS(GDK.SbVDoubleArrow) CURS(GDK.Shuttle) CURS(GDK.Sizing) CURS(GDK.Spider) CURS(GDK.Spraycan) CURS(GDK.Star) CURS(GDK.Target) CURS(GDK.Tcross) CURS(GDK.TopLeftArrow) CURS(GDK.TopLeftCorner) CURS(GDK.TopRightCorner) CURS(GDK.TopSide) CURS(GDK.TopTee) CURS(GDK.Trek) CURS(GDK.UlAngle) CURS(GDK.Umbrella) CURS(GDK.UrAngle) CURS(GDK.Watch) CURS(GDK.Xterm) </table>

    Method set_events

      `GDK.Window set_events(int events)`

    Description

      events is a bitwise or of one or more of the following constants: GDK.ExposureMask, GDK.PointerMotionMask, GDK.PointerMotion_HINTMask, GDK.ButtonMotionMask, GDK.Button1MotionMask, GDK.Button2MotionMask, GDK.Button3MotionMask, GDK.ButtonPressMask, GDK.ButtonReleaseMask, GDK.KeyPressMask, GDK.KeyReleaseMask, GDK.EnterNotifyMask, GDK.LeaveNotifyMask, GDK.FocusChangeMask, GDK.StructureMask, GDK.PropertyChangeMask, GDK.VisibilityNotifyMask, GDK.ProximityInMask, GDK.ProximityOutMask and GDK.AllEventsMask

    Method set_icon

      `GDK.Window set_icon(GDK.Pixmap pixmap, GDK.Bitmap mask, GDK.Window window)`

    Description

      Set the icon to the specified image (with mask) or the specified GDK.Window. It is up to the window manager to display the icon. Most window manager handles window and pixmap icons, but only a few can handle the mask argument. If you want a shaped icon, the only safe bet is a shaped window.

    Method set_icon_name

      `GDK.Window set_icon_name(string name)`

    Description

      Set the icon name to the specified string.

    Method shape_combine_mask

      `GDK.Window shape_combine_mask(GDK.Bitmap mask, int xoffset, int yoffset)`

    Description

      Set the shape of the widget, or, rather, it's window, to that of the supplied bitmap.

  CLASS GDK.GC

    Description

      A GC, or Graphics Context, is used for most low-level drawing operation.

      As an example, the foreground color, background color and drawing function is stored in the GC.

      NOIMG

    Method create

      `GDK.GC GDK.GC(GTK.Widget context)`

    Description

      The argument is a either a W(Widget) or a GDK(Drawable) in which the gc will be valid.

    Method destroy

      `GDK.GC destroy()`

    Description

      Free the gc, called automatically by pike when the object is destroyed.

    Method get_values

      `mapping get_values()`

    Description

      Get all (or rather most) values from the GC.

    Method set_background

      `GDK.GC set_background(GDK.Color color)`

    Description

      Set the background to the specified GDK.Color.

    Method set_clip_mask

      `GDK.GC set_clip_mask(GDK.Bitmap mask)`

    Description

      Set the clip mask to the specified GDK.Bitmap

    Method set_clip_origin

      `GDK.GC set_clip_origin(int x, int y)`

    Description

      Set the clip mask origin to the specified point.

    Method set_font

      `GDK.GC set_font(GDK.Font font)`

    Description

      Set the font to the specified GDK.Font.

    Method set_foreground

      `GDK.GC set_foreground(GDK.Color color)`

    Description

      Set the foreground to the specified GDK.Color.

    Method set_function

      `GDK.GC set_function(int fun)`

    Description

      Set the function to the specified one. One of GDK.Xor, GDK.Invert and GDK.Copy.

    Method set_subwindow

      `GDK.GC set_subwindow(int draw_on_subwindows)`

    Description

      If set, anything drawn with this GC will draw on subwindows as well as the window in which the drawing is done.

  CLASS GDK.Font

    Description

      The GdkFont data type represents a font for drawing on the screen. These functions provide support for loading fonts, and also for determining the dimensions of characters and strings when drawn with a particular font.

      Fonts in X are specified by a X Logical Font Description. The following description is considerably simplified. For definitive information about XLFD's see the X reference documentation. A X Logical Font Description (XLFD) consists of a sequence of fields separated (and surrounded by) '-' characters. For example, Adobe Helvetica Bold 12 pt, has the full description: "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1"

      The fields in the XLFD are:

      Foundry | the company or organization where the font originated.
      Family | the font family (a group of related font designs).
      Weight | A name for the font's typographic weight For example, 'bold' or 'medium').
      Slant | The slant of the font. Common values are 'R' for Roman, 'I' for italoc, and 'O' for oblique.
      Set Width | A name for the width of the font. For example, 'normal' or 'condensed'.
      Add Style | Additional information to distinguish a font from other fonts of the same family.
      Pixel Size | The body size of the font in pixels.
      Point Size | The body size of the font in 10ths of a point. (A point is 1/72.27 inch)
      Resolution X | The horizontal resolution that the font was designed for.
      Resolution Y | The vertical resolution that the font was designed for .
      Spacing | The type of spacing for the font - can be 'p' for proportional, 'm' for monospaced or 'c' for charcell.
      Average Width | The average width of a glyph in the font. For monospaced and charcell fonts, all glyphs in the font have this width
      Charset Registry | The registration authority that owns the encoding for the font. Together with the Charset Encoding field, this defines the character set for the font.
      Charset Encoding | An identifier for the particular character set encoding.

      When specifying a font via a X logical Font Description, '*' can be used as a wildcard to match any portion of the XLFD. For instance, the above example could also be specified as "-*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1"

      It is generally a good idea to use wildcards for any portion of the XLFD that your program does not care about specifically, since that will improve the chances of finding a matching font.

    Method char_width

      `int char_width(int character)`

    Description

      Return the width, in pixels, of the specified character, if rendered with this font. The character can be between 0 and 65535, the character encoding is font specific.

    Method create

      `GDK.Font GDK.Font(string|void font_name)`

    Description

      Create a new font object. The string is the font XLFD.

    Method destroy

      `GDK.Font destroy()`

    Description

      Free the font, called automatically by pike when the object is destroyed.

Module Gnome

  CLASS Gnome.AppletWidget

    Description

      Applets are basically GNOME applications whose window sits inside the panel. Also the panel "takes care" of the applets by providing them with session saving and restarting, window management (inside of the panel), and a context menu.

      The simplest applet one can write would be along the lines of:

           int main( int argc, array argv )
           {
             Gnome.init( "hello", "1.0", argv, 0 );
             Gnome.AppletWidget("hello")-&gt;add(GTK.Label("Hello World!"))-&gt;show_all();
             GTK.applet_widget_gtk_main();
           }

      This creates an applet which just sits on the panel, not really doing anything, in real life the label would be substituted by something which actually does something useful. As you can see the applet doesn't really take care of restarting itself.

      For the applet to be added to the menus, you need to install two files. Your x.gnorba file goes into $sysconfdir/CORBA/servers/ and the x.desktop file goes into $prefix/share/applets/&lt;category&gt;/.

      Example hello.desktop:

           [Desktop Entry]
            Name=Hello Applet
            Comment=An example Hello World type Applet
            Type=PanelApplet
            Exec=hello.pike
            Icon=gnome-hello.png
            Terminal=0

      Example hello.gnorba:

           [hello]
            type=exe
            repo_id=IDL:GNOME/Applet:1.0
            description=Hello Applet
            location_info=hello.pike

      One thing to keep in mind is that the Exec line for the .desktop doesn't actually get executed when the Type is PanelApplet. The Exec line should be the GOAD ID specified in the .gnorba file (the "hello" enclosed by brackets). For a simple applet all you need to do is replace the hello.pike with the name of your applet executable.

      When the user right clicks on the applet, a menu appears, this is all handeled by the panel, so in order to add items to it you use a special interface to "add callbacks" to the menu. A very simple example would be (making our hello applet even more feature full):

           void hello_there()
           {
             write( "Hello there, indeed!\n" );
           }

           int main( int argc, array argv )
           {
             Gnome.AppletWidget w;
             Gnome.init( "hello", "1.0", argv, 0 );
             w = Gnome.AppletWidget("hello");
             w-&gt;add(GTK.Label("Hello World!"))-&gt;show_all();
             w-&gt;register_callback( "hello", "Hello there", hello_there, 0 );
             GTK.applet_widget_gtk_main();
           }

      Now the user will see a "Hello There" menu item on the applet menu, and when selected, the applet will print "Hello There". Useful huh?

      Note that the first argument to the register_callback is just a string identifier of this callback, and can really be whatever you want. But it should NOT be translated as the label (the 2nd argument) should be.

      Signals: back_change

      change_orient

      change_pixel_size

      change_position

      tooltip_state

    Inherit Plug

      inherit GTK.Plug : Plug

    Method abort_load

      `Gnome.AppletWidget abort_load()`

    Description

      Abort the applet loading, once applet has been created, this is a way to tell the panel to forget about us if we decide we want to quit before we add the actual applet to the applet-widget. This is only useful before before add() is called.

    Method add

      `Gnome.AppletWidget add(GTK.Widget what)`

    Description

      Add a child (widget) to the applet. This finishes the handshaking with the panel started in applet_widget_new. You should never call this function twice for the same applet. If you have already created an applet widget, but need to cancel the loading of the applet, use abort_load.

    Method callback_set_sensitive

      `Gnome.AppletWidget callback_set_sensitive(string name, int sensitive)`

    Description

      Sets the sensitivity of a menu item in the applet's context menu.

    Method create

      `Gnome.AppletWidget Gnome.AppletWidget(string applet_name)`

    Description

      Make a new applet and register us with the panel, if you decide to cancel the load before calling add, you should call abort_load.

    Method get_free_space

      `int get_free_space()`

    Description

      Gets the free space left that you can use for your applet. This is the number of pixels around your applet to both sides. If you strech by this amount you will not disturb any other applets. If you are on a packed panel 0 will be returned.

    Method get_globcfgpath

      `string get_globcfgpath()`

    Method get_panel_orient

      `int get_panel_orient()`

    Description

      Gets the orientation of the panel this widget is on. it can be one of GNOME_Panel_ORIENT_DOWN , GNOME_Panel_ORIENT_LEFT , GNOME_Panel_ORIENT_RIGHT and GNOME_Panel_ORIENT_UP . This is not the position of the panel, but rather the direction that the applet should be "reaching out". So any arrows should for example point in this direction. It will be OrientUp or OrientDown for horizontal panels and OrientLeft or OrientRight for vertical panels

    Method get_panel_pixel_size

      `int get_panel_pixel_size()`

    Description

      Gets the width of the panel in pixels. This is not the actual size, but the recomended one. The panel may be streched if the applets use larger sizes then this.

    Method get_privcfgpath

      `string get_privcfgpath()`

    Method register_callback

      `Gnome.AppletWidget register_callback(string name, string menutext, function callback_cb, mixed callback_arg)`

    Description

      Adds a menu item to the applet's context menu. The name should be a path that is separated by '/' and ends in the name of this item. You need to add any submenus with register_callback_dir.

    Method register_callback_dir

      `Gnome.AppletWidget register_callback_dir(string name, string menutext)`

    Description

      Adds a submenu to the applet's context menu. The name should be the full path of the new submenu with the name of the new submenu as the last part of the path. The name can, but doesn't have to be terminated with a '/'.

    Method register_stock_callback

      `Gnome.AppletWidget register_stock_callback(string name, string stock_type, string menutext, function callback_cb, mixed callback_arg)`

    Description

      Adds a menu item to the applet's context menu with a stock GNOME pixmap. This works almost exactly the same as register_callback.

    Method register_stock_callback_dir

      `Gnome.AppletWidget register_stock_callback_dir(string name, string stock_type, string menutext)`

    Description

      Adds a submenu to the applet's context menu with a stock GNOME pixmap. This is similiar to register_callback_dir.

    Method remove

      `Gnome.AppletWidget remove()`

    Description

      Remove the plug from the panel, this will destroy the applet. You can only call this once for each applet.

    Method send_position

      `Gnome.AppletWidget send_position(int enable)`

    Description

      If you need to get a signal everytime this applet changes position relative to the screen, you need to run this function with TRUE for enable and bind the change_position signal on the applet. This signal can be quite CPU/bandwidth consuming so only applets which need it should use it. By default change_position is not sent.

    Method set_tooltip

      `Gnome.AppletWidget set_tooltip(string to)`

    Description

      Set a tooltip on the entire applet that will follow the tooltip setting from the panel configuration.

    Method set_widget_tooltip

      `Gnome.AppletWidget set_widget_tooltip(GTK.Widget widget, string text)`

    Description

      Set a tooltip on the widget that will follow the tooltip setting from the panel configuration.

    Method sync_config

      `Gnome.AppletWidget sync_config()`

    Description

      Tell the panel to save our session here (just saves, no shutdown). This should be done when you change some of your config and want the panel to save it's config, you should NOT call this in the session_save handler as it will result in a locked panel, as it will actually trigger another session_save signal for you. However it also asks for a complete panel save, so you should not do this too often, and only when the user has changed some preferences and you want to sync them to disk. Theoretically you don't even need to do that if you don't mind loosing settings on a panel crash or when the user kills the session without logging out properly, since the panel will always save your session when it exists.

    Method unregister_callback

      `Gnome.AppletWidget unregister_callback(string name)`

    Description

      Remove a menu item from the applet's context menu. The name should be the full path to the menu item. This will not remove any submenus.

    Method unregister_callback_dir

      `Gnome.AppletWidget unregister_callback_dir(string name)`

    Description

      Removes a submenu from the applet's context menu. Use this instead of unregister_callback to remove submenus. The name can be, but doesn't have to be terminated with a '/'. If you have not removed the subitems of this menu, it will still be shown but without it's title or icon. So make sure to first remove any items and submenus before calling this function.

  CLASS Gnome.PaperSelector

    Description

      `Gnome.PaperSelector()`

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method create

      `Gnome.PaperSelector Gnome.PaperSelector()`

    Method get_bottom_margin

      `float get_bottom_margin()`

    Method get_height

      `float get_height()`

    Method get_left_margin

      `float get_left_margin()`

    Method get_name

      `string get_name()`

    Method get_right_margin

      `float get_right_margin()`

    Method get_top_margin

      `float get_top_margin()`

    Method get_width

      `float get_width()`

  CLASS Gnome.Appbar

    Description

      A bar that GNOME applications put on the bottom of the windows to display status, progress, hints for menu items or a minibuffer for getting some sort of response. It has a stack for status messages `Gnome.Appbar( 1, 1, Gnome.PreferencesUser )->set_progress( 0.4 );`

      Signals: clear_prompt Emitted when the prompt is cleared

      user_response Emitted when the user hits enter after a prompt

    Inherit Hbox

      inherit GTK.Hbox : Hbox

    Method clear_prompt

      `Gnome.Appbar clear_prompt()`

    Description

      Remove any prompt.

    Method clear_stack

      `Gnome.Appbar clear_stack()`

    Description

      Remove all status messages from appbar, and display default status message (if present).

    Method create

      `Gnome.Appbar Gnome.Appbar(int has_progress, int has_status, int interactivity)`

    Description

      Create a new GNOME application status bar. If has_progress is TRUE, a small progress bar widget will be created, and placed on the left side of the appbar. If has_status is TRUE, a status bar, possibly an editable one, is created.

      interactivity determines whether the appbar is an interactive "minibuffer" or just a status bar. If it is set to Gnome.PREFERENCES_NEVER, it is never interactive. If it is set to Gnome.PREFERENCES_USER we respect user preferences from ui-properties. If it's Gnome.PREFERENCES_ALWAYS we are interactive whether the user likes it or not. Basically, if your app supports both interactive and not (for example, if you use the gnome-app-util interfaces), you should use Gnome.PREFERENCES_USER. Otherwise, use the setting you support. Please note that "interactive" mode is not functional now; GtkEntry is inadequate and so a custom widget will be written eventually.

    Method get_progress

      `GTK.Progress get_progress()`

    Description

      Returns GTK.Progress widget pointer, so that the progress bar may be manipulated further.

    Method get_response

      `string get_response()`

    Description

      Get the response to the prompt, if any.

    Method pop

      `Gnome.Appbar pop()`

    Description

      Remove current status message, and display previous status message, if any. It is OK to call this with an empty stack.

    Method push

      `Gnome.Appbar push(string what)`

    Description

      Push a new status message onto the status bar stack, and display it.

    Method refresh

      `Gnome.Appbar refresh()`

    Description

      Reflect the current state of stack/default. Useful to force a set_status to disappear.

    Method set_default

      `Gnome.Appbar set_default(string default_status)`

    Description

      What to show when showing nothing else; defaults to "".

    Method set_progress

      `Gnome.Appbar set_progress(float percentage)`

    Description

      Sets progress bar to the given percentage. Pure sugar - with a bad name, in light of the get_progress name which is not the opposite of set_progress. Maybe this function should die.

    Method set_prompt

      `Gnome.Appbar set_prompt(string prompt, int modal)`

    Description

      Put a prompt in the appbar and wait for a response. When the user responds or cancels, a user_response signal is emitted.

    Method set_status

      `Gnome.Appbar set_status(string status)`

    Description

      Sets the status label without changing widget state; next set or push will destroy this permanently.

  CLASS Gnome.NumberEntry

    Description

      Provides an entry line for numbers. This routine does not attempt to do any validation on the valid number ranges, but provides a button that will let the user bring up a calculator to fill in the value of the entry widget. `Gnome.NumberEntry("", "Select a number...");`

    Inherit Hbox

      inherit GTK.Hbox : Hbox

    Method create

      `Gnome.NumberEntry Gnome.NumberEntry(string history_id, string calc_dialog_title)`

    Description

      Creates a new number entry widget, with a history id and title for the calculator dialog.

    Method get_number

      `float get_number()`

    Description

      Get the current number from the entry

    Method gnome_entry

      `Gnome.Entry gnome_entry()`

    Description

      Get the W(GnomeEntry) component of the Gnome.NumberEntry for lower-level manipulation.

    Method gtk_entry

      `GTK.Entry gtk_entry()`

    Description

      Get the W(Entry) component of the Gnome.NumberEntry for Gtk+-level manipulation.

    Method set_title

      `Gnome.NumberEntry set_title(string title)`

    Description

      Set the title of the calculator dialog to calc_dialog_title. Takes effect the next time the calculator button is pressed.

  CLASS Gnome.DockBand

    Description

      Gnome.DockBand is a widget implementing a "dock band", i.e. a horizontal or vertical stripe containing dockable widgets.

      The application programmer does not normally need to use Gnome.DockBand directly; they are mostly used by the W(GnomeDock) widget to implement its functionality. For an explanation of the way dock bands are used within a dock, check out the documentation for the W(GnomeDock) widget.

    Inherit Container

      inherit GTK.Container : Container

    Method append

      `int append(Gnome.DockItem child, int offset)`

    Description

      Add child to the band with the specified offset as the last element.

    Method create

      `Gnome.DockBand Gnome.DockBand()`

    Description

      Create a new Gnome.DockBand widget.

    Method get_child_offset

      `int get_child_offset(GTK.Widget child)`

    Description

      Retrieve the offset of the child

    Method get_item_by_name

      `Gnome.DockItem get_item_by_name(string name)`

    Description

      Retrieve a named item from the band.

    Method get_num_children

      `int get_num_children()`

    Description

      Retrieve the number of children

    Method get_orientation

      `int get_orientation()`

    Description

      Retrieve the orientation

    Method insert

      `int insert(Gnome.DockItem child, int offset, int position)`

    Description

      Add child to the band at the specified position, with the specified offset from the previous item (or from the beginning of the band, if this is the first item).

    Method layout_add

      `Gnome.DockBand layout_add(Gnome.DockLayout layout, int placement, int band_num)`

    Method prepend

      `int prepend(Gnome.DockItem child, int offset)`

    Description

      Add child to the band with the specified offset as the first element.

    Method set_child_offset

      `Gnome.DockBand set_child_offset(GTK.Widget child, int offset)`

    Description

      Set the offset for the specified child of the band.

    Method set_orientation

      `Gnome.DockBand set_orientation(int orientation)`

    Description

      Set the orientation.

  CLASS Gnome.DruidPageFinish

    Description

      This is a W(GnomeDruidPage).

    Inherit DruidPage

      inherit Gnome.DruidPage : DruidPage

    Method create

      `Gnome.DruidPageFinish Gnome.DruidPageFinish()`

    Description

      Creates a new Gnome.DruidPageStandard widget.

    Method set_bg_color

      `Gnome.DruidPageFinish set_bg_color(GDK.Color color)`

    Description

      This will set the background color to be the specified color.

    Method set_logo_bg_color

      `Gnome.DruidPageFinish set_logo_bg_color(GDK.Color color)`

    Description

      This will set the background color of the logo

    Method set_text

      `Gnome.DruidPageFinish set_text(string text)`

    Description

      Set the text

    Method set_text_color

      `Gnome.DruidPageFinish set_text_color(GDK.Color color)`

    Description

      Set the text color

    Method set_textbox_color

      `Gnome.DruidPageFinish set_textbox_color(GDK.Color color)`

    Description

      This will set the textbox color to be the specified color.

    Method set_title

      `Gnome.DruidPageFinish set_title(string title)`

    Description

      Set the title

    Method set_title_color

      `Gnome.DruidPageFinish set_title_color(GDK.Color color)`

    Description

      Set the title color

  CLASS Gnome.Less

    Description

      This widget implements a graphical "more" command. It allows the user to view a text file. There are various possible ways to specify the contents to display: loading the data from a file (by providing a filename) or by loading it from an open file data stream or from the output of a Unix command.

      `Gnome.Less()->show_string("Example string\nshown in this\nwidget")`

      `Gnome.Less()->show_file("/usr/dict/words" );`

      `Gnome.Less()->show_command( "psrinfo -v" )`

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method clear

      `Gnome.Less clear()`

    Description

      Clears all the text

    Method create

      `Gnome.Less Gnome.Less()`

    Description

      Creates a new GnomeLess widget.

    Method reshow

      `Gnome.Less reshow()`

    Description

      Re-displays all of the text in the GnomeLess widget gl. If the font has changed since the last show/reshow of text, it will update the current text to the new font.

    Method set_fixed_font

      `Gnome.Less set_fixed_font(int fixed)`

    Description

      Specifies whether or not new text should be displayed using a fixed font. Pass TRUE in fixed to use a fixed font, or FALSE to revert to the default GtkText font.

      Note: This will not affect text already being displayed. If you use this function after adding text to the widget, you must show it again by using gnome_less_reshow or one of the gnome_less_show commands.

    Method set_font

      `Gnome.Less set_font(GDK.Font font)`

    Description

      Sets the font of the text to be displayed in the GnomeLess widget gl to font. Note: This will not affect text already being displayed. If you use this function after adding text to the widget, you must show it again by using reshow or one of the show commands.

    Method show_command

      `Gnome.Less show_command(string command_line)`

    Description

      Runs the shell command specified in command_line, and places the output of that command in the GnomeLess widget specified by gl. Replaces any text already being displayed in the widget.

    Method show_file

      `Gnome.Less show_file(string file)`

    Description

      Displays a file in a GnomeLess widget. Replaces any text already being displayed in the widget.

    Method show_filestream

      `Gnome.Less show_filestream(Stdio.File stream)`

    Method show_string

      `Gnome.Less show_string(string data)`

    Description

      Displays a string in the GnomeLess widget gl. Replaces any text already being displayed.

    Method write_file

      `int write_file(string path)`

    Description

      Writes the text displayed in the GnomeLess widget gl to the file specified by path.

    Method write_filestream

      `int write_filestream(Stdio.File fd)`

  CLASS Gnome.DockItem

    Inherit Bin

      inherit GTK.Bin : Bin

    Method create

      `Gnome.DockItem Gnome.DockItem(string name, int behavior)`

    Description

      Create a new GnomeDockItem named name, with the specified behavior. Gnome.DockItemBehExclusive specifies that the dock item is always the only one in its band. Gnome.DockItemBehNeverFloating specifies that users cannot detach the dock item from the dock. Gnome.DockItemBehNeverVertical specifies that the dock item must be kept horizontal, and users cannot move it to a vertical band. Gnome.DockItemBehNeverHorizontal specifies that the dock item must be kept horizontal, and users cannot move it to a vertical band. Gnome.DockItemBehLocked specifies that users cannot drag the item around.

    Method get_behavior

      `int get_behavior()`

    Method get_child

      `GTK.Widget get_child()`

    Description

      Retrieve the child of the item.

    Method get_name

      `string get_name()`

    Description

      Retrieve the name

    Method get_orientation

      `int get_orientation()`

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_orientation

      `Gnome.DockItem set_orientation(int orientation)`

    Method set_shadow_type

      `Gnome.DockItem set_shadow_type(int shadow_type)`

    Description

      One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

  CLASS Gnome.Druid

    Description

      The GNOME druid is a system for assisting the user with installing a service. It is roughly equivalent in functionality to the "Wizards" available in Windows.

      There are two major parts of the druid, the Gnome.Druid widget, and the set of W(Gnome.DruidPage) widgets. The Gnome.Druid widget is the main widget that interacts with the user. It has a Next, a Prev, and a Cancel button, and acts as a container for the pages. It is not a top-level window, so it needs to be put in a W(GTK.Window) in almost all cases. The W(Gnome.DruidPage) is a virtual widget, from which all of the actual content of the page inherits from. There are currently three of these available within gnome-libs.

      GNOME druids are fairly simple to program with. You start by creating a GnomeDruid into which you put all of your pages. This widget will handle the presentation of the W(GnomeDruidPage) widgets.

      You then create all appropriate W(GnomeDruidPage) widgets. There are three implementations of these, although there is no reason why more couldn't be written. They are the W(GnomeDruidPageStart), the W(GnomeDruidPageStandard), and the W(GnomeDruidPageFinish). The W(GnomeDruidPageStandard) acts as a W(Container), and is probably the most commonly used druid page. The other ones, as their names might suggest, are used at the endpoints of the druid. More information on the specific properties of these widgets can be found on their respective pages.

      You will need to add the pages to the druid in order for them to appear. The druid itself keeps an internal list of all pages, and using the prepend_page(), append_page(), and insert_page() functions will place them into it.

      Signals: cancel This signal is emitted when the "cancel" button has been pressed. Note that the current druid page has the option to trap the signal and use it, if need be, preventing this signal from being emitted.

    Inherit Container

      inherit GTK.Container : Container

    Method append_page

      `Gnome.Druid append_page(Gnome.DruidPage page)`

    Description

      This will append a GnomeDruidPage into the internal list of pages that the druid has.

    Method create

      `Gnome.Druid Gnome.Druid()`

    Description

      Create a new druid

    Method insert_page

      `Gnome.Druid insert_page(Gnome.DruidPage back_page, Gnome.DruidPage page)`

    Description

      This will insert page after back_page into the list of internal pages that the druid has. If back_page is not present in the list or is 0, page will be prepended to the list.

    Method prepend_page

      `Gnome.Druid prepend_page(Gnome.DruidPage page)`

    Description

      This will prepend a GnomeDruidPage into the internal list of pages that the druid has.

    Method set_buttons_sensitive

      `Gnome.Druid set_buttons_sensitive(int beck_sensitive, int next_sensitive, int cancel_sensitive)`

    Description

      Sets the sensitivity of the druid's control-buttons. If the variables are TRUE, then they will be clickable. This function is used primarily by the actual W(GnomeDruidPage) widgets.

    Method set_page

      `Gnome.Druid set_page(Gnome.DruidPage page)`

    Description

      This will make page the currently showing page in the druid. page must already be in the druid.

    Method set_show_finish

      `Gnome.Druid set_show_finish(int show_finish)`

    Description

      Sets the text on the last button on the druid. If show_finish is TRUE, then the text becomes "Finish". If show_finish is FALSE, then the text becomes "Cancel".

  CLASS Gnome.FontPicker

    Description

      GnomeFontPicker - Button that displays current font; click to select new font. `Gnome.FontPicker();`

      `Gnome.FontPicker()->set_mode( Gnome.FontPickerModeFontInfo );`

      Signals: font_set

    Inherit Button

      inherit GTK.Button : Button

    Method create

      `Gnome.FontPicker Gnome.FontPicker()`

    Description

      Create a new font pick button

    Method fi_set_show_size

      `Gnome.FontPicker fi_set_show_size(int show_size)`

    Description

      If show_size is TRUE, font size will be displayed along with font chosen by user. This only applies if current button mode is Gnome.FontPickerModeFontInfo.

    Method fi_set_use_font_in_label

      `Gnome.FontPicker fi_set_use_font_in_label(int use_font_in_label, int size)`

    Description

      If use_font_in_label is TRUE, font name will be written using font chosen by user and using size passed to this function. This only applies if current button mode is Gnome.FontPickerModeFontInfo.

    Method get_font

      `GDK.Font get_font()`

    Description

      Retrieves the font from the font selection dialog.

    Method get_font_name

      `string get_font_name()`

    Description

      Retrieve name of font from font selection dialog.

    Method get_mode

      `int get_mode()`

    Description

      Returns current font picker button mode (or what to show).

    Method get_preview_text

      `string get_preview_text()`

    Description

      Retrieve preview text from font selection dialog if available.

    Method set_font_name

      `int set_font_name(string fontname)`

    Description

      Set or update the currently displayed font in the font picker dialog

    Method set_mode

      `Gnome.FontPicker set_mode(int mode)`

    Description

      Set value of subsequent font picker button mode (or what to show). Mode is one of GNOME_FONT_PICKER_MODE_FONT_INFO , GNOME_FONT_PICKER_MODE_PIXMAP , GNOME_FONT_PICKER_MODE_UNKNOWN and GNOME_FONT_PICKER_MODE_USER_WIDGET

    Method set_preview_text

      `Gnome.FontPicker set_preview_text(string text)`

    Description

      Set preview text in font picker, and in font selection dialog if one is being displayed.

    Method set_title

      `Gnome.FontPicker set_title(string title)`

    Description

      Sets the title for the font selection dialog.

    Method uw_set_widget

      `Gnome.FontPicker uw_set_widget(GTK.Widget widget)`

    Description

      Set the user-supplied widget as the inside of the font picker. This only applies with Gnome.FontPickerModeUserWidget.

  CLASS Gnome.DockLayoutItem

    Description

      Information about an item in a gnome_dock_layout

    Method get_item

      `Gnome.DockItem get_item()`

    Description

      The W(gnome_dock_item) this information applies to.

    Method get_placement

      `int get_placement()`

    Description

      One of

    Method position

      `mapping position()`

    Description

      Get the position of the item

  CLASS Gnome.PropertyBox

    Description

      The Gnome.PropertyBox widget simplifies coding a consistent dialog box for configuring properties of any kind.

      The Gnome.PropertyBox is a toplevel widget (it will create its own window), inside it contains a GtkNotebook which is used to hold the various property pages.

      The box will include ok, cancel, apply and help buttons (the actual buttons depends on the settings the user has, for example, apply can be hidden). The ok and apply buttons will start up in non-sensitive state, the programmer needs to configure the widgets inserted into the property box to inform the widget of any state changes to enable the ok and apply buttons. This is done by calling the changed() function.

      To use this widget, you create the widget and then you call append_page() for each property page you want in the property box.

      The widget emits two signals: "apply" and "help". To make a functional dialog box you will want to connect to at least the "apply" signal. Your function will be invoked once for each page and one more time at the end, passing a special value of -1 for the page number.

      Signals: apply This signal is invoked with the page number that is being applied. The signal is emited with the special page number -1 when it has finished emiting the signals for all of the property pages.

      help This signal is invoked when the user clicks on the help button in the property box. An argument is passed that identifies the currently active page number.

    Inherit Dialog

      inherit Gnome.Dialog : Dialog

    Method append_page

      `int append_page(GTK.Widget child, GTK.Widget tab_label)`

    Description

      Appends a new page to the Gnome.PropertyBox. widget is the widget that is being inserted, and tab_label will be used as the label for this configuration page.

    Method changed

      `Gnome.PropertyBox changed()`

    Description

      When a setting has changed, the code needs to invoke this routine to make the Ok/Apply buttons sensitive.

    Method create

      `Gnome.PropertyBox Gnome.PropertyBox()`

    Description

      Creates a new Gnome.PropertyBox widget.

    Method set_state

      `Gnome.PropertyBox set_state(int state)`

  CLASS Gnome.DockLayout

    Description

      The Gnome.DockLayout widget is meant to make it simple for programmers to handle the layout of a GnomeDock widget.

      Gnome.DockLayout can contain an arbitrary number of W(Gnome.DockItem) widgets, each of them with its own placement information. It is possible to "extract" a layout from an existing W(GnomeDock) widget, as well as adding the items present in a Gnome.DockLayout to it. Moreover, Gnome.DockLayout is able to create a layout configuration string that can be later used to re-construct the layout on a brand new Gnome.DockLayout widget.

      As a consequence, Gnome.DockLayout is very useful to save and retrieve W(GnomeDock) configurations into files. For example, W(GnomeApp) uses Gnome.DockLayout to create a default layout configuration, override it with the user-specific configuration file, and finally apply it to it's W(GnomeDock).

    Inherit Object

      inherit GTK.Object : Object

    Method add_floating_item

      `int add_floating_item(Gnome.DockItem item, int x, int y, int orientation)`

    Description

      Add item to the layout as a floating item with the specified (x, y) position and orientation.

    Method add_item

      `int add_item(Gnome.DockItem item, int placement, int band_num, int band_position, int offset)`

    Description

      Add item to the layout with the specified parameters.

    Method add_to_dock

      `int add_to_dock(Gnome.Dock dock)`

    Description

      Add all the items in this layout to the specified dock

    Method create

      `Gnome.DockLayout Gnome.DockLayout()`

    Description

      Create a new Gnome.DockLayout widget.

    Method create_string

      `string create_string()`

    Description

      Generate a string describing the layout

    Method get_item

      `Gnome.DockLayoutItem get_item(Gnome.DockItem item)`

    Description

      Retrieve a dock layout item.

    Method get_item_by_name

      `Gnome.DockLayoutItem get_item_by_name(string name)`

    Description

      Retrieve the dock layout item named name

    Method parse_string

      `Gnome.DockLayout parse_string(string str)`

    Description

      Parse the layout string str, and move around the items in layout accordingly.

    Method remove_item

      `int remove_item(Gnome.DockItem item)`

    Description

      Remove the specified item from the layout.

    Method remove_item_by_name

      `int remove_item_by_name(string name)`

    Description

      Remove the specified item from the layout.

  CLASS Gnome.FileEntry

    Description

      This widget provides an entry box with history (a W(GnomeEntry)) and a button which can pop up a file selector dialog box W(GtkFileSelection). It also accepts DND drops from the filemanager and other sources. `Gnome.FileEntry("","")`

      Signals: browse_clicked Signal emitted when the "browse" button is clicked. This is so that you can add stuff to the file selector or to override this method.

    Inherit Hbox

      inherit GTK.Hbox : Hbox

    Method create

      `Gnome.FileEntry Gnome.FileEntry(string history_id, string browse_dialog_title)`

    Description

      Creates a new Gnome.FileEntry widget.

    Method get_full_path

      `string get_full_path(int file_must_exist)`

    Description

      Gets the full absolute path of the file from the entry. If file_must_exist is false, nothing is tested and the path is returned. If file_must_exist is true, then the path is only returned if the path actually exists. In case the entry is a directory entry (see set_directory), then if the path exists and is a directory then it's returned; if not, it is assumed it was a file so we try to strip it, and try again.

    Method gnome_entry

      `Gnome.Entry gnome_entry()`

    Description

      Get the W(GnomeEntry) component of the widget for lower-level manipulation.

    Method gtk_entry

      `GTK.Entry gtk_entry()`

    Description

      Get the W(Entry) component of the widget for lower-level manipulation.

    Method set_default_path

      `Gnome.FileEntry set_default_path(string path)`

    Description

      Set the default path of browse dialog to path. The default path is only used if the entry is empty or if the current path of the entry is not an absolute path, in which case the default path is prepended to it before the dialog is started.

    Method set_directory

      `Gnome.FileEntry set_directory(int directory_entry)`

    Description

      Sets whether this is a directory only entry. If directory_entry is true, then get_full_path will check for the file being a directory, and the browse dialog will have the file list disabled.

    Method set_modal

      `Gnome.FileEntry set_modal(int is_modal)`

    Description

      Sets the modality of the browse dialog.

    Method set_title

      `Gnome.FileEntry set_title(string browse_dialog_title)`

    Description

      Set the title of the browse dialog to browse_dialog_title. The new title will go into effect the next time the browse button is pressed.

  CLASS Gnome.Href

    Description

      This widget is a GtkButton button that contains a URL. When clicked it invokes the configured browser for the URL you provided.

      `Gnome.Href( "http://www.gnome.org", "GNOME Web Site" )`

      `Gnome.Href( "http://www.gnome.org" )`

    Inherit Button

      inherit GTK.Button : Button

    Method create

      `Gnome.Href Gnome.Href(string url, string|void label)`

    Description

      Created a GNOME href object, a label widget with a clickable action and an associated URL. If label is set to 0, url is used as the label.

    Method get_label

      `string get_label()`

    Description

      Returns the contents of the label widget used to display the link text.

    Method get_url

      `string get_url()`

    Description

      Return the url

    Method set_label

      `Gnome.Href set_label(string label)`

    Description

      Sets the internal label widget text (used to display a URL's link text) to the given value.

    Method set_url

      `Gnome.Href set_url(string url)`

    Description

      Sets the internal URL

  CLASS Gnome.DruidPage

    Description

      This widget is a virtual widget to define the interface to a druid page. It's descendants are placed in a W(Gnome.Druid) widget.

      Signals: back

      cancel

      finish

      next

      prepare

    Inherit Bin

      inherit GTK.Bin : Bin

  CLASS Gnome.StatusDocklet

    Description

      Some apps want to embed a very small icon or widget in the panel to display the status of the app. This can be done without the operational overhead of an applet. The status docklet will embed a 22 by 22 window inside the panel. This is not a separate applet and thus is minimally intrusive to the user and is meant for very temporary status displays for which a full applet would not be appropriate.

      The way StatusDocklet works is a little different from how the AppletWidget works. Firstly, StatusDocklet object is not a widget, it is just an abstract GTK+ object. You create a new StatusDocklet object and then bind the "build_plug" signal which is emitted when the panel was contacted and a widget must be built. After binding the "build_plug" signal, you call run() to actually start trying to contacting the panel. StatusDocklet is safe to use without a panel. By default it will try to locate a panel for 15 minutes and after that it will give up. It will also handle panel restarts by default. If it does, your widget will be destroyed and "build_plug" will be emitted again when the new panel starts. Even though the panel will never restart by itself, the user might not run session management and thus might restart panel by hand, or due to a bug, the panel might crash and restart itself.

      Docklets are not available in GNOME 1.0.

      Signals: build_plug This signal is emitted when you actually need to build the widget that you want to place inside the plug in the status docklet. It should be 22 by 22, and if it is larger it will be cropped.

    Inherit Object

      inherit GTK.Object : Object

    Method create

      `Gnome.StatusDocklet Gnome.StatusDocklet()`

    Description

      Creates a new status docklet object with the default parameters. By default the docklet object will try to contact a panel 20 times. It will try to find a panel every 15 seconds. You need to bind the build_plug signal in which you build your own widget and add it to the provided container. By default the docklet object will handle a panel restart, in which case your widget will be destroyed and when the panel is contacted again the build_plug signal will be emitted again. You also must call the status_docklet_run function after you bind the build_plug signal.

    Method get_plug

      `GTK.Plug get_plug()`

    Description

      the current W(plug) holding the docklet

    Method run

      `Gnome.StatusDocklet run()`

    Description

      Search for the panel and add the plug if it finds it. This function is also called internally from the timeout. If called externally more times, a panel lookup will be forced and one try will be wasted. You need to call this function at least once after binding the build_plug signal to tell the status docklet to start looking for the panel. If the status docklet handles restarts you don't have to call this function ever again.

  CLASS Gnome.Entry

    Description

      This widget is a wrapper around the GtkEntry widget, but it provides a history mechanism for all the input entered into the widget. The way this works is that a special identifier is provided when creating the GnomeEntry widget, and this identifier is used to load and save the history of the text.

      `Gnome.Entry( "history" )`

    Inherit Combo

      inherit GTK.Combo : Combo

    Method append_history

      `Gnome.Entry append_history(int save, string text)`

    Description

      Adds a history item of the given text to the tail of the history list inside gentry. If save is TRUE, the history item will be saved in the config file (assuming that gentry's history id is not 0).

    Method create

      `Gnome.Entry Gnome.Entry(string|void history_id)`

    Description

      Creates a new GnomeEntry widget. If history_id is not 0, then the history list will be saved and restored between uses under the given id.

    Method gtk_entry

      `GTK.Entry gtk_entry()`

    Description

      Obtain pointer to Gnome.Entry's internal GTK.Entry text entry

    Method load_history

      `Gnome.Entry load_history()`

    Description

      Loads a stored history list from the GNOME config file, if one is available. If the history id of gentry is 0, nothing occurs.

    Method prepend_history

      `Gnome.Entry prepend_history(int save, string text)`

    Description

      Adds a history item of the given text to the head of the history list inside gentry. If save is TRUE, the history item will be saved in the config file (assuming that gentry's history id is not 0).

    Method save_history

      `Gnome.Entry save_history()`

    Description

      Force the history items of the widget to be stored in a configuration file. If the history id of gentry is 0, nothing occurs.

    Method set_history_id

      `Gnome.Entry set_history_id(string|void history_id)`

    Description

      Set or clear the history id of the GnomeEntry widget. If history_id is 0, the widget's history id is cleared. Otherwise, the given id replaces the previous widget history id.

  CLASS Gnome.PixmapEntry

    Description

      Entry for large images with a preview. Unlike GnomeIconEntry, it does not scale the images to a specific size and shows them 1:1. This is perfect for selection of backgrounds and such. It also allows DND to be performed on the preview box. It also provides all the GnomeEntry functionality as well. `Gnome.PixmapEntry("","browse...",1);`

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method create

      `Gnome.PixmapEntry Gnome.PixmapEntry(string history_id, string browse_dialog_title, int do_preview)`

    Description

      Creates a new pixmap entry widget, if do_preview is false, the preview is hidden but the files are still loaded so that it's easy to show it. For a pixmap entry without preview, use the W(GnomeFileEntry) widget.

    Method get_filename

      `string get_filename()`

    Description

      Gets the filename of the image if the preview successfully loaded.

    Method gnome_entry

      `Gnome.Entry gnome_entry()`

    Description

      Get the W(GnomeEntry) component of the W(GnomePixmapEntry) widget for lower-level manipulation.

    Method gnome_file_entry

      `Gnome.FileEntry gnome_file_entry()`

    Description

      Get the W(GnomeFileEntry) component of the W(GnomePixmapEntry) widget for lower-level manipulation.

    Method set_pixmap_subdir

      `Gnome.PixmapEntry set_pixmap_subdir(string dir)`

    Description

      Sets the default path for the file entry. The new subdirectory should be specified relative to the default GNOME pixmap directory.

    Method set_preview

      `Gnome.PixmapEntry set_preview(int do_preview)`

    Description

      Sets whether or not previews of the currently selected pixmap should be shown in the file selector.

    Method set_preview_size

      `Gnome.PixmapEntry set_preview_size(int min_w, int min_h)`

    Description

      Sets the minimum size of the preview frame in pixels.

  CLASS Gnome.DruidPageStart

    Description

      This is a W(GnomeDruidPage). It is meant to be used to introduce the user to what is being installed in a consistent manner.

    Inherit DruidPage

      inherit Gnome.DruidPage : DruidPage

    Method create

      `Gnome.DruidPageStart Gnome.DruidPageStart()`

    Description

      Creates a new Gnome.DruidPageStart widget.

    Method set_bg_color

      `Gnome.DruidPageStart set_bg_color(GDK.Color color)`

    Description

      This will set the background color to be the specified color.

    Method set_logo_bg_color

      `Gnome.DruidPageStart set_logo_bg_color(GDK.Color color)`

    Description

      This will set the background color of the logo

    Method set_text

      `Gnome.DruidPageStart set_text(string text)`

    Description

      Set the text

    Method set_text_color

      `Gnome.DruidPageStart set_text_color(GDK.Color color)`

    Description

      Set the text color

    Method set_textbox_color

      `Gnome.DruidPageStart set_textbox_color(GDK.Color color)`

    Description

      This will set the textbox color to be the specified color.

    Method set_title

      `Gnome.DruidPageStart set_title(string title)`

    Description

      Set the title

    Method set_title_color

      `Gnome.DruidPageStart set_title_color(GDK.Color color)`

    Description

      Set the title color

  CLASS Gnome.Dock

    Description

      GnomeDock is a container widget designed to let users move around widgets such as toolbars, menubars and so on.

      Every GnomeDock contains a widget called the "client area". On the four sides of the client area, there are four "dock areas", which can contain an arbitrary number of dockable widgets. All the dockable widgets should be GnomeDockItem widgets; the GnomeDockItem widget can in turn contain any kind of widget, and implements the dragging functionality: every GnomeDockItem has a handle that users can use to move them within the dock, or even move them outside it, so that they become "floating items".

      Every "dock area" is implemented by means of zero or more "dock bands": a dock band is a horizontal or vertical stripe containing one or more dock items, and is implemented by the GnomeDockBand widget. Items are ordered from top to bottom in vertical bands, and from left to right in horizontal bands. Every dock item in a band is given an offset value that defines the distance, in pixels, from the previous item in the same band; if the item is first in the band, the offset defines the distance from the start of the band.

      As a consequence, the position of an item in the dock can be specified by means of the following values: a "placement" specifying what area is being used (top, bottom, left, right), a "band number" specifying the number of the band within the specified area, a "position" within the band and a "offset" from the previous item in the same band.

      Signals: layout_changed

    Inherit Container

      inherit GTK.Container : Container

    Method add_floating_item

      `Gnome.Dock add_floating_item(Gnome.DockItem item, int x, int y, int orientation)`

    Description

      Add item to dock and make it floating at the specified (x, y) coordinates (relative to the root window of the screen).

    Method add_item

      `Gnome.Dock add_item(Gnome.DockItem item, int placement, int band_num, int position, int offset, int new_band)`

    Description

      Add item to dock. placement can be either Gnome.DOCK_TOP, Gnome.DOCK_RIGHT, Gnome.DOCK_BOTTOM or Gnome.DOCK_LEFT, and specifies what area of the dock should contain the item. If in_new_band is TRUE, a new dock band is created at the position specified by band_num; otherwise, the item is added to the band_num'th band.

    Method allow_floating_items

      `Gnome.Dock allow_floating_items(int allow)`

    Method create

      `Gnome.Dock Gnome.Dock()`

    Method get_client_area

      `GTK.Widget get_client_area()`

    Method get_item_by_name

      `Gnome.DockItem get_item_by_name(string name)`

    Method set_client_area

      `Gnome.Dock set_client_area(GTK.Widget area)`

    Description

      Specify a widget for the dock's client area.

  CLASS Gnome.AppProgressKey

    Description

      Wrapper for the opaque GnomeAppProgressKey type

    Method destroy

      `Gnome.AppProgressKey destroy()`

    Method done

      `Gnome.AppProgressKey done()`

    Method set

      `Gnome.AppProgressKey set(float percent)`

  CLASS Gnome.IconEntry

    Description

      This widget provides the facilities to select an icon. An icon is displayed inside a button, when the button is pressed, an Icon selector (a dialog with a W(GnomeIconSelection) widget) pops up to let the user choose an icon. It also allows one to Drag and Drop the images to and from the preview button.

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method create

      `Gnome.IconEntry Gnome.IconEntry(string history_id, string title)`

    Description

      Creates a new icon entry widget

    Method get_filename

      `string get_filename()`

    Description

      Gets the file name of the image if it was possible to load it into the preview. That is, it will only return a filename if the image exists and it was possible to load it as an image.

    Method gnome_entry

      `Gnome.Entry gnome_entry()`

    Description

      Get the W(GnomeEntry) widget that's part of the entry

    Method gnome_file_entry

      `Gnome.FileEntry gnome_file_entry()`

    Description

      Get the W(GnomeFileEntry) widget that's part of the entry

    Method gtk_entry

      `GTK.Entry gtk_entry()`

    Description

      Get the W(Entry) widget that's part of the entry

    Method set_pixmap_subdir

      `Gnome.IconEntry set_pixmap_subdir(string subdir)`

    Description

      Sets the subdirectory below gnome's default pixmap directory to use as the default path for the file entry.

  CLASS Gnome.DateEdit

    Description

      The GnomeDateEdit widget provides a way to enter dates and times with a helper calendar to let the user select the date. `Gnome.DateEdit(time(),1,1);`

      `Gnome.DateEdit(time(),0,1);`

      Signals: date_changed

      time_changed

    Inherit Hbox

      inherit GTK.Hbox : Hbox

    Method create

      `Gnome.DateEdit Gnome.DateEdit(int the_time, int show_time, int use_24_format)`

    Description

      Creates a new GnomeDateEdit widget which can be used to provide an easy to use way for entering dates and times.

    Method get_date

      `int get_date()`

    Description

      Returns the configured time

    Method set_popup_range

      `Gnome.DateEdit set_popup_range(int low_hour, int high_hour)`

    Description

      Sets the range of times that will be provide by the time popup selectors.

    Method set_time

      `Gnome.DateEdit set_time(int the_time)`

    Description

      Changes the displayed date and time in the GnomeDateEdit widget to be the one represented by the_time.

  CLASS Gnome.About

    Description

      A standard way of providing a small about box for your application. You provide the name of your application, version, copyright, a list of authors and some comments about your application. It also allows the programmer to provide a logo to be displayed.

      `Gnome.About( "Example", "1.0", "(c) Roxen IS 2000\n(c) IDA, LiU 2002", ({"Per Hedbor"}), "Some nice documentation\nabout this example" );`

    Inherit Dialog

      inherit Gnome.Dialog : Dialog

    Method create

      `Gnome.About Gnome.About(string title, string version, string copyright, array authors, string comment, string|void logo)`

    Description

      Creates a new GNOME About dialog. title, version, copyright, and authors are displayed first, in that order. comments is typically the location for multiple lines of text, if necessary. (Separate with "\n".) logo is the filename of a optional pixmap to be displayed in the dialog, typically a product or company logo of some sort; omit this argument if no logo file is available.

  CLASS Gnome.ColorPicker

    Description

      This widget provides color selection facilities to your application. The widget appears as a button which contains a "color swatch" of the currently selected color. When the button is pressed, the widget presents the user with a color selection dialog where the color can be selected.

      You can select the color to be displayed in a number of ways: floating point values for the red, green and blue channels, integers in the range 0 to 65,535, or integers in the range 0 to 255, depending on your needs. `Gnome.ColorPicker();`

      Signals: color_set This signal is emitted when the user changes the color on the color selector. The values passed to this signal are the red, green, blue and alpha channels selected in integer form in the range 0 to 65535.

    Inherit Button

      inherit GTK.Button : Button

    Method create

      `Gnome.ColorPicker Gnome.ColorPicker()`

    Description

      Creates a new GNOME color picker widget. This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

    Method get

      `mapping get()`

    Description

      Returns a mapping ([ "d":([ "r":rvalue, "g":gvalue, "b":bvalue, "a":avalue ]), "i8":([ ... ]), "i16":([ .. ]) ]);

    Method set_d

      `Gnome.ColorPicker set_d(float r, float g, float b, float a)`

    Description

      Set color shown in the color picker widget using floating point values. The values range between 0.0 and 1.0.

    Method set_dither

      `Gnome.ColorPicker set_dither(int dither)`

    Description

      Sets whether the picker should dither the color sample or just paint a solid rectangle.

    Method set_i16

      `Gnome.ColorPicker set_i16(int r, int g, int b, int a)`

    Description

      Set color shown in the color picker widget using integer values. The values range between 0 and 65535.

    Method set_i8

      `Gnome.ColorPicker set_i8(int r, int g, int b, int a)`

    Description

      Set color shown in the color picker widget using integer values. The values range between 0 and 255.

    Method set_title

      `Gnome.ColorPicker set_title(string title)`

    Description

      Sets the title for the color selection dialog

    Method set_use_alpha

      `Gnome.ColorPicker set_use_alpha(int use_alpha)`

    Description

      Sets whether or not the picker should use the alpha channel.

  CLASS Gnome.Dialog

    Description

      Gnome.Dialog gives dialogs a consistent look and feel, while making them more convenient to program. Gnome.Dialog makes it easy to use stock buttons, makes it easier to handle delete_event, and adds some cosmetic touches (such as a separator above the buttons, and a bevel around the edge of the window).

      Signals: clicked

      close

    Inherit Window

      inherit GTK.Window : Window

    Method append_button_with_pixmap

      `Gnome.Dialog append_button_with_pixmap(string name, string pixmap_file)`

    Method button_connect

      `Gnome.Dialog button_connect(int button, function callback_cb, mixed callback_arg)`

    Description

      Simply a signal_connect to the "clicked" signal of the specified button.

    Method close

      `Gnome.Dialog close()`

    Description

      See also close_hides(). This function emits the "close" signal( which either hides or destroys the dialog (destroy by default). If you connect to the "close" signal, and your callback returns TRUE, the hide or destroy will be blocked. You can do this to avoid closing the dialog if the user gives invalid input, for example.

      Using close() in place of hide() or destroy() allows you to easily catch all sources of dialog closure, including delete_event and button clicks, and handle them in a central location.

    Method create

      `Gnome.Dialog Gnome.Dialog(string title, string ... buttons)`

    Description

      Creates a new Gnome.Dialog, with the given title, and any button names in the arg list. Buttons can be simple names, such as "My Button", or gnome-stock defines such as GNOME.StockButtonOK, etc. The last argument should be NULL to terminate the list.

      Buttons passed to this function are numbered from left to right, starting with 0. So the first button in the arglist is button 0, then button 1, etc. These numbers are used throughout the Gnome.Dialog API.

    Method editable_enters

      `Gnome.Dialog editable_enters(GTK.Editable widget)`

    Description

      Normally if there's an editable widget (such as GtkEntry) in your dialog, pressing Enter will activate the editable rather than the default dialog button. However, in most cases, the user expects to type something in and then press enter to close the dialog. This function enables that behavior.

    Method get_vbox

      `GTK.Vbox get_vbox()`

    Method run

      `int run()`

    Description

      Blocks until the user clicks a button or closes the dialog with the window manager's close decoration (or by pressing Escape).

      You need to set up the dialog to do the right thing when a button is clicked or delete_event is received; you must consider both of those possibilities so that you know the status of the dialog when run() returns. A common mistake is to forget about Escape and the window manager close decoration; by default, these call close(), which by default destroys the dialog. If your button clicks do not destroy the dialog, you don't know whether the dialog is destroyed when run() returns. This is bad.

      So you should either close the dialog on button clicks as well, or change the close() behavior to hide instead of destroy. You can do this with close_hides().

    Method run_and_close

      `int run_and_close()`

    Description

      See run(). The only difference is that this function calls close() before returning if the dialog was not already closed.

    Method set_accelerator

      `Gnome.Dialog set_accelerator(int button, int accelerator_key, int accelerator_mode)`

    Method set_close

      `Gnome.Dialog set_close(int click_closes)`

    Description

      This is a convenience function so you don't have to connect callbacks to each button just to close the dialog. By default, Gnome.Dialog has this parameter set the FALSE and it will not close on any click. (This was a design error.) However, almost all the Gnome.Dialog subclasses, such as Gnome.MessageBox and Gnome.PropertyBox, have this parameter set to TRUE by default.

    Method set_default

      `Gnome.Dialog set_default(int button)`

    Description

      The default button will be activated if the user just presses return. Usually you should make the least-destructive button the default. Otherwise, the most commonly-used button.

    Method set_parent

      `Gnome.Dialog set_parent(GTK.Window parent)`

    Description

      Dialogs have "parents," usually the main application window which spawned them. This function will let the window manager know about the parent-child relationship. Usually this means the dialog must stay on top of the parent, and will be minimized when the parent is. Gnome also allows users to request dialog placement above the parent window (vs. at the mouse position, or at a default window manger location).

    Method set_sensitive

      `Gnome.Dialog set_sensitive(int button, int sensitive)`

    Description

      Calls set_sensitive() on the specified button number.

  CLASS Gnome.Scores

    Description

      This is a high-scores dialog box. The GNOME libraries also handle loading/saving systemwide high scores in a secure way.

      `Gnome.Scores( 17, ({ "per" })*17, map((array(float))indices(allocate(17)),`*,42), map(indices(allocate(17)), `*, 10 ), 1 )`

    Inherit Dialog

      inherit Gnome.Dialog : Dialog

    Method create

      `Gnome.Scores Gnome.Scores(int n_scores, array names, array scores, array times, int clear)`

    Method set_color

      `Gnome.Scores set_color(int pos, GDK.Color color)`

    Method set_current_player

      `Gnome.Scores set_current_player(int index)`

    Method set_def_color

      `Gnome.Scores set_def_color(GDK.Color color)`

    Method set_logo_label_title

      `Gnome.Scores set_logo_label_title(string txt)`

    Method set_logo_pixmap

      `Gnome.Scores set_logo_pixmap(string logofile)`

    Method set_logo_widget

      `Gnome.Scores set_logo_widget(GTK.Widget widget)`

  CLASS Gnome.App

    Description

      Toplevel GNOME applications would normally use one Gnome.App widget as their toplevel window. You can create as many Gnome.App widgets as you want, for example, some people use one GnomeApp per document their application loads.

      Once you have created one instance of this widget, you would add your main application view information to this window by using set_contents() routine.

      The GnomeApp has support for including a menubar, one or more toolbars and a statusbar for your application. It also takes care of intalling the accelerators for you when used in conjuction with the gnome-app-helper routines. The toolbars are inserted into Gnome.Dock widgets.

      The gnome-app-helper module provides various helper routines to simplify the configuration of your menus and toolbars, but you can create those yourself and use the set_menus(), add_toolbar(), set_toolbar(), add_dock_item() and add_docked().

    Inherit Window

      inherit GTK.Window : Window

    Method add_dock_item

      `Gnome.App add_dock_item(Gnome.DockItem item, int placement, int band_num, int band_position, int|void offset)`

    Description

      Create a new Gnome.DockItem widget containing widget, and add it to app's dock with the specified layout information. Notice that, if automatic layout configuration is enabled, the layout is overridden by the saved configuration, if any.

      item : Item to be added to app's dock placement : Placement for the new dock item, one of Gnome.DockTop, Gnome.DockRight, Gnome.DockBottom, Gnome.DockLeft and Gnome.DockFloating band_num : Number of the band where the dock item should be placed band_position : Position of the new dock item in band band_num offset : Offset from the previous dock item in the band; if there is no previous item, offset from the beginning of the band.

    Method add_docked

      `Gnome.App add_docked(GTK.Widget widget, string name, int behavior, int placement, int band_num, int band_position, int|void offset)`

    Description

      Create a new Gnome.DockItem widget containing widget, and add it to app's dock with the specified layout information. Notice that, if automatic layout configuration is enabled, the layout is overridden by the saved configuration, if any.

      widget : Widget to be added to app's dock name : Name for the dock item that will contain toolbar behavior : Behavior for the new dock item. One of GNOME_DOCK_ITEM_BEH_EXCLUSIVE , GNOME_DOCK_ITEM_BEH_LOCKED , GNOME_DOCK_ITEM_BEH_NEVER_FLOATING , GNOME_DOCK_ITEM_BEH_NEVER_HORIZONTAL , GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL and GNOME_DOCK_ITEM_BEH_NORMAL placement : Placement for the new dock item, one of Gnome.DockTop, Gnome.DockRight, Gnome.DockBottom, Gnome.DockLeft and Gnome.DockFloating band_num : Number of the band where the dock item should be placed band_position : Position of the new dock item in band band_num offset : Offset from the previous dock item in the band; if there is no previous item, offset from the beginning of the band.

    Method add_toolbar

      `Gnome.App add_toolbar(GTK.Toolbar toolbar, string name, int behavior, int placement, int band_num, int band_position, int|void offset)`

    Description

      Create a new Gnome.DockItem widget containing toolbar, and add it to app's dock with the specified layout information. Notice that, if automatic layout configuration is enabled, the layout is overridden by the saved configuration, if any.

      toolbar : Toolbar to be added to app's dock name : Name for the dock item that will contain toolbar behavior : Behavior for the new dock item. One or more of GNOME_DOCK_ITEM_BEH_EXCLUSIVE , GNOME_DOCK_ITEM_BEH_LOCKED , GNOME_DOCK_ITEM_BEH_NEVER_FLOATING , GNOME_DOCK_ITEM_BEH_NEVER_HORIZONTAL , GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL and GNOME_DOCK_ITEM_BEH_NORMAL placement : Placement for the new dock item, one of Gnome.DockTop, Gnome.DockRight, Gnome.DockBottom, Gnome.DockLeft and Gnome.DockFloating band_num : Number of the band where the dock item should be placed band_position : Position of the new dock item in band band_num offset : Offset from the previous dock item in the band; if there is no previous item, offset from the beginning of the band.

    Method create

      `Gnome.App Gnome.App(string appname, string|void title)`

    Description

      Create a new (empty) application window. You must specify the application's name (used internally as an identifier). title can be left as 0, in which case the window's title will not be set.

    Method enable_layout_config

      `Gnome.App enable_layout_config(int enable)`

    Description

      Specify whether the the dock's layout configuration should be automatically saved via gnome-config whenever it changes, or not.

    Method error

      `Gnome.Dialog error(string error)`

    Description

      An important fatal error; if it appears in the statusbar, it might gdk_beep() and require acknowledgement.

    Method flash

      `Gnome.App flash(string flash)`

    Description

      Flash the message in the statusbar for a few moments; if no statusbar, do nothing. For trivial little status messages, e.g. "Auto saving..."

    Method get_dock

      `Gnome.Dock get_dock()`

    Description

      retrieved the Gnome.Dock widget contained in the App

    Method get_dock_item_by_name

      `Gnome.DockItem get_dock_item_by_name(string name)`

    Method message

      `Gnome.Dialog message(string message)`

    Description

      A simple message, in an OK dialog or the status bar. Requires confirmation from the user before it goes away. Returns 0 or a dialog widget. If 0, the message is displayed in the status bar.

    Method ok_cancel

      `Gnome.App ok_cancel(string question, function callback, mixed cb_arg2)`

    Description

      Ask a ok or cancel question and call the callback when it's answered.

    Method ok_cancel_modal

      `Gnome.App ok_cancel_modal(string question, function callback, mixed cb_arg2)`

    Description

      Ask a ok or cancel question, block the application while it is asked, and call the callback when it's answered.

    Method progress_manual

      `Gnome.AppProgressKey progress_manual(string prompt)`

    Method progress_timeout

      `Gnome.AppProgressKey progress_timeout(string prompt, int interval, function cb, mixed cb_arg1)`

    Method question

      `Gnome.App question(string question, function reply_callback, mixed cb_arg2)`

    Description

      Ask a yes or no question, and call the callback when it's answered.

    Method question_modal

      `Gnome.App question_modal(string question, function callback, mixed cb_arg2)`

    Description

      Ask a yes or no question, block the application while it is asked, and call the callback when it's answered.

    Method request_password

      `Gnome.App request_password(string question, function callback, mixed cb_arg2)`

    Description

      As request string, but do not show the string

    Method request_string

      `Gnome.App request_string(string question, function callback, mixed cb_arg2)`

    Description

      Request a string, and call the callback when it's answered.

    Method set_contents

      `Gnome.App set_contents(GTK.Widget contents)`

    Description

      Sets the status bar of the application window.

    Method set_menus

      `Gnome.App set_menus(GTK.MenuBar menu_bar)`

    Description

      Sets the menu bar of the application window.

    Method set_statusbar

      `Gnome.App set_statusbar(GTK.Widget statusbar)`

    Description

      Sets the status bar of the application window.

    Method set_toolbar

      `Gnome.App set_toolbar(GTK.Toolbar toolbar)`

    Description

      Sets the main toolbar of the application window.

    Method warning

      `Gnome.Dialog warning(string warning)`

    Description

      A not-so-important error, but still marked better than a flash

  CLASS Gnome.MessageBox

    Description

      The GnomeMessageBox widget creates dialog boxes (of type GnomeDialog) that contain a severity level (indicated by an icon and a title), a message to be displayed and a list of buttons that will be in the dialog.

      The programmer will use strings desired for each button. If the strings are any of the GNOME_STOCK macros, then instead of creating a button with the text, the button will be a GNOME stock button with a stock icon.

      The list of known types for message boxes are: GNOME_MESSAGE_BOX_ERROR , GNOME_MESSAGE_BOX_GENERIC , GNOME_MESSAGE_BOX_INFO , GNOME_MESSAGE_BOX_QUESTION and GNOME_MESSAGE_BOX_WARNING . `Gnome.MessageBox( "This is a nice message", Gnome.MessageBoxInfo, Gnome.StockButtonOk, Gnome.StockButtonCancel );`

      `Gnome.MessageBox( "This is another not so nice message", Gnome.MessageBoxError, Gnome.StockButtonClose, Gnome.StockButtonCancel );`

    Inherit Dialog

      inherit Gnome.Dialog : Dialog

    Method create

      `Gnome.MessageBox Gnome.MessageBox(string message, string messagebox_type, string ... buttons)`

    Description

      Creates a dialog box of type message_box_type with message. A number of buttons are inserted on it. You can use the GNOME stock identifiers to create gnome stock buttons.

  CLASS Gnome.Calculator

    Description

      This widget provides a simple calculator that you can embed in your applications for doing quick computations.

      The widget consists of a fully functional calculator including standard arithmetic functions as well as trigonometric capabilities, exponents, factorials, nested equations, and others. `Gnome.Calculator()`

      Signals: result_changed This signal is emited by the widget when the result has been changed.

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method clear

      `Gnome.Calculator clear(int reset)`

    Description

      Resets the calculator back to zero. If reset is TRUE, results stored in memory and the calculator mode are cleared also.

    Method create

      `Gnome.Calculator Gnome.Calculator()`

    Description

      Create a new calculator widget

    Method get_result

      `float get_result()`

    Description

      Value currently stored in calculator buffer.

    Method set

      `Gnome.Calculator set(float result)`

    Description

      Sets the value stored in the calculator's result buffer to the given result.

  CLASS Gnome.IconList

    Description

      The GNOME icon list widget can hold a number of icons with captions. The icons on the list can be selected (various selection methods are supported). The programmer can enable caption-editing for the icons. This parameters is configured when you create the icon list widget. You can control the type of selection mode you desire by using the set_selection_mode() function.

      Signals: select_icon

      text_changed

      unselect_icon

    Inherit Widget

      inherit GTK.Widget : Widget

    Method append

      `Gnome.IconList append(string icon_filename, string text)`

    Description

      Appends an icon to the specified icon list. The icon's image is loaded from the specified file, and it is inserted at the pos index.

    Method clear

      `Gnome.IconList clear()`

    Description

      Clears the contents for the icon list by removing all the icons. If destroy handlers were specified for any of the icons, they will be called with the appropriate data.

    Method create

      `Gnome.IconList Gnome.IconList(int icon_widt, int flags)`

    Description

      Creates a new icon list widget. The icon columns are allocated a width of icon_width pixels. Icon captions will be word-wrapped to this width as well.

      If flags has the Gnome.IconListIsEditable flag set, then the user will be able to edit the text in the icon captions, and the "text_changed" signal will be emitted when an icon's text is changed.

    Method find_icon_from_data

      `int find_icon_from_data(object data)`

    Description

      Find a icon in the list that has the given user data. If no icon is found, -1 is returned.

    Method freeze

      `Gnome.IconList freeze()`

    Description

      Freezes an icon list so that any changes made to it will not be reflected on the screen until it is thawed with thaw(). It is recommended to freeze the icon list before inserting or deleting many icons, for example, so that the layout process will only be executed once, when the icon list is finally thawed.

      You can call this function multiple times, but it must be balanced with the same number of calls to thaw() before the changes will take effect.

    Method get_icon_at

      `int get_icon_at(int x, int y)`

    Description

      Returns the index of the icon that is under the specified coordinates, which are relative to the icon list's window. If there is no icon in that position, -1 is returned.

    Method get_icon_data

      `object get_icon_data(int icon)`

    Description

      Return the data associated with a icon, or 0.

    Method get_selected_icons

      `array get_selected_icons()`

    Description

      Return an array with the currently selected icons

    Method icon_is_visible

      `int icon_is_visible(int pos)`

    Description

      returns 1 if the icon whose index is pos is visible.

    Method insert

      `Gnome.IconList insert(int pos, string icon_filename, string text)`

    Description

      Inserts an icon in the specified icon list. The icon's image is loaded from the specified file, and it is inserted at the pos index.

    Method moveto

      `Gnome.IconList moveto(int pos, float yalign)`

    Description

      Makes the icon whose index is pos be visible on the screen. The icon list gets scrolled so that the icon is visible. An alignment of 0.0 represents the top of the visible part of the icon list, and 1.0 represents the bottom. An icon can be centered on the icon list using 0.5 as the yalign.

    Method remove

      `Gnome.IconList remove(int pos)`

    Description

      Removes the icon at index position pos. If a destroy handler was specified for that icon, it will be called with the appropriate data.

    Method select_icon

      `Gnome.IconList select_icon(int idx)`

    Description

      Selects the specified icon.

    Method set_col_spacing

      `Gnome.IconList set_col_spacing(int pixels)`

    Description

      Sets the spacing to be used between columns of icons.

    Method set_hadjustment

      `Gnome.IconList set_hadjustment(GTK.Adjustment hadj)`

    Description

      Sets the adjustment to be used for horizontal scrolling. This is normally not required, as the icon list can be simply inserted in a W(ScrolledWindow) and scrolling will be handled automatically.

    Method set_icon_border

      `Gnome.IconList set_icon_border(int pixels)`

    Description

      Set the width of the border to be displayed around an icon's image. This is currently not implemented.

    Method set_icon_data

      `Gnome.IconList set_icon_data(int icon, object data)`

    Description

      Set the user data associated with the specified icon. This data can be used to find icons, and when an icon is selected it can be easily retrieved using get_icon_data.

      You can only use objects as icon data right now

    Method set_icon_width

      `Gnome.IconList set_icon_width(int w)`

    Description

      Sets the amount of horizontal space allocated to the icons, i.e. the column width of the icon list

    Method set_row_spacing

      `Gnome.IconList set_row_spacing(int pixels)`

    Description

      Sets the spacing to be used between rows of icons.

    Method set_selection_mode

      `Gnome.IconList set_selection_mode(int mode)`

    Description

      One of SELECTION_BROWSE , SELECTION_EXTENDED , SELECTION_MULTIPLE and SELECTION_SINGLE .

    Method set_separators

      `Gnome.IconList set_separators(string sep)`

    Description

      Set the characters that can be used as word separators when doing word-wrapping of the text captions.

    Method set_text_spacing

      `Gnome.IconList set_text_spacing(int pixels)`

    Description

      Sets the spacing to be used between the icon and its caption

    Method set_vadjustment

      `Gnome.IconList set_vadjustment(GTK.Adjustment hadj)`

    Description

      Sets the adjustment to be used for vertical scrolling. This is normally not required, as the icon list can be simply inserted in a W(ScrolledWindow) and scrolling will be handled automatically.

    Method thaw

      `Gnome.IconList thaw()`

    Description

      Unfreeze the icon list

    Method unselect_all

      `Gnome.IconList unselect_all()`

    Description

      Unselect all icons.

    Method unselect_icon

      `Gnome.IconList unselect_icon(int idx)`

    Description

      Unselects the specified icon.

  CLASS Gnome.DruidPageStandard

    Description

      This is a W(GnomeDruidPage).

    Inherit DruidPage

      inherit Gnome.DruidPage : DruidPage

    Method create

      `Gnome.DruidPageStandard Gnome.DruidPageStandard()`

    Description

      Creates a new Gnome.DruidPageStandard widget.

    Method set_bg_color

      `Gnome.DruidPageStandard set_bg_color(GDK.Color color)`

    Description

      This will set the background color to be the specified color.

    Method set_logo_bg_color

      `Gnome.DruidPageStandard set_logo_bg_color(GDK.Color color)`

    Description

      This will set the background color of the logo

    Method set_title

      `Gnome.DruidPageStandard set_title(string title)`

    Description

      Set the title

    Method set_title_color

      `Gnome.DruidPageStandard set_title_color(GDK.Color color)`

    Description

      Set the title color

  CLASS Gnome.IconSelection

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method add_defaults

      `Gnome.IconSelection add_defaults()`

    Description

      Adds the default pixmap directory into the selection widget.

    Method add_directory

      `Gnome.IconSelection add_directory(string dir)`

    Description

      Adds the icons from the directory dir to the selection widget.

    Method clear

      `Gnome.IconSelection clear(int|void not_shown)`

    Description

      Clear the currently shown icons, the ones that weren't shown yet are not cleared unless the not_shown parameter is given, in which case even those are cleared.

    Method create

      `Gnome.IconSelection Gnome.IconSelection()`

    Description

      reates a new icon selection widget, it uses a W(GnomeIconList) for the listing of icons

    Method get_icon

      `string get_icon(int full_path)`

    Description

      Gets the currently selected icon name, if full_path is true, it returns the full path to the icon, if none is selected it returns 0.

    Method select_icon

      `Gnome.IconSelection select_icon(string filename)`

    Description

      Selects the icon filename. This icon must have already been added and shown

    Method show_icons

      `Gnome.IconSelection show_icons()`

    Description

      Shows the icons inside the widget that were added with add_defaults and add_directory. Before this function isf called the icons aren't actually added to the listing and can't be picked by the user.

Module GTK

  Inherit GTKSupport

    inherit GTKSupport : GTKSupport

  Constant FALSE

    `constant GTK.FALSE`

  Constant GDK_ACTION_ASK

    `constant GTK.GDK_ACTION_ASK`

  Constant GDK_ACTION_COPY

    `constant GTK.GDK_ACTION_COPY`

  Constant GDK_ACTION_DEFAULT

    `constant GTK.GDK_ACTION_DEFAULT`

  Constant GDK_ACTION_LINK

    `constant GTK.GDK_ACTION_LINK`

  Constant GDK_ACTION_MOVE

    `constant GTK.GDK_ACTION_MOVE`

  Constant GDK_ACTION_PRIVATE

    `constant GTK.GDK_ACTION_PRIVATE`

  Constant GDK_ALL_EVENTS_MASK

    `constant GTK.GDK_ALL_EVENTS_MASK`

  Constant GDK_AND

    `constant GTK.GDK_AND`

  Constant GDK_AND_INVERT

    `constant GTK.GDK_AND_INVERT`

  Constant GDK_AND_REVERSE

    `constant GTK.GDK_AND_REVERSE`

  Constant GDK_ARROW

    `constant GTK.GDK_ARROW`

  Constant GDK_BASED_ARROW_DOWN

    `constant GTK.GDK_BASED_ARROW_DOWN`

  Constant GDK_BASED_ARROW_UP

    `constant GTK.GDK_BASED_ARROW_UP`

  Constant GDK_BOAT

    `constant GTK.GDK_BOAT`

  Constant GDK_BOGOSITY

    `constant GTK.GDK_BOGOSITY`

  Constant GDK_BOTTOM_LEFT_CORNER

    `constant GTK.GDK_BOTTOM_LEFT_CORNER`

  Constant GDK_BOTTOM_RIGHT_CORNER

    `constant GTK.GDK_BOTTOM_RIGHT_CORNER`

  Constant GDK_BOTTOM_SIDE

    `constant GTK.GDK_BOTTOM_SIDE`

  Constant GDK_BOTTOM_TEE

    `constant GTK.GDK_BOTTOM_TEE`

  Constant GDK_BOX_SPIRAL

    `constant GTK.GDK_BOX_SPIRAL`

  Constant GDK_BUTTON1_MASK

    `constant GTK.GDK_BUTTON1_MASK`

  Constant GDK_BUTTON1_MOTION_MASK

    `constant GTK.GDK_BUTTON1_MOTION_MASK`

  Constant GDK_BUTTON2_MASK

    `constant GTK.GDK_BUTTON2_MASK`

  Constant GDK_BUTTON2_MOTION_MASK

    `constant GTK.GDK_BUTTON2_MOTION_MASK`

  Constant GDK_BUTTON3_MASK

    `constant GTK.GDK_BUTTON3_MASK`

  Constant GDK_BUTTON3_MOTION_MASK

    `constant GTK.GDK_BUTTON3_MOTION_MASK`

  Constant GDK_BUTTON_MOTION_MASK

    `constant GTK.GDK_BUTTON_MOTION_MASK`

  Constant GDK_BUTTON_PRESS_MASK

    `constant GTK.GDK_BUTTON_PRESS_MASK`

  Constant GDK_BUTTON_RELEASE_MASK

    `constant GTK.GDK_BUTTON_RELEASE_MASK`

  Constant GDK_CAP_BUTT

    `constant GTK.GDK_CAP_BUTT`

  Constant GDK_CAP_NOT_LAST

    `constant GTK.GDK_CAP_NOT_LAST`

  Constant GDK_CAP_PROJECTING

    `constant GTK.GDK_CAP_PROJECTING`

  Constant GDK_CAP_ROUND

    `constant GTK.GDK_CAP_ROUND`

  Constant GDK_CENTER_PTR

    `constant GTK.GDK_CENTER_PTR`

  Constant GDK_CIRCLE

    `constant GTK.GDK_CIRCLE`

  Constant GDK_CLEAR

    `constant GTK.GDK_CLEAR`

  Constant GDK_CLOCK

    `constant GTK.GDK_CLOCK`

  Constant GDK_COFFEE_MUG

    `constant GTK.GDK_COFFEE_MUG`

  Constant GDK_CONTROL_MASK

    `constant GTK.GDK_CONTROL_MASK`

  Constant GDK_COPY

    `constant GTK.GDK_COPY`

  Constant GDK_COPY_INVERT

    `constant GTK.GDK_COPY_INVERT`

  Constant GDK_CROSS

    `constant GTK.GDK_CROSS`

  Constant GDK_CROSSHAIR

    `constant GTK.GDK_CROSSHAIR`

  Constant GDK_CROSS_REVERSE

    `constant GTK.GDK_CROSS_REVERSE`

  Constant GDK_DECOR_ALL

    `constant GTK.GDK_DECOR_ALL`

  Constant GDK_DECOR_BORDER

    `constant GTK.GDK_DECOR_BORDER`

  Constant GDK_DECOR_MAXIMIZE

    `constant GTK.GDK_DECOR_MAXIMIZE`

  Constant GDK_DECOR_MENU

    `constant GTK.GDK_DECOR_MENU`

  Constant GDK_DECOR_MINIMIZE

    `constant GTK.GDK_DECOR_MINIMIZE`

  Constant GDK_DECOR_RESIZEH

    `constant GTK.GDK_DECOR_RESIZEH`

  Constant GDK_DECOR_TITLE

    `constant GTK.GDK_DECOR_TITLE`

  Constant GDK_DIAMOND_CROSS

    `constant GTK.GDK_DIAMOND_CROSS`

  Constant GDK_DOT

    `constant GTK.GDK_DOT`

  Constant GDK_DOTBOX

    `constant GTK.GDK_DOTBOX`

  Constant GDK_DOUBLE_ARROW

    `constant GTK.GDK_DOUBLE_ARROW`

  Constant GDK_DRAFT_LARGE

    `constant GTK.GDK_DRAFT_LARGE`

  Constant GDK_DRAFT_SMALL

    `constant GTK.GDK_DRAFT_SMALL`

  Constant GDK_DRAG_PROTO_MOTIF

    `constant GTK.GDK_DRAG_PROTO_MOTIF`

  Constant GDK_DRAG_PROTO_ROOTWIN

    `constant GTK.GDK_DRAG_PROTO_ROOTWIN`

  Constant GDK_DRAG_PROTO_XDND

    `constant GTK.GDK_DRAG_PROTO_XDND`

  Constant GDK_DRAPED_BOX

    `constant GTK.GDK_DRAPED_BOX`

  Constant GDK_ENTER_NOTIFY_MASK

    `constant GTK.GDK_ENTER_NOTIFY_MASK`

  Constant GDK_EQUIV

    `constant GTK.GDK_EQUIV`

  Constant GDK_EVEN_ODD_RULE

    `constant GTK.GDK_EVEN_ODD_RULE`

  Constant GDK_EXCHANGE

    `constant GTK.GDK_EXCHANGE`

  Constant GDK_EXPOSURE_MASK

    `constant GTK.GDK_EXPOSURE_MASK`

  Constant GDK_EXTENSION_EVENTS_ALL

    `constant GTK.GDK_EXTENSION_EVENTS_ALL`

  Constant GDK_EXTENSION_EVENTS_CURSOR

    `constant GTK.GDK_EXTENSION_EVENTS_CURSOR`

  Constant GDK_EXTENSION_EVENTS_NONE

    `constant GTK.GDK_EXTENSION_EVENTS_NONE`

  Constant GDK_FLEUR

    `constant GTK.GDK_FLEUR`

  Constant GDK_FOCUS_CHANGE_MASK

    `constant GTK.GDK_FOCUS_CHANGE_MASK`

  Constant GDK_FUNC_ALL

    `constant GTK.GDK_FUNC_ALL`

  Constant GDK_FUNC_CLOSE

    `constant GTK.GDK_FUNC_CLOSE`

  Constant GDK_FUNC_MAXIMIZE

    `constant GTK.GDK_FUNC_MAXIMIZE`

  Constant GDK_FUNC_MINIMIZE

    `constant GTK.GDK_FUNC_MINIMIZE`

  Constant GDK_FUNC_MOVE

    `constant GTK.GDK_FUNC_MOVE`

  Constant GDK_FUNC_RESIZE

    `constant GTK.GDK_FUNC_RESIZE`

  Constant GDK_GL_ACCUM_ALPHA_SIZE

    `constant GTK.GDK_GL_ACCUM_ALPHA_SIZE`

  Constant GDK_GL_ACCUM_BLUE_SIZE

    `constant GTK.GDK_GL_ACCUM_BLUE_SIZE`

  Constant GDK_GL_ACCUM_GREEN_SIZE

    `constant GTK.GDK_GL_ACCUM_GREEN_SIZE`

  Constant GDK_GL_ACCUM_RED_SIZE

    `constant GTK.GDK_GL_ACCUM_RED_SIZE`

  Constant GDK_GL_ALPHA_SIZE

    `constant GTK.GDK_GL_ALPHA_SIZE`

  Constant GDK_GL_AUX_BUFFERS

    `constant GTK.GDK_GL_AUX_BUFFERS`

  Constant GDK_GL_BLUE_SIZE

    `constant GTK.GDK_GL_BLUE_SIZE`

  Constant GDK_GL_BUFFER_SIZE

    `constant GTK.GDK_GL_BUFFER_SIZE`

  Constant GDK_GL_DEPTH_SIZE

    `constant GTK.GDK_GL_DEPTH_SIZE`

  Constant GDK_GL_DOUBLEBUFFER

    `constant GTK.GDK_GL_DOUBLEBUFFER`

  Constant GDK_GL_GREEN_SIZE

    `constant GTK.GDK_GL_GREEN_SIZE`

  Constant GDK_GL_LEVEL

    `constant GTK.GDK_GL_LEVEL`

  Constant GDK_GL_NONE

    `constant GTK.GDK_GL_NONE`

  Constant GDK_GL_RED_SIZE

    `constant GTK.GDK_GL_RED_SIZE`

  Constant GDK_GL_RGBA

    `constant GTK.GDK_GL_RGBA`

  Constant GDK_GL_STENCIL_SIZE

    `constant GTK.GDK_GL_STENCIL_SIZE`

  Constant GDK_GL_STEREO

    `constant GTK.GDK_GL_STEREO`

  Constant GDK_GL_TRANSPARENT_ALPHA_VALUE_EXT

    `constant GTK.GDK_GL_TRANSPARENT_ALPHA_VALUE_EXT`

  Constant GDK_GL_TRANSPARENT_BLUE_VALUE_EXT

    `constant GTK.GDK_GL_TRANSPARENT_BLUE_VALUE_EXT`

  Constant GDK_GL_TRANSPARENT_GREEN_VALUE_EXT

    `constant GTK.GDK_GL_TRANSPARENT_GREEN_VALUE_EXT`

  Constant GDK_GL_TRANSPARENT_INDEX_VALUE_EXT

    `constant GTK.GDK_GL_TRANSPARENT_INDEX_VALUE_EXT`

  Constant GDK_GL_TRANSPARENT_RED_VALUE_EXT

    `constant GTK.GDK_GL_TRANSPARENT_RED_VALUE_EXT`

  Constant GDK_GL_TRANSPARENT_TYPE_EXT

    `constant GTK.GDK_GL_TRANSPARENT_TYPE_EXT`

  Constant GDK_GL_USE_GL

    `constant GTK.GDK_GL_USE_GL`

  Constant GDK_GL_X_VISUAL_TYPE_EXT

    `constant GTK.GDK_GL_X_VISUAL_TYPE_EXT`

  Constant GDK_GOBBLER

    `constant GTK.GDK_GOBBLER`

  Constant GDK_GUMBY

    `constant GTK.GDK_GUMBY`

  Constant GDK_HAND1

    `constant GTK.GDK_HAND1`

  Constant GDK_HAND2

    `constant GTK.GDK_HAND2`

  Constant GDK_HEART

    `constant GTK.GDK_HEART`

  Constant GDK_ICON

    `constant GTK.GDK_ICON`

  Constant GDK_IM_PREEDIT_AREA

    `constant GTK.GDK_IM_PREEDIT_AREA`

  Constant GDK_IM_PREEDIT_CALLBACKS

    `constant GTK.GDK_IM_PREEDIT_CALLBACKS`

  Constant GDK_IM_PREEDIT_MASK

    `constant GTK.GDK_IM_PREEDIT_MASK`

  Constant GDK_IM_PREEDIT_NONE

    `constant GTK.GDK_IM_PREEDIT_NONE`

  Constant GDK_IM_PREEDIT_NOTHING

    `constant GTK.GDK_IM_PREEDIT_NOTHING`

  Constant GDK_IM_PREEDIT_POSITION

    `constant GTK.GDK_IM_PREEDIT_POSITION`

  Constant GDK_IM_STATUS_AREA

    `constant GTK.GDK_IM_STATUS_AREA`

  Constant GDK_IM_STATUS_CALLBACKS

    `constant GTK.GDK_IM_STATUS_CALLBACKS`

  Constant GDK_IM_STATUS_MASK

    `constant GTK.GDK_IM_STATUS_MASK`

  Constant GDK_IM_STATUS_NONE

    `constant GTK.GDK_IM_STATUS_NONE`

  Constant GDK_IM_STATUS_NOTHING

    `constant GTK.GDK_IM_STATUS_NOTHING`

  Constant GDK_INVERT

    `constant GTK.GDK_INVERT`

  Constant GDK_IRON_CROSS

    `constant GTK.GDK_IRON_CROSS`

  Constant GDK_JOIN_BEVEL

    `constant GTK.GDK_JOIN_BEVEL`

  Constant GDK_JOIN_MITER

    `constant GTK.GDK_JOIN_MITER`

  Constant GDK_JOIN_ROUND

    `constant GTK.GDK_JOIN_ROUND`

  Constant GDK_KEY_PRESS_MASK

    `constant GTK.GDK_KEY_PRESS_MASK`

  Constant GDK_KEY_RELEASE_MASK

    `constant GTK.GDK_KEY_RELEASE_MASK`

  Constant GDK_LEAVE_NOTIFY_MASK

    `constant GTK.GDK_LEAVE_NOTIFY_MASK`

  Constant GDK_LEFTBUTTON

    `constant GTK.GDK_LEFTBUTTON`

  Constant GDK_LEFT_PTR

    `constant GTK.GDK_LEFT_PTR`

  Constant GDK_LEFT_SIDE

    `constant GTK.GDK_LEFT_SIDE`

  Constant GDK_LEFT_TEE

    `constant GTK.GDK_LEFT_TEE`

  Constant GDK_LINE_DOUBLE_DASH

    `constant GTK.GDK_LINE_DOUBLE_DASH`

  Constant GDK_LINE_ON_OFF_DASH

    `constant GTK.GDK_LINE_ON_OFF_DASH`

  Constant GDK_LINE_SOLID

    `constant GTK.GDK_LINE_SOLID`

  Constant GDK_LL_ANGLE

    `constant GTK.GDK_LL_ANGLE`

  Constant GDK_LOCK_MASK

    `constant GTK.GDK_LOCK_MASK`

  Constant GDK_LR_ANGLE

    `constant GTK.GDK_LR_ANGLE`

  Constant GDK_MAN

    `constant GTK.GDK_MAN`

  Constant GDK_MIDDLEBUTTON

    `constant GTK.GDK_MIDDLEBUTTON`

  Constant GDK_MOD1_MASK

    `constant GTK.GDK_MOD1_MASK`

  Constant GDK_MOD2_MASK

    `constant GTK.GDK_MOD2_MASK`

  Constant GDK_MOD3_MASK

    `constant GTK.GDK_MOD3_MASK`

  Constant GDK_MOD4_MASK

    `constant GTK.GDK_MOD4_MASK`

  Constant GDK_MOD5_MASK

    `constant GTK.GDK_MOD5_MASK`

  Constant GDK_MOUSE

    `constant GTK.GDK_MOUSE`

  Constant GDK_NAND

    `constant GTK.GDK_NAND`

  Constant GDK_NOOP

    `constant GTK.GDK_NOOP`

  Constant GDK_OPAQUE_STIPPLED

    `constant GTK.GDK_OPAQUE_STIPPLED`

  Constant GDK_OR

    `constant GTK.GDK_OR`

  Constant GDK_OR_INVERT

    `constant GTK.GDK_OR_INVERT`

  Constant GDK_OR_REVERSE

    `constant GTK.GDK_OR_REVERSE`

  Constant GDK_OVERLAP_RECTANGLE_IN

    `constant GTK.GDK_OVERLAP_RECTANGLE_IN`

  Constant GDK_OVERLAP_RECTANGLE_OUT

    `constant GTK.GDK_OVERLAP_RECTANGLE_OUT`

  Constant GDK_OVERLAP_RECTANGLE_PART

    `constant GTK.GDK_OVERLAP_RECTANGLE_PART`

  Constant GDK_PENCIL

    `constant GTK.GDK_PENCIL`

  Constant GDK_PIRATE

    `constant GTK.GDK_PIRATE`

  Constant GDK_PLUS

    `constant GTK.GDK_PLUS`

  Constant GDK_POINTER_MOTION_HINT_MASK

    `constant GTK.GDK_POINTER_MOTION_HINT_MASK`

  Constant GDK_POINTER_MOTION_MASK

    `constant GTK.GDK_POINTER_MOTION_MASK`

  Constant GDK_PROPERTY_CHANGE_MASK

    `constant GTK.GDK_PROPERTY_CHANGE_MASK`

  Constant GDK_PROP_MODE_APPEND

    `constant GTK.GDK_PROP_MODE_APPEND`

  Constant GDK_PROP_MODE_PREPEND

    `constant GTK.GDK_PROP_MODE_PREPEND`

  Constant GDK_PROP_MODE_REPLACE

    `constant GTK.GDK_PROP_MODE_REPLACE`

  Constant GDK_PROXIMITY_IN_MASK

    `constant GTK.GDK_PROXIMITY_IN_MASK`

  Constant GDK_PROXIMITY_OUT_MASK

    `constant GTK.GDK_PROXIMITY_OUT_MASK`

  Constant GDK_QUESTION_ARROW

    `constant GTK.GDK_QUESTION_ARROW`

  Constant GDK_RIGHTBUTTON

    `constant GTK.GDK_RIGHTBUTTON`

  Constant GDK_RIGHT_PTR

    `constant GTK.GDK_RIGHT_PTR`

  Constant GDK_RIGHT_SIDE

    `constant GTK.GDK_RIGHT_SIDE`

  Constant GDK_RIGHT_TEE

    `constant GTK.GDK_RIGHT_TEE`

  Constant GDK_RTL_LOGO

    `constant GTK.GDK_RTL_LOGO`

  Constant GDK_SAILBOAT

    `constant GTK.GDK_SAILBOAT`

  Constant GDK_SB_DOWN_ARROW

    `constant GTK.GDK_SB_DOWN_ARROW`

  Constant GDK_SB_H_DOUBLE_ARROW

    `constant GTK.GDK_SB_H_DOUBLE_ARROW`

  Constant GDK_SB_LEFT_ARROW

    `constant GTK.GDK_SB_LEFT_ARROW`

  Constant GDK_SB_RIGHT_ARROW

    `constant GTK.GDK_SB_RIGHT_ARROW`

  Constant GDK_SB_UP_ARROW

    `constant GTK.GDK_SB_UP_ARROW`

  Constant GDK_SB_V_DOUBLE_ARROW

    `constant GTK.GDK_SB_V_DOUBLE_ARROW`

  Constant GDK_SELECTION_TYPE_ATOM

    `constant GTK.GDK_SELECTION_TYPE_ATOM`

  Constant GDK_SELECTION_TYPE_BITMAP

    `constant GTK.GDK_SELECTION_TYPE_BITMAP`

  Constant GDK_SELECTION_TYPE_COLORMAP

    `constant GTK.GDK_SELECTION_TYPE_COLORMAP`

  Constant GDK_SELECTION_TYPE_DRAWABLE

    `constant GTK.GDK_SELECTION_TYPE_DRAWABLE`

  Constant GDK_SELECTION_TYPE_INTEGER

    `constant GTK.GDK_SELECTION_TYPE_INTEGER`

  Constant GDK_SELECTION_TYPE_PIXMAP

    `constant GTK.GDK_SELECTION_TYPE_PIXMAP`

  Constant GDK_SELECTION_TYPE_STRING

    `constant GTK.GDK_SELECTION_TYPE_STRING`

  Constant GDK_SELECTION_TYPE_WINDOW

    `constant GTK.GDK_SELECTION_TYPE_WINDOW`

  Constant GDK_SET

    `constant GTK.GDK_SET`

  Constant GDK_SHIFT_MASK

    `constant GTK.GDK_SHIFT_MASK`

  Constant GDK_SHUTTLE

    `constant GTK.GDK_SHUTTLE`

  Constant GDK_SIZING

    `constant GTK.GDK_SIZING`

  Constant GDK_SOLID

    `constant GTK.GDK_SOLID`

  Constant GDK_SPIDER

    `constant GTK.GDK_SPIDER`

  Constant GDK_SPRAYCAN

    `constant GTK.GDK_SPRAYCAN`

  Constant GDK_STAR

    `constant GTK.GDK_STAR`

  Constant GDK_STIPPLED

    `constant GTK.GDK_STIPPLED`

  Constant GDK_STRUCTURE_MASK

    `constant GTK.GDK_STRUCTURE_MASK`

  Constant GDK_TARGET

    `constant GTK.GDK_TARGET`

  Constant GDK_TARGET_BITMAP

    `constant GTK.GDK_TARGET_BITMAP`

  Constant GDK_TARGET_COLORMAP

    `constant GTK.GDK_TARGET_COLORMAP`

  Constant GDK_TARGET_DRAWABLE

    `constant GTK.GDK_TARGET_DRAWABLE`

  Constant GDK_TARGET_PIXMAP

    `constant GTK.GDK_TARGET_PIXMAP`

  Constant GDK_TARGET_STRING

    `constant GTK.GDK_TARGET_STRING`

  Constant GDK_TCROSS

    `constant GTK.GDK_TCROSS`

  Constant GDK_TILED

    `constant GTK.GDK_TILED`

  Constant GDK_TOP_LEFT_ARROW

    `constant GTK.GDK_TOP_LEFT_ARROW`

  Constant GDK_TOP_LEFT_CORNER

    `constant GTK.GDK_TOP_LEFT_CORNER`

  Constant GDK_TOP_RIGHT_CORNER

    `constant GTK.GDK_TOP_RIGHT_CORNER`

  Constant GDK_TOP_SIDE

    `constant GTK.GDK_TOP_SIDE`

  Constant GDK_TOP_TEE

    `constant GTK.GDK_TOP_TEE`

  Constant GDK_TREK

    `constant GTK.GDK_TREK`

  Constant GDK_UL_ANGLE

    `constant GTK.GDK_UL_ANGLE`

  Constant GDK_UMBRELLA

    `constant GTK.GDK_UMBRELLA`

  Constant GDK_UR_ANGLE

    `constant GTK.GDK_UR_ANGLE`

  Constant GDK_VISIBILITY_NOTIFY_MASK

    `constant GTK.GDK_VISIBILITY_NOTIFY_MASK`

  Constant GDK_WATCH

    `constant GTK.GDK_WATCH`

  Constant GDK_WINDING_RULE

    `constant GTK.GDK_WINDING_RULE`

  Constant GDK_WINDOW_CHILD

    `constant GTK.GDK_WINDOW_CHILD`

  Constant GDK_WINDOW_DIALOG

    `constant GTK.GDK_WINDOW_DIALOG`

  Constant GDK_WINDOW_FOREIGN

    `constant GTK.GDK_WINDOW_FOREIGN`

  Constant GDK_WINDOW_ROOT

    `constant GTK.GDK_WINDOW_ROOT`

  Constant GDK_WINDOW_TEMP

    `constant GTK.GDK_WINDOW_TEMP`

  Constant GDK_WINDOW_TOPLEVEL

    `constant GTK.GDK_WINDOW_TOPLEVEL`

  Constant GDK_XOR

    `constant GTK.GDK_XOR`

  Constant GDK_XTERM

    `constant GTK.GDK_XTERM`

  Constant GNOME_DOCK_BOTTOM

    `constant GTK.GNOME_DOCK_BOTTOM`

  Constant GNOME_DOCK_ITEM_BEH_EXCLUSIVE

    `constant GTK.GNOME_DOCK_ITEM_BEH_EXCLUSIVE`

  Constant GNOME_DOCK_ITEM_BEH_LOCKED

    `constant GTK.GNOME_DOCK_ITEM_BEH_LOCKED`

  Constant GNOME_DOCK_ITEM_BEH_NEVER_FLOATING

    `constant GTK.GNOME_DOCK_ITEM_BEH_NEVER_FLOATING`

  Constant GNOME_DOCK_ITEM_BEH_NEVER_HORIZONTAL

    `constant GTK.GNOME_DOCK_ITEM_BEH_NEVER_HORIZONTAL`

  Constant GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL

    `constant GTK.GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL`

  Constant GNOME_DOCK_ITEM_BEH_NORMAL

    `constant GTK.GNOME_DOCK_ITEM_BEH_NORMAL`

  Constant GNOME_DOCK_LEFT

    `constant GTK.GNOME_DOCK_LEFT`

  Constant GNOME_DOCK_RIGHT

    `constant GTK.GNOME_DOCK_RIGHT`

  Constant GNOME_DOCK_TOP

    `constant GTK.GNOME_DOCK_TOP`

  Constant GNOME_FONT_PICKER_MODE_FONT_INFO

    `constant GTK.GNOME_FONT_PICKER_MODE_FONT_INFO`

  Constant GNOME_FONT_PICKER_MODE_PIXMAP

    `constant GTK.GNOME_FONT_PICKER_MODE_PIXMAP`

  Constant GNOME_FONT_PICKER_MODE_UNKNOWN

    `constant GTK.GNOME_FONT_PICKER_MODE_UNKNOWN`

  Constant GNOME_FONT_PICKER_MODE_USER_WIDGET

    `constant GTK.GNOME_FONT_PICKER_MODE_USER_WIDGET`

  Constant GNOME_ICON_LIST_ICONS

    `constant GTK.GNOME_ICON_LIST_ICONS`

  Constant GNOME_ICON_LIST_IS_EDITABLE

    `constant GTK.GNOME_ICON_LIST_IS_EDITABLE`

  Constant GNOME_ICON_LIST_STATIC_TEXT

    `constant GTK.GNOME_ICON_LIST_STATIC_TEXT`

  Constant GNOME_ICON_LIST_TEXT_BELOW

    `constant GTK.GNOME_ICON_LIST_TEXT_BELOW`

  Constant GNOME_ICON_LIST_TEXT_RIGHT

    `constant GTK.GNOME_ICON_LIST_TEXT_RIGHT`

  Constant GNOME_MESSAGE_BOX_ERROR

    `constant GTK.GNOME_MESSAGE_BOX_ERROR`

  Constant GNOME_MESSAGE_BOX_GENERIC

    `constant GTK.GNOME_MESSAGE_BOX_GENERIC`

  Constant GNOME_MESSAGE_BOX_INFO

    `constant GTK.GNOME_MESSAGE_BOX_INFO`

  Constant GNOME_MESSAGE_BOX_QUESTION

    `constant GTK.GNOME_MESSAGE_BOX_QUESTION`

  Constant GNOME_MESSAGE_BOX_WARNING

    `constant GTK.GNOME_MESSAGE_BOX_WARNING`

  Constant GNOME_PREFERENCES_ALWAYS

    `constant GTK.GNOME_PREFERENCES_ALWAYS`

  Constant GNOME_PREFERENCES_NEVER

    `constant GTK.GNOME_PREFERENCES_NEVER`

  Constant GNOME_PREFERENCES_USER

    `constant GTK.GNOME_PREFERENCES_USER`

  Constant GNOME_Panel_ORIENT_DOWN

    `constant GTK.GNOME_Panel_ORIENT_DOWN`

  Constant GNOME_Panel_ORIENT_LEFT

    `constant GTK.GNOME_Panel_ORIENT_LEFT`

  Constant GNOME_Panel_ORIENT_RIGHT

    `constant GTK.GNOME_Panel_ORIENT_RIGHT`

  Constant GNOME_Panel_ORIENT_UP

    `constant GTK.GNOME_Panel_ORIENT_UP`

  Constant GNOME_STOCK_BUTTON_APPLY

    `constant GTK.GNOME_STOCK_BUTTON_APPLY`

  Constant GNOME_STOCK_BUTTON_CANCEL

    `constant GTK.GNOME_STOCK_BUTTON_CANCEL`

  Constant GNOME_STOCK_BUTTON_CLOSE

    `constant GTK.GNOME_STOCK_BUTTON_CLOSE`

  Constant GNOME_STOCK_BUTTON_DOWN

    `constant GTK.GNOME_STOCK_BUTTON_DOWN`

  Constant GNOME_STOCK_BUTTON_FONT

    `constant GTK.GNOME_STOCK_BUTTON_FONT`

  Constant GNOME_STOCK_BUTTON_HELP

    `constant GTK.GNOME_STOCK_BUTTON_HELP`

  Constant GNOME_STOCK_BUTTON_NEXT

    `constant GTK.GNOME_STOCK_BUTTON_NEXT`

  Constant GNOME_STOCK_BUTTON_NO

    `constant GTK.GNOME_STOCK_BUTTON_NO`

  Constant GNOME_STOCK_BUTTON_OK

    `constant GTK.GNOME_STOCK_BUTTON_OK`

  Constant GNOME_STOCK_BUTTON_PREV

    `constant GTK.GNOME_STOCK_BUTTON_PREV`

  Constant GNOME_STOCK_BUTTON_UP

    `constant GTK.GNOME_STOCK_BUTTON_UP`

  Constant GNOME_STOCK_BUTTON_YES

    `constant GTK.GNOME_STOCK_BUTTON_YES`

  Constant GNOME_STOCK_MENU_ABOUT

    `constant GTK.GNOME_STOCK_MENU_ABOUT`

  Constant GNOME_STOCK_MENU_ALIGN_CENTER

    `constant GTK.GNOME_STOCK_MENU_ALIGN_CENTER`

  Constant GNOME_STOCK_MENU_ALIGN_JUSTIFY

    `constant GTK.GNOME_STOCK_MENU_ALIGN_JUSTIFY`

  Constant GNOME_STOCK_MENU_ALIGN_LEFT

    `constant GTK.GNOME_STOCK_MENU_ALIGN_LEFT`

  Constant GNOME_STOCK_MENU_ALIGN_RIGHT

    `constant GTK.GNOME_STOCK_MENU_ALIGN_RIGHT`

  Constant GNOME_STOCK_MENU_ATTACH

    `constant GTK.GNOME_STOCK_MENU_ATTACH`

  Constant GNOME_STOCK_MENU_BACK

    `constant GTK.GNOME_STOCK_MENU_BACK`

  Constant GNOME_STOCK_MENU_BLANK

    `constant GTK.GNOME_STOCK_MENU_BLANK`

  Constant GNOME_STOCK_MENU_BOOK_BLUE

    `constant GTK.GNOME_STOCK_MENU_BOOK_BLUE`

  Constant GNOME_STOCK_MENU_BOOK_GREEN

    `constant GTK.GNOME_STOCK_MENU_BOOK_GREEN`

  Constant GNOME_STOCK_MENU_BOOK_OPEN

    `constant GTK.GNOME_STOCK_MENU_BOOK_OPEN`

  Constant GNOME_STOCK_MENU_BOOK_RED

    `constant GTK.GNOME_STOCK_MENU_BOOK_RED`

  Constant GNOME_STOCK_MENU_BOOK_YELLOW

    `constant GTK.GNOME_STOCK_MENU_BOOK_YELLOW`

  Constant GNOME_STOCK_MENU_BOTTOM

    `constant GTK.GNOME_STOCK_MENU_BOTTOM`

  Constant GNOME_STOCK_MENU_CDROM

    `constant GTK.GNOME_STOCK_MENU_CDROM`

  Constant GNOME_STOCK_MENU_CLOSE

    `constant GTK.GNOME_STOCK_MENU_CLOSE`

  Constant GNOME_STOCK_MENU_CONVERT

    `constant GTK.GNOME_STOCK_MENU_CONVERT`

  Constant GNOME_STOCK_MENU_COPY

    `constant GTK.GNOME_STOCK_MENU_COPY`

  Constant GNOME_STOCK_MENU_CUT

    `constant GTK.GNOME_STOCK_MENU_CUT`

  Constant GNOME_STOCK_MENU_DOWN

    `constant GTK.GNOME_STOCK_MENU_DOWN`

  Constant GNOME_STOCK_MENU_EXEC

    `constant GTK.GNOME_STOCK_MENU_EXEC`

  Constant GNOME_STOCK_MENU_EXIT

    `constant GTK.GNOME_STOCK_MENU_EXIT`

  Constant GNOME_STOCK_MENU_FIRST

    `constant GTK.GNOME_STOCK_MENU_FIRST`

  Constant GNOME_STOCK_MENU_FONT

    `constant GTK.GNOME_STOCK_MENU_FONT`

  Constant GNOME_STOCK_MENU_FORWARD

    `constant GTK.GNOME_STOCK_MENU_FORWARD`

  Constant GNOME_STOCK_MENU_HOME

    `constant GTK.GNOME_STOCK_MENU_HOME`

  Constant GNOME_STOCK_MENU_INDEX

    `constant GTK.GNOME_STOCK_MENU_INDEX`

  Constant GNOME_STOCK_MENU_JUMP_TO

    `constant GTK.GNOME_STOCK_MENU_JUMP_TO`

  Constant GNOME_STOCK_MENU_LAST

    `constant GTK.GNOME_STOCK_MENU_LAST`

  Constant GNOME_STOCK_MENU_LINE_IN

    `constant GTK.GNOME_STOCK_MENU_LINE_IN`

  Constant GNOME_STOCK_MENU_MAIL

    `constant GTK.GNOME_STOCK_MENU_MAIL`

  Constant GNOME_STOCK_MENU_MAIL_FWD

    `constant GTK.GNOME_STOCK_MENU_MAIL_FWD`

  Constant GNOME_STOCK_MENU_MAIL_NEW

    `constant GTK.GNOME_STOCK_MENU_MAIL_NEW`

  Constant GNOME_STOCK_MENU_MAIL_RCV

    `constant GTK.GNOME_STOCK_MENU_MAIL_RCV`

  Constant GNOME_STOCK_MENU_MAIL_RPL

    `constant GTK.GNOME_STOCK_MENU_MAIL_RPL`

  Constant GNOME_STOCK_MENU_MAIL_SND

    `constant GTK.GNOME_STOCK_MENU_MAIL_SND`

  Constant GNOME_STOCK_MENU_MIC

    `constant GTK.GNOME_STOCK_MENU_MIC`

  Constant GNOME_STOCK_MENU_MIDI

    `constant GTK.GNOME_STOCK_MENU_MIDI`

  Constant GNOME_STOCK_MENU_NEW

    `constant GTK.GNOME_STOCK_MENU_NEW`

  Constant GNOME_STOCK_MENU_OPEN

    `constant GTK.GNOME_STOCK_MENU_OPEN`

  Constant GNOME_STOCK_MENU_PASTE

    `constant GTK.GNOME_STOCK_MENU_PASTE`

  Constant GNOME_STOCK_MENU_PREF

    `constant GTK.GNOME_STOCK_MENU_PREF`

  Constant GNOME_STOCK_MENU_PRINT

    `constant GTK.GNOME_STOCK_MENU_PRINT`

  Constant GNOME_STOCK_MENU_PROP

    `constant GTK.GNOME_STOCK_MENU_PROP`

  Constant GNOME_STOCK_MENU_QUIT

    `constant GTK.GNOME_STOCK_MENU_QUIT`

  Constant GNOME_STOCK_MENU_REDO

    `constant GTK.GNOME_STOCK_MENU_REDO`

  Constant GNOME_STOCK_MENU_REFRESH

    `constant GTK.GNOME_STOCK_MENU_REFRESH`

  Constant GNOME_STOCK_MENU_REVERT

    `constant GTK.GNOME_STOCK_MENU_REVERT`

  Constant GNOME_STOCK_MENU_SAVE

    `constant GTK.GNOME_STOCK_MENU_SAVE`

  Constant GNOME_STOCK_MENU_SAVE_AS

    `constant GTK.GNOME_STOCK_MENU_SAVE_AS`

  Constant GNOME_STOCK_MENU_SCORES

    `constant GTK.GNOME_STOCK_MENU_SCORES`

  Constant GNOME_STOCK_MENU_SEARCH

    `constant GTK.GNOME_STOCK_MENU_SEARCH`

  Constant GNOME_STOCK_MENU_SPELLCHECK

    `constant GTK.GNOME_STOCK_MENU_SPELLCHECK`

  Constant GNOME_STOCK_MENU_SRCHRPL

    `constant GTK.GNOME_STOCK_MENU_SRCHRPL`

  Constant GNOME_STOCK_MENU_STOP

    `constant GTK.GNOME_STOCK_MENU_STOP`

  Constant GNOME_STOCK_MENU_TEXT_BOLD

    `constant GTK.GNOME_STOCK_MENU_TEXT_BOLD`

  Constant GNOME_STOCK_MENU_TEXT_ITALIC

    `constant GTK.GNOME_STOCK_MENU_TEXT_ITALIC`

  Constant GNOME_STOCK_MENU_TEXT_STRIKEOUT

    `constant GTK.GNOME_STOCK_MENU_TEXT_STRIKEOUT`

  Constant GNOME_STOCK_MENU_TEXT_UNDERLINE

    `constant GTK.GNOME_STOCK_MENU_TEXT_UNDERLINE`

  Constant GNOME_STOCK_MENU_TIMER

    `constant GTK.GNOME_STOCK_MENU_TIMER`

  Constant GNOME_STOCK_MENU_TIMER_STOP

    `constant GTK.GNOME_STOCK_MENU_TIMER_STOP`

  Constant GNOME_STOCK_MENU_TOP

    `constant GTK.GNOME_STOCK_MENU_TOP`

  Constant GNOME_STOCK_MENU_TRASH

    `constant GTK.GNOME_STOCK_MENU_TRASH`

  Constant GNOME_STOCK_MENU_TRASH_FULL

    `constant GTK.GNOME_STOCK_MENU_TRASH_FULL`

  Constant GNOME_STOCK_MENU_UNDELETE

    `constant GTK.GNOME_STOCK_MENU_UNDELETE`

  Constant GNOME_STOCK_MENU_UNDO

    `constant GTK.GNOME_STOCK_MENU_UNDO`

  Constant GNOME_STOCK_MENU_UP

    `constant GTK.GNOME_STOCK_MENU_UP`

  Constant GNOME_STOCK_MENU_VOLUME

    `constant GTK.GNOME_STOCK_MENU_VOLUME`

  Constant GNOME_STOCK_PIXMAP_ABOUT

    `constant GTK.GNOME_STOCK_PIXMAP_ABOUT`

  Constant GNOME_STOCK_PIXMAP_ADD

    `constant GTK.GNOME_STOCK_PIXMAP_ADD`

  Constant GNOME_STOCK_PIXMAP_ALIGN_CENTER

    `constant GTK.GNOME_STOCK_PIXMAP_ALIGN_CENTER`

  Constant GNOME_STOCK_PIXMAP_ALIGN_JUSTIFY

    `constant GTK.GNOME_STOCK_PIXMAP_ALIGN_JUSTIFY`

  Constant GNOME_STOCK_PIXMAP_ALIGN_LEFT

    `constant GTK.GNOME_STOCK_PIXMAP_ALIGN_LEFT`

  Constant GNOME_STOCK_PIXMAP_ALIGN_RIGHT

    `constant GTK.GNOME_STOCK_PIXMAP_ALIGN_RIGHT`

  Constant GNOME_STOCK_PIXMAP_ATTACH

    `constant GTK.GNOME_STOCK_PIXMAP_ATTACH`

  Constant GNOME_STOCK_PIXMAP_BACK

    `constant GTK.GNOME_STOCK_PIXMAP_BACK`

  Constant GNOME_STOCK_PIXMAP_BOOK_BLUE

    `constant GTK.GNOME_STOCK_PIXMAP_BOOK_BLUE`

  Constant GNOME_STOCK_PIXMAP_BOOK_GREEN

    `constant GTK.GNOME_STOCK_PIXMAP_BOOK_GREEN`

  Constant GNOME_STOCK_PIXMAP_BOOK_OPEN

    `constant GTK.GNOME_STOCK_PIXMAP_BOOK_OPEN`

  Constant GNOME_STOCK_PIXMAP_BOOK_RED

    `constant GTK.GNOME_STOCK_PIXMAP_BOOK_RED`

  Constant GNOME_STOCK_PIXMAP_BOOK_YELLOW

    `constant GTK.GNOME_STOCK_PIXMAP_BOOK_YELLOW`

  Constant GNOME_STOCK_PIXMAP_BOTTOM

    `constant GTK.GNOME_STOCK_PIXMAP_BOTTOM`

  Constant GNOME_STOCK_PIXMAP_CDROM

    `constant GTK.GNOME_STOCK_PIXMAP_CDROM`

  Constant GNOME_STOCK_PIXMAP_CLEAR

    `constant GTK.GNOME_STOCK_PIXMAP_CLEAR`

  Constant GNOME_STOCK_PIXMAP_CLOSE

    `constant GTK.GNOME_STOCK_PIXMAP_CLOSE`

  Constant GNOME_STOCK_PIXMAP_COLORSELECTOR

    `constant GTK.GNOME_STOCK_PIXMAP_COLORSELECTOR`

  Constant GNOME_STOCK_PIXMAP_CONVERT

    `constant GTK.GNOME_STOCK_PIXMAP_CONVERT`

  Constant GNOME_STOCK_PIXMAP_COPY

    `constant GTK.GNOME_STOCK_PIXMAP_COPY`

  Constant GNOME_STOCK_PIXMAP_CUT

    `constant GTK.GNOME_STOCK_PIXMAP_CUT`

  Constant GNOME_STOCK_PIXMAP_DISABLED

    `constant GTK.GNOME_STOCK_PIXMAP_DISABLED`

  Constant GNOME_STOCK_PIXMAP_DOWN

    `constant GTK.GNOME_STOCK_PIXMAP_DOWN`

  Constant GNOME_STOCK_PIXMAP_EXEC

    `constant GTK.GNOME_STOCK_PIXMAP_EXEC`

  Constant GNOME_STOCK_PIXMAP_EXIT

    `constant GTK.GNOME_STOCK_PIXMAP_EXIT`

  Constant GNOME_STOCK_PIXMAP_FIRST

    `constant GTK.GNOME_STOCK_PIXMAP_FIRST`

  Constant GNOME_STOCK_PIXMAP_FOCUSED

    `constant GTK.GNOME_STOCK_PIXMAP_FOCUSED`

  Constant GNOME_STOCK_PIXMAP_FONT

    `constant GTK.GNOME_STOCK_PIXMAP_FONT`

  Constant GNOME_STOCK_PIXMAP_FORWARD

    `constant GTK.GNOME_STOCK_PIXMAP_FORWARD`

  Constant GNOME_STOCK_PIXMAP_HELP

    `constant GTK.GNOME_STOCK_PIXMAP_HELP`

  Constant GNOME_STOCK_PIXMAP_HOME

    `constant GTK.GNOME_STOCK_PIXMAP_HOME`

  Constant GNOME_STOCK_PIXMAP_INDEX

    `constant GTK.GNOME_STOCK_PIXMAP_INDEX`

  Constant GNOME_STOCK_PIXMAP_JUMP_TO

    `constant GTK.GNOME_STOCK_PIXMAP_JUMP_TO`

  Constant GNOME_STOCK_PIXMAP_LAST

    `constant GTK.GNOME_STOCK_PIXMAP_LAST`

  Constant GNOME_STOCK_PIXMAP_LINE_IN

    `constant GTK.GNOME_STOCK_PIXMAP_LINE_IN`

  Constant GNOME_STOCK_PIXMAP_MAIL

    `constant GTK.GNOME_STOCK_PIXMAP_MAIL`

  Constant GNOME_STOCK_PIXMAP_MAIL_FWD

    `constant GTK.GNOME_STOCK_PIXMAP_MAIL_FWD`

  Constant GNOME_STOCK_PIXMAP_MAIL_NEW

    `constant GTK.GNOME_STOCK_PIXMAP_MAIL_NEW`

  Constant GNOME_STOCK_PIXMAP_MAIL_RCV

    `constant GTK.GNOME_STOCK_PIXMAP_MAIL_RCV`

  Constant GNOME_STOCK_PIXMAP_MAIL_RPL

    `constant GTK.GNOME_STOCK_PIXMAP_MAIL_RPL`

  Constant GNOME_STOCK_PIXMAP_MAIL_SND

    `constant GTK.GNOME_STOCK_PIXMAP_MAIL_SND`

  Constant GNOME_STOCK_PIXMAP_MIC

    `constant GTK.GNOME_STOCK_PIXMAP_MIC`

  Constant GNOME_STOCK_PIXMAP_MIDI

    `constant GTK.GNOME_STOCK_PIXMAP_MIDI`

  Constant GNOME_STOCK_PIXMAP_MULTIPLE

    `constant GTK.GNOME_STOCK_PIXMAP_MULTIPLE`

  Constant GNOME_STOCK_PIXMAP_NEW

    `constant GTK.GNOME_STOCK_PIXMAP_NEW`

  Constant GNOME_STOCK_PIXMAP_NOT

    `constant GTK.GNOME_STOCK_PIXMAP_NOT`

  Constant GNOME_STOCK_PIXMAP_OPEN

    `constant GTK.GNOME_STOCK_PIXMAP_OPEN`

  Constant GNOME_STOCK_PIXMAP_PASTE

    `constant GTK.GNOME_STOCK_PIXMAP_PASTE`

  Constant GNOME_STOCK_PIXMAP_PREFERENCES

    `constant GTK.GNOME_STOCK_PIXMAP_PREFERENCES`

  Constant GNOME_STOCK_PIXMAP_PRINT

    `constant GTK.GNOME_STOCK_PIXMAP_PRINT`

  Constant GNOME_STOCK_PIXMAP_PROPERTIES

    `constant GTK.GNOME_STOCK_PIXMAP_PROPERTIES`

  Constant GNOME_STOCK_PIXMAP_QUIT

    `constant GTK.GNOME_STOCK_PIXMAP_QUIT`

  Constant GNOME_STOCK_PIXMAP_REDO

    `constant GTK.GNOME_STOCK_PIXMAP_REDO`

  Constant GNOME_STOCK_PIXMAP_REFRESH

    `constant GTK.GNOME_STOCK_PIXMAP_REFRESH`

  Constant GNOME_STOCK_PIXMAP_REGULAR

    `constant GTK.GNOME_STOCK_PIXMAP_REGULAR`

  Constant GNOME_STOCK_PIXMAP_REMOVE

    `constant GTK.GNOME_STOCK_PIXMAP_REMOVE`

  Constant GNOME_STOCK_PIXMAP_REVERT

    `constant GTK.GNOME_STOCK_PIXMAP_REVERT`

  Constant GNOME_STOCK_PIXMAP_SAVE

    `constant GTK.GNOME_STOCK_PIXMAP_SAVE`

  Constant GNOME_STOCK_PIXMAP_SAVE_AS

    `constant GTK.GNOME_STOCK_PIXMAP_SAVE_AS`

  Constant GNOME_STOCK_PIXMAP_SCORES

    `constant GTK.GNOME_STOCK_PIXMAP_SCORES`

  Constant GNOME_STOCK_PIXMAP_SEARCH

    `constant GTK.GNOME_STOCK_PIXMAP_SEARCH`

  Constant GNOME_STOCK_PIXMAP_SPELLCHECK

    `constant GTK.GNOME_STOCK_PIXMAP_SPELLCHECK`

  Constant GNOME_STOCK_PIXMAP_SRCHRPL

    `constant GTK.GNOME_STOCK_PIXMAP_SRCHRPL`

  Constant GNOME_STOCK_PIXMAP_STOP

    `constant GTK.GNOME_STOCK_PIXMAP_STOP`

  Constant GNOME_STOCK_PIXMAP_TABLE_BORDERS

    `constant GTK.GNOME_STOCK_PIXMAP_TABLE_BORDERS`

  Constant GNOME_STOCK_PIXMAP_TABLE_FILL

    `constant GTK.GNOME_STOCK_PIXMAP_TABLE_FILL`

  Constant GNOME_STOCK_PIXMAP_TEXT_BOLD

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_BOLD`

  Constant GNOME_STOCK_PIXMAP_TEXT_BULLETED_LIST

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_BULLETED_LIST`

  Constant GNOME_STOCK_PIXMAP_TEXT_INDENT

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_INDENT`

  Constant GNOME_STOCK_PIXMAP_TEXT_ITALIC

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_ITALIC`

  Constant GNOME_STOCK_PIXMAP_TEXT_NUMBERED_LIST

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_NUMBERED_LIST`

  Constant GNOME_STOCK_PIXMAP_TEXT_STRIKEOUT

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_STRIKEOUT`

  Constant GNOME_STOCK_PIXMAP_TEXT_UNDERLINE

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_UNDERLINE`

  Constant GNOME_STOCK_PIXMAP_TEXT_UNINDENT

    `constant GTK.GNOME_STOCK_PIXMAP_TEXT_UNINDENT`

  Constant GNOME_STOCK_PIXMAP_TIMER

    `constant GTK.GNOME_STOCK_PIXMAP_TIMER`

  Constant GNOME_STOCK_PIXMAP_TIMER_STOP

    `constant GTK.GNOME_STOCK_PIXMAP_TIMER_STOP`

  Constant GNOME_STOCK_PIXMAP_TOP

    `constant GTK.GNOME_STOCK_PIXMAP_TOP`

  Constant GNOME_STOCK_PIXMAP_TRASH

    `constant GTK.GNOME_STOCK_PIXMAP_TRASH`

  Constant GNOME_STOCK_PIXMAP_TRASH_FULL

    `constant GTK.GNOME_STOCK_PIXMAP_TRASH_FULL`

  Constant GNOME_STOCK_PIXMAP_TYPE_DATA

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_DATA`

  Constant GNOME_STOCK_PIXMAP_TYPE_FILE

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_FILE`

  Constant GNOME_STOCK_PIXMAP_TYPE_GPIXMAP

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_GPIXMAP`

  Constant GNOME_STOCK_PIXMAP_TYPE_IMLIB

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_IMLIB`

  Constant GNOME_STOCK_PIXMAP_TYPE_IMLIB_SCALED

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_IMLIB_SCALED`

  Constant GNOME_STOCK_PIXMAP_TYPE_NONE

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_NONE`

  Constant GNOME_STOCK_PIXMAP_TYPE_PATH

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_PATH`

  Constant GNOME_STOCK_PIXMAP_TYPE_WIDGET

    `constant GTK.GNOME_STOCK_PIXMAP_TYPE_WIDGET`

  Constant GNOME_STOCK_PIXMAP_UNDELETE

    `constant GTK.GNOME_STOCK_PIXMAP_UNDELETE`

  Constant GNOME_STOCK_PIXMAP_UNDO

    `constant GTK.GNOME_STOCK_PIXMAP_UNDO`

  Constant GNOME_STOCK_PIXMAP_UP

    `constant GTK.GNOME_STOCK_PIXMAP_UP`

  Constant GNOME_STOCK_PIXMAP_VOLUME

    `constant GTK.GNOME_STOCK_PIXMAP_VOLUME`

  Constant ACCEL_LOCKED

    `constant GTK.ACCEL_LOCKED`

  Constant ACCEL_SIGNAL_VISIBLE

    `constant GTK.ACCEL_SIGNAL_VISIBLE`

  Constant ACCEL_VISIBLE

    `constant GTK.ACCEL_VISIBLE`

  Constant ANCHOR_CENTER

    `constant GTK.ANCHOR_CENTER`

  Constant ANCHOR_E

    `constant GTK.ANCHOR_E`

  Constant ANCHOR_EAST

    `constant GTK.ANCHOR_EAST`

  Constant ANCHOR_N

    `constant GTK.ANCHOR_N`

  Constant ANCHOR_NE

    `constant GTK.ANCHOR_NE`

  Constant ANCHOR_NORTH

    `constant GTK.ANCHOR_NORTH`

  Constant ANCHOR_NORTH_EAST

    `constant GTK.ANCHOR_NORTH_EAST`

  Constant ANCHOR_NORTH_WEST

    `constant GTK.ANCHOR_NORTH_WEST`

  Constant ANCHOR_NW

    `constant GTK.ANCHOR_NW`

  Constant ANCHOR_S

    `constant GTK.ANCHOR_S`

  Constant ANCHOR_SE

    `constant GTK.ANCHOR_SE`

  Constant ANCHOR_SOUTH

    `constant GTK.ANCHOR_SOUTH`

  Constant ANCHOR_SOUTH_EAST

    `constant GTK.ANCHOR_SOUTH_EAST`

  Constant ANCHOR_SOUTH_WEST

    `constant GTK.ANCHOR_SOUTH_WEST`

  Constant ANCHOR_SW

    `constant GTK.ANCHOR_SW`

  Constant ANCHOR_W

    `constant GTK.ANCHOR_W`

  Constant ANCHOR_WEST

    `constant GTK.ANCHOR_WEST`

  Constant APP_PAINTABLE

    `constant GTK.APP_PAINTABLE`

  Constant ARROW_DOWN

    `constant GTK.ARROW_DOWN`

  Constant ARROW_LEFT

    `constant GTK.ARROW_LEFT`

  Constant ARROW_RIGHT

    `constant GTK.ARROW_RIGHT`

  Constant ARROW_UP

    `constant GTK.ARROW_UP`

  Constant BUTTONBOX_DEFAULT_STYLE

    `constant GTK.BUTTONBOX_DEFAULT_STYLE`

  Constant BUTTONBOX_EDGE

    `constant GTK.BUTTONBOX_EDGE`

  Constant BUTTONBOX_END

    `constant GTK.BUTTONBOX_END`

  Constant BUTTONBOX_SPREAD

    `constant GTK.BUTTONBOX_SPREAD`

  Constant BUTTONBOX_START

    `constant GTK.BUTTONBOX_START`

  Constant BUTTON_DRAGS

    `constant GTK.BUTTON_DRAGS`

  Constant BUTTON_EXPANDS

    `constant GTK.BUTTON_EXPANDS`

  Constant BUTTON_IGNORED

    `constant GTK.BUTTON_IGNORED`

  Constant BUTTON_SELECTS

    `constant GTK.BUTTON_SELECTS`

  Constant CALENDAR_NO_MONTH_CHANGE

    `constant GTK.CALENDAR_NO_MONTH_CHANGE`

  Constant CALENDAR_SHOW_DAY_NAMES

    `constant GTK.CALENDAR_SHOW_DAY_NAMES`

  Constant CALENDAR_SHOW_HEADING

    `constant GTK.CALENDAR_SHOW_HEADING`

  Constant CALENDAR_SHOW_WEEK_NUMBERS

    `constant GTK.CALENDAR_SHOW_WEEK_NUMBERS`

  Constant CALENDAR_WEEK_START_MONDAY

    `constant GTK.CALENDAR_WEEK_START_MONDAY`

  Constant CAN_DEFAULT

    `constant GTK.CAN_DEFAULT`

  Constant CAN_FOCUS

    `constant GTK.CAN_FOCUS`

  Constant CELL_EMPTY

    `constant GTK.CELL_EMPTY`

  Constant CELL_PIXMAP

    `constant GTK.CELL_PIXMAP`

  Constant CELL_PIXTEXT

    `constant GTK.CELL_PIXTEXT`

  Constant CELL_TEXT

    `constant GTK.CELL_TEXT`

  Constant CELL_WIDGET

    `constant GTK.CELL_WIDGET`

  Constant CENTIMETERS

    `constant GTK.CENTIMETERS`

  Constant CLIST_ADD_MODE

    `constant GTK.CLIST_ADD_MODE`

  Constant CLIST_AUTO_RESIZE_BLOCKED

    `constant GTK.CLIST_AUTO_RESIZE_BLOCKED`

  Constant CLIST_AUTO_SORT

    `constant GTK.CLIST_AUTO_SORT`

  Constant CLIST_DRAW_DRAG_LINE

    `constant GTK.CLIST_DRAW_DRAG_LINE`

  Constant CLIST_DRAW_DRAG_RECT

    `constant GTK.CLIST_DRAW_DRAG_RECT`

  Constant CLIST_IN_DRAG

    `constant GTK.CLIST_IN_DRAG`

  Constant CLIST_REORDERABLE

    `constant GTK.CLIST_REORDERABLE`

  Constant CLIST_ROW_HEIGHT_SET

    `constant GTK.CLIST_ROW_HEIGHT_SET`

  Constant CLIST_SHOW_TITLES

    `constant GTK.CLIST_SHOW_TITLES`

  Constant CLIST_USE_DRAG_ICONS

    `constant GTK.CLIST_USE_DRAG_ICONS`

  Constant CLOCK_DECREASING

    `constant GTK.CLOCK_DECREASING`

  Constant CLOCK_INCREASING

    `constant GTK.CLOCK_INCREASING`

  Constant CLOCK_REALTIME

    `constant GTK.CLOCK_REALTIME`

  Constant COMPOSITE_CHILD

    `constant GTK.COMPOSITE_CHILD`

  Constant CORNER_BOTTOM_LEFT

    `constant GTK.CORNER_BOTTOM_LEFT`

  Constant CORNER_BOTTOM_RIGHT

    `constant GTK.CORNER_BOTTOM_RIGHT`

  Constant CORNER_TOP_LEFT

    `constant GTK.CORNER_TOP_LEFT`

  Constant CORNER_TOP_RIGHT

    `constant GTK.CORNER_TOP_RIGHT`

  Constant CTREE_EXPANDER_CIRCULAR

    `constant GTK.CTREE_EXPANDER_CIRCULAR`

  Constant CTREE_EXPANDER_NONE

    `constant GTK.CTREE_EXPANDER_NONE`

  Constant CTREE_EXPANDER_SQUARE

    `constant GTK.CTREE_EXPANDER_SQUARE`

  Constant CTREE_EXPANDER_TRIANGLE

    `constant GTK.CTREE_EXPANDER_TRIANGLE`

  Constant CTREE_EXPANSION_COLLAPSE

    `constant GTK.CTREE_EXPANSION_COLLAPSE`

  Constant CTREE_EXPANSION_COLLAPSE_RECURSIVE

    `constant GTK.CTREE_EXPANSION_COLLAPSE_RECURSIVE`

  Constant CTREE_EXPANSION_EXPAND

    `constant GTK.CTREE_EXPANSION_EXPAND`

  Constant CTREE_EXPANSION_EXPAND_RECURSIVE

    `constant GTK.CTREE_EXPANSION_EXPAND_RECURSIVE`

  Constant CTREE_EXPANSION_TOGGLE

    `constant GTK.CTREE_EXPANSION_TOGGLE`

  Constant CTREE_EXPANSION_TOGGLE_RECURSIVE

    `constant GTK.CTREE_EXPANSION_TOGGLE_RECURSIVE`

  Constant CTREE_LINES_DOTTED

    `constant GTK.CTREE_LINES_DOTTED`

  Constant CTREE_LINES_NONE

    `constant GTK.CTREE_LINES_NONE`

  Constant CTREE_LINES_SOLID

    `constant GTK.CTREE_LINES_SOLID`

  Constant CTREE_LINES_TABBED

    `constant GTK.CTREE_LINES_TABBED`

  Constant CTREE_POS_AFTER

    `constant GTK.CTREE_POS_AFTER`

  Constant CTREE_POS_AS_CHILD

    `constant GTK.CTREE_POS_AS_CHILD`

  Constant CTREE_POS_BEFORE

    `constant GTK.CTREE_POS_BEFORE`

  Constant CURVE_TYPE_FREE

    `constant GTK.CURVE_TYPE_FREE`

  Constant CURVE_TYPE_LINEAR

    `constant GTK.CURVE_TYPE_LINEAR`

  Constant CURVE_TYPE_SPLINE

    `constant GTK.CURVE_TYPE_SPLINE`

  Constant DATABOX_BARS

    `constant GTK.DATABOX_BARS`

  Constant DATABOX_LINES

    `constant GTK.DATABOX_LINES`

  Constant DATABOX_NOT_DISPLAYED

    `constant GTK.DATABOX_NOT_DISPLAYED`

  Constant DATABOX_POINTS

    `constant GTK.DATABOX_POINTS`

  Constant DEST_DEFAULT_ALL

    `constant GTK.DEST_DEFAULT_ALL`

  Constant DEST_DEFAULT_DROP

    `constant GTK.DEST_DEFAULT_DROP`

  Constant DEST_DEFAULT_HIGHLIGHT

    `constant GTK.DEST_DEFAULT_HIGHLIGHT`

  Constant DEST_DEFAULT_MOTION

    `constant GTK.DEST_DEFAULT_MOTION`

  Constant DIRECTION_LEFT

    `constant GTK.DIRECTION_LEFT`

  Constant DIRECTION_RIGHT

    `constant GTK.DIRECTION_RIGHT`

  Constant DIR_DOWN

    `constant GTK.DIR_DOWN`

  Constant DIR_LEFT

    `constant GTK.DIR_LEFT`

  Constant DIR_RIGHT

    `constant GTK.DIR_RIGHT`

  Constant DIR_TAB_BACKWARD

    `constant GTK.DIR_TAB_BACKWARD`

  Constant DIR_TAB_FORWARD

    `constant GTK.DIR_TAB_FORWARD`

  Constant DIR_UP

    `constant GTK.DIR_UP`

  Constant EXPAND

    `constant GTK.EXPAND`

  Constant FILL

    `constant GTK.FILL`

  Constant FILL_X

    `constant GTK.FILL_X`

  Constant FILL_Y

    `constant GTK.FILL_Y`

  Constant HAS_DEFAULT

    `constant GTK.HAS_DEFAULT`

  Constant HAS_FOCUS

    `constant GTK.HAS_FOCUS`

  Constant HAS_GRAB

    `constant GTK.HAS_GRAB`

  Constant INCHES

    `constant GTK.INCHES`

  Constant JUSTIFY_CENTER

    `constant GTK.JUSTIFY_CENTER`

  Constant JUSTIFY_FILL

    `constant GTK.JUSTIFY_FILL`

  Constant JUSTIFY_LEFT

    `constant GTK.JUSTIFY_LEFT`

  Constant JUSTIFY_RIGHT

    `constant GTK.JUSTIFY_RIGHT`

  Constant LEFT_RIGHT

    `constant GTK.LEFT_RIGHT`

  Constant MAPPED

    `constant GTK.MAPPED`

  Constant NO_REPARENT

    `constant GTK.NO_REPARENT`

  Constant NO_WINDOW

    `constant GTK.NO_WINDOW`

  Constant ORIENTATION_HORIZONTAL

    `constant GTK.ORIENTATION_HORIZONTAL`

  Constant ORIENTATION_VERTICAL

    `constant GTK.ORIENTATION_VERTICAL`

  Constant PACK_END

    `constant GTK.PACK_END`

  Constant PACK_EXPAND

    `constant GTK.PACK_EXPAND`

  Constant PACK_START

    `constant GTK.PACK_START`

  Constant PARENT_SENSITIVE

    `constant GTK.PARENT_SENSITIVE`

  Constant PIXELS

    `constant GTK.PIXELS`

  Constant POLICY_ALWAYS

    `constant GTK.POLICY_ALWAYS`

  Constant POLICY_AUTOMATIC

    `constant GTK.POLICY_AUTOMATIC`

  Constant POLICY_NEVER

    `constant GTK.POLICY_NEVER`

  Constant POS_BOTTOM

    `constant GTK.POS_BOTTOM`

  Constant POS_LEFT

    `constant GTK.POS_LEFT`

  Constant POS_RIGHT

    `constant GTK.POS_RIGHT`

  Constant POS_TOP

    `constant GTK.POS_TOP`

  Constant PREVIEW_COLOR

    `constant GTK.PREVIEW_COLOR`

  Constant PREVIEW_GRAYSCALE

    `constant GTK.PREVIEW_GRAYSCALE`

  Constant PROGRESS_BOTTOM_TO_TOP

    `constant GTK.PROGRESS_BOTTOM_TO_TOP`

  Constant PROGRESS_CONTINUOUS

    `constant GTK.PROGRESS_CONTINUOUS`

  Constant PROGRESS_DISCRETE

    `constant GTK.PROGRESS_DISCRETE`

  Constant PROGRESS_LEFT_TO_RIGHT

    `constant GTK.PROGRESS_LEFT_TO_RIGHT`

  Constant PROGRESS_RIGHT_TO_LEFT

    `constant GTK.PROGRESS_RIGHT_TO_LEFT`

  Constant PROGRESS_TOP_TO_BOTTOM

    `constant GTK.PROGRESS_TOP_TO_BOTTOM`

  Constant RC_STYLE

    `constant GTK.RC_STYLE`

  Constant REALIZED

    `constant GTK.REALIZED`

  Constant RELIEF_HALF

    `constant GTK.RELIEF_HALF`

  Constant RELIEF_NONE

    `constant GTK.RELIEF_NONE`

  Constant RELIEF_NORMAL

    `constant GTK.RELIEF_NORMAL`

  Constant RESIZE_IMMEDIATE

    `constant GTK.RESIZE_IMMEDIATE`

  Constant RESIZE_PARENT

    `constant GTK.RESIZE_PARENT`

  Constant RESIZE_QUEUE

    `constant GTK.RESIZE_QUEUE`

  Constant RUN_BOTH

    `constant GTK.RUN_BOTH`

  Constant RUN_FIRST

    `constant GTK.RUN_FIRST`

  Constant RUN_LAST

    `constant GTK.RUN_LAST`

  Constant RUN_NO_RECURSE

    `constant GTK.RUN_NO_RECURSE`

  Constant SCROLL_JUMP

    `constant GTK.SCROLL_JUMP`

  Constant SCROLL_NONE

    `constant GTK.SCROLL_NONE`

  Constant SCROLL_PAGE_BACKWARD

    `constant GTK.SCROLL_PAGE_BACKWARD`

  Constant SCROLL_PAGE_FORWARD

    `constant GTK.SCROLL_PAGE_FORWARD`

  Constant SCROLL_STEP_BACKWARD

    `constant GTK.SCROLL_STEP_BACKWARD`

  Constant SCROLL_STEP_FORWARD

    `constant GTK.SCROLL_STEP_FORWARD`

  Constant SELECTION_BROWSE

    `constant GTK.SELECTION_BROWSE`

  Constant SELECTION_EXTENDED

    `constant GTK.SELECTION_EXTENDED`

  Constant SELECTION_MULTIPLE

    `constant GTK.SELECTION_MULTIPLE`

  Constant SELECTION_SINGLE

    `constant GTK.SELECTION_SINGLE`

  Constant SENSITIVE

    `constant GTK.SENSITIVE`

  Constant SHADOW_ETCHED_IN

    `constant GTK.SHADOW_ETCHED_IN`

  Constant SHADOW_ETCHED_OUT

    `constant GTK.SHADOW_ETCHED_OUT`

  Constant SHADOW_IN

    `constant GTK.SHADOW_IN`

  Constant SHADOW_NONE

    `constant GTK.SHADOW_NONE`

  Constant SHADOW_OUT

    `constant GTK.SHADOW_OUT`

  Constant SHRINK

    `constant GTK.SHRINK`

  Constant SIDE_BOTTOM

    `constant GTK.SIDE_BOTTOM`

  Constant SIDE_LEFT

    `constant GTK.SIDE_LEFT`

  Constant SIDE_RIGHT

    `constant GTK.SIDE_RIGHT`

  Constant SIDE_TOP

    `constant GTK.SIDE_TOP`

  Constant SORT_ASCENDING

    `constant GTK.SORT_ASCENDING`

  Constant SORT_DESCENDING

    `constant GTK.SORT_DESCENDING`

  Constant SPIN_END

    `constant GTK.SPIN_END`

  Constant SPIN_HOME

    `constant GTK.SPIN_HOME`

  Constant SPIN_PAGE_BACKWARD

    `constant GTK.SPIN_PAGE_BACKWARD`

  Constant SPIN_PAGE_FORWARD

    `constant GTK.SPIN_PAGE_FORWARD`

  Constant SPIN_STEP_BACKWARD

    `constant GTK.SPIN_STEP_BACKWARD`

  Constant SPIN_STEP_FORWARD

    `constant GTK.SPIN_STEP_FORWARD`

  Constant SPIN_USER_DEFINED

    `constant GTK.SPIN_USER_DEFINED`

  Constant STATE_ACTIVE

    `constant GTK.STATE_ACTIVE`

  Constant STATE_INSENSITIVE

    `constant GTK.STATE_INSENSITIVE`

  Constant STATE_NORMAL

    `constant GTK.STATE_NORMAL`

  Constant STATE_PRELIGHT

    `constant GTK.STATE_PRELIGHT`

  Constant STATE_SELECTED

    `constant GTK.STATE_SELECTED`

  Constant TOOLBAR_BOTH

    `constant GTK.TOOLBAR_BOTH`

  Constant TOOLBAR_ICONS

    `constant GTK.TOOLBAR_ICONS`

  Constant TOOLBAR_TEXT

    `constant GTK.TOOLBAR_TEXT`

  Constant TOPLEVEL

    `constant GTK.TOPLEVEL`

  Constant TOP_BOTTOM

    `constant GTK.TOP_BOTTOM`

  Constant TREE_VIEW_ITEM

    `constant GTK.TREE_VIEW_ITEM`

  Constant TREE_VIEW_LINE

    `constant GTK.TREE_VIEW_LINE`

  Constant TROUGH_END

    `constant GTK.TROUGH_END`

  Constant TROUGH_JUMP

    `constant GTK.TROUGH_JUMP`

  Constant TROUGH_NONE

    `constant GTK.TROUGH_NONE`

  Constant TROUGH_START

    `constant GTK.TROUGH_START`

  Constant UPDATE_ALWAYS

    `constant GTK.UPDATE_ALWAYS`

  Constant UPDATE_CONTINUOUS

    `constant GTK.UPDATE_CONTINUOUS`

  Constant UPDATE_DELAYED

    `constant GTK.UPDATE_DELAYED`

  Constant UPDATE_DISCONTINUOUS

    `constant GTK.UPDATE_DISCONTINUOUS`

  Constant UPDATE_IF_VALID

    `constant GTK.UPDATE_IF_VALID`

  Constant VISIBILITY_FULL

    `constant GTK.VISIBILITY_FULL`

  Constant VISIBILITY_NONE

    `constant GTK.VISIBILITY_NONE`

  Constant VISIBILITY_PARTIAL

    `constant GTK.VISIBILITY_PARTIAL`

  Constant VISIBLE

    `constant GTK.VISIBLE`

  Constant WINDOW_DIALOG

    `constant GTK.WINDOW_DIALOG`

  Constant WINDOW_POPUP

    `constant GTK.WINDOW_POPUP`

  Constant WINDOW_TOPLEVEL

    `constant GTK.WINDOW_TOPLEVEL`

  Constant WIN_POS_CENTER

    `constant GTK.WIN_POS_CENTER`

  Constant WIN_POS_MOUSE

    `constant GTK.WIN_POS_MOUSE`

  Constant WIN_POS_NONE

    `constant GTK.WIN_POS_NONE`

  Constant TRUE

    `constant GTK.TRUE`

  Method applet_widget_gtk_main

    `void applet_widget_gtk_main()`

  Description

    Special corba main loop for gnome panel applets

  Method applet_widget_gtk_main_quit

    `void applet_widget_gtk_main_quit()`

  Description

    Exit from the applet_widget_gtk_main function on the next iteration.

  Method false

    `int false()`

  Description

    Always returns false.

  Method flush

    `void flush()`

  Description

    Flush GDK. Not normally needed, can be useful while doing calculations.

  Method gnome_init

    `array gnome_init(string app_id, string app_version, array argv, int|void corba_init_flags)`

  Description

    Initializes the application. This sets up all of the GNOME internals and prepares them (imlib, gdk/gtk, session-management, triggers, sound, user preferences). If corba init flags are specified, corba initialization is done as well as gnome initialization. corba_init_flags is 0 or more of GNORBA_INIT_SERVER_FUNC (1), GNORBA_INIT_DISABLE_COOKIES (2) and GNORBA_INIT_CORBA_PRIO_HIGH (4)

  Method grab_add

    `void grab_add(GTK.Widget widget)`

  Method grab_remove

    `void grab_remove(GTK.Widget widget)`

  Method gtk_init

    `array gtk_init(array|void argc, int|void no_pgtkrc)`

  Description

    Low level GTK init function (used by setup_gtk). This function is more or less equivalent to the C-GTK+ function gtk_init. setup_gtk does some extra things (such as parsing ~/.pgtkrc).

  Method low_flush

    `void low_flush()`

  Description

    Flush, but do not process events. Not normally needed.

  Method main

    `void main()`

  Description

    Start GTK in blocking mode. Doing this disables asynchronous I/O in pike. You can return -1 from main in pike to run GTK (and the rest of pike) in asynchrounous mode.

  Method main_iteration_do

    `int main_iteration_do(int block)`

  Description

    Run one iteration in the mainloop. If block is true, wait for an event before returning.

  Method main_level

    `int main_level()`

  Description

    Return the current recursion depth.

  Method main_quit

    `void main_quit()`

  Description

    Exit from the gtk_main function on the next iteration.

  Method parse_rc

    `void parse_rc(string rc)`

  Description

    Takes a string and reads it as a gtkrc file.

  Method root_window

    `GDK.Window root_window()`

  Description

    Returns the root window of the current display

  Method set_new_signal_convention

    `int set_new_signal_convention(int n)`

  Method setup_gtk

    `array setup_gtk(array|void argv, int|void do_not_parse_rc)`

  Description

    Initialize GTK, and all that comes with it. Also parses $HOME/.pgtkrc and $HOME/.gtkrc if they exists. The single argument, if supplied, is the argument array passed to the program. This is used to set default window titles etc. The second argument, if supplied, indicates that pike specific *rc files should not be parsed.

    The most common usage is GTK.setup_gtk(argv);

  Method true

    `int true()`

  Description

    Always returns true.

  CLASS GTK.Hbox

    Description

      Most packing is done by creating boxes. These are invisible widget containers that we can pack our widgets into which come in two forms, a horizontal box, and a vertical box. This is the horizontal one. When packing widgets into a horizontal box, the objects are inserted horizontally from left to right or right to left depending on the call used.

      `GTK.Hbox(0,0)->add(GTK.Button("Hello"))->add(GTK.Button("World"))->pack_end_defaults(GTK.Button("From right"))->pack_start_defaults(GTK.Button("From left"))`

      `GTK.Hbox(1,0)->add(GTK.Button("Hello"))->add(GTK.Button("World"))->pack_end_defaults(GTK.Button("From right"))->pack_start_defaults(GTK.Button("From left"))`

      `GTK.Hbox(1,40)->add(GTK.Button("Hello"))->add(GTK.Button("World"))->pack_end_defaults(GTK.Button("From right"))->pack_start_defaults(GTK.Button("From left"))`

    Inherit Box

      inherit GTK.Box : Box

    Method create

      `GTK.Hbox GTK.Hbox(int all_same_size, int hpadding)`

    Description

      Create a new horizontal box widget. If all_same_size is true, all widgets will have exactly the same size. hpadding is added to the left and right of the children.

  CLASS GTK.Fixed

    Description

      A fixed container is a container that keeps it's children at fixed locations and give them fixed sizes, both given in pixels.

      Example: `GTK.Fixed()->put(GTK.Label("100,100"), 100, 100)->put(GTK.Label("0,0"), 0, 0)->set_usize(150,115)`

    Inherit Container

      inherit GTK.Container : Container

    Method create

      `GTK.Fixed GTK.Fixed()`

    Description

      Create a new fixed widget

    Method move

      `GTK.Fixed move(GTK.Widget widget, int new_xpos, int new_ypos)`

    Description

      Move the widget to new_xpos,new_ypos from it's old location.

    Method put

      `GTK.Fixed put(GTK.Widget widget, int x, int y)`

    Description

      Place the widget at xpos,ypos.

  CLASS GTK.Alignment

    Description

      The W(Alignment) widget controls the alignment and size of its child widget. It has four settings: xscale, yscale, xalign, and yalign.

      The scale settings are used to specify how much the child widget should expand to fill the space allocated to the W(Alignment). The values can range from 0 (meaning the child doesn't expand at all) to 1 (meaning the child expands to fill all of the available space).

      The align settings are used to place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect.

      NOIMG

    Inherit Bin

      inherit GTK.Bin : Bin

    Method create

      `GTK.Alignment GTK.Alignment(float xalign, float yalign, float xscale, float yscale)`

    Description

      xalign : | the horizontal alignment of the child widget, from 0 (left) to 1 (right).
      yalign : | the vertical alignment of the child widget, from 0 (top) to 1 (bottom).
      xscale : | the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the GTK.Alignment.
      yscale : | the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

    Method get_xalign

      `float get_xalign()`

    Description

      the horizontal alignment of the child widget, from 0 (left) to 1 (right).

    Method get_xscale

      `float get_xscale()`

    Description

      the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the GTK.Alignment.

    Method get_yalign

      `float get_yalign()`

    Description

      the vertical alignment of the child widget, from 0 (top) to 1 (bottom).

    Method get_yscale

      `float get_yscale()`

    Description

      the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

    Method set

      `GTK.Alignment set(float xalign, float yalign, float xscale, float yscale)`

    Description

      xalign : | the horizontal alignment of the child widget, from 0 (left) to 1 (right).
      yalign : | the vertical alignment of the child widget, from 0 (top) to 1 (bottom).
      xscale : | the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the GTK.Alignment.
      yscale : | the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

  CLASS GTK.Scrollbar

    Description

      These are your standard, run-of-the-mill scrollbars. These should be used only for scrolling some other widget, such as a list, a text box, or a viewport (and it's generally easier to use the scrolled window widget in most cases). For other purposes, you should use scale widgets, as they are friendlier and more featureful.

    Inherit Range

      inherit GTK.Range : Range

  CLASS GTK.FontSelection

    Description

      `GTK.FontSelection()`

    Inherit Notebook

      inherit GTK.Notebook : Notebook

    Method create

      `GTK.FontSelection GTK.FontSelection()`

    Method get_font

      `GDK.Font get_font()`

    Method get_font_name

      `string get_font_name()`

    Method get_preview_text

      `string get_preview_text()`

    Method set_font_name

      `GTK.FontSelection set_font_name(string xlfd)`

    Description

      This sets the currently displayed font. It should be a valid X Logical Font Description font name (anything else will be ignored), e.g. "-adobe-courier-bold-o-normal--25-*-*-*-*-*-*-*"

    Method set_preview_text

      `GTK.FontSelection set_preview_text(string text)`

  CLASS GTK.Paned

    Description

      GTK.Paned is the base class for widgets with two panes, arranged either horizontally (W(HPaned)) or vertically (W(VPaned)). Child widgets are added to the panes of the widget with pack1() and pack2(). The division beween the two children is set by default from the size requests of the children, but it can be adjusted by the user.

      A paned widget draws a separator between the two child widgets and a small handle that the user can drag to adjust the division. It does not draw any relief around the children or around the separator. (The space in which the separator is called the gutter). Often, it is useful to put each child inside a W(Frame) with the shadow type set to GTK.ShadowIn so that the gutter appears as a ridge.

      Each child has two options that can be set, resize and shrink. If resize is true, then when the GTK.Paned is resized, that child will expand or shrink along with the paned widget. If shrink is true, then when that child can be made smaller than it's requisition by the user. Setting shrink to 0 allows the application to set a minimum size. If resize is false for both children, then this is treated as if resize is true for both children.

      The application can set the position of the slider as if it were set by the user, by calling set_position().

    Inherit Container

      inherit GTK.Container : Container

    Method add1

      `GTK.Paned add1(GTK.Widget left_or_top)`

    Description

      Set the left or topmost item. This is equivalent to pack1(left_or_top,0,1)

    Method add2

      `GTK.Paned add2(GTK.Widget right_or_bottom)`

    Description

      Set the right or bottommost item This is equivalent to pack2(left_or_top,0,1)

    Method get_handle_size

      `int get_handle_size()`

    Description

      The size of the handle, in pixels

    Method get_handle_xpos

      `int get_handle_xpos()`

    Description

      The xpos of the handle, in pixels

    Method get_handle_ypos

      `int get_handle_ypos()`

    Description

      The ypos of the handle, in pixels

    Method get_in_drag

      `int get_in_drag()`

    Description

      Return 1 if the user is dragging the handle

    Method get_max_position

      `int get_max_position()`

    Description

      The maximum handle position possible.

    Method get_min_position

      `int get_min_position()`

    Description

      The minimum handle position possible.

    Method pack1

      `GTK.Paned pack1(GTK.Widget widget, int resize, int shrink)`

    Description

      Add a child to the top or left pane.

    Method pack2

      `GTK.Paned pack2(GTK.Widget widget, int resize, int shrink)`

    Description

      Add a child to the bottom or right pane.

    Method set_gutter_size

      `GTK.Paned set_gutter_size(int gsize)`

    Description

      Set the width of the gutter. (The area between the two panes).

    Method set_handle_size

      `GTK.Paned set_handle_size(int hsize)`

    Description

      The size of the handle in pixels

    Method set_position

      `GTK.Paned set_position(int position)`

    Description

      Set the position of the separator, as if set by the user. If position is negative, the remembered position is forgotten, and the division is recomputed from the the requisitions of the children.

  CLASS GTK.Text

    Description

      The Text widget allows multiple lines of text to be displayed and edited. It supports both multi-colored and multi-font text, allowing them to be mixed in any way we wish. It also has a wide set of key based text editing commands, which are compatible with Emacs.

      The text widget supports full cut-and-paste facilities, including the use of double- and triple-click to select a word and a whole line, respectively.

      Bugs:<ul> <li> You cannot add text to the widget before it is realized.</li> </ul>

      `GTK.Text(GTK.Adjustment(),GTK.Adjustment())`

      `function_object(call_out(GTK.Text(GTK.Adjustment(),GTK.Adjustment())->set_text, 0, "Some text")[0])`

      `function_object(call_out(GTK.Text(GTK.Adjustment(),GTK.Adjustment())->insert, 0, "Some text", 0, GDK.Color(255,255,0), GDK.Color(0,0,0))[0])`

    Inherit Editable

      inherit GTK.Editable : Editable

    Method backward_delete

      `GTK.Text backward_delete(int nchars)`

    Description

      Delete n characters backwards from the cursor position

    Method create

      `GTK.Text GTK.Text(GTK.Adjustment xadjustment, GTK.Adjustment yadjustment)`

    Description

      Creates a new GTK.Text widget, initialized with the given Gtk.Adjustments. These pointers can be used to track the viewing position of the GTK.Text widget. Passing NULL to either or both of them will make the text widget create it's own. You can set these later with the function gtk_text_set_adjustment()

    Method forward_delete

      `GTK.Text forward_delete(int nchars)`

    Description

      Delete n characters forward from the cursor position

    Method freeze

      `GTK.Text freeze()`

    Description

      Freezes the widget which disallows redrawing of the widget until it is thawed. This is useful if a large number of changes are going to made to the text within the widget, reducing the amount of flicker seen by the user.

    Method get_length

      `int get_length()`

    Description

      Returns the length of the all the text contained within the widget

    Method get_point

      `int get_point()`

    Description

      Gets the current position of the cursor as the number of characters from the upper left corner of the GtkText widget.

    Method get_text

      `string get_text()`

    Description

      Get the current contents of the text object.

    Method insert

      `GTK.Text insert(string text, GDK.Font font, GDK.Color bg, GDK.Color fg)`

    Description

      syntax: object insert(string what); OR object insert(string what, GDK.Font font, GDK.Color fg, GDK.Color bg); OR object insert(string what, 0, GDK.Color fg, GDK.Color bg); OR object insert(string what, 0, GDK.Color fg); OR object insert(string what, 0, 0, GDK.Color bg);

      Insert new text, optionally with colors.

    Method set_adjustments

      `GTK.Text set_adjustments(GTK.Adjustment xadjustment, GTK.Adjustment yadjustment)`

    Description

      Change the adjustments (as supplied to the constructor) to other adjustments.

    Method set_editable

      `GTK.Text set_editable(int editablep)`

    Description

      If true, the user can change the text in the widget.

    Method set_line_wrap

      `GTK.Text set_line_wrap(int linewrapp)`

    Description

      If true, the widget will automatically wrap the contents.

    Method set_point

      `GTK.Text set_point(int point)`

    Description

      Sets the cursor at the given point. In this case a point constitutes the number of characters from the extreme upper left corner of the widget.

    Method set_text

      `GTK.Text set_text(string to)`

    Description

      Set the text to the specified string.

    Method set_word_wrap

      `GTK.Text set_word_wrap(int wordwrapp)`

    Description

      If true, the widget will automatically wrap the contents.

    Method thaw

      `GTK.Text thaw()`

    Description

      unfreeze the widget.

  CLASS GTK.Pixmap

    Description

      Pixmaps are data structures that contain pictures. These pictures can be used in various places, but most visibly as icons on the X-Windows desktop, or as cursors. A bitmap is a 2-color pixmap.

      To use pixmaps in GTK, you must first build a GDK.Pixmap object using GDK.Pixmap.

      The pixels in a GTK.Pixmap cannot be manipulated by the application after creation, since under the X Window system the pixel data is stored on the X server and so is not available to the client application. If you want to create graphical images which can be manipulated by the application, look at W(Image).

      `GTK.Pixmap( GDK.Pixmap( Image.Image(100,100)->test()) )`

      `GTK.Pixmap( GDK.Pixmap( Image.Image(100,100)->test()), GDK.Bitmap(Image.Image(100,100,255,255,255)->box(10,10,80,80, 0,0,0) ))`

    Inherit Misc

      inherit GTK.Misc : Misc

    Method create

      `GTK.Pixmap GTK.Pixmap(GDK.Pixmap pixmap, GDK.Bitmap mask)`

    Description

      Create a new pixmap object, and sets the image and the mask.

    Method get

      `mapping get()`

    Description

      Returns ([ "pixmap":pixmap, "mask":mask, "pixmap_insensitive":insensitive version of the pixmap ])

    Method get_build_insensitive

      `int get_build_insensitive()`

    Method set

      `GTK.Pixmap set(GDK.Pixmap pixmap, GDK.Bitmap mask)`

    Description

      Sets the GDK.Pixmap image and the optinal GDK.Bitmap mask

    Method set_build_insensitive

      `GTK.Pixmap set_build_insensitive(int buildp)`

    Description

      Set to TRUE if an extra pixmap should be automatically created to use when the pixmap is insensitive.

    Method set_insensitive_pixmap

      `GTK.Pixmap set_insensitive_pixmap(GDK.Pixmap insensitive_pixmap)`

    Description

      Set the pixmap to use when the pixmap is insensitive.

  CLASS GTK.Viewport

    Description

      This is a container that can be scrolled around, but it has no scrollbars. You can connect scrollbars to it using the adjustment objects. `GTK.Viewport(GTK.Adjustment(),GTK.Adjustment())->set_usize(100,100)`

      `GTK.Viewport(GTK.Adjustment(),GTK.Adjustment())->set_usize(100,100)->set_shadow_type(GTK.SHADOW_ETCHED_IN)`

      `GTK.Viewport(GTK.Adjustment(),GTK.Adjustment())->set_usize(100,100)->add(GTK.Label("A label with a very long text on it, it will not fit"))->set_shadow_type(GTK.SHADOW_ETCHED_IN)`

      `lambda(){ object a1;object v = GTK.Viewport(a1=GTK.Adjustment(),GTK.Adjustment())->set_usize(100,100)->add(GTK.Label("A label with a very long text on it, it will not fit"))->set_shadow_type(GTK.SHADOW_ETCHED_IN);call_out(a1->set_value,0,100.0);return v;}()`

    Inherit Bin

      inherit GTK.Bin : Bin

    Method create

      `GTK.Viewport GTK.Viewport(GTK.Adjustment xscroll, GTK.Adjustment yscroll)`

    Description

      Create a new viewport. The adjustments are used to select what part of the viewport to view to the user. They are normally connected to a scrollbar or something similar.

    Method get_hadjustment

      `GTK.Adjustment get_hadjustment()`

    Description

      Return the current horizontal adjustment object

    Method get_vadjustment

      `GTK.Adjustment get_vadjustment()`

    Description

      Return the current vertical adjustment object

    Method set_hadjustment

      `GTK.Viewport set_hadjustment(GTK.Adjustment xscroll)`

    Description

      Set a new horizontal adjustment object.

    Method set_shadow_type

      `GTK.Viewport set_shadow_type(int type)`

    Description

      Set the shadow style. One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_vadjustment

      `GTK.Viewport set_vadjustment(GTK.Adjustment yscroll)`

    Description

      Set a new vertical adjustment object.

  CLASS GTK.Editable

    Description

      The GTK.Editable class is a base class for widgets for editing text, such as W(Entry) and W(Text). It cannot be instantiated by itself. The editable class contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget.

      Signals: activate Indicates that the user has activated the widget in some fashion. Generally, this will be done with a keystroke. (The default binding for this action is Return for GTK.Entry and Control-Return for GTK.Text.

      changed Called when the text in the edit area is changed

      copy_clipboard An action signal. Causes the characters in the current selection to be copied to the clipboard.

      cut_clipboard An action signal. Causes the characters in the current selection to be copied to the clipboard and then deleted from the widget.

      delete_text This signal is emitted when text is deleted from the widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with signal_emit_stop(), it is possible to modify the inserted text, or prevent it from being inserted entirely. The start_pos and end_pos parameters are interpreted as for delete_text()

      insert_text This signal is emitted when text is inserted into the widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with signal_emit_stop(), it is possible to modify the inserted text, or prevent it from being inserted entirely.

      kill_char An action signal. Delete a single character.

      kill_line An action signal. Delete a single line.

      kill_word n action signal. Delete a single word.

      move_cursor An action signal. Move the cursor position.

      move_page An action signal. Move the cursor by pages.

      move_to_column An action signal. Move the cursor to the given column.

      move_to_row An action signal. Move the cursor to the given row.

      move_word An action signal. Move the cursor by words.

      paste_clipboard An action signal. Causes the contents of the clipboard to be pasted into the editable widget at the current cursor position.

      set_editable Determines if the user can edit the text in the editable widget or not. This is meant to be overriden by child classes and should not generally be useful to applications.

    Inherit Widget

      inherit GTK.Widget : Widget

    Method copy_clipboard

      `GTK.Editable copy_clipboard()`

    Description

      Causes the characters in the current selection to be copied to the clipboard.

    Method cut_clipboard

      `GTK.Editable cut_clipboard()`

    Description

      Causes the characters in the current selection to be copied to the clipboard and then deleted from the widget.

    Method delete_selection

      `GTK.Editable delete_selection()`

    Description

      Deletes the current contents of the widgets selection and disclaims the selection.

    Method delete_text

      `GTK.Editable delete_text(int start_pos, int end_pos)`

    Description

      Delete a sequence of characters. The characters that are deleted are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the the characters deleted will be those characters from start_pos to the end of the text.

    Method get_chars

      `string get_chars(int start_pos, int end_pos)`

    Description

      Retrieves a sequence of characters. The characters that are retrieved are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the the characters retrieved will be those characters from start_pos to the end of the text.

    Method get_position

      `int get_position()`

    Description

      Returns the cursor position

    Method insert_text

      `GTK.Editable insert_text(string text, int num_chars, int where)`

    Description

      Insert 'num_chars' characters from the text at the position 'where'.

    Method paste_clipboard

      `GTK.Editable paste_clipboard()`

    Description

      Causes the contents of the clipboard to be pasted into the given widget at the current cursor position.

    Method select_region

      `GTK.Editable select_region(int start_pos, int end_pos)`

    Description

      Selects a region of text. The characters that are selected are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the the characters selected will be those characters from start_pos to the end of the text. are

    Method set_editable

      `GTK.Editable set_editable(int editablep)`

    Description

      Determines if the user can edit the text in the editable widget or not.

    Method set_position

      `GTK.Editable set_position(int pos)`

    Description

      Sets the cursor position.

  CLASS GTK.Widget

    Description

      The basic widget, inherited (directly or indirectly) by all widgets. Thus, all functions and signals defined in this widget works on all widgets.

      One of the most importat functions in this class is 'show', it lets GTK know that we are done setting the attributes of the widget, and it is ready to be displayed. You may also use hide to make it disappear again. The order in which you show the widgets is not important, but I suggest showing the toplevel window last so the whole window pops up at once rather than seeing the individual widgets come up on the screen as they're formed. The children of a widget (a window is a widget too) will not be displayed until the window itself is shown using the show() function.

      Signals: add_accelerator Called when an accelarator (keyboard shortcut) is added to the widget

      button_press_event Called when a mouse button is pressed

      button_release_event Called when a mouse button is released

      client_event An event sent by another client application

      configure_event The size, position or stacking order of the widget has changed

      debug_msg

      delete_event Called when the user has requested that the widget should be closed

      destroy_event Called when the widget is destroyed

      drag_begin Called when the drag is initiated, on the sending side

      drag_data_delete Called when the data can be safely deleted (there is no need to use this function in pigtk, it's all handled automatically)

      drag_data_get Called on the sending side when the drop is initiated

      drag_data_received Called on the receiving side when the drop is finished.

      drag_drop Called on the receiving side when the drop is initiated

      drag_end Called when the drag is finished, on the sending side

      drag_leave Called when the mouse leaves the widget while the user is dragging something

      drag_motion Called on the receiving side when the cursor is moved over the widget while dragging something

      draw Called when the widget should draw itself.

      draw_default Called when the widget should draw itself, and indicate that it's the default widget

      draw_focus Called when the widget should draw itself, and a focus indicator around itself (or otherwise indicate that is has the keyboard focus)

      enter_notify_event Called when the mouse enters the widget

      event Called for all events

      expose_event Called when the widget, or a part of the widget gets and expose event

      focus_in_event The keyboard focus has entered the widget

      focus_out_event The keyboard focus has left the widget

      hide Called when the widget is hidden

      key_press_event Called when a keyboard key is pressed

      key_release_event Called when a keyboard key is released

      leave_notify_event Called when the mouse leaves the widget

      map Called when the window associated with the widget is mapped

      map_event Called just before the 'map' signal

      motion_notify_event Called when the mouse is moved inside the widget

      no_expose_event

      other_event

      parent_set Called when the parent widget is changed

      property_notify_event Called when a property of the GDK window associated with the widget is changed

      proximity_in_event

      proximity_out_event

      realize Called when the widget is realized. Some methods cannot be used until the widget has been realized, if you get assertion errors related to 'w->window' or similar, this is probably the cause.

      remove_accelerator Called when an accelerator (keyboard shortcut) is removed from the widget

      selection_clear_event NYI

      selection_notify_event NYI

      selection_received NYI

      selection_request_event NYI

      show Called when the widget is shown

      size_allocate Called when the widget gets the size it should be

      size_request Called when the widget should calculate how big it wants to be

      state_changed

      style_set Called when the style is changed

      unmap Called when the window associated with the widget is unmapped

      unmap_event Called just before the 'unmap' signal

      unrealize Called when the widget is unrealized.

      visibility_notify_event The widget has been mapped, unmapped, hidden, or otherwise had its visibility modified

    Inherit Object

      inherit GTK.Object : Object

    Method activate

      `GTK.Widget activate()`

    Description

      Activate the widget. This either activates the widget, if possible (as an example, buttons can be activated), or activates the default widget of its parent (or its parent, or its parents parent etc.)

    Method add_accelerator

      `GTK.Widget add_accelerator(string signal, GTK.AccelGroup group, int key, int modifiers, int flags)`

    Description

      Add an accelerator (keyboard shortcut).

      Flag is one of ACCEL_LOCKED , ACCEL_SIGNAL_VISIBLE and ACCEL_VISIBLE

      The signal is the signal to invoke when the accelerator key is pressed.

      The modifiers is a bitwise or of one or more of GDK.ShiftMask, GDK.LockMask, GDK.ControlMask, GDK_MOD1_MASK , GDK_MOD2_MASK , GDK_MOD3_MASK , GDK_MOD4_MASK and GDK_MOD5_MASK .

      The group is the accelerator group in which the accelerator should be added.

      The key is the unicode code for the key to bind.

    Method add_events

      `GTK.Widget add_events(int events)`

    Description

      Events is one or more of: GDK.ExposureMask, GDK.PointerMotionMask, GDK.PointerMotion_HINTMask, GDK.ButtonMotionMask, GDK.Button1MotionMask, GDK.Button2MotionMask, GDK.Button3MotionMask, GDK.ButtonPressMask, GDK.ButtonReleaseMask, GDK.KeyPressMask, GDK.KeyReleaseMask, GDK.EnterNotifyMask, GDK.LeaveNotifyMask, GDK.FocusChangeMask, GDK.StructureMask, GDK.PropertyChangeMask, GDK.VisibilityNotifyMask, GDK.ProximityInMask, GDK.ProximityOutMask and GDK.AllEventsMask

    Method allocation

      `mapping allocation()`

    Description

      Returns ([ "x":xoffset, "y":yoffset, "width":xsize, "height":ysize ])

    Method class_path

      `string class_path()`

    Description

      Returns the class 'pathname' of this widget. Useful for rc-files and such.

    Method copy_area

      `GTK.Widget copy_area(GDK.GC gc, int xdest, int ydest, GTK.Widget source, int xsource, int ysource, int width, int height)`

    Description

      Copies the rectangle defined by xsource,ysource and width,height from the source widget, and places the results at xdest,ydest in the widget in which this function is called. NOTE: The widget must be realized before this function can be used

    Method drag_dest_set

      `GTK.Widget drag_dest_set(int flags, array targets, int actions)`

    Description

      Register a drop site, and possibly add default behaviors. arguments: flags: Which types of default drag behavior to use (one of DEST_DEFAULT_ALL , DEST_DEFAULT_DROP , DEST_DEFAULT_HIGHLIGHT and DEST_DEFAULT_MOTION ) targets: Table of targets that can be accepted ({ ({ content_type(string), flags(int(try 0)), id(int) }), ...}) The id will be received in the signal handlers. actions: one of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE results:

    Method drag_dest_unset

      `GTK.Widget drag_dest_unset()`

    Description

      Removes the drop support from this widget (see drag_dest_set)

    Method drag_get_data

      `GTK.Widget drag_get_data(GDK.DragContext ctx, int time)`

    Description

      Get the data from a context and an integer timestamp (from an event), requesting it from the dropping client. This function should probably never be used directly.

      Use the selection argument passed to the drag_data_received signal instead.

    Method drag_highlight

      `GTK.Widget drag_highlight()`

    Description

      Highlight the widget. Not normaly used directly.

    Method drag_source_set

      `GTK.Widget drag_source_set(int flags, array targets, int actions)`

    Description

      Register a drop site, and possibly add default behaviors. arguments: buttons: Which mouse buttons can be used to start the drag targets: Table of targets that can be accepted ({ ({ content_type(string), flags(int(try 0)), id(int) }), ...}) The id will be received in the signal handlers. actions: one of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE results:

    Method drag_source_set_icon

      `GTK.Widget drag_source_set_icon(GDK.Pixmap pm, GDK.Bitmap mask)`

    Description

      Set the icon that will be used (by default) for drags from this widget.

    Method drag_source_unset

      `GTK.Widget drag_source_unset()`

    Description

      Remove the drag support from this widget. See drag_source_set.

    Method drag_unhighlight

      `GTK.Widget drag_unhighlight()`

    Description

      Unhighlight the widget. Not normaly used directly.

    Method ensure_style

      `GTK.Widget ensure_style()`

    Description

      Ensure that the widget has a style associated with it.

    Method get_composite_name

      `string get_composite_name()`

    Description

      Like set name, but it is inherited by the children of this widget.

    Method get_events

      `int get_events()`

    Description

      Return the current event mask (see set_events and add_events)

    Method get_extension_events

      `int get_extension_events()`

    Description

      Returns one of GDK_EXTENSION_EVENTS_ALL , GDK_EXTENSION_EVENTS_CURSOR and GDK_EXTENSION_EVENTS_NONE

    Method get_gdkwindow

      `GDK.Window get_gdkwindow()`

    Description

      Return the GDK.Window associated with this widget, if any.

    Method get_name

      `string get_name()`

    Description

      Returns the name set by set_name or the class name

    Method get_parent

      `GTK.Widget get_parent()`

    Description

      Returns the parent of this widget, if any, if there is no parent 0 is returned.

    Method get_style

      `GTK.Style get_style()`

    Description

      Return the style associated with this widget

    Method get_toplevel

      `GTK.Widget get_toplevel()`

    Description

      return the toplevel widget this widget is inside (or this widget if it is the toplevel widget)

    Method grab_default

      `GTK.Widget grab_default()`

    Description

      Make this widget the default action for the parent widget

    Method grab_focus

      `GTK.Widget grab_focus()`

    Description

      Grab the focus.

    Method has_set_flags

      `int has_set_flags(int mask)`

    Description

      All possible flags are: GTK.AppPaintable, GTK.CanDefault, GTK.CanFocus, GTK.CompositeChild, GTK.HasDefault, GTK.HasFocus, GTK.HasGrab, GTK.Mapped, GTK.NoReparent, GTK.NoWindow, GTK.ParentSensitive, GTK.RcStyle, GTK.Realized, GTK.ReceivesDefault GTK.Sensitive, GTK.Toplevel and GTK.Visible.

    Method hide

      `GTK.Widget hide()`

    Description

      Hide this widget

    Method hide_all

      `GTK.Widget hide_all()`

    Description

      Hide this widget and all its children

    Method intersect

      `int intersect(GDK.Rectangle area, GDK.Rectangle intersection)`

    Description

      Do an intersection with the area and place the result in 'intersection'.

    Method is_ancestor

      `int is_ancestor(GTK.Widget of)`

    Description

      Returns true if the specified widget is an ancestor of this widget.

    Method lock_accelerators

      `GTK.Widget lock_accelerators()`

    Description

      Make it impossible to add new accelerators, or remove old ones

    Method map

      `GTK.Widget map()`

    Description

      Map the widget. Should normally not be called directly.

    Method path

      `string path()`

    Description

      Returns the 'pathname' of this widget. Useful for rc-files and such.

    Method popup

      `GTK.Widget popup(int xpos, int ypos)`

    Description

      Map the widget at the specified coordinates.

    Method queue_clear

      `GTK.Widget queue_clear()`

    Description

      Force a clear (and subsequent redraw) of the widget

    Method queue_clear_area

      `GTK.Widget queue_clear_area(int x, int y, int width, int height)`

    Description

      Force a clear (and subsequent redraw) of part of the widget

    Method queue_draw

      `GTK.Widget queue_draw()`

    Description

      Force a redraw of the widget

    Method queue_draw_area

      `GTK.Widget queue_draw_area(int x, int y, int width, int height)`

    Description

      Force a redraw of part of the widget

    Method queue_resize

      `GTK.Widget queue_resize()`

    Description

      Force a allocation recalculation, followed by a redraw

    Method realize

      `GTK.Widget realize()`

    Description

      Realize this widget, and its children, if nessesary

    Method remove_accelerator

      `GTK.Widget remove_accelerator(GTK.AccelGroup group, int key, int modifiers)`

    Description

      Remove an accelerator (keyboard shortcut).

      The modifiers is a bitwise or of one or more of GDK.ShiftMask, GDK.LockMask, GDK.ControlMask, GDK_MOD1_MASK , GDK_MOD2_MASK , GDK_MOD3_MASK , GDK_MOD4_MASK and GDK_MOD5_MASK .

      The group is the accelerator group in which the accelerator should be added.

      The key is the unicode code for the key to bind.

    Method reparent

      `GTK.Widget reparent(GTK.Widget to)`

    Description

      Change the parent of the widget.

    Method reset_rc_styles

      `GTK.Widget reset_rc_styles()`

    Description

      Reset all styles to their default value, recursively

    Method restore_default_style

      `GTK.Widget restore_default_style()`

    Description

      Reset all styles to their default value

    Method selection_add_target

      `GTK.Widget selection_add_target(GDK.Atom|void selection, GDK.Atom|void target, int|void info)`

    Description

      Supplying the selection is a bit more complicated than requesting it. You must register handlers that will be called when your selection is requested. For each selection/target pair you will handle, you make a call to this function.

      selection, and target identify the requests this handler will manage. When a request for a selection is received, the "selection_get" signal will be called. info can be used as an enumerator to identify the specific target within the callback function.

      Selection defaults to PRIMARY, and target defaults to STRING.

    Method selection_owner_set

      `GTK.Widget selection_owner_set(GDK.Atom|void selection, int|void time)`

    Description

      When prompted by the user, you claim ownership of the selection by calling this function.

      If another application claims ownership of the selection, you will receive a "selection_clear_event".

      The selection defaults to the PRIMARY selection, and the time to GDK.CurrentTime.

    Method selecton_convert

      `int selecton_convert(GDK.Atom|void selection, GDK.Atom|void target, int|void time)`

    Description

      Retrieving the selection is an asynchronous process. To start the process, you call this function.

      This converts the selection into the form specified by target. If at all possible, the time field should be the time from the event that triggered the selection. This helps make sure that events occur in the order that the user requested them. However, if it is not available (for instance, if the conversion was triggered by a "clicked" signal), then you can omit it altogether. This will cause it to be set to GDK.CurrentTime.

      When the selection owner responds to the request, a "selection_received" signal is sent to your application. The handler for this signal receives a pointer to a GTK.SelectionData object.

      The special target TARGETS generates a list of all valid targets.

      Selection defaults to PRIMARY, and target defaults to STRING.

    Method set_app_paintable

      `GTK.Widget set_app_paintable(int paintablep)`

    Description

      Make it possible to draw directly in the widget using the low-level drawing functions.

    Method set_background

      `GTK.Widget set_background(GDK.Color background)`

    Description

      Set the background color or image. The argument is either a GDK.Pixmap or a GDK.Color object. NOTE: The widget must be realized before this function can be used

    Method set_bitmap_cursor

      `GTK.Widget set_bitmap_cursor(GDK.Bitmap source, GDK.Bitmap mask, GDK.Color fg, GDK.Color bg, int xhot, int yhot)`

    Description

      xhot and yhot are the locations of the x and y hotspot relative to the upper left corner of the cursor image. Both the bitmaps and the colors must be specified.

    Method set_composite_name

      `GTK.Widget set_composite_name(string name)`

    Description

      Like set name, but it is inherited by the children of this widget.

    Method set_cursor

      `GTK.Widget set_cursor(int|void cursor_type, GDK.Color fg, GDK.Color bg)`

    Description

      Change the widget cursor. If no arguments are passed, restore the default cursor. Both fg and bg must be specified if either one is. <table border="0" cellpadding="3" cellspacing="0"> CURS(GDK.Arrow) CURS(GDK.BasedArrowDown) CURS(GDK.BasedArrowUp) CURS(GDK.Boat) CURS(GDK.Bogosity) CURS(GDK.BottomLeftCorner) CURS(GDK.BottomRightCorner) CURS(GDK.BottomSide) CURS(GDK.BottomTee) CURS(GDK.BoxSpiral) CURS(GDK.CenterPtr) CURS(GDK.Circle) CURS(GDK.Clock) CURS(GDK.CoffeeMug) CURS(GDK.Cross) CURS(GDK.CrossReverse) CURS(GDK.Crosshair) CURS(GDK.DiamondCross) CURS(GDK.Dot) CURS(GDK.Dotbox) CURS(GDK.DoubleArrow) CURS(GDK.DraftLarge) CURS(GDK.DraftSmall) CURS(GDK.DrapedBox) CURS(GDK.Exchange) CURS(GDK.Fleur) CURS(GDK.Gobbler) CURS(GDK.Gumby) CURS(GDK.Hand1) CURS(GDK.Hand2) CURS(GDK.Heart) CURS(GDK.Icon) CURS(GDK.IronCross) CURS(GDK.LeftPtr) CURS(GDK.LeftSide) CURS(GDK.LeftTee) CURS(GDK.Leftbutton) CURS(GDK.LlAngle) CURS(GDK.LrAngle) CURS(GDK.Man) CURS(GDK.Middlebutton) CURS(GDK.Mouse) CURS(GDK.Pencil) CURS(GDK.Pirate) CURS(GDK.Plus) CURS(GDK.QuestionArrow) CURS(GDK.RightPtr) CURS(GDK.RightSide) CURS(GDK.RightTee) CURS(GDK.Rightbutton) CURS(GDK.RtlLogo) CURS(GDK.Sailboat) CURS(GDK.SbDownArrow) CURS(GDK.SbHDoubleArrow) CURS(GDK.SbLeftArrow) CURS(GDK.SbRightArrow) CURS(GDK.SbUpArrow) CURS(GDK.SbVDoubleArrow) CURS(GDK.Shuttle) CURS(GDK.Sizing) CURS(GDK.Spider) CURS(GDK.Spraycan) CURS(GDK.Star) CURS(GDK.Target) CURS(GDK.Tcross) CURS(GDK.TopLeftArrow) CURS(GDK.TopLeftCorner) CURS(GDK.TopRightCorner) CURS(GDK.TopSide) CURS(GDK.TopTee) CURS(GDK.Trek) CURS(GDK.UlAngle) CURS(GDK.Umbrella) CURS(GDK.UrAngle) CURS(GDK.Watch) CURS(GDK.Xterm) </table>

    Method set_events

      `GTK.Widget set_events(int events)`

    Description

      Events is one or more of: GDK.ExposureMask, GDK.PointerMotionMask, GDK.PointerMotion_HINTMask, GDK.ButtonMotionMask, GDK.Button1MotionMask, GDK.Button2MotionMask, GDK.Button3MotionMask, GDK.ButtonPressMask, GDK.ButtonReleaseMask, GDK.KeyPressMask, GDK.KeyReleaseMask, GDK.EnterNotifyMask, GDK.LeaveNotifyMask, GDK.FocusChangeMask, GDK.StructureMask, GDK.PropertyChangeMask, GDK.VisibilityNotifyMask, GDK.ProximityInMask, GDK.ProximityOutMask and GDK.AllEventsMask

    Method set_extension_events

      `GTK.Widget set_extension_events(int events)`

    Description

      Events is one of GDK_EXTENSION_EVENTS_ALL , GDK_EXTENSION_EVENTS_CURSOR and GDK_EXTENSION_EVENTS_NONE

    Method set_flags

      `GTK.Widget set_flags(int flags)`

    Description

      The flags that it makes sense to set are: GTK.CanFocus and GTK.CanDefault

    Method set_name

      `GTK.Widget set_name(string name)`

    Description

      Set the name of the widget. The name is used when the rc-file is parsed, you can also parse your own resources by calling GTK.parse_rc() with a resource string. Example: TODO

    Method set_rc_style

      `GTK.Widget set_rc_style()`

    Description

      Set the style from the .rc files

    Method set_scroll_adjustments

      `int set_scroll_adjustments(GTK.Adjustment hadjustment, GTK.Adjustment vadjustment)`

    Description

      Set the scrolling (panning) adjustment objects for this widget. Returns 1 if it is possible to do so, and 0 otherwise.

    Method set_sensitive

      `GTK.Widget set_sensitive(int sensitivep)`

    Description

      True (1) or false (0). If true, the widget can receive events, otherwise the user cannot interact with the widget. Most widgets are drawn 'greyed' or more dim when they are unsensitive.

    Method set_state

      `GTK.Widget set_state(int state)`

    Description

      One of STATE_ACTIVE , STATE_INSENSITIVE , STATE_NORMAL , STATE_PRELIGHT and STATE_SELECTED . This function should normaly not be used directly.

    Method set_style

      `GTK.Widget set_style(GTK.Style cf)`

    Description

      Set the style to be associated with this widget

    Method set_uposition

      `GTK.Widget set_uposition(int xpos, int ypos)`

    Description

      Set the absolute coordinates of the widget relative to its parent.

    Method set_usize

      `GTK.Widget set_usize(int xsize, int ysize)`

    Description

      Set the absolute size of the widget. It might resize itself anyway, but this size is used as is in most widgets. Beware of this function, it might produce unexpected results. 0 for any size means 'keep old size'. When setting sizes of wtoplevel windows, it is preferable to use set_default_size

    Method shape_combine_mask

      `GTK.Widget shape_combine_mask(GDK.Bitmap shape, int xoffset, int yoffset)`

    Description

      Set the shape of the widget, or, rather, its window, to that of the supplied bitmap. Notice how the window behind the example window can be seen because of the rather odd shape the example window has. `GTK.Window( GTK.WINDOW_TOPLEVEL )->add(GTK.Label("A rather Oddly shaped\n" "Window\n" "Indeed\n" "Or what do you\nthink?\n" "This text\n" "should\n" "be long enough"))->shape_combine_mask( GDK.Bitmap(Image.Image(100,100,255,255,255)->rotate(10,0,0,0) ), 20,20)`

      NOTE: The widget must be realized before this function can be used

    Method show

      `GTK.Widget show()`

    Description

      Show the widget. Most (almost all) widgets must be shown to be visible on the screen.

    Method show_all

      `GTK.Widget show_all()`

    Description

      Show this widget and all its children

    Method show_now

      `GTK.Widget show_now()`

    Description

      Show this widget and do not return until it is visible.

    Method text_width

      `int text_width(string text)`

    Description

      Returns the width, in pixels, the string would have if it was written with the default font in the style object assosiated with the widget.

    Method unlock_accelerators

      `GTK.Widget unlock_accelerators()`

    Description

      Make it possible to add new accelerators, and remove old ones, again. Use this after lock_accelerators()

    Method unmap

      `GTK.Widget unmap()`

    Description

      Unmap the widget. Should normally not be called directly.

    Method unparent

      `GTK.Widget unparent()`

    Description

      Remove this widget from its parent

    Method unrealize

      `GTK.Widget unrealize()`

    Description

      Unrealize this widget, and its children, if nessesary

    Method unset_flags

      `GTK.Widget unset_flags(int flags)`

    Description

      The flags that it makes sense to unset are: GTK.CanFocus and GTK.CanDefault

    Method xoffset

      `int xoffset()`

    Description

      Returns the x position of the upper left corner relative to the widgets window in pixels. For widgets that have their own window this will most likely be 0.

    Method xsize

      `int xsize()`

    Description

      Returns the width of the widget in pixels.

    Method yoffset

      `int yoffset()`

    Description

      Returns the y position of the upper left corner relative to the widgets window in pixels. For widgets that have their own window this will most likely be 0.

    Method ysize

      `int ysize()`

    Description

      Returns the height of the widget in pixels.

  CLASS GTK.SpinButton

    Description

      The Spin Button widget is generally used to allow the user to select a value from a range of numeric values. It consists of a text entry box with up and down arrow buttons attached to the side. Selecting one of the buttons causes the value to "spin" up and down the range of possible values. The entry box may also be edited directly to enter a specific value.

      The Spin Button allows the value to have zero or a number of decimal places and to be incremented/decremented in configurable steps. The action of holding down one of the buttons optionally results in an acceleration of change in the value according to how long it is depressed.

      The Spin Button uses an W(Adjustment) object to hold information about the range of values that the spin button can take.

      The attributes of an W(Adjustment) are used by the Spin Button in the following way: <ul><li>value: initial value for the Spin Button</li> <li>lower: lower range value</li> <li>upper: upper range value</li> <li>step_increment: value to increment/decrement when pressing mouse button 1 on a button</li> <li>page_increment: value to increment/decrement when pressing mouse button 2 on a button</li> <li>page_size: unused</li> </ul>

      The argument order for the W(Adjustment) constructor is: value, lower, upper, step_increment, page_increment, page_size

      `GTK.SpinButton( GTK.Adjustment(),0.1, 1 )->set_usize(60,20)`

    Inherit Entry

      inherit GTK.Entry : Entry

    Method configure

      `GTK.SpinButton configure(GTK.Adjustment range, float climb_rate, int precision)`

    Description

      Adjustment (with the lower/upper/increse values), climb_rate and digits

    Method create

      `GTK.SpinButton GTK.SpinButton(GTK.Adjustment range, float climb_rate, int precision)`

    Description

      The climb_rate argument take a value between 0.0 and 1.0 and indicates the amount of acceleration that the Spin Button has. The digits argument specifies the number of decimal places to which the value will be displayed.

    Method get_climb_rate

      `float get_climb_rate()`

    Description

      The amount of acceleration that the Spin Button has. 0.0 is no accelleration and 1.0 is highest accelleration.

    Method get_digits

      `int get_digits()`

    Description

      The number of decimal places to which the value will be displayed.

    Method get_numeric

      `int get_numeric()`

    Description

      If != 0 the user can not enter anything but numeric values.

    Method get_snap_to_ticks

      `int get_snap_to_ticks()`

    Description

      If != 0 the Spin Button will round the value to the nearest step_increment.

    Method get_update_policy

      `int get_update_policy()`

    Description

      The update policy. GTK_UPDATE_ALWAYS or GTK_UPDATE_IF_VALID.

    Method get_value_as_float

      `float get_value_as_float()`

    Description

      The current value of a Spin Button can be retrieved as a float.

    Method get_value_as_int

      `int get_value_as_int()`

    Description

      The current value of a Spin Button can be retrieved as a int.

    Method get_wrap

      `int get_wrap()`

    Description

      If != 0 the Spin Button will wrap around between the upper and lower range values.

    Method set_adjustment

      `GTK.SpinButton set_adjustment(GTK.Adjustment range)`

    Description

      Set a new adjustment.

    Method set_digits

      `GTK.SpinButton set_digits(int precision)`

    Description

      Set the number of digits to show to the user.

    Method set_numeric

      `GTK.SpinButton set_numeric(int numericp)`

    Description

      If true, it is a numeric value. This prevents a user from typing anything other than numeric values into the text box of a Spin Button

    Method set_shadow_type

      `GTK.SpinButton set_shadow_type(int type)`

    Description

      Type is one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_snap_to_ticks

      `GTK.SpinButton set_snap_to_ticks(int snapp)`

    Description

      Set the Spin Button to round the value to the nearest step_increment, which is set within the Adjustment object used with the Spin Button

    Method set_update_policy

      `GTK.SpinButton set_update_policy(int policy)`

    Description

      The possible values of policy are either GTK.UpdateAlways or GTK.UpdateIfValid.

      These policies affect the behavior of a Spin Button when parsing inserted text and syncing its value with the values of the Adjustment.

      In the case of GTK.UpdateIfValid the Spin Button value only gets changed if the text input is a numeric value that is within the range specified by the Adjustment. Otherwise the text is reset to the current value.

      In case of GTK.UpdateAlways errors are ignored while converting text into a numeric value.

    Method set_value

      `GTK.SpinButton set_value(float to)`

    Description

      Set the value.

    Method set_wrap

      `GTK.SpinButton set_wrap(int wrapp)`

    Description

      If true, the spin button will wrap from the lowest to the highest value, and the highest to the lowest.

    Method spin

      `GTK.SpinButton spin(int direction, float increment)`

    Description

      If you want to alter the value of a Spin Value relative to its current value, then this ffunction can be used.

      The direction paramenter is one of SPIN_END , SPIN_HOME , SPIN_PAGE_BACKWARD , SPIN_PAGE_FORWARD , SPIN_STEP_BACKWARD , SPIN_STEP_FORWARD and SPIN_USER_DEFINED

      GTK.SpinStepForward and GTK.SpinStepBackward change the value of the Spin Button by the amount specified by increment, unless increment is equal to 0, in which case the value is changed by the value of step_increment in theAdjustment.

      GTK.SpinPageForward and GTK.SpinPageBackward simply alter the value of the Spin Button by increment.

      GTK.SpinHome sets the value of the Spin Button to the bottom of the Adjustments range.

      GTK.SpinEnd sets the value of the Spin Button to the top of the Adjustments range.

      GTK.SpinUserDefined simply alters the value of the Spin Button by the specified amount.

    Method update

      `GTK.SpinButton update()`

    Description

      Explicitly request that the Spin Button updates itself

  CLASS GTK.PixmapMenuItem

    Description

      GtkPixmapMenuItem works like a normal GTK menu item, but you can insert a arbitrary widget (most often a pixmap widget), which is displayed at the left side. The advantage is that indentation is handled the same way as GTK does (i.e if you create a menu with a gtk_check_menu_item, all normal menu items are automatically indented by GTK - so if you use a normal menu item to display pixmaps at the left side, the pixmaps will be indented, which is not what you want. This widget solves the problem).

    Inherit MenuItem

      inherit GTK.MenuItem : MenuItem

    Method create

      `GTK.PixmapMenuItem GTK.PixmapMenuItem()`

    Description

      Creates a new pixmap menu item.

    Method set_pixmap

      `GTK.PixmapMenuItem set_pixmap(GTK.Widget pixmap)`

    Description

      Set the pixmap of the menu item.

  CLASS GTK.AccelGroup

    Description

      An AccelGroup stores keybindings. A group is automatically created by W(MenuFactory)

      NOIMG

    Inherit Data

      inherit GTK.Data : Data

    Method add_accel

      `GTK.AccelGroup add_accel(GTK.Widget widget, string signal, int key, int modifiers, int flags)`

    Description

      the widget is the one in which the signal specified by 'signal' recides.

      The key is the character code (such as 'a' for the a key and '@' for the @ key), and modifiers is a bitmap of one or more bits, the bits are . Flags is one or more of ACCEL_LOCKED , ACCEL_SIGNAL_VISIBLE and ACCEL_VISIBLE

    Method create

      `GTK.AccelGroup GTK.AccelGroup()`

    Description

      Create a new accelerator group

    Method destroy

      `GTK.AccelGroup destroy()`

    Method remove

      `GTK.AccelGroup remove(GTK.Widget widget, int key, int modifiers)`

    Description

      Remove all bindings for the specified key/mask in the specified object.

  CLASS GTK.Arrow

    Description

      An arrow pointing in one of four directions. The 'etched' shadow types does not work. `GTK.Arrow(GTK.ARROW_UP, GTK.SHADOW_OUT)`

      `GTK.Arrow(GTK.ARROW_LEFT, GTK.SHADOW_IN)`

      `GTK.Arrow(GTK.ARROW_RIGHT, GTK.SHADOW_IN)`

      `GTK.Arrow(GTK.ARROW_DOWN, GTK.SHADOW_OUT)`

    Inherit Misc

      inherit GTK.Misc : Misc

    Method create

      `GTK.Arrow GTK.Arrow(int arrow_type, int shadow_type)`

    Description

      First argument is one of ARROW_DOWN , ARROW_LEFT , ARROW_RIGHT and ARROW_UP , second one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT .

    Method get_arrow_type

      `int get_arrow_type()`

    Description

      Return the arrow type. One of ARROW_DOWN , ARROW_LEFT , ARROW_RIGHT and ARROW_UP .

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      Return the shadow type. One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT .

    Method set

      `GTK.Arrow set(int arrow_type, int shadow_type)`

    Description

      First argument is one of ARROW_DOWN , ARROW_LEFT , ARROW_RIGHT and ARROW_UP , second one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT .

  CLASS GTK.Separator

    Description

      A generic separator. Basicaly a line, like &lt;hr&gt; in HTML.

    Inherit Widget

      inherit GTK.Widget : Widget

  CLASS GTK.HbuttonBox

    Description

      A HbuttonBox is very similar to a Hbox. The major diffference is that the button box is made to pack buttons in, and has a few convenience function for normal button layouts.

      `GTK.HbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_usize(400,30)`

      `GTK.HbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_SPREAD)->set_usize(400,30)`

      `GTK.HbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_EDGE)->set_usize(400,30)`

      `GTK.HbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_START)->set_usize(400,30)`

      `GTK.HbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_END)->set_usize(400,30)`

    Inherit ButtonBox

      inherit GTK.ButtonBox : ButtonBox

    Method create

      `GTK.HbuttonBox GTK.HbuttonBox()`

    Description

      Create a new horizontal button box

  CLASS GTK.Image

    Description

      An image is a image object stored in client, not X server, memory. A pixmap, on the other hand, is a image object stored in the X-server. See GDK.Image and GDK.Pixmap.

      `GTK.Image( GDK.Image(0)->set(Image.Image(200,200)->test() ) );`

    Inherit Misc

      inherit GTK.Misc : Misc

    Method create

      `GTK.Image GTK.Image(GDK.Image image, GDK.Bitmap mask)`

    Description

      You can skip the mask. The mask is used to mask the drawing of the image on it's background. It will not make the container transparent, though. Use shape_combine_mask on the container with the mask for that.

    Method get

      `mapping get()`

    Description

      Returns ([ "image":GDK.Image img, "mask":GDK.Bitmap mask ])

    Method set

      `GTK.Image set(GDK.Image image, GDK.Bitmap mask)`

    Description

      Args: GDK.Image and GDK.Bitmap, respectively. You can skip the mask. The mask is used to mask the drawing of the image on it's background. It will not make the container transparent, though. Use shape_combine_mask on the container with the mask for that.

      There is no need to call 'set' with the same GDK.Image again if you have modified the image. You must, however, use -&gt;queue_draw() to redraw the image. Otherwise the old contens will be shown until an refresh of the widget is done for any other reason.

  CLASS GTK.AspectFrame

    Description

      A W(Frame) widget that always maintain a specified ratio between width and height. width/height == ratio

      `GTK.Aspect_frame("Title",0.5,0.5,0.4,0)->add( GTK.Label("Wrong aspect"))->set_usize(200,200)`

    Inherit Frame

      inherit GTK.Frame : Frame

    Method create

      `GTK.AspectFrame GTK.AspectFrame(string label, float xalign, float yalign, float ratio, int obey_child)`

    Description

      Create a new frame. Arguments are label, xalign, yalign, ratio, obey_child xalign is floats between 0 and 1, 0.0 is upper (or leftmost), 1.0 is lower (or rightmost). If 'obey_child' is true, the frame will use the aspect ratio of it's (one and only) child widget instead of 'ratio'.

    Method set

      `GTK.AspectFrame set(float xalign, float yalign, float ratio, int obey_child)`

    Description

      Set the aspec values. Arguments are xalign, yalign, ratio, obey_child xalign is floats between 0 and 1, 0.0 is upper (or leftmost), 1.0 is lower (or rightmost). If 'obey_child' is true, the frame will use the aspect ratio of it's (one and only) child widget instead of 'ratio'.

  CLASS GTK.Notebook

    Description

      The NoteBook Widget is a collection of 'pages' that overlap each other, each page contains different information. This widget has become more common lately in GUI programming, and it is a good way to show blocks similar information that warrant separation in their display.

      `GTK.Notebook( )->set_tab_pos( GTK.POS_LEFT )->append_page( GTK.Label("Page 1\nContents"), GTK.Label("Page 1"))->append_page( GTK.Label(""), GTK.Label("Page 2"))->append_page(GTK.Label("Page 3 contents\nare here!"), GTK.Label("Page 3"))`

      `GTK.Notebook( )->set_tab_pos( GTK.POS_TOP )->append_page( GTK.Label("Page 1\nContents"), GTK.Label("Page 1"))->append_page( GTK.Label(""), GTK.Label("Page 2"))->append_page(GTK.Label("Page 3 contents\nare here!"), GTK.Label("Page 3"))`

      `GTK.Notebook( )->set_tab_pos( GTK.POS_RIGHT )->append_page( GTK.Label("Page 1\nContents"), GTK.Label("Page 1"))->append_page( GTK.Label(""), GTK.Label("Page 2"))->append_page(GTK.Label("Page 3 contents\nare here!"), GTK.Label("Page 3"))->next_page()->next_page()`

      Signals: switch_page Called when a different page is selected

    Inherit Container

      inherit GTK.Container : Container

    Method append_page

      `GTK.Notebook append_page(GTK.Widget contents, GTK.Widget label)`

    Description

      Add a new 'page' to the notebook. The first argument is the contents of the page, the second argument is the label.

    Method append_page_menu

      `GTK.Notebook append_page_menu(GTK.Widget contents, GTK.Widget label, GTK.Menu menu)`

    Description

      Add a new 'page' to the notebook. The first argument is the contents of the page, the second argument is the label, the third argument is a menu widget.

    Method create

      `GTK.Notebook GTK.Notebook()`

    Method get_current_page

      `int get_current_page()`

    Description

      Returns the index of the currently selected page

    Method get_menu_label

      `GTK.Widget get_menu_label(GTK.Widget page)`

    Method get_nth_page

      `GTK.Widget get_nth_page(int index)`

    Description

      Returns the page for the specified index

    Method get_tab_label

      `GTK.Widget get_tab_label(GTK.Widget page)`

    Method insert_page

      `GTK.Notebook insert_page(GTK.Widget contents, GTK.Widget label, int pos)`

    Description

      Insert a page at the specified location, arguments as for append_page, but an aditional integer specifies the location.

    Method insert_page_menu

      `GTK.Notebook insert_page_menu(GTK.Widget contents, GTK.Widget label, GTK.Menu menu, int pos)`

    Description

      Insert a page at the specified location, arguments as for append_page_menu, but an aditional integer specifies the location.

    Method next_page

      `GTK.Notebook next_page()`

    Description

      Go to the next page

    Method page_num

      `int page_num(GTK.Widget widget)`

    Description

      Returns the index for the specified page

    Method popup_disable

      `GTK.Notebook popup_disable()`

    Description

      Disable the popup menu (set with insert_page_menu)

    Method popup_enable

      `GTK.Notebook popup_enable()`

    Description

      Enable the popup menu (set with insert_page_menu)

    Method prepend_page

      `GTK.Notebook prepend_page(GTK.Widget contents, GTK.Widget label)`

    Description

      Add a page at the end of the list of pages. The first argument is the contents of the page, the second argument is the label.

    Method prepend_page_menu

      `GTK.Notebook prepend_page_menu(GTK.Widget contents, GTK.Widget label, GTK.Menu menu)`

    Description

      Add a new 'page' at the end of the list of pages. The first argument is the contents of the page, the second argument is the label, the third argument is a menu widget.

    Method prev_page

      `GTK.Notebook prev_page()`

    Description

      Go to the previous page

    Method query_tab_label_packing

      `mapping query_tab_label_packing(GTK.Widget page)`

    Description

      Returns ([ "expand":expandp, "fill":fillp, "pack_type":type ])

    Method remove_page

      `GTK.Notebook remove_page(int pos)`

    Description

      Remove a page.

    Method reorder_child

      `GTK.Notebook reorder_child(GTK.Widget page, int new_index)`

    Description

      Move the specified page to the index new_index

    Method set_homogeneous_tabs

      `GTK.Notebook set_homogeneous_tabs(int homogeneousp)`

    Description

      If true, all tabs will have the same size

    Method set_menu_label

      `GTK.Notebook set_menu_label(GTK.Widget page, GTK.Widget label)`

    Method set_menu_label_text

      `GTK.Notebook set_menu_label_text(GTK.Widget page, string label)`

    Method set_page

      `GTK.Notebook set_page(int pos)`

    Description

      Go to the specified page

    Method set_scrollable

      `GTK.Notebook set_scrollable(int scrollablep)`

    Description

      If true, add scrollbars if nessesary.

    Method set_show_border

      `GTK.Notebook set_show_border(int showborderp)`

    Description

      If true, show the borders around the contents and tabs.

    Method set_show_tabs

      `GTK.Notebook set_show_tabs(int showtabsp)`

    Description

      If supplied with a true value, the tabs will be shown. Otherwise they will not be shown. The user will not be able to select the pages without them, but you can add 'next' and 'previous' buttons to create a wizard-line interface.

    Method set_tab_border

      `GTK.Notebook set_tab_border(int border_width)`

    Description

      In pixels.

    Method set_tab_hborder

      `GTK.Notebook set_tab_hborder(int border_width)`

    Description

      In pixels.

    Method set_tab_label

      `GTK.Notebook set_tab_label(GTK.Widget page, GTK.Widget label)`

    Method set_tab_label_packing

      `GTK.Notebook set_tab_label_packing(GTK.Widget child, int expand, int fill, int type)`

    Method set_tab_label_text

      `GTK.Notebook set_tab_label_text(GTK.Widget page, string title)`

    Method set_tab_pos

      `GTK.Notebook set_tab_pos(int pos)`

    Description

      One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

    Method set_tab_vborder

      `GTK.Notebook set_tab_vborder(int border_width)`

    Description

      In pixels.

  CLASS GTK.Layout

    Inherit Container

      inherit GTK.Container : Container

    Method create

      `GTK.Layout GTK.Layout(GTK.Adjustment hadjustment, GTK.Adjustment vadjustment)`

    Method freeze

      `GTK.Layout freeze()`

    Method get_hadjustment

      `GTK.Adjustment get_hadjustment()`

    Method get_height

      `int get_height()`

    Method get_vadjustment

      `GTK.Adjustment get_vadjustment()`

    Method get_width

      `int get_width()`

    Method get_xoffset

      `int get_xoffset()`

    Method get_yoffset

      `int get_yoffset()`

    Method move

      `GTK.Layout move(GTK.Widget widget, int x, int y)`

    Method put

      `GTK.Layout put(GTK.Widget widget, int x, int y)`

    Method set_hadjustment

      `GTK.Layout set_hadjustment(GTK.Adjustment adj)`

    Method set_size

      `GTK.Layout set_size(int xsize, int ysize)`

    Method set_vadjustment

      `GTK.Layout set_vadjustment(GTK.Adjustment adj)`

    Method thaw

      `GTK.Layout thaw()`

  CLASS GTK.ColorSelection

    Description

      The color selection widget is, not surprisingly, a widget for interactive selection of colors. This composite widget lets the user select a color by manipulating RGB (Red, Green, Blue) and HSV (Hue, Saturation, Value) triples. This is done either by adjusting single values with sliders or entries, or by picking the desired color from a hue-saturation wheel/value bar. Optionally, the opacity of the color can also be set.

      The color selection widget currently emits only one signal, "color_changed", which is emitted whenever the current color in the widget changes, either when the user changes it or if it's set explicitly through set_color().

      `GTK.ColorSelection()`

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method create

      `GTK.ColorSelection GTK.ColorSelection()`

    Description

      Create a new color selection.

    Method get_color

      `array get_color()`

    Description

      When you need to query the current color, typically when you've received a "color_changed" signal, you use this function. The return value is an array of floats, See the set_color() function for the description of this array.

    Method set_color

      `GTK.ColorSelection set_color(array color)`

    Description

      You can set the current color explicitly by calling this function with an array of colors (floats). The length of the array depends on whether opacity is enabled or not. Position 0 contains the red component, 1 is green, 2 is blue and opacity is at position 3 (only if opacity is enabled, see set_opacity()) All values are between 0.0 and 1.0

    Method set_update_policy

      `GTK.ColorSelection set_update_policy(int policy)`

    Description

      one of UPDATE_ALWAYS , UPDATE_CONTINUOUS , UPDATE_DELAYED , UPDATE_DISCONTINUOUS and UPDATE_IF_VALID .

      The default policy is GTK.UpdateContinuous which means that the current color is updated continuously when the user drags the sliders or presses the mouse and drags in the hue-saturation wheel or value bar. If you experience performance problems, you may want to set the policy to GTK.UpdateDiscontinuous or GTK.UpdateDelayed.

  CLASS GTK.FontSelectionDialog

    Description

      The GtkFontSelectionDialog widget is a dialog box for selecting a font.

      To set the font which is initially selected, use set_font_name().

      To get the selected font use get_font() or get_font_name().

      To change the text which is shown in the preview area, use set_preview_text().

      The base filter is not yet implemented in Pike GTK. Filters can be used to limit the fonts shown. There are 2 filters in the GtkFontSelectionDialog - a base filter and a user filter. The base filter can not be changed by the user, so this can be used when the user must choose from the restricted set of fonts (e.g. for a terminal-type application you may want to force the user to select a fixed-width font). The user filter can be changed or reset by the user, by using the 'Reset Filter' button or changing the options on the 'Filter' page of the dialog. `GTK.FontSelectionDialog("Select a font")`

    Inherit Window

      inherit GTK.Window : Window

    Method create

      `GTK.FontSelectionDialog GTK.FontSelectionDialog(string title)`

    Description

      Create a new font selection dialog with the specified window title

    Method get_apply_button

      `GTK.Button get_apply_button()`

    Description

      The apply button

    Method get_cancel_button

      `GTK.Button get_cancel_button()`

    Description

      The cancel button

    Method get_fontsel

      `GTK.FontSelection get_fontsel()`

    Description

      The W(FontSelection) widget

    Method get_ok_button

      `GTK.Button get_ok_button()`

    Description

      The ok button

  CLASS GTK.Style

    Method apply_default_background

      `GTK.Style apply_default_background(GDK.Window window, int set_bgp, int state_type, GDK.Rectangle area, int x, int y, int width, int height)`

    Description

      Set the background of the specified window (or the subarea indicated by the rectangle) to the default background for the state specified by state_type.

      If set_bgp is true, the background of the widget will be set, otherwise it will only be drawn into the window.

    Method attach

      `GTK.Style attach(GDK.Window to)`

    Description

      Attach a style to a window; this process allocates the colors and creates the GC's for the style - it specializes it to a particular visual and colormap. The process may involve the creation of a new style if the style has already been attached to a window with a different style and colormap.

    Method copy

      `GTK.Style copy()`

    Description

      Copy this style, and return the new style object

    Method destroy

      `GTK.Style destroy()`

    Method detach

      `GTK.Style detach()`

    Description

      Undo a previous attach

    Method get_base

      `array get_base()`

    Method get_base_gc

      `array get_base_gc()`

    Method get_bg

      `array get_bg()`

    Method get_bg_gc

      `array get_bg_gc()`

    Method get_bg_pixmap

      `array get_bg_pixmap()`

    Method get_black

      `GDK.Color get_black()`

    Method get_black_gc

      `GDK.GC get_black_gc()`

    Method get_dark

      `array get_dark()`

    Method get_dark_gc

      `array get_dark_gc()`

    Method get_fg

      `array get_fg()`

    Method get_fg_gc

      `array get_fg_gc()`

    Method get_font

      `GDK.Font get_font()`

    Method get_light

      `array get_light()`

    Method get_light_gc

      `array get_light_gc()`

    Method get_mid

      `array get_mid()`

    Method get_mid_gc

      `array get_mid_gc()`

    Method get_text

      `array get_text()`

    Method get_text_gc

      `array get_text_gc()`

    Method get_white

      `GDK.Color get_white()`

    Method get_white_gc

      `GDK.GC get_white_gc()`

  CLASS GTK.Hpaned

    Description

      The paned window widgets are useful when you want to divide an area into two parts, with the relative size of the two parts controlled by the user. A groove is drawn between the two portions with a handle that the user can drag to change the ratio. This widgets makes a horizontal division

      See W(Paned) for details.

      `GTK.Hpaned()->add1(GTK.Label("Left\nSide\nOf\nPane"))->add2(GTK.Label("Right\nSide\nOf\nPane"))->set_usize(100,100)`

    Inherit Paned

      inherit GTK.Paned : Paned

    Method create

      `GTK.Hpaned GTK.Hpaned()`

  CLASS GTK.Progress

    Inherit Widget

      inherit GTK.Widget : Widget

    Method configure

      `GTK.Progress configure(float value, float min, float max)`

    Description

      Sets the current value, the minimum value and the maximum value. The default min and max are 0.0 and 1.0 respectively.

    Method get_activity_mode

      `int get_activity_mode()`

    Description

      The currently set activity mode.

    Method get_current_percentage

      `float get_current_percentage()`

    Description

      Returns a float between 0.0 and 1.0

    Method get_current_text

      `string get_current_text()`

    Description

      Return the current text (see set_format_string)

    Method get_format

      `string get_format()`

    Description

      The format used to convert the value to a the text

    Method get_percentage_from_value

      `float get_percentage_from_value(float value)`

    Description

      Returns a float between 0.0 and 1.0

    Method get_show_text

      `int get_show_text()`

    Description

      1 if the text will be shown

    Method get_text_from_value

      `string get_text_from_value(float value)`

    Description

      Formats 'value' and returns it as a text.

    Method get_value

      `float get_value()`

    Description

      Return the current value

    Method get_x_align

      `float get_x_align()`

    Description

      The text alignment, 0.0 is leftmost, 1.0 is rightmost

    Method get_y_align

      `float get_y_align()`

    Description

      The text alignment, 0.0 is topmost, 1.0 is bottommost

    Method set_activity_mode

      `GTK.Progress set_activity_mode(int modep)`

    Description

      As well as indicating the amount of progress that has occurred, the progress bar may be set to just indicate that there is some activity. This can be useful in situations where progress cannot be measured against a value range. Mode is: 1: active 0: inactive

    Method set_adjustment

      `GTK.Progress set_adjustment(GTK.Adjustment adjustment)`

    Description

      Sets the adjustment to use. See the adjustment documentation for more info

    Method set_format_string

      `GTK.Progress set_format_string(string format)`

    Description

      More or less like sprintf. %[field width][character] 0&lt;=width&gt;=2 Supported characters:

           %: Insert a %
           p or P: The percentage completed, with 'digits' number of decimals
           v or V: The actual value, with digits decimals.
           l or L: The lower value (from the adjustment)
           u or U: The higer value (from the adjustment)
           %: Insert a %

      The default format is '%P%%'

    Method set_percentage

      `GTK.Progress set_percentage(float pct)`

    Description

      Sets the value (between 0.0 and 1.0). Uses the min and max values.

    Method set_show_text

      `GTK.Progress set_show_text(int textp)`

    Description

      If true, write a text in the progress bar.

    Method set_text_alignment

      `GTK.Progress set_text_alignment(float xalign, float yalign)`

    Description

      The location for the text in the progress bar. xalign is between 0.0 (leftmost) and 1.0 (rightmost) yalign is between 0.0 (topmost) and 1.0 (bottommost)

      Default is xalign == yalign == 0.5

    Method set_value

      `GTK.Progress set_value(float value)`

    Description

      Set the value.

  CLASS GTK.ColorSelectionDialog

    Description

      The color selection dialog widget is, not surprisingly, a color selection widget in a dialog window. Use the subwidget functions below to access the different subwidgets directly.

      `GTK.ColorSelectionDialog("Select color")`

      Signals: color_changed Called when the color is changed

    Inherit Window

      inherit GTK.Window : Window

    Method create

      `GTK.ColorSelectionDialog GTK.ColorSelectionDialog(string title)`

    Description

      Create a new color selection dialog with the specified title.

    Method get_cancel_button

      `GTK.Button get_cancel_button()`

    Description

      Return the cancel button widget.

    Method get_colorsel

      `GTK.ColorSelection get_colorsel()`

    Description

      Return the color selection widget

    Method get_help_button

      `GTK.Button get_help_button()`

    Description

      Return the help button

    Method get_ok_button

      `GTK.Button get_ok_button()`

    Description

      Return the ok button

  CLASS GTK.Range

    Description

      The category of range widgets includes the ubiquitous scrollbar widget and the less common "scale" widget. Though these two types of widgets are generally used for different purposes, they are quite similar in function and implementation. All range widgets share a set of common graphic elements, each of which has its own X window and receives events. They all contain a "trough" and a "slider" (what is sometimes called a "thumbwheel" in other GUI environments). Dragging the slider with the pointer moves it back and forth within the trough, while clicking in the trough advances the slider towards the location of the click, either completely, or by a designated amount, depending on which mouse button is used.

      As mentioned in the W(Adjustment) page, all range widgets are associated with an adjustment object, from which they calculate the length of the slider and its position within the trough. When the user manipulates the slider, the range widget will change the value of the adjustment.

      All of the GTK range widgets react to mouse clicks in more or less the same way. Clicking button-1 in the trough will cause its adjustment's page_increment to be added or subtracted from its value, and the slider to be moved accordingly. Clicking mouse button-2 in the trough will jump the slider to the point at which the button was clicked. Clicking any button on a scrollbar's arrows will cause its adjustment's value to change step_increment at a time.

      It may take a little while to get used to, but by default, scrollbars as well as scale widgets can take the keyboard focus in GTK. If you think your users will find this too confusing, you can always disable this by unsetting the GTK.CanFocus flag on the scrollbar, like this:

      `scrollbar->unset_flag( GTK.CanFocus );`

      The key bindings (which are, of course, only active when the widget has focus) are slightly different between horizontal and vertical range widgets, for obvious reasons. They are also not quite the same for scale widgets as they are for scrollbars, for somewhat less obvious reasons (possibly to avoid confusion between the keys for horizontal and vertical scrollbars in scrolled windows, where both operate on the same area).

    Inherit Widget

      inherit GTK.Widget : Widget

    Method get_adjustment

      `GTK.Adjustment get_adjustment()`

    Method get_button

      `int get_button()`

    Method get_click_child

      `int get_click_child()`

    Method get_digits

      `int get_digits()`

    Method get_in_child

      `int get_in_child()`

    Method get_need_timer

      `int get_need_timer()`

    Method get_old_lower

      `float get_old_lower()`

    Method get_old_page_size

      `float get_old_page_size()`

    Method get_old_upper

      `float get_old_upper()`

    Method get_old_value

      `float get_old_value()`

    Method get_policy

      `int get_policy()`

    Method get_scroll_type

      `int get_scroll_type()`

    Method get_timer

      `int get_timer()`

    Method get_x_click_point

      `int get_x_click_point()`

    Method get_y_click_point

      `int get_y_click_point()`

    Method set_adjustment

      `GTK.Range set_adjustment(GTK.Adjustment pos)`

    Description

      set_adjustment() does absolutely nothing if you pass it the adjustment that range is already using, regardless of whether you changed any of its fields or not. If you pass it a new Adjustment, it will unreference the old one if it exists (possibly destroying it), connect the appropriate signals to the new one, and call the private function gtk_range_adjustment_changed(), which will (or at least, is supposed to...) recalculate the size and/or position of the slider and redraw if necessary.

    Method set_update_policy

      `GTK.Range set_update_policy(int when)`

    Description

      The "update policy" of a range widget defines at what points during user interaction it will change the value field of its Adjustment and emit the "value_changed" signal on this Adjustment. The update policies are:

      GTK.UpdatePolicyContinuous

        This is the default. The "value_changed" signal is emitted continuously, i.e., whenever the slider is moved by even the tiniest amount.

      GTK.UpdatePolicyDiscontinuous

        The "value_changed" signal is only emitted once the slider has stopped moving and the user has released the mouse button.

      GTK.UpdatePolicyDelayed

        The "value_changed" signal is emitted when the user releases the mouse button, or if the slider stops moving for a short period of time.

    Method slider_update

      `GTK.Range slider_update()`

    Description

      Update the slider values.

  CLASS GTK.TearoffMenuItem

    Description

      a GTK.TearoffMenuItem is a special W(MenuItem) which is used to tear off and reattach its menu.

      When its menu is shown normally, the GTK.TearoffMenuItem is drawn as a dotted line indicating that the menu can be torn off. Activating it causes its menu to be torn off and displayed in its own window as a tearoff menu.

      When its menu is shown as a tearoff menu, the GTK.TearoffMenuItem is drawn as a dotted line which has a left pointing arrow graphic indicating that the tearoff menu can be reattached. Activating it will erase the tearoff menu window. `GTK.TearoffMenuItem()->set_usize( 100,0 )`

    Inherit MenuItem

      inherit GTK.MenuItem : MenuItem

    Method create

      `GTK.TearoffMenuItem GTK.TearoffMenuItem()`

    Description

      Create a new tear of menu item

    Method get_torn_off

      `int get_torn_off()`

    Description

      Return 1 if the menu the menu item is connected to is currently torn off.

  CLASS GTK.Adjustment

    Description

      The GTK.Adjustment object represents a value which has an associated lower and upper bound, together with step and page increments, and a page size. It is used within several GTK+ widgets, including GtkSpinButton, GtkViewport, and GtkRange (which is a base class for GtkHScrollbar, GtkVScrollbar, GtkHScale, and GtkVScale).

      The GtkAdjustment object does not update the value itself. Instead it is left up to the owner of the GtkAdjustment to control the value.

      The owner of the GtkAdjustment typically calls the value_changed() and changed() functions after changing the value or its bounds. This results in the emission of the "value_changed" or "changed" signal respectively.

      Signals: changed The adjustment changed in some way

      value_changed The value changed

    Inherit Data

      inherit GTK.Data : Data

    Method changed

      `GTK.Adjustment changed()`

    Description

      Call this when you have modified anything except the value member of the adjustment.

    Method clamp_page

      `GTK.Adjustment clamp_page(float lower, float upper)`

    Description

      Updates the GTK.Adjustment value to ensure that the range between lower and upper is in the current page (i.e. between value and value + page_size). If the range is larger than the page size, then only the start of it will be in the current page. A "value_changed" signal will be emitted if the value is changed.

    Method create

      `GTK.Adjustment GTK.Adjustment(float|void value, float|void lower, float|void upper, float|void step_increment, float|void page_increment, float|void page_size)`

    Description

      The value argument is the initial value you want to give to the adjustment, usually corresponding to the topmost or leftmost position of an adjustable widget. The lower argument specifies the lowest value which the adjustment can hold. The step_increment argument specifies the "smaller" of the two increments by which the user can change the value, while the page_increment is the "larger" one. The page_size argument usually corresponds somehow to the visible area of a panning widget. The upper argument is used to represent the bottom most or right most coordinate in a panning widget's child. Therefore it is not always the largest number that value can take, since the page_size of such widgets is usually non-zero.

      All values are optional, they default to 0.0. For most widgets the unit is pixels.

    Method get_lower

      `float get_lower()`

    Description

      Get the lower limit

    Method get_page_increment

      `float get_page_increment()`

    Description

      Get the page increment (page down or through click)

    Method get_page_size

      `float get_page_size()`

    Description

      Get the page size (the actual size of a page)

    Method get_step_increment

      `float get_step_increment()`

    Description

      Get the step increment (arrow click)

    Method get_upper

      `float get_upper()`

    Description

      get the upper limit.

    Method get_value

      `float get_value()`

    Description

      Get the value component.

    Method set_set_lower

      `float set_set_lower()`

    Description

      Set the lower limit.

    Method set_set_page_increment

      `float set_set_page_increment()`

    Description

      Set the page increment (page down or through click)

    Method set_set_page_size

      `float set_set_page_size()`

    Description

      Set the page size (the actual size of a page)

    Method set_set_step_increment

      `float set_set_step_increment()`

    Description

      Set the step increment (arrow click)

    Method set_set_upper

      `float set_set_upper()`

    Description

      Set the upper limit.

    Method set_value

      `GTK.Adjustment set_value(float to)`

    Description

      Set the value component.

  CLASS GTK.VbuttonBox

    Description

      A Vbutton_box is very similar to a Vbox. The major diffference is that the button box is made to pack buttons in, and has a few convenience function for normal button layouts.

      `GTK.VbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_usize(100,300)`

      `GTK.VbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_SPREAD)->set_usize(100,300)`

      `GTK.VbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_EDGE)->set_usize(100,300)`

      `GTK.VbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_START)->set_usize(100,300)`

      `GTK.VbuttonBox()->add(GTK.Button("Hello"))->add(GTK.Button("World"))->set_layout(GTK.BUTTONBOX_END)->set_usize(100,300)`

    Inherit ButtonBox

      inherit GTK.ButtonBox : ButtonBox

    Method create

      `GTK.VbuttonBox GTK.VbuttonBox()`

    Description

      Create a new vertical button box

  CLASS GTK.TipsQuery

    Inherit Label

      inherit GTK.Label : Label

    Method create

      `GTK.TipsQuery GTK.TipsQuery()`

    Method get_caller

      `GTK.Widget get_caller()`

    Method get_in_query

      `int get_in_query()`

    Method get_label_inactive

      `string get_label_inactive()`

    Method get_label_no_tip

      `string get_label_no_tip()`

    Method get_last_crossed

      `GTK.Widget get_last_crossed()`

    Method set_caller

      `GTK.TipsQuery set_caller(GTK.Widget caller_widget)`

    Method set_labels

      `GTK.TipsQuery set_labels(string label_inactive, string label_no_tip)`

    Method start_query

      `GTK.TipsQuery start_query()`

    Method stop_query

      `GTK.TipsQuery stop_query()`

  CLASS GTK.DrawingArea

    Description

      The drawing area is a window you can draw in. Please note that you must handle refresh and resize events on your own. Use W(pDrawingArea) for a drawingarea with automatic refresh/resize handling. `GTK.DrawingArea()->set_usize(100,100)`

    Inherit Widget

      inherit GTK.Widget : Widget

    Method clear

      `GTK.DrawingArea clear(int|void x, int|void y, int|void width, int|void height)`

    Description

      Either clears the rectangle defined by the arguments, of if no arguments are specified, the whole drawable.

    Method copy_area

      `GTK.DrawingArea copy_area(GDK.GC gc, int xdest, int ydest, GTK.Widget source, int xsource, int ysource, int width, int height)`

    Description

      Copies the rectangle defined by xsource,ysource and width,height from the source drawable, and places the results at xdest,ydest in the drawable in which this function is called.

    Method create

      `GTK.DrawingArea GTK.DrawingArea()`

    Method draw_arc

      `GTK.DrawingArea draw_arc(GDK.GC gc, int filledp, int x1, int y1, int x2, int y2, int angle1, int angle2)`

    Description

      Draws a single circular or elliptical arc. Each arc is specified by a rectangle and two angles. The center of the circle or ellipse is the center of the rectangle, and the major and minor axes are specified by the width and height. Positive angles indicate counterclockwise motion, and negative angles indicate clockwise motion. If the magnitude of angle2 is greater than 360 degrees, it is truncated to 360 degrees.

    Method draw_bitmap

      `GTK.DrawingArea draw_bitmap(GDK.GC gc, GDK.Bitmap bitmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw a GDK(Bitmap) in this drawable. NOTE: This drawable must be a bitmap as well. This will be fixed in GTK 1.3

    Method draw_image

      `GTK.DrawingArea draw_image(GDK.GC gc, GDK.Image image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK(Image) at xdest,ydest in the destination drawable

    Method draw_line

      `GTK.DrawingArea draw_line(GDK.GC gc, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK.DrawingArea()->set_usize(100,100); delay: g = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_line(g,x*10,0,100-x*10,99); img_end

    Method draw_pixmap

      `GTK.DrawingArea draw_pixmap(GDK.GC gc, GDK.Pixmap pixmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK(Pixmap) at xdest,ydest in the destination drawable

    Method draw_point

      `GTK.DrawingArea draw_point(GDK.GC gc, int x, int y)`

    Description

      img_begin w = GTK.DrawingArea()->set_usize(10,10); delay: g = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_point(g, x, x); img_end

    Method draw_rectangle

      `GTK.DrawingArea draw_rectangle(GDK.GC gc, int filledp, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK.DrawingArea()->set_usize(100,100); delay: g = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_rectangle(g,0,x*10,0,100-x*10,99); img_end img_begin w = GTK.DrawingArea()->set_usize(100,100); delay: g = GDK.GC(w); delay: for(int x = 0; x<30; x++) { delay: g->set_foreground(GDK.Color(random(255),random(255),random(255)) ); delay: w->draw_rectangle(g,1,x*10,0,100-x*10,99); delay: } img_end

    Method draw_text

      `GTK.DrawingArea draw_text(GDK.GC gc, GDK.Font font, int x, int y, string text, int forcewide)`

    Description

      y is used as the baseline for the text. If forcewide is true, the string will be expanded to a wide string even if it is not already one. This is useful when writing text using either unicode or some other 16 bit font.

    Method size

      `GTK.DrawingArea size(int width, int height)`

    Description

      This function is OBSOLETE

  CLASS GTK.HandleBox

    Description

      The contents of a handle box can be 'dragged' out of the box by the user. The contents will then be placed in a separate window. `GTK.HandleBox()->add(GTK.Label("The contents"))`

      Signals: child_attached Called when a new child is added to the box

      child_detached Called when a child is removed from the box

    Inherit Bin

      inherit GTK.Bin : Bin

    Method create

      `GTK.HandleBox GTK.HandleBox()`

    Description

      Create a new handle box widget.

    Method get_child_detached

      `int get_child_detached()`

    Description

      Is the child detatched?

    Method get_float_window_mapped

      `int get_float_window_mapped()`

    Description

      Is the floating window mapped?

    Method get_handle_position

      `int get_handle_position()`

    Description

      The position of the handle. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

    Method get_in_drag

      `int get_in_drag()`

    Description

      1 if the window is beeing dragged around right now.

    Method get_shrink_on_detach

      `int get_shrink_on_detach()`

    Description

      True if the container should shrink when the child is detatched

    Method get_snap_edge

      `int get_snap_edge()`

    Description

      The edge to snap to. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP , or -1 for unset.

    Method set_handle_position

      `GTK.HandleBox set_handle_position(int pos)`

    Description

      The position of the handle. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

    Method set_set_shrink_on_detach

      `int set_set_shrink_on_detach()`

    Description

      True if the container should shrink when the child is detatched

    Method set_shadow_type

      `GTK.HandleBox set_shadow_type(int shadow_type)`

    Description

      One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_snap_edge

      `GTK.HandleBox set_snap_edge(int pos)`

    Description

      The edge to snap to. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP , or -1 for unset.

  CLASS GTK.Ctree

    Description

      The GtkCTree widget is used for showing a hierarchical tree to the user, for example a directory tree.

      The tree is internally represented as a set of GtkCTreeNode structures.

      The interface has much in common with the GtkCList widget: rows (nodes) can be selected by the user etc.

      Positions in the tree are often indicated by two arguments, a parent and a sibling, both GtkCTreeNode pointers. If the parent is NULL, the position is at the root of the tree and if the sibling is NULL, it will be the last child of parent, otherwise it will be inserted just before the sibling.

      Signals: change_focus_row_expansion Changed when the focused row is either expanded or collapsed

      tree_collapse Called when a node is collapsed

      tree_expand Called when a node is expanded

      tree_move Called when a node is moved (using DND, as an example)

      tree_select_row Called when a node is selected.

      tree_unselect_row Called when a node is unselected.

    Inherit Clist

      inherit GTK.Clist : Clist

    Method collapse

      `GTK.Ctree collapse(GTK.CTreeNode node)`

    Description

      Collapse the node, hiding it's children. If no node is given, expand the toplevel of the tree

    Method collapse_recursive

      `GTK.Ctree collapse_recursive(GTK.CTreeNode node)`

    Description

      Collapse the node, showing it's children, it's childrens children, etc. If no node is given, collapse the whole tree

    Method collapse_to_depth

      `GTK.Ctree collapse_to_depth(GTK.CTreeNode node, int depth)`

    Description

      Collapse depth levels of the tree, starting with the specified node. If no node is given, start with the toplevel node.

    Method create

      `GTK.Ctree GTK.Ctree(int columns, int tree_column)`

    Description

      tree_column is the column that has the tree graphics (lines and expander buttons).

    Method expand

      `GTK.Ctree expand(GTK.CTreeNode node)`

    Description

      Expand the node, showing it's children. If no node is given, expand the toplevel of the tree

    Method expand_recursive

      `GTK.Ctree expand_recursive(GTK.CTreeNode node)`

    Description

      Expand the node, showing it's children, it's childrens children, etc. If no node is given, expand the whole tree

    Method expand_to_depth

      `GTK.Ctree expand_to_depth(GTK.CTreeNode node, int depth)`

    Description

      Expand depth levels of the tree, starting with the specified node. If no node is given, start with the toplevel node.

    Method find

      `int find(GTK.CTreeNode node, GTK.CTreeNode start)`

    Description

      Returns true if the node is a child of the start node.

      If you omit the starting node, the tree will be searched from the root.

    Method find_by_row_data

      `GTK.Ctree find_by_row_data(object data, CTreeNode|void root)`

    Description

      Find a node in the tree starting with root, that has the given user data. If no node is found, 0 is returned.

    Method find_node_ptr

      `GTK.CTreeNode find_node_ptr(GTK.CTreeRow node)`

    Description

      Given a W(CTreeRow) (deprectated structure in PiGTK), return the W(CTreeNode) associated with the row.

    Method get_expander_style

      `int get_expander_style()`

    Description

      The style of the expander buttons, one of CTREE_EXPANDER_CIRCULAR , CTREE_EXPANDER_NONE , CTREE_EXPANDER_SQUARE and CTREE_EXPANDER_TRIANGLE

    Method get_line_style

      `int get_line_style()`

    Description

      The style of the lines, one of CTREE_LINES_DOTTED , CTREE_LINES_NONE , CTREE_LINES_SOLID and CTREE_LINES_TABBED

    Method get_show_stub

      `int get_show_stub()`

    Description

      Will stubs be shows?

    Method get_tree_column

      `int get_tree_column()`

    Description

      The column that is the tree column (the one with the expand/collapse icons)

    Method get_tree_indent

      `int get_tree_indent()`

    Description

      The number of pixels to indent the tree levels.

    Method get_tree_spacing

      `int get_tree_spacing()`

    Description

      The number of pixels between the tree and the columns

    Method insert_node

      `GTK.Ctree insert_node(GTK.CTreeNode parent, GTK.CTreeNode sibling, array text, int is_leaf, int expanded)`

    Description

      At least one of parent or sibling must be specified. If both are specified, sibling->parent() must be equal to parent.

      If the parent and sibling is 0, the position is at the root of the tree, if the sibling is NULL, it will be the last child of parent, otherwise it will be inserted just before the sibling.

    Method is_ancestor

      `int is_ancestor(GTK.CTreeNode node, GTK.CTreeNode child)`

    Description

      Returns true if node is an ancestor of child

    Method is_hot_spot

      `int is_hot_spot(int x, int y)`

    Description

      Returns true if the given coordinates lie on an expander button

    Method is_viewable

      `int is_viewable(GTK.CTreeNode node)`

    Description

      Returns 1 if a certain node can be viewed (with or without scrolling of the tree). Returns 0 if the node is in a folded part of the tree.

    Method last

      `GTK.CTreeNode last(GTK.CTreeNode node)`

    Description

      Returns the last child of the last child of the last child... of the given node.

    Method move

      `GTK.Ctree move(GTK.CTreeNode node, GTK.CTreeNode new_parent, GTK.CTreeNode new_sibling)`

    Description

      Move a node. Coordinates work as for insert.

    Method node_get_cell_style

      `GTK.Style node_get_cell_style(GTK.CTreeNode node, int col)`

    Description

      Return the style of a cell

    Method node_get_cell_type

      `int node_get_cell_type(GTK.CTreeNode node, int column)`

    Description

      Return the celltype of this node.

    Method node_get_pixmap

      `mapping node_get_pixmap(CTreeNode node, int column)`

    Description

      Returns the pixmap and mask of this node in a mapping: ([ "pixmap":the_pixmap, "mask":the_bitmap ])

    Method node_get_pixtext

      `mapping node_get_pixtext(GTK.CTreeNode n, int columne)`

    Description

      Returns the pixmap, mask and text of this node in a mapping: ([ "pixmap":the_pixmap, "mask":the_bitmap, "text":the_text ])

    Method node_get_row_data

      `object node_get_row_data(GTK.CTreeNode n)`

    Description

      Return the data associated with a node, or 0.

    Method node_get_row_style

      `GTK.Style node_get_row_style(GTK.CTreeNode node)`

    Description

      Return the style of a row

    Method node_get_selectable

      `int node_get_selectable(GTK.CTreeNode node)`

    Description

      Return whether or not this node can be selcted by the user

    Method node_get_text

      `string node_get_text(GTK.CTreeNode node, int column)`

    Description

      Returns the text of the specified node

    Method node_is_visible

      `int node_is_visible(GTK.CTreeNode node)`

    Description

      Return 1 if the node is currently visible

    Method node_moveto

      `GTK.Ctree node_moveto(GTK.CTreeNode row, int column, float row_align, float col_align)`

    Description

      Scroll the tree so a specified node (and column) is visible. If the node is folded, it's first visible parent will be shown.

    Method node_nth

      `GTK.CTreeNode node_nth(int row)`

    Description

      Return the node that is currently visible on the specified row.

    Method node_set_background

      `GTK.Ctree node_set_background(GTK.CTreeNode node, GDK.Color color)`

    Description

      Set the background of a row

    Method node_set_cell_style

      `GTK.Ctree node_set_cell_style(GTK.CTreeNode node, int col, GTK.Style style)`

    Description

      Set the style of a cell

    Method node_set_foreground

      `GTK.Ctree node_set_foreground(GTK.CTreeNode node, GDK.Color col)`

    Description

      Set the foreground of a row

    Method node_set_pixmap

      `GTK.Ctree node_set_pixmap(GTK.CTreeNode node, int column, GDK.Pixmap pixmap, GDK.Bitmap mask)`

    Description

      Set the pixmap in a cell

    Method node_set_pixtext

      `GTK.Ctree node_set_pixtext(GTK.CTreeNode node, int column, string text, int spacing, GDK.Pixmap pixmap, GDK.Bitmap mask)`

    Description

      Set the pixmap and text in a cell

    Method node_set_row_data

      `GTK.Ctree node_set_row_data(GTK.CTreeNode node, object data)`

    Description

      Set the user data associated with the specified node. This data can be used to find nodes, and when a node is selected it can be easily retrieved using node_get_row_data.

      You can only use objects as row data right now

    Method node_set_row_style

      `GTK.Ctree node_set_row_style(GTK.CTreeNode node, GTK.Style style)`

    Description

      Set the style of a row

    Method node_set_selectable

      `GTK.Ctree node_set_selectable(GTK.CTreeNode node, int selectablep)`

    Description

      Whether this node can be selected by the user.

    Method node_set_shift

      `GTK.Ctree node_set_shift(GTK.CTreeNode node, int column, int vertical, int horizontal)`

    Description

      Shift the given cell the given amounts in pixels.

    Method node_set_text

      `GTK.Ctree node_set_text(GTK.CTreeNode node, int column, string text)`

    Description

      Set the text in a cell

    Method remove_node

      `GTK.Ctree remove_node(GTK.CTreeNode node)`

    Description

      Remove a node and it's subnodes from the tree. The nodes will be destroyed, so you cannot add them again.

    Method select

      `GTK.Ctree select(GTK.CTreeNode node)`

    Description

      Select a node.

    Method select_recursive

      `GTK.Ctree select_recursive(GTK.CTreeNode node)`

    Description

      Select a node and it's children.

    Method set_expander_style

      `GTK.Ctree set_expander_style(int style)`

    Description

      Set the expander style, one of CTREE_EXPANDER_CIRCULAR , CTREE_EXPANDER_NONE , CTREE_EXPANDER_SQUARE and CTREE_EXPANDER_TRIANGLE

    Method set_indent

      `GTK.Ctree set_indent(int npixels)`

    Description

      Set the indentation level

    Method set_line_style

      `GTK.Ctree set_line_style(int style)`

    Description

      Set the line style, one of CTREE_LINES_DOTTED , CTREE_LINES_NONE , CTREE_LINES_SOLID and CTREE_LINES_TABBED

    Method set_node_info

      `GTK.Ctree set_node_info(GTK.CTreeNode node, string text, int spacing, GDK.Pixmap pixmap_closed, GDK.Bitmap mask_closed, GDK.Pixmap pixmap_opened, GDK.Bitmap mask_opened, int is_leaf, int expanded)`

    Description

      text : | The texts to be shown in each column.
      spacing : | The extra space between the pixmap and the text.
      pixmap_closed : | The pixmap to be used when the node is collapsed. Can be NULL.
      mask_closed : | The mask for the above pixmap. Can be NULL.
      pixmap_opened : | The pixmap to be used when the children are visible. Can be NULL.
      mask_opened : | The mask for the above pixmap. Can be NULL.
      is_leaf : | Whether this node is going to be a leaf.
      expanded : | Whether this node should start out expanded or not.

    Method set_show_stub

      `GTK.Ctree set_show_stub(int stubp)`

    Description

      If true, the 'stub' will be shown. The stub is the small line that goes horizontally from the expand or collapse button to the actual contents of the tree

    Method set_spacing

      `GTK.Ctree set_spacing(int npixels)`

    Description

      Set the spacing between the tree column and the other columns

    Method sort_node

      `GTK.Ctree sort_node(GTK.CTreeNode node)`

    Description

      Sort the specified node.

    Method sort_recursive

      `GTK.Ctree sort_recursive(GTK.CTreeNode node)`

    Description

      Sort the specified node and it's children.

    Method toggle_expansion

      `GTK.Ctree toggle_expansion(GTK.CTreeNode node)`

    Description

      If the node is expanded, collapse it, and if it's collapsed, expand it.

    Method toggle_expansion_recursive

      `GTK.Ctree toggle_expansion_recursive(GTK.CTreeNode node)`

    Description

      Toggle the expansion of the whole subtree, starting with node.

    Method unselect

      `GTK.Ctree unselect(GTK.CTreeNode node)`

    Description

      Unselect a node.

    Method unselect_recursive

      `GTK.Ctree unselect_recursive(GTK.CTreeNode node)`

    Description

      Unselect a node and it's children.

  CLASS GTK.Statusbar

    Description

      Statusbars are simple widgets used to display a text message. They keep a stack of the messages pushed onto them, so that popping the current message will re-display the previous text message.

      In order to allow different parts of an application to use the same statusbar to display messages, the statusbar widget issues Context Identifiers which are used to identify different 'users'. The message on top of the stack is the one displayed, no matter what context it is in. Messages are stacked in last-in-first-out order, not context identifier order.

      `lambda() {object sb = GTK.Statusbar();int id = sb->get_context_id("test");sb->push(id,"A message");sb->push(id,"Another message");return sb;}()`

      `lambda() {object sb = GTK.Statusbar();int id = sb->get_context_id("test");sb->push(id,"A message");sb->push(id,"Another message");sb->pop(id);return sb;}()`

      Signals: text_poped

      text_pushed

    Inherit Hbox

      inherit GTK.Hbox : Hbox

    Method create

      `GTK.Statusbar GTK.Statusbar()`

    Description

      Create a new statusbar widget

    Method get_context_id

      `int get_context_id(string context)`

    Description

      Create a new context id (or get the id of an old one). The argument is any string. The return value can be used for -&gt;push() -&gt;pop() and -&gt;remove later on.

    Method pop

      `GTK.Statusbar pop(int context)`

    Description

      Remove the topmost message.

    Method push

      `int push(int context, string data)`

    Description

      Push a message onto the statusbar. The return value is an id that can be passed to remove later on.

    Method remove

      `GTK.Statusbar remove(int context, int id)`

    Description

      Remove the specified message (the message id is the second argument).

  CLASS GTK.Vscale

    Description

      The GTK.VScale widget is used to allow the user to select a value using a vertical slider. A GtkAdjustment is used to set the initial value, the lower and upper bounds, and the step and page increments.

      The position to show the current value, and the number of decimal places shown can be set using the parent W(Scale) class's functions.

      `GTK.Vscale(GTK.Adjustment())->set_usize(30,100)`

    Inherit Scale

      inherit GTK.Scale : Scale

    Method create

      `GTK.Vscale GTK.Vscale(GTK.Adjustment settings)`

    Description

      Used to create a new vscale widget. The adjustment argument can either be an existing W(Adjustment), or 0, in which case one will be created for you. Specifying 0 might actually be useful in this case, if you wish to pass the newly automatically created adjustment to the constructor function of some other widget which will configure it for you, such as a text widget.

  CLASS GTK.ButtonBox

    Description

      More or less equivalent to a normal box, but you can set a few layout schemes that are not available for normal boxes. See the hbox and vbox documentation for examples.

    Inherit Box

      inherit GTK.Box : Box

    Method get_child_ipadding

      `mapping get_child_ipadding()`

    Description

      Return the default inter-child padding ([ "x":xpadding, "y":ypadding ])

    Method get_child_size

      `mapping get_child_size()`

    Description

      Return the child size as ([ "x":xsize, "y":ysize ])

    Method get_layout

      `int get_layout()`

    Description

      Returns the currently configured layout. One of BUTTONBOX_DEFAULT_STYLE , BUTTONBOX_EDGE , BUTTONBOX_END , BUTTONBOX_SPREAD and BUTTONBOX_START

    Method get_spacing

      `int get_spacing()`

    Description

      Return the spacing that is added between the buttons

    Method set_child_ipadding

      `GTK.ButtonBox set_child_ipadding(int child_number, int child_padding)`

    Description

      Set the padding for a specific child.

    Method set_child_size

      `GTK.ButtonBox set_child_size(int child_number, int child_size)`

    Description

      Set the size of a specified child

    Method set_layout

      `GTK.ButtonBox set_layout(int layout)`

    Description

      layout is one of BUTTONBOX_DEFAULT_STYLE , BUTTONBOX_EDGE , BUTTONBOX_END , BUTTONBOX_SPREAD and BUTTONBOX_START

    Method set_spacing

      `GTK.ButtonBox set_spacing(int spacing)`

    Description

      in pixels

  CLASS GTK.Vbox

    Description

      Most packing is done by creating boxes. These are invisible widget containers that we can pack our widgets into which come in two forms, a horizontal box, and a vertical box. This is the vertical one. When packing widgets into a vertical box, the objects are inserted horizontally from top to bottom or bottom to top depending on the call used.

      `GTK.Vbox(0,0)->add(GTK.Button("Hello"))->add(GTK.Button("World"))->pack_end_defaults(GTK.Button("From right"))->pack_start_defaults(GTK.Button("From left"))`

      `GTK.Vbox(1,0)->add(GTK.Button("Hello"))->add(GTK.Button("World"))->pack_end_defaults(GTK.Button("From right"))->pack_start_defaults(GTK.Button("From left"))`

      `GTK.Vbox(1,40)->add(GTK.Button("Hello"))->add(GTK.Button("World"))->pack_end_defaults(GTK.Button("From right"))->pack_start_defaults(GTK.Button("From left"))`

    Inherit Box

      inherit GTK.Box : Box

    Method create

      `GTK.Vbox GTK.Vbox(int uniformp, int padding)`

    Description

      Create a new horizontal box widget. If all_same_size is true, all widgets will have exactly the same size. padding is added to the top and bottom of the children.

  CLASS GTK.Bin

    Description

      A container that can only contain one child.

    Inherit Container

      inherit GTK.Container : Container

    Method get_child

      `GTK.Widget get_child()`

    Description

      Returns the (one and only) child of this container.

  CLASS GTK.Invisible

    Description

      An invisible container, useful, eh? :)

    Inherit Bin

      inherit GTK.Bin : Bin

    Method create

      `GTK.Invisible GTK.Invisible()`

    Description

      Create a new invisible widget

  CLASS GTK.Vruler

    Description

      Ruler widgets are used to indicate the location of the mouse pointer in a given window. A window can have a vertical ruler spanning across the width and a horizontal ruler spanning down the height. A small triangular indicator on the ruler shows the exact location of the pointer relative to the ruler.

      `GTK.Vruler()->set_metric(GTK.PIXELS)->set_range(0.0,100.0,50.0,100.0)->draw_ticks()->draw_pos()->set_usize(30,50)`

      `GTK.Vruler()->set_metric(GTK.CENTIMETERS)->set_range(0.0,100.0,50.0,100.0)->draw_ticks()->draw_pos()->set_usize(30,50)`

      `GTK.Vruler()->set_usize(30,50)`

    Inherit Ruler

      inherit GTK.Ruler : Ruler

    Method create

      `GTK.Vruler GTK.Vruler()`

    Description

      Used to create a new vruler widget.

  CLASS GTK.CTreeRow

    Description

      This class is deprecated.

    Method get_children

      `GTK.CTreeNode get_children()`

    Description

      Return the first child

    Method get_expanded

      `int get_expanded()`

    Description

      Return 1 if the node is expanded

    Method get_is_leaf

      `int get_is_leaf()`

    Description

      Return 1 if the node is a leaf node

    Method get_level

      `int get_level()`

    Description

      Return the level of this node (0 for root, 1 for a child of the root, etc)

    Method get_parent

      `GTK.CTreeNode get_parent()`

    Description

      Return the parent node of this node

  CLASS GTK.GladeXML

    Description

      Glade is a free GUI builder for GTK+ and Gnome. It's normally used to create C-code, but can also produce code for other languages. Libglade is a utility library that builds the GUI from the Glade XML save files. This module uses libglade and allows you to easily make GUI designs to be used with your Pike applications. Since PiGTK doesn't support Gnome yet, you can only use the normal GTK widgets.

    Method get_widget

      `GTK.Widget get_widget(string name)`

    Description

      This function is used to get get the widget corresponding to name in the interface description. You would use this if you have to do anything to the widget after loading.

    Method get_widget_by_long_name

      `GTK.Widget get_widget_by_long_name(string long_name)`

    Description

      This function is used to get the widget corresponding to long_name in the interface description. You would use this if you have to do anything to the widget after loading. This function differs from GladeXML->get_widget, in that you have to give the long form of the widget name, with all its parent widget names, separated by periods.

    Method get_widget_long_name

      `string get_widget_long_name(GTK.Widget widget)`

    Description

      Used to get the long name of a widget that was generated by a GladeXML object.

    Method get_widget_name

      `string get_widget_name(GTK.Widget widget)`

    Description

      Used to get the name of a widget that was generated by a GladeXML object.

    Method new

      `GTK.GladeXML new(string filename, string|void root, string|void domain)`

    Description

      Creates a new GladeXML object (and the corresponding widgets) from the XML file filename. Optionally it will only build the interface from the widget node root. This feature is useful if you only want to build say a toolbar or menu from the XML file, but not the window it is embedded in. Note also that the XML parse tree is cached to speed up creating another GladeXML object for the same file. The third optional argument is used to specify a different translation domain from the default to be used.

    Method new_from_memory

      `GTK.GladeXML new_from_memory(string data, string|void root, string|void domain)`

    Description

      Creates a new GladeXML object (and the corresponding widgets) from the string data. Optionally it will only build the interface from the widget node root. This feature is useful if you only want to build say a toolbar or menu from the XML document, but not the window it is embedded in. The third optional argument is used to specify a different translation domain from the default to be used.

    Method signal_autoconnect

      `GTK.GladeXML signal_autoconnect(mapping callbacks, mixed data)`

    Description

      Try to connect functions to all signals in the interface. The mapping should consist of handler name : function pairs. The data argument will be saved and sent as the first argument to all callback functions.

    Method signal_autoconnect_new

      `GTK.GladeXML signal_autoconnect_new(mapping callbacks, mixed data)`

    Description

      Try to connect functions to all signals in the interface. The mapping should consist of handler name : function pairs. This function differs from the signal_connect function in how it calls the callback function.

      The old interface:

             void signal_handler( mixed data, GTK.Object object,
                                  mixed ... signal_arguments )

      The new interface:

             void signal_handler( mixed ... signal_arguments,
                                  mixed data, GTK.Object object )

  CLASS GTK.Databox

    Description

      GtkDatabox is designed to display large amounts of numerical data fast and easy. Thousands of data points (X and Y coordinate) may be displayed without any problems, zooming and scrolling as well as optional rulers are already included.

      The widget may be used as display for oscilloscopes or other applications that need to display fast changes in their data.

      `GTK.Databox x=GTK.Databox(); x->data_add_x_y(3, ({ 1.0, 0.5, 0.0 }), ({1.0, -1.0, 0.0}),GDK.Color(Image.Color.red), GTK.DataboxLines,2); x->rescale(); x->set_usize(300,300); return x;`

      Signals: marked

      selection_canceled

      selection_changed

      selection_started

      selection_stopped

      zoomed

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method create

      `GTK.Databox GTK.Databox()`

    Description

      Create a new databox widget

    Method data_add_x

      `int data_add_x(int nelems, array x, int shared_Y_index, GDK.Color color, int type, int dot_size)`

    Description

      Type is one of DATABOX_BARS , DATABOX_LINES , DATABOX_NOT_DISPLAYED and DATABOX_POINTS

    Method data_add_x_y

      `int data_add_x_y(int nelems, array x, array y, GDK.Color color, int type, int dot_size)`

    Description

      Type is one of DATABOX_BARS , DATABOX_LINES , DATABOX_NOT_DISPLAYED and DATABOX_POINTS

    Method data_add_y

      `int data_add_y(int nelems, array y, int shared_X_index, GDK.Color color, int type, int dot_size)`

    Description

      Type is one of DATABOX_BARS , DATABOX_LINES , DATABOX_NOT_DISPLAYED and DATABOX_POINTS

    Method data_destroy

      `int data_destroy(int index)`

    Method data_destroy_all

      `int data_destroy_all()`

    Method data_get_extrema

      `array data_get_extrema()`

    Method data_get_value

      `mapping data_get_value(int x, int y)`

    Method data_get_visible_extrema

      `array data_get_visible_extrema()`

    Method disable_zoom

      `GTK.Databox disable_zoom()`

    Method enable_zoom

      `GTK.Databox enable_zoom()`

    Method hide_cross

      `GTK.Databox hide_cross()`

    Method hide_rulers

      `GTK.Databox hide_rulers()`

    Method hide_scrollbars

      `GTK.Databox hide_scrollbars()`

    Method rescale

      `GTK.Databox rescale()`

    Method rescale_with_values

      `GTK.Databox rescale_with_values(float minx, float miny, float maxx, float maxy)`

    Method set_color

      `int set_color(int index, GDK.Color color)`

    Method set_data_type

      `int set_data_type(int index, int type, int dot_size)`

    Description

      Type is one of DATABOX_BARS , DATABOX_LINES , DATABOX_NOT_DISPLAYED and DATABOX_POINTS

    Method show_cross

      `GTK.Databox show_cross()`

    Method show_rulers

      `GTK.Databox show_rulers()`

    Method show_scrollbars

      `GTK.Databox show_scrollbars()`

  CLASS GTK.Container

    Description

      The basic container class.

      Signals: add Called when a new object is added to the container. (used internally)

      focus Called when the container gets focus (used internally)

      need_resize Called when the container needs resizing (used internally)

      remove Called when a object is removed from the container (used internally)

      set_focus_child

    Inherit Widget

      inherit GTK.Widget : Widget

    Method add

      `GTK.Container add(GTK.Widget widget)`

    Description

      Add a subwidget to the container. Don't forget to call show() in the subwidget. Some (even most) containers can only contain one child. Calling this function might result in a resize of the container.

    Method border_width

      `GTK.Container border_width(int width)`

    Description

      Compatibility alias for set_border_width. Do not use this function in new code!

    Method children

      `array children()`

    Description

      This function returns all children of the container as an array.

    Method focus

      `GTK.Container focus(int focus_direction)`

    Description

      Emulate a focus event. direction is one of DIR_DOWN , DIR_LEFT , DIR_RIGHT , DIR_TAB_BACKWARD , DIR_TAB_FORWARD and DIR_UP .

    Method remove

      `GTK.Container remove(GTK.Widget widget)`

    Description

      Remove a child from the container. The argument is the child to remove. Calling this function might result in a resize of the container.

    Method set_border_width

      `GTK.Container set_border_width(int external_border_width)`

    Description

      Set the border width. The border width is the size of the padding around the container. Calling this function might result in a resize of the container.

    Method set_focus_child

      `GTK.Container set_focus_child(GTK.Widget child)`

    Description

      Emulate a set_focus_child signal. Focus on the specified child.

    Method set_focus_hadjustment

      `GTK.Container set_focus_hadjustment(GTK.Adjustment adj)`

    Description

      Set the hadjustment used to focus children.

    Method set_focus_vadjustment

      `GTK.Container set_focus_vadjustment(GTK.Adjustment adj)`

    Description

      Set the vadjustment used to focus children.

    Method set_resize_mode

      `GTK.Container set_resize_mode(int mode)`

    Description

      One of RESIZE_IMMEDIATE , RESIZE_PARENT and RESIZE_QUEUE

  CLASS GTK.GammaCurve

    Description

      A gamma curve widget.. Rather complex.

      Lets the user edit a gamma curve (a one-to-one mapping usually used to adjust the intensity of an image to the physical characteristics of the output device). You can set the minimum and maximum values for input and output. You can set the initial vector as well. You are guaranteed that every input value will have a (not necessarily unique) output value specified.

      `GTK.GammaCurve()->set_usize(210,130)`

    Inherit Vbox

      inherit GTK.Vbox : Vbox

    Method create

      `GTK.GammaCurve GTK.GammaCurve()`

    Description

      Create a new gamma curve

    Method get_curve

      `GTK.Curve get_curve()`

    Description

      The actual curve

    Method get_gamma

      `float get_gamma()`

    Description

      The current gamma value

  CLASS GTK.Vpaned

    Description

      The paned window widgets are useful when you want to divide an area into two parts, with the relative size of the two parts controlled by the user. A groove is drawn between the two portions with a handle that the user can drag to change the ratio. This widgets makes a vertical division

      `GTK.Vpaned()->add1(GTK.Label("Top Side Of Pane"))->add2(GTK.Label("Bottom"))->set_usize(100,100)`

    Inherit Paned

      inherit GTK.Paned : Paned

    Method create

      `GTK.Vpaned GTK.Vpaned()`

  CLASS GTK.Item

    Description

      This class is inherited by all 'item' type of widgets.

      Signals: deselect

      select

      toggle

    Inherit Bin

      inherit GTK.Bin : Bin

    Method deselect

      `GTK.Item deselect()`

    Description

      Emulate a 'deselect' event.

    Method select

      `GTK.Item select()`

    Description

      Emulate a 'select' event.

    Method toggle

      `GTK.Item toggle()`

    Description

      Emulate a 'toggle' event.

  CLASS GTK.MenuItem

    Description

      Menu items, to be added to menues.

    Inherit Item

      inherit GTK.Item : Item

    Method activate

      `GTK.MenuItem activate()`

    Description

      Emulate an activate signal

    Method configure

      `GTK.MenuItem configure(int toggle_indicator, int submenu_indicator)`

    Description

      First argument is 'show_toggle_indicator', second is 'show_submenu_indicator'.

    Method create

      `GTK.MenuItem GTK.MenuItem(string|void label)`

    Description

      If a string is supplied, a W(Label) widget is created using that string and added to the item. Otherwise, you should add another widget to the list item with -&gt;add().

    Method deselect

      `GTK.MenuItem deselect()`

    Description

      Emulate a deselect signal

    Method get_accelerator_width

      `int get_accelerator_width()`

    Description

      The width of the accelerator string, in pixels

    Method get_right_justify

      `int get_right_justify()`

    Description

      Is the widget right justified?

    Method get_show_submenu_indicator

      `int get_show_submenu_indicator()`

    Description

      Should the submenu indicator be shown?

    Method get_show_toggle_indicator

      `int get_show_toggle_indicator()`

    Description

      Should the toggle indicator be shown?

    Method get_submenu_direction

      `int get_submenu_direction()`

    Description

      The direction the submenu will be shown in. One of DIR_DOWN , DIR_LEFT , DIR_RIGHT , DIR_TAB_BACKWARD , DIR_TAB_FORWARD and DIR_UP

    Method get_submenu_placement

      `int get_submenu_placement()`

    Description

      The placement of the submenu.

    Method get_toggle_size

      `int get_toggle_size()`

    Description

      The size of the toggle indicator

    Method remove_submenu

      `GTK.MenuItem remove_submenu()`

    Description

      Remove the submenu for this menu button.

    Method right_justify

      `GTK.MenuItem right_justify()`

    Description

      Make the menu item stick to the right edge of it's container.

    Method select

      `GTK.MenuItem select()`

    Description

      Emulate a select signal

    Method set_placement

      `GTK.MenuItem set_placement(int dir)`

    Description

      (sub menu placement) One of DIRECTION_LEFT and DIRECTION_RIGHT

    Method set_submenu

      `GTK.MenuItem set_submenu(GTK.Widget menu)`

    Description

      Set the submenu for this menu button.

  CLASS GTK.Entry

    Description

      Use this widget when you want the user to input a single line of text. `GTK.Entry()->set_text("Hello world")->set_editable(1)`

    Inherit Editable

      inherit GTK.Editable : Editable

    Method append_text

      `GTK.Entry append_text(string text)`

    Description

      Append the specified string at the end of the entry

    Method create

      `GTK.Entry GTK.Entry()`

    Method get_text

      `string get_text()`

    Description

      Returns the contents of the entry widget.

    Method prepend_text

      `GTK.Entry prepend_text(string text)`

    Description

      Prepend the specified string to the start of the entry

    Method set_max_length

      `GTK.Entry set_max_length(int maxlen)`

    Description

      text is truncated if needed

    Method set_text

      `GTK.Entry set_text(string text)`

    Description

      Set the text to the specified string. The old text is dropped.

    Method set_visibility

      `GTK.Entry set_visibility(int visiblep)`

    Description

      0 indicates invisible text (password boxes, as an example)

  CLASS GTK.Label

    Description

      A simple text label. `GTK.Label("A simple text label")`

      `GTK.Label("Multi\nline text\nlabel here")`

      `GTK.Label("Multi\nline text\nlabel here")->set_justify(GTK.JUSTIFY_LEFT)`

      `GTK.Label("Multi\nline text\nlabel here")->set_justify(GTK.JUSTIFY_RIGHT)`

    Inherit Misc

      inherit GTK.Misc : Misc

    Method create

      `GTK.Label GTK.Label(string text)`

    Description

      Creates a new label.

    Method parse_uline

      `int parse_uline(string uline_string)`

    Description

      Convenience function to set the text and pattern by parsing a string with embedded underscores, returns the appropriate key symbol for the accelerator.

    Method set

      `GTK.Label set(string text)`

    Description

      DEPRECATED Compatibility function to set the text in the label. Use set_text. This function can dissapear in the future.

    Method set_justify

      `GTK.Label set_justify(int justify)`

    Description

      one of JUSTIFY_CENTER , JUSTIFY_FILL , JUSTIFY_LEFT and JUSTIFY_RIGHT

    Method set_line_wrap

      `GTK.Label set_line_wrap(int wrapp)`

    Description

      Should the label autolinewrap?

    Method set_pattern

      `GTK.Label set_pattern(string pattern_string)`

    Description

      A string with either spaces or underscores. It should be of the same length as the text.

      When a character in the text has a matching _ in the pattern, the character in the label will be underlined.

    Method set_text

      `GTK.Label set_text(string text)`

    Description

      Set the text in the label

  CLASS GTK.Hscrollbar

    Description

      A horizontal scrollbar. General documentation: See W(Scrollbar) `GTK.Hscrollbar(GTK.Adjustment())->set_usize(300,15)`

    Inherit Scrollbar

      inherit GTK.Scrollbar : Scrollbar

    Method create

      `GTK.Hscrollbar GTK.Hscrollbar(GTK.Adjustment adjustment)`

    Description

      Used to create a new vscale widget. The adjustment argument can either be an existing W(Adjustment), or 0, in which case one will be created for you. Specifying 0 might actually be useful in this case, if you wish to pass the newly automatically created adjustment to the constructor function of some other widget which will configure it for you, such as a text widget.

  CLASS GTK.Tooltips

    Description

      Tooltips are the messages that appear next to a widget when the mouse pointer is held over it for a short amount of time. They are especially helpful for adding more verbose descriptions of things such as buttons in a toolbar.

      An individual tooltip belongs to a group of tooltips. A group is created with a call to GTK.Tooltips(). Every tooltip in the group can then be turned off with a call to disable() and enabled with enable().

      The length of time the user must keep the mouse over a widget before the tip is shown, can be altered with set_delay(). This is set on a 'per group of tooltips' basis.

      To assign a tip to a particular W(Widget), set_tip() is used.

      The default appearance of all tooltips in a program is determined by the current gtk theme that the user has selected. To change the tooltip appearance manually, use set_colors(). Again, this is per group of tooltips.

    Inherit Data

      inherit GTK.Data : Data

    Method create

      `GTK.Tooltips GTK.Tooltips()`

    Description

      Creates an empty group of tooltips. This function initialises a GTK.Tooltips structure. Without at least one such structure, you can not add tips to your application.

    Method disable

      `GTK.Tooltips disable()`

    Description

      Disable this tooltip collection

    Method enable

      `GTK.Tooltips enable()`

    Description

      Enable this tooltip collection

    Method force_window

      `GTK.Tooltips force_window()`

    Description

      Realize the tooltip window (as returned from get_gdkwindow())

    Method set_colors

      `GTK.Tooltips set_colors(GDK.Color foreground, GDK.Color background)`

    Description

      Changes the foreground and background colors.

    Method set_delay

      `GTK.Tooltips set_delay(int delay)`

    Description

      Set the delat (in seconds)

    Method set_tip

      `GTK.Tooltips set_tip(GTK.Widget in, string to)`

    Description

      Adds a tooltip containing the message tip_text to the specified W(Widget).

  CLASS GTK.Frame

    Description

      The frame widget is a Bin that surrounds its child with a decorative frame and an optional label. If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with set_label_align().

      Used to visually group objects.

      `GTK.Frame("Title")->add(GTK.Label("Contents"))`

      `GTK.Frame()->add(GTK.Label("Contents"))`

      `GTK.Frame()->add(GTK.Label("Contents"))->set_shadow_type(GTK.SHADOW_IN)`

    Inherit Container

      inherit GTK.Container : Container

    Method create

      `GTK.Frame GTK.Frame(string|void label_text)`

    Description

      Create a new W(Frame) widget.

    Method set_label

      `GTK.Frame set_label(string|void label_text)`

    Description

      Set the text of the label.

    Method set_label_align

      `GTK.Frame set_label_align(float xalign, float yalign)`

    Description

      Arguments are xalignment and yalignment. 0.0 is left or topmost, 1.0 is right or bottommost. The default value for a newly created Frame is 0.0.

    Method set_shadow_type

      `GTK.Frame set_shadow_type(int shadow_type)`

    Description

      Set the shadow type for the Frame widget. The type is one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

  CLASS GTK.SelectionData

    Description

      The data associated with a selection.

    Method data

      `string data()`

    Description

      Returns the selection in the data. The return value is always a string, but the width can vary (8, 16 or 32 bits per character).

    Method format

      `int format()`

    Description

      Returns the selction format. The format is the number of bits per character.

    Method length

      `int length()`

    Description

      Return the size of the selection data, in bytes.

      The size of the data in characters (as returned by data()) is not necessarily the same.

    Method selection

      `GDK.Atom selection()`

    Description

      The selection id, as a GDK(Atom).

    Method set

      `GTK.SelectionData set(string data)`

    Description

      Store new data into a GtkSelectionData object. Should _only_ by called from a selection handler callback.

    Method target

      `GDK.Atom target()`

    Description

      The target, as a GDK(Atom).

    Method type

      `GDK.Atom type()`

    Description

      The selection type, as a GDK(Atom).

  CLASS GTK.CheckMenuItem

    Description

      A check menu item is more or less identical to a check button, but it should be used in menus. `GTK.CheckMenuItem("Hi there")`

      `GTK.CheckMenuItem("Hi there")->set_active(1)`

      Signals: toggled Called when the state of the menu item is changed

    Inherit MenuItem

      inherit GTK.MenuItem : MenuItem

    Method create

      `GTK.CheckMenuItem GTK.CheckMenuItem(string|void label)`

    Description

      The argument, if specified, is the label of the item. If no label is specified, use object->add() to add some other widget (such as an pixmap or image widget)

    Method set_active

      `GTK.CheckMenuItem set_active(int new_state)`

    Description

      State is either 1 or 0. If 1, the button will be 'pressed'.

    Method set_show_toggle

      `GTK.CheckMenuItem set_show_toggle(int togglep)`

    Description

      If true, the toggle indicator will be shown

    Method toggled

      `GTK.CheckMenuItem toggled()`

    Description

      Emulate a toggled event

  CLASS GTK.ProgressBar

    Description

      A simple progress bar. Useful when you are doing things that take a long time. Try to always have an 'abort' button whenever it makes sence. `GTK.ProgressBar()->update(0.1)`

      `GTK.ProgressBar()->set_show_text(1)->update(0.3)`

      `GTK.ProgressBar()->update(0.6)`

      `GTK.ProgressBar()->update(1.0)`

    Inherit Progress

      inherit GTK.Progress : Progress

    Method create

      `GTK.ProgressBar GTK.ProgressBar()`

    Description

      Create a new progress bar. The default values are: Min 0.0, max 1.0, current 0.0

    Method get_activity_blocks

      `int get_activity_blocks()`

    Description

      The number of blocks that are set.

    Method get_activity_dir

      `int get_activity_dir()`

    Description

      The current direction of the progress meter. 1 is forward and 0 is backwards. Usefull if you for some strange reason would like to know in what direction the activity indicator is swinging right now...

    Method get_activity_pos

      `int get_activity_pos()`

    Description

      The position of the progress meter in pixels.

    Method get_activity_step

      `int get_activity_step()`

    Description

      The step size of the activity indicator in pixels.

    Method get_bar_style

      `int get_bar_style()`

    Description

      The progress bar style. GTK_PROGRESS_CONTINUOUS or GTK_PROGRESS_DISCRETE.

    Method get_blocks

      `int get_blocks()`

    Description

      The total number of blocks.

    Method get_orientation

      `int get_orientation()`

    Description

      The current orientation. GTK_PROGRESS_LEFT_TO_RIGHT, GTK_PROGRESS_RIGHT_TO_LEFT, GTK_PROGRESS_BOTTOM_TO_TOP or GTK_PROGRESS_TOP_TO_BOTTOM.

    Method set_activity_blocks

      `GTK.ProgressBar set_activity_blocks(int blocks)`

    Description

      The number of activity blocks

    Method set_activity_step

      `GTK.ProgressBar set_activity_step(int stepp)`

    Description

      Include activity blocks (empty gaps in the progressbar, ala windows 98)

    Method set_bar_style

      `GTK.ProgressBar set_bar_style(int style)`

    Description

      One of GTK.ProgressContinuous or GTK.ProgressDiscrete

    Method set_discrete_blocks

      `GTK.ProgressBar set_discrete_blocks(int blocks)`

    Description

      The number of discrete blocks in the progress bar

    Method set_orientation

      `GTK.ProgressBar set_orientation(int style)`

    Description

      One of GTK.ProgressLeftToRight, GTK.ProgressRightToLeft, GTK.ProgressBottomToTop or GTK.ProgressTopToBottom

    Method update

      `GTK.ProgressBar update(float fraction)`

    Description

      0.0 is the minimum value, 1.0 is the maximum value.

  CLASS GTK.MenuShell

    Description

      A GTK.MenuShell is the abstract base class used to derive the W(Menu) and W(MenuBar) subclasses.

      A GTK.MenuShell is a container of W(MenuItem) objects arranged in a list which can be navigated, selected, and activated by the user to perform application functions. A W(MenuItem) can have a submenu associated with it, allowing for nested hierarchical menus.

      Signals: activate_current An action signal that activates the current menu item within the menu shell.

      cancel An action signal which cancels the selection within the menu shell. Causes the selection_done signal to be emitted.

      deactivate This signal is emitted when a menu shell is deactivated.

      move_current An action signal which moves the current menu item in the direction specified by the third argument.

      selection_done This signal is emitted when a selection has been completed within a menu shell.

    Inherit Container

      inherit GTK.Container : Container

    Method activate_item

      `GTK.MenuShell activate_item(GTK.Widget menu_item, int force_deactivate)`

    Description

      Activates the menu item within the menu shell.

    Method append

      `GTK.MenuShell append(GTK.Widget what)`

    Description

      Adds a new W(MenuItem) to the end of the menu shell's item list. Same as 'add'.

    Method children

      `array children()`

    Description

      This function returns all children of the menushell as an array.

    Method deactivate

      `GTK.MenuShell deactivate()`

    Description

      Deactivates the menu shell. Typically this results in the menu shell being erased from the screen.

    Method get_active

      `int get_active()`

    Description

      1 if the menu shell is currently active.

    Method insert

      `GTK.MenuShell insert(GTK.Widget what, int where)`

    Description

      Add a widget after the specified location

    Method prepend

      `GTK.MenuShell prepend(GTK.Widget what)`

    Description

      Add a menu item to the start of the widget (for a menu: top, for a bar: left)

    Method select_item

      `GTK.MenuShell select_item(GTK.Widget menuitem)`

    Description

      Selects the menu item from the menu shell.

  CLASS GTK.ToggleButton

    Description

      Toggle buttons are derived from normal buttons and are very similar, except they will always be in one of two states, alternated by a click. They may be depressed, and when you click again, they will pop back up. Click again, and they will pop back down.

      `GTK.ToggleButton("Toggle button")`

      `GTK.ToggleButton("Toggle button")->set_active( 1 )`

      Signals: toggled

    Inherit Button

      inherit GTK.Button : Button

    Method create

      `GTK.ToggleButton GTK.ToggleButton(string|void label)`

    Description

      If you supply a string, a label will be created and inserted in the button. Otherwise, use -&gt;add(widget) to create the contents of the button.

    Method get_active

      `int get_active()`

    Description

      returns 1 if the button is pressed, 0 otherwise.

    Method set_active

      `GTK.ToggleButton set_active(int activep)`

    Description

      If activep is true, the toggle button will be activated.

    Method set_mode

      `GTK.ToggleButton set_mode(int mode)`

    Description

      If true, draw indicator

    Method toggled

      `GTK.ToggleButton toggled()`

    Description

      emulate a 'toggle' of the button. This will emit a 'toggled' signal.

  CLASS GTK.Data

    Description

      A class inherited by all objects used to store data (they are not widgets)

      Signals: disconnect

    Inherit Object

      inherit GTK.Object : Object

  CLASS GTK.GLArea

    Inherit DrawingArea

      inherit GTK.DrawingArea : DrawingArea

    Method create

      `GTK.GLArea GTK.GLArea(array gloptions)`

    Method make_current

      `GTK.GLArea make_current()`

    Method swap_buffers

      `GTK.GLArea swap_buffers()`

    Method wait_gdk

      `GTK.GLArea wait_gdk()`

    Method wait_gl

      `GTK.GLArea wait_gl()`

  CLASS GTK.RadioButton

    Description

      Radio buttons are similar to check buttons except they are grouped so that only one may be selected/depressed at a time. This is good for places in your application where you need to select from a short list of options. To connect the buttons, use another button in the desired group as the second argument to GTK.RadioButton().

      `GTK.Radio_button("Button");`

    Inherit CheckButton

      inherit GTK.CheckButton : CheckButton

    Method create

      `GTK.RadioButton GTK.RadioButton(string|void title, GTK.RadioButton groupmember)`

    Description

      Normal creation: object GTK.RadioButton(string title) - First button (with label) object GTK.RadioButton()->add(widget) - First button (with widget) object GTK.RadioButton(title, another_radio_button) - Second to n:th button (with title) object GTK.RadioButton(0,another_radio_button)->add(widget) - Second to n:th button (with widget)

    Method set_group

      `GTK.RadioButton set_group(GTK.RadioButton groupmember)`

    Description

      the argument is another radio button to whose group this button should be added to. It is prefereable to use the second argument to the constructor instead, but if you for some reason want to move the button to another group, use this function.

  CLASS GTK.Vseparator

    Description

      Simply creates a vertical separator. No bells or whistles. `GTK.Vseparator()->set_usize(3,50)`

    Inherit Separator

      inherit GTK.Separator : Separator

    Method create

      `GTK.Vseparator GTK.Vseparator()`

    Description

      Used to create a new vseparator widget.

  CLASS GTK.Vscrollbar

    Description

      General documentation: See W(Scrollbar) `GTK.Vscrollbar(GTK.Adjustment())->set_usize(15,60)`

    Inherit Scrollbar

      inherit GTK.Scrollbar : Scrollbar

    Method create

      `GTK.Vscrollbar GTK.Vscrollbar(GTK.Adjustment pos)`

    Description

      Used to create a new vscrollbar widget. The adjustment argument can either be an existing W(Adjustment), or 0, in which case one will be created for you. Specifying 0 might actually be useful in this case, if you wish to pass the newly automatically created adjustment to the constructor function of some other widget which will configure it for you, such as a text widget.

  CLASS GTK.EventBox

    Description

      Some gtk widgets don't have associated X windows, so they just draw on their parents. Because of this, they cannot receive events and if they are incorrectly sized, they don't clip so you can get messy overwritting etc. If you require more from these widgets, the EventBox is for you.

      At first glance, the EventBox widget might appear to be totally useless. It draws nothing on the screen and responds to no events. However, it does serve a function - it provides an X window for its child widget. This is important as many GTK widgets do not have an associated X window. Not having an X window saves memory and improves performance, but also has some drawbacks. A widget without an X window cannot receive events, and does not perform any clipping on it's contents. Although the name EventBox emphasizes the event-handling function, the widget can also be used for clipping.

      The primary use for this widget is when you want to receive events for a widget without a window. Examples of such widgets are labels and images.

      `GTK.EventBox()->set_usize(100,100)`

    Inherit Bin

      inherit GTK.Bin : Bin

    Method create

      `GTK.EventBox GTK.EventBox()`

    Description

      Create a new event box widget

  CLASS GTK.Scale

    Description

      The GTK.Scale widget is an abstract class, used only for deriving the subclasses GTK.Hscale and GTK.Vscale.

      See W(Range) for generic range documentation

    Inherit Range

      inherit GTK.Range : Range

    Method get_draw_value

      `int get_draw_value()`

    Description

      non-zero if the scale's current value is displayed next to the slider.

    Method get_value_pos

      `int get_value_pos()`

    Description

      The position in which the textual value is displayed, selected from POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

    Method get_value_width

      `int get_value_width()`

    Description

      An internal function used to get the maximum width needed to display the value string. Not normaly used by applications.

    Method set_digits

      `GTK.Scale set_digits(int precision)`

    Description

      Sets the number of decimal places that are displayed in the value.

    Method set_draw_value

      `GTK.Scale set_draw_value(int drawp)`

    Description

      Specifies whether the current value is displayed as a string next to the slider.

    Method set_value_pos

      `GTK.Scale set_value_pos(int where)`

    Description

      Sets the position in which the current value is displayed. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

  CLASS GTK.Clock

    Description

      The GtkClock widget provides an easy way of providing a textual clock in your application. It supports realtime display, as well as count up and count down modes. The clock widget could conceivably be used in such applications as an application's status bar, or as the basis for a panel applet, etc.

      Three modes of operation are supported. These are realtime - which displays the current time, count-up/increasing - which counts up from an initial value (like a stopwatch), and count-down/decreasing - which counts down from an initial value.

      Note, however, that the accuracy of the gtkclock widget is limited to 1 second. `GTK.Clock( GTK.ClockRealtime );`

      `GTK.Clock( GTK.ClockDecreasing )->set_seconds(10000)->start();`

    Inherit Label

      inherit GTK.Label : Label

    Method create

      `GTK.Clock GTK.Clock(int type)`

    Description

      type is one of CLOCK_DECREASING , CLOCK_INCREASING and CLOCK_REALTIME ;

    Method set_format

      `GTK.Clock set_format(string fmt)`

    Description

      Set the format of a GtkClock widget. The syntax of the format string is identical to that of the function strftime(3). Further information about time format strings can be found on this man page. The widget defaults to a format string of "%H:%M" in realtime mode, or "%H:%M:%S" in count-up or count-down modes.

    Method set_seconds

      `GTK.Clock set_seconds(int seconds)`

    Description

      Set the current time as displayed by the clock in count-up and count-down modes. This function has no effect in realtime mode, as the clock time is determined by the system clock in realtime mode.

    Method set_update_interval

      `GTK.Clock set_update_interval(int seconds)`

    Description

      Set the interval at which the GtkClock widget is updated. The seconds parameter is used to determine how often the time shown on the widget is updated. The default value is to update every second, but you may wish to increase this value. If you set the update interval to 0, the clock is never updated.

    Method start

      `GTK.Clock start()`

    Description

      Start the clock counting in count-up or count-down modes. The clock will begin counting up or down from the time when this function is called, until gtk_clock_stop is called. This function has no effect in the realtime mode (you can't start and stop real time! :-).

    Method stop

      `GTK.Clock stop()`

    Description

      Stop the clock counting in count-up or count-down modes. The clock ceases counting up or down, and the last time reached remains on the display. This function has no effect in the realtime mode (you can't start and stop real time! :-).

  CLASS GTK.InputDialog

    Description

      This dialog is used to enable XInput devices. By default, no extension devices are enabled. We need a mechanism to allow users to enable and configure their extension devices. GTK provides the InputDialog widget to automate this process. The following procedure manages an InputDialog widget. It creates the dialog if it isn't present, and shows it otherwise.

           GTK.InputDialog inputd;
           void create_input_dialog ()
           {
             if (!inputd)
             {
               inputd = GTK.InputDialog();
               inputd-&gt;close_button()-&gt;signal_connect("clicked",inputd-&gt;hide, 0);
               inputd-&gt;save_button()-&gt;hide();
               inputd-&gt;show();
             }
             else
               inputd-&gt;show();
           }

      `GTK.InputDialog()`

      Signals: disable_device his signal is emitted when the user changes the mode of a device from a GDK_MODE_SCREEN or GDK_MODE_WINDOW to GDK_MODE_ENABLED

      enable_device This signal is emitted when the user changes the mode of a device from GDK_MODE_DISABLED to a GDK_MODE_SCREEN or GDK_MODE_WINDOW.

    Inherit Dialog

      inherit GTK.Dialog : Dialog

    Method create

      `GTK.InputDialog GTK.InputDialog()`

    Description

      Create a new input dialog window.

    Method get_close_button

      `GTK.Button get_close_button()`

    Description

      The 'close' button of the dialog.

    Method get_save_button

      `GTK.Button get_save_button()`

    Description

      The 'save' button of the dialog.

  CLASS GTK.Packer

    Inherit Container

      inherit GTK.Container : Container

    Method add

      `GTK.Packer add(GTK.Widget widget, int side, int anchor, int options, int border_width, int pad_x, int pad_y, int i_pad_x, int i_pad_y)`

    Description

      side is one of SIDE_BOTTOM , SIDE_LEFT , SIDE_RIGHT and SIDE_TOP , anchor is one of ANCHOR_CENTER , ANCHOR_E , ANCHOR_EAST , ANCHOR_N , ANCHOR_NE , ANCHOR_NORTH , ANCHOR_NORTH_EAST , ANCHOR_NORTH_WEST , ANCHOR_NW , ANCHOR_S , ANCHOR_SE , ANCHOR_SOUTH , ANCHOR_SOUTH_EAST , ANCHOR_SOUTH_WEST , ANCHOR_SW , ANCHOR_W and ANCHOR_WEST , options is a bitwise or of GTK.PackExpand, GTK.FillX and GTK.FillY

    Method add_defaults

      `GTK.Packer add_defaults(GTK.Widget widget, int side, int anchor, int options)`

    Description

      side is one of SIDE_BOTTOM , SIDE_LEFT , SIDE_RIGHT and SIDE_TOP , anchor is one of ANCHOR_CENTER , ANCHOR_E , ANCHOR_EAST , ANCHOR_N , ANCHOR_NE , ANCHOR_NORTH , ANCHOR_NORTH_EAST , ANCHOR_NORTH_WEST , ANCHOR_NW , ANCHOR_S , ANCHOR_SE , ANCHOR_SOUTH , ANCHOR_SOUTH_EAST , ANCHOR_SOUTH_WEST , ANCHOR_SW , ANCHOR_W and ANCHOR_WEST , options is a bitwise or of GTK.PackExpand, GTK.FillX and GTK.FillY

    Method create

      `GTK.Packer GTK.Packer()`

    Method get_default_border_width

      `int get_default_border_width()`

    Method get_default_i_pad_x

      `int get_default_i_pad_x()`

    Method get_default_i_pad_y

      `int get_default_i_pad_y()`

    Method get_default_pad_x

      `int get_default_pad_x()`

    Method get_default_pad_y

      `int get_default_pad_y()`

    Method get_spacing

      `int get_spacing()`

    Method reorder_child

      `GTK.Packer reorder_child(GTK.Widget child, int pos)`

    Method set_child_packing

      `GTK.Packer set_child_packing(GTK.Widget child, int side, int anchor, int options, int border_width, int pad_x, int pad_y, int i_pad_x, int i_pad_y)`

    Description

      side is one of SIDE_BOTTOM , SIDE_LEFT , SIDE_RIGHT and SIDE_TOP , anchor is one of ANCHOR_CENTER , ANCHOR_E , ANCHOR_EAST , ANCHOR_N , ANCHOR_NE , ANCHOR_NORTH , ANCHOR_NORTH_EAST , ANCHOR_NORTH_WEST , ANCHOR_NW , ANCHOR_S , ANCHOR_SE , ANCHOR_SOUTH , ANCHOR_SOUTH_EAST , ANCHOR_SOUTH_WEST , ANCHOR_SW , ANCHOR_W and ANCHOR_WEST , options is a bitwise or of GTK.PackExpand, GTK.FillX and GTK.FillY

    Method set_default_border_width

      `GTK.Packer set_default_border_width(int border)`

    Method set_default_ipad

      `GTK.Packer set_default_ipad(int xpad, int ypad)`

    Method set_default_pad

      `GTK.Packer set_default_pad(int xpad, int ypad)`

    Method set_spacing

      `GTK.Packer set_spacing(int new_spacing)`

  CLASS GTK.RadioMenuItem

    Description

      Exactly like W(RadioButton), but it is an menu item. `GTK.RadioMenuItem("Menu item")`

    Inherit MenuItem

      inherit GTK.MenuItem : MenuItem

    Method create

      `GTK.RadioMenuItem GTK.RadioMenuItem(string|void title, GTK.RadioMenuItem groupmember)`

    Description

      object GTK.RadioMenuItem(string title) - First button (with label) object GTK.RadioMenuItem()->add(widget) - First button (with widget) object GTK.RadioMenuItem(title, another_radio_button) - Second to n:th button (with title) object GTK.RadioMenuItem(0,another_radio_button)->add(widget) - Second to n:th button (with widget)

    Method set_group

      `GTK.RadioMenuItem set_group(GTK.RadioMenuItem groupmember)`

    Description

      the argument is another radio menu item to whose group this button should be added to. It is prefereable to use the second argument to the constructor instead, but if you for some reason want to move the button to another group, use this function.

  CLASS GTK.Clist

    Description

      The GtkCList widget is a multi-column list widget that is capable of handling literally thousands of rows of information. Each column can optionally have a title, which itself is optionally active, allowing us to bind a function to it's selection. `GTK.Clist(2)->set_column_title(0,"Col 1")->set_column_title(1,"Col 2")->column_titles_show()->set_column_width(0,50)->set_usize(150,70)`

      Signals: abort_column_resize

      click_column Called when a column is clicked

      end_selection

      extend_selection

      resize_column Called when a column is resized

      scroll_horizontal

      scroll_vertical

      select_all

      select_row Called when a row is selected

      start_selection

      toggle_add_mode

      toggle_focus_row

      undo_selection

      unselect_all

      unselect_row Called when a row is deselected

    Inherit Container

      inherit GTK.Container : Container

    Method append

      `int append(array columns)`

    Description

      The return value of indicates the index of the row that was just added.

      'columns' are the texts we want to put in the columns. The size of the array should equal the number of columns in the list.

    Method clear

      `GTK.Clist clear()`

    Description

      remove all rows

    Method column_title_active

      `GTK.Clist column_title_active(int column)`

    Description

      Make a specific column title active

    Method column_title_passive

      `GTK.Clist column_title_passive(int column)`

    Description

      Make a specific column title passive

    Method column_titles_active

      `GTK.Clist column_titles_active()`

    Description

      The column titles can be pressed

    Method column_titles_hide

      `GTK.Clist column_titles_hide()`

    Description

      Hide the column titles

    Method column_titles_passive

      `GTK.Clist column_titles_passive()`

    Description

      The column titles can't be pressed

    Method column_titles_show

      `GTK.Clist column_titles_show()`

    Description

      Show the column titles.

    Method columns_autosize

      `int columns_autosize()`

    Description

      Resize all columns according to their contents

    Method create

      `GTK.Clist GTK.Clist(int columns)`

    Description

      Create a new empty clist, columns columns wide.

      Not all columns have to be visible, some can be used to store data that is related to a certain cell in the list.

    Method find_row_from_data

      `int find_row_from_data(object data)`

    Description

      Find a row in the list that has the given user data. If no node is found, -1 is returned.

    Method freeze

      `GTK.Clist freeze()`

    Description

      freeze all visual updates of the list, and then thaw the list after you have made a number of changes and the updates wil occure in a more efficent mannor than if you made them on a unfrozen list

    Method get_background

      `GDK.Color get_background(int row)`

    Description

      Return the background color of a specified row

    Method get_cell_style

      `GTK.Style get_cell_style(int row, int col)`

    Description

      return the W(Style) associated with a specific cell

    Method get_cell_type

      `int get_cell_type(int row, int column)`

    Description

      Return value is one of CELL_EMPTY , CELL_PIXMAP , CELL_PIXTEXT , CELL_TEXT and CELL_WIDGET

    Method get_column_title

      `string get_column_title(int column)`

    Description

      Returns the title of a specified column.

    Method get_column_widget

      `GTK.Widget get_column_widget(int column)`

    Description

      Return the widget for the specified column title

    Method get_columns

      `int get_columns()`

    Description

      Return the number of columns in this clist

    Method get_drag_button

      `int get_drag_button()`

    Description

      Return the button used to drag items (by default 1)

    Method get_flags

      `int get_flags()`

    Description

      Return the flags. A bitwise or of CLIST_ADD_MODE , CLIST_AUTO_RESIZE_BLOCKED , CLIST_AUTO_SORT , CLIST_DRAW_DRAG_LINE , CLIST_DRAW_DRAG_RECT , CLIST_IN_DRAG , CLIST_REORDERABLE , CLIST_ROW_HEIGHT_SET , CLIST_SHOW_TITLES and CLIST_USE_DRAG_ICONS

    Method get_focus_row

      `int get_focus_row()`

    Description

      The currently focused row

    Method get_foreground

      `GDK.Color get_foreground(int row)`

    Description

      Return the foregroun color for the specified row

    Method get_hadjustment

      `GTK.Adjustment get_hadjustment()`

    Description

      Return the W(Adjustment) object used for horizontal scrolling

    Method get_pixmap

      `GTK.Clist get_pixmap(int row, int column)`

    Description

      Return the pixmap for the specified cell

    Method get_pixtext

      `mapping get_pixtext(int row, int col)`

    Description

      Return the pixmap and text for the specified cell as a mapping: ([ "spacing":spacing, "text":text, "pixmap":pixmap ])

    Method get_row_data

      `object get_row_data(int row)`

    Description

      Return the data associated with a row, or 0.

    Method get_row_height

      `int get_row_height()`

    Description

      Return the height of the row

    Method get_row_style

      `GTK.Style get_row_style(int row)`

    Description

      Return the W(style) object associated with the specified row

    Method get_rows

      `int get_rows()`

    Description

      Return the number of rows

    Method get_selectable

      `int get_selectable(int row)`

    Description

      Return 1 if the specified row can be selected by the user.

    Method get_selection

      `array get_selection()`

    Description

      Return an array with all selected rows.

    Method get_selection_info

      `mapping get_selection_info(int x, int y)`

    Description

      Return the row column corresponding to the x and y coordinates, the returned values are only valid if the x and y coordinates are relative to the clist window coordinates

    Method get_selection_mode

      `int get_selection_mode()`

    Description

      Return the selection mode. One of SELECTION_BROWSE , SELECTION_EXTENDED , SELECTION_MULTIPLE and SELECTION_SINGLE

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      Return the curreent shadow type. One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method get_sort_column

      `int get_sort_column()`

    Description

      The column that will be used to sort the rows

    Method get_sort_type

      `int get_sort_type()`

    Description

      The sort method, one of SORT_ASCENDING and SORT_DESCENDING

    Method get_text

      `GTK.Clist get_text(int row, int col)`

    Description

      Return the text associated with a specific cell.

    Method get_vadjustment

      `GTK.Adjustment get_vadjustment()`

    Description

      Return the W(Adjustment) object used for vertical scrolling

    Method insert

      `int insert(int row, array columns)`

    Description

      Insert a row after a specified row. The return value of indicates the index of the row that was just added, please note that this is not nessasarily the same row as the specified one, if autosort is activated, the row will be inserted so that the list is sill sorted.

      'columns' are the texts we want to put in the columns. The size of the array should equal the number of columns in the list.

    Method moveto

      `GTK.Clist moveto(int row, int column, float xpos, float ypos)`

    Description

      Make the specified row and column visible, and place it relative to xpos and ypos in the area the Clist occupies. xpos and ypos are relative, 0.0 == top, 1.0 == bottom

    Method optimal_column_width

      `int optimal_column_width(int column)`

    Description

      Return the optimal width of the specified column

    Method prepend

      `int prepend(array columns)`

    Description

      The return value of indicates the index of the row that was just added.

      'columns' are the texts we want to put in the columns. The size of the array should equal the number of columns in the list.

    Method remove

      `GTK.Clist remove(int row)`

    Description

      Delete a specified row. If you want to remove all rows in a Clist, use 'clear()' instead of calling remove multiple times.

    Method row_move

      `GTK.Clist row_move(int from_row, int to_row)`

    Description

      Move the specified row to just before the specified destination row.

    Method select_all

      `GTK.Clist select_all()`

    Description

      Select all rows

    Method select_row

      `GTK.Clist select_row(int row, int column)`

    Description

      Select the given row. The column is sent to the signal handler, but ignored for all other purposes.

    Method set_auto_sort

      `GTK.Clist set_auto_sort(int sortp)`

    Description

      If true, the clist will automatically be re-sorted when new rows are inserted. Please note that it will not be resorted if the text in cells are changed, use 'sort()' to force a reorder. The sort function is stable.

    Method set_background

      `GTK.Clist set_background(int row, GDK.Color color)`

    Description

      Set the background color of the specified row the the specified color

    Method set_button_actions

      `GTK.Clist set_button_actions(int button, int action)`

    Description

      Action is a bitwise or of BUTTONBOX_DEFAULT_STYLE , BUTTONBOX_EDGE , BUTTONBOX_END , BUTTONBOX_SPREAD , BUTTONBOX_START , BUTTON_DRAGS , BUTTON_EXPANDS , BUTTON_IGNORED and BUTTON_SELECTS Button is the mouse button (normally 1-3, 4 and 5 sometimes beeing scroll wheel up and scroll wheel down)

    Method set_cell_style

      `GTK.Clist set_cell_style(int row, int column, GTK.Style style)`

    Description

      Set a W(Style) for a specific cell

    Method set_column_auto_resize

      `GTK.Clist set_column_auto_resize(int column, int autoresizep)`

    Description

      Automatically resize a column to the width of it's widest contents.

    Method set_column_justification

      `GTK.Clist set_column_justification(int column, int justification)`

    Description

      justification is one of JUSTIFY_CENTER , JUSTIFY_FILL , JUSTIFY_LEFT and JUSTIFY_RIGHT

    Method set_column_max_width

      `GTK.Clist set_column_max_width(int column, int width)`

    Description

      if width 6lt; 0 , there is no restriction

    Method set_column_min_width

      `GTK.Clist set_column_min_width(int column, int width)`

    Description

      Width in pixels

    Method set_column_resizeable

      `GTK.Clist set_column_resizeable(int column, int resizeablep)`

    Description

      Make a column resizable, or remove it's the resizability.

    Method set_column_title

      `GTK.Clist set_column_title(int column, string title)`

    Description

      Set the column title of a specified column. It is a good idea to set the titles before the column title buttons are shown.

    Method set_column_visibility

      `GTK.Clist set_column_visibility(int column, int visiblep)`

    Description

      Hide or show a column

    Method set_column_widget

      `GTK.Clist set_column_widget(int column, GTK.Widget widget)`

    Description

      Put a widget as a column title. The widget will be added to a W(Button).

    Method set_column_width

      `GTK.Clist set_column_width(int column, int width)`

    Description

      Width in pixels

    Method set_compare_func

      `GTK.Clist set_compare_func(function cmpfun)`

    Description

      Set the compare function. The function will be called with a mapping as it's only argument, like this:

             ([
                "clist":the clist widget,
                "sort_column":the column to sort on,
                "row1_data":The user data pointer for the first row,
                "row2_data":The user data pointer for the second row,
                "row1_text":The text in the sort cell in the first row
                "row2_text":The text in the sort cell in the second row
             ])

      The return value is one of: 1: Row 1 is more than row 2 0: The rows are equal -1: Row 1 is lesser than row 2 To remove the comparefunction, use 0 as the argument.

    Method set_foreground

      `GTK.Clist set_foreground(int row, GDK.Color color)`

    Description

      Set the foreground color of the specified row to the specified color

    Method set_hadjustment

      `GTK.Clist set_hadjustment(GTK.Adjustment adjustment)`

    Description

      Set the W(Adjustment) object used for horizontal scrolling

    Method set_pixmap

      `GTK.Clist set_pixmap(int row, int col, GDK.Pixmap image, GDK.Bitmap mask)`

    Description

      Set the pixmap of the specified cell. The mask is optional

    Method set_pixtext

      `GTK.Clist set_pixtext(int row, int column, string text, int spacing, GDK.Pixmap image, GDK.Bitmap mask)`

    Description

      Set the pixmap and text of the specified cell. The mask is optional The spacing is the number of pixels between the pixmap and the text.

    Method set_reorderable

      `GTK.Clist set_reorderable(int reorderablep)`

    Description

      If true, the user can drag around the rows in the list.

    Method set_row_data

      `GTK.Clist set_row_data(int row, object data)`

    Description

      Set the user data associated with the specified row. This data can be used to find rows, and when a row is selected it can be easily retrieved using node_get_row_data.

      You can only use objects as row data right now

    Method set_row_height

      `GTK.Clist set_row_height(int pixels)`

    Description

      in pixels

    Method set_row_style

      `GTK.Clist set_row_style(int row, GTK.Style style)`

    Method set_selectable

      `GTK.Clist set_selectable(int row, int selectablep)`

    Description

      If true, the row can be selected by the user, otherwise it cannot be selected, only focused.

    Method set_selection_mode

      `GTK.Clist set_selection_mode(int mode)`

    Description

      One of SELECTION_BROWSE , SELECTION_EXTENDED , SELECTION_MULTIPLE and SELECTION_SINGLE

    Method set_shadow_type

      `GTK.Clist set_shadow_type(int shadowtype)`

    Description

      One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_shift

      `GTK.Clist set_shift(int row, int column, int yshift, int xshift)`

    Description

      The contents of the specified cell will be drawn shifted (indented) the specifid number of pixels.

      This can be useful to generate a tree-like layout when you do not want to make a W(Ctree)

    Method set_sort_column

      `GTK.Clist set_sort_column(int column)`

    Method set_sort_type

      `GTK.Clist set_sort_type(int direction)`

    Description

      Ascending or descending (One of SORT_ASCENDING and SORT_DESCENDING )

    Method set_text

      `GTK.Clist set_text(int row, int column, string text)`

    Description

      Set the text for the specified cell. Please note that even if auto sorting is enabled, the row will not be resorted. Use the 'sort()' function.

    Method set_use_drag_icons

      `GTK.Clist set_use_drag_icons(int dragiconsp)`

    Description

      If true, hard coded drag icons will be used.

    Method set_vadjustment

      `GTK.Clist set_vadjustment(GTK.Adjustment adjustment)`

    Description

      Set the W(Adjustment) object used for vertical scrolling

    Method sort

      `GTK.Clist sort()`

    Description

      Set the column on which all sorting will be performed

    Method thaw

      `GTK.Clist thaw()`

    Description

      freeze all visual updates of the list, and then thaw the list after you have made a number of changes and the updates wil occure in a more efficent mannor than if you made them on a unfrozen list

    Method undo_selection

      `GTK.Clist undo_selection()`

    Description

      Undo the previous selection

    Method unselect_all

      `GTK.Clist unselect_all()`

    Description

      Unselect all rows

    Method unselect_row

      `GTK.Clist unselect_row(int row, int column)`

    Description

      Unselect the given row. The column is sent to the signal handler, but ignored for all other purposes.

  CLASS GTK.MenuBar

    Description

      Basically a horizontal W(Menu). The menu image cannot be grabbed automatically, but this is how you would create a menu all in one line. This is not the recommended coding style. `GTK.MenuBar()->add(GTK.Menu_item("Menu")->set_submenu(GTK.Menu()->add(GTK.Menu_item("Sub")))->select()->activate())->add(GTK.Menu_item("Bar"))`

    Inherit MenuShell

      inherit GTK.MenuShell : MenuShell

    Method append

      `GTK.MenuBar append(GTK.Widget menu)`

    Method create

      `GTK.MenuBar GTK.MenuBar()`

    Method insert

      `GTK.MenuBar insert(GTK.Widget menu, int position)`

    Method prepend

      `GTK.MenuBar prepend(GTK.Widget menu)`

    Method set_shadow_type

      `GTK.MenuBar set_shadow_type(int int)`

  CLASS GTK.CheckButton

    Description

      Check buttons inherent many properties and functions from the the toggle buttons, but look a little different. Rather than being buttons with text inside them, they are small squares with the text to the right of them. These are often used for toggling options on and off in applications. `GTK.Check_button( "title" )`

    Inherit ToggleButton

      inherit GTK.ToggleButton : ToggleButton

    Method create

      `GTK.CheckButton GTK.CheckButton(string|void label)`

    Description

      The argument, if specified, is the label of the item. If no label is specified, use object->add() to add some other widget (such as an pixmap or image widget)

  CLASS GTK.AccelLabel

    Description

      A label for accelerators.

    Inherit Label

      inherit GTK.Label : Label

    Method create

      `GTK.AccelLabel GTK.AccelLabel(string text)`

    Method get_accel_width

      `int get_accel_width()`

    Method refetch

      `int refetch()`

    Method set_accel_widget

      `GTK.AccelLabel set_accel_widget(GTK.Widget accel_widget)`

  CLASS GTK.Window

    Description

      The basic window. Nothing much to say about it. It can only contain one child widget. Show the main window last to avoid annoying flashes when the subwidget (and it's subwidgets) are added to it, this is done automatically by calling 'window->show_all' when you are done with your widget packing.

      Signals: move_resize

      set_focus

    Inherit Bin

      inherit GTK.Bin : Bin

    Method activate_default

      `int activate_default()`

    Description

      Activate the default widget

    Method activate_focus

      `int activate_focus()`

    Description

      Activate the focus widget

    Method add_accel_group

      `GTK.Window add_accel_group(GTK.AccelGroup group)`

    Description

      This function adds an accelerator group to the window. The shortcuts in the table will work in the window, it's child, and all children of it's child that do not select keyboard input.

    Method add_embedded_xid

      `GTK.Window add_embedded_xid(int x_window_id)`

    Description

      Add an embedded X-window

    Method create

      `GTK.Window GTK.Window(int window_type)`

    Description

      Argument is one of WINDOW_DIALOG , WINDOW_POPUP and WINDOW_TOPLEVEL

    Method get_allow_grow

      `int get_allow_grow()`

    Description

      If true, the window can grow if nessesary

    Method get_allow_shrink

      `int get_allow_shrink()`

    Description

      If true, the window can be shrunk by the user

    Method get_auto_shrink

      `int get_auto_shrink()`

    Description

      If true, the window will shrink if possible

    Method get_default_widget

      `GTK.Widget get_default_widget()`

    Description

      The default widget

    Method get_focus_widget

      `GTK.Widget get_focus_widget()`

    Description

      The focus widget

    Method get_modal

      `int get_modal()`

    Description

      If true, this is a modal dialog window

    Method get_title

      `string get_title()`

    Description

      The title of the window

    Method get_transient_parent

      `GTK.Window get_transient_parent()`

    Description

      The parent window for this window if this is a transient window, 0 otherwise.

    Method get_type

      `int get_type()`

    Description

      The window type, one of WINDOW_DIALOG , WINDOW_POPUP and WINDOW_TOPLEVEL

    Method get_wmclass_class

      `string get_wmclass_class()`

    Description

      The window manager class of this application.

    Method get_wmclass_name

      `string get_wmclass_name()`

    Description

      The window manager name of this application.

    Method lower

      `GTK.Window lower()`

    Description

      Lower this window if the window manager allows that.

    Method raise

      `GTK.Window raise()`

    Description

      Raise this window if the window manager allows that.

    Method remove_accel_group

      `GTK.Window remove_accel_group(GTK.AccelGroup table)`

    Description

      Remove a previously installed table.

    Method remove_embedded_xid

      `GTK.Window remove_embedded_xid(int x_window_id)`

    Description

      Remove the embeded X window

    Method set_default

      `GTK.Window set_default(GTK.Widget default_widget)`

    Description

      Set the default widget to the specified widget. The specified widget must have the GTK.CanDefault flag set.

    Method set_default_size

      `GTK.Window set_default_size(int width, int height)`

    Description

      The following differs from set_usize, in that set_usize() overrides the requisition, and thus sets a minimum size, while this only sets the size requested from the WM.

    Method set_focus

      `GTK.Window set_focus(GTK.Widget child)`

    Description

      Set the focus widget to the specified child. Please note that this is normaly handled automatically.

    Method set_icon

      `GTK.Window set_icon(GDK.Pixmap p, GDK.Bitmap b, GDK.Window w)`

    Description

      Set the icon to the specified image (with mask) or the specified GDK.Window. It is up to the window manager to display the icon. Most window manager handles window and pixmap icons, but only a few can handle the mask argument. If you want a shaped icon, the only safe bet is a shaped window.

    Method set_icon_name

      `GTK.Window set_icon_name(string name)`

    Description

      Set the icon name to the specified string.

    Method set_modal

      `GTK.Window set_modal(int modalp)`

    Description

      / Is this a modal dialog?

    Method set_policy

      `GTK.Window set_policy(int allow_shrink, int allow_grow, int auto_shrink)`

    Description

      If allow shrink is true, the user can resize the window to a smaller size. If allow_grow is true, the window can resize itself, and the user can resize the window, to a bigger size. It auto shrink is true, the window will resize itself to a smaller size when it's subwidget is resized.

    Method set_position

      `GTK.Window set_position(int pos)`

    Description

      one of WINDOW_DIALOG , WINDOW_POPUP , WINDOW_TOPLEVEL , WIN_POS_CENTER , WIN_POS_MOUSE and WIN_POS_NONE

    Method set_title

      `GTK.Window set_title(string title)`

    Description

      Set the window title. The default title is the value sent to setup_gtk, or if none is sent, Pike GTK.

    Method set_transient_for

      `GTK.Window set_transient_for(GTK.Window parent)`

    Description

      Mark this window as a transient window for the parent window. Most window managers renders transient windows differently (different borders, sometimes no resize widgets etc)

      Useful for short lived dialogs.

    Method set_wmclass

      `GTK.Window set_wmclass(string name, string class)`

    Description

      Set the window manager application name and class.

  CLASS GTK.Combo

    Description

      Thee combo box is another fairly simple widget that is really just a collection of other widgets. From the user's point of view, the widget consists of a text entry box and a pull down menu from which the user can select one of a set of predefined entries. Alternatively, the user can type a different option directly into the text box.

      The combo box has two principal parts that you as the programmer really care about: The W(entry) and the W(list).

      `GTK.Combo()`

    Inherit Hbox

      inherit GTK.Hbox : Hbox

    Method create

      `GTK.Combo GTK.Combo()`

    Description

      Create a new combo box

    Method disable_activate

      `GTK.Combo disable_activate()`

    Description

      This will disable the 'activate' signal for the entry widget in the combo box.

    Method get_entry

      `GTK.Entry get_entry()`

    Description

      The entry widget

    Method set_case_sensitive

      `GTK.Combo set_case_sensitive(int sensitivep)`

    Description

      set_case_sensitive() toggles whether or not GTK searches for entries in a case sensitive manner. This is used when the Combo widget is asked to find a value from the list using the current entry in the text box. This completion can be performed in either a case sensitive or insensitive manner, depending upon the use of this function. The Combo widget can also simply complete the current entry if the user presses the key combination MOD-1 and "Tab". MOD-1 is often mapped to the "Alt" key, by the xmodmap utility. Note, however that some window managers also use this key combination, which will override its use within GTK.

    Method set_item_string

      `GTK.Combo set_item_string(GTK.Item item, string text)`

    Description

      The item is one of the ones in the list subwidget.

    Method set_popdown_strings

      `GTK.Combo set_popdown_strings(array strings)`

    Description

      Set the values in the popdown list.

    Method set_use_arrows

      `GTK.Combo set_use_arrows(int use_arrows)`

    Description

      set_use_arrows() lets the user change the value in the entry using the up/down arrow keys. This doesn't bring up the list, but rather replaces the current text in the entry with the next list entry (up or down, as your key choice indicates). It does this by searching in the list for the item corresponding to the current value in the entry and selecting the previous/next item accordingly. Usually in an entry the arrow keys are used to change focus (you can do that anyway using TAB). Note that when the current item is the last of the list and you press arrow-down it changes the focus (the same applies with the first item and arrow-up).

    Method set_use_arrows_always

      `GTK.Combo set_use_arrows_always(int always_arrows)`

    Description

      set_use_arrows_always() allows the use the the up/down arrow keys to cycle through the choices in the dropdown list, just as with set_use_arrows, but it wraps around the values in the list, completely disabling the use of the up and down arrow keys for changing focus.

    Method set_value_in_list

      `GTK.Combo set_value_in_list(int value_must_be_in_list, int ok_if_empty)`

    Description

      If value_must_be_in_list is true, the user will not be able to enter any value that is not in the list. If ok_if_empty is true, empty values are possible as well as the values in the list.

  CLASS GTK.Calendar

    Description

      A calendar widget. `GTK.Calendar();`

      `GTK.Calendar()->select_day( 16 );`

      Signals: day_selected

      day_selected_double_click

      month_changed

      next_month

      next_year

      prev_month

      prev_year

    Inherit Widget

      inherit GTK.Widget : Widget

    Method clear_marks

      `GTK.Calendar clear_marks()`

    Description

      Remove all day markers

    Method create

      `GTK.Calendar GTK.Calendar()`

    Description

      Create a new calendar widget

    Method display_options

      `GTK.Calendar display_options(int options)`

    Description

      Bitwise or of one or more of CALENDAR_NO_MONTH_CHANGE , CALENDAR_SHOW_DAY_NAMES , CALENDAR_SHOW_HEADING , CALENDAR_SHOW_WEEK_NUMBERS and CALENDAR_WEEK_START_MONDAY .

    Method freeze

      `GTK.Calendar freeze()`

    Description

      Suspend all dynamic updating of the widget

    Method get_date

      `mapping get_date()`

    Description

      returns a mapping: ([ "year":year, "month":month, "day":day ])

    Method get_day

      `array get_day()`

    Description

      Return an array of 6x7 days, representing the cells in the currently viewed calendar month.

    Method get_day_month

      `array get_day_month()`

    Description

      Return an array of 6x7 days, representing the cells in the currently viewed calendar month. The value is the day of month.

    Method get_focus_col

      `int get_focus_col()`

    Description

      The currently focused column

    Method get_focus_row

      `int get_focus_row()`

    Description

      The currently focused row

    Method get_highlight_col

      `int get_highlight_col()`

    Description

      The currently highlighted column

    Method get_highlight_row

      `int get_highlight_row()`

    Description

      The currently highlighted row

    Method get_marked_dates

      `array get_marked_dates()`

    Description

      Returns an array (with 31 elements) with 1es and 0es.

    Method get_month

      `int get_month()`

    Description

      The current month

    Method get_num_marked_dates

      `int get_num_marked_dates()`

    Description

      The number of days that are marked

    Method get_selected_day

      `int get_selected_day()`

    Description

      The currently selected day

    Method get_year

      `int get_year()`

    Description

      The current year

    Method mark_day

      `GTK.Calendar mark_day(int day_of_month)`

    Description

      Mark a day

    Method select_day

      `GTK.Calendar select_day(int day_of_month)`

    Description

      Select a certain day of the currently selected month

    Method select_month

      `int select_month(int month, int year)`

    Description

      Select the month to be viewed.

    Method set_marked_date_color

      `GTK.Calendar set_marked_date_color(int index, GDK.Color color)`

    Description

      Set the color to use to mark dates

    Method thaw

      `GTK.Calendar thaw()`

    Description

      Resume dynamic updating of the widget

    Method unmark_day

      `GTK.Calendar unmark_day(int day_of_month)`

    Description

      Unmark a day

  CLASS GTK.Dial

    Description

      This widget provides an analog dial widget, similar to, for example, a physical volume control on a stereo. Dial values can be changable or read-only for value reporting. `GTK.Dial( GTK.Adjustment() );`

      `GTK.Dial( GTK.Adjustment(10.0) )->set_percentage(0.4);`

    Inherit Widget

      inherit GTK.Widget : Widget

    Method create

      `GTK.Dial GTK.Dial(GTK.Adjustment adjustment)`

    Method get_adjustment

      `GTK.Adjustment get_adjustment()`

    Method get_percentage

      `float get_percentage()`

    Description

      Retrieves the current percentage held in the dial widget.

    Method get_value

      `float get_value()`

    Description

      Retrieves the current value helt in the dial widget.

    Method set_adjustment

      `GTK.Dial set_adjustment(GTK.Adjustment pos)`

    Description

      set_adjustment() does absolutely nothing if you pass it the adjustment that range is already using, regardless of whether you changed any of its fields or not. If you pass it a new Adjustment, it will unreference the old one if it exists (possibly destroying it), connect the appropriate signals to the new one, and call the private function gtk_range_adjustment_changed(), which will (or at least, is supposed to...) recalculate the size and/or position of the slider and redraw if necessary.

    Method set_percentage

      `GTK.Dial set_percentage(float percent)`

    Description

      Sets the GTK.Dial's value to percent of dial->adjustment->upper. The upper value is set when the GtkAdjustment is created.

    Method set_update_policy

      `GTK.Dial set_update_policy(int when)`

    Description

      The "update policy" of a range widget defines at what points during user interaction it will change the value field of its Adjustment and emit the "value_changed" signal on this Adjustment. The update policies are:

      GTK.UpdatePolicyContinuous

        This is the default. The "value_changed" signal is emitted continuously, i.e., whenever the slider is moved by even the tiniest amount.

      GTK.UpdatePolicyDiscontinuous

        The "value_changed" signal is only emitted once the slider has stopped moving and the user has released the mouse button.

      GTK.UpdatePolicyDelayed

        The "value_changed" signal is emitted when the user releases the mouse button, or if the slider stops moving for a short period of time.

    Method set_value

      `float set_value(float to)`

    Description

      Sets the current value held in the GtkDial's adjustment object to value. Returns the new percentage of value to the adjustment's upper limit.

    Method set_view_only

      `GTK.Dial set_view_only(int view_only)`

    Description

      Specifies whether or not the user is to be able to edit the value represented by the dial widget. If view_only is TRUE, the dial will be set to view-only mode, and the user will not be able to edit it. If view_only is FALSE, the user will be able to change the valuerepresented.

  CLASS GTK.Hseparator

    Description

      Simply creates a horizontal separator. No bells or whistles. `GTK.Hseparator()->set_usize(300,3)`

    Inherit Separator

      inherit GTK.Separator : Separator

    Method create

      `GTK.Hseparator GTK.Hseparator()`

    Description

      Used to create a new hseparator widget.

  CLASS GTK.Object

    Description

      The basic GTK class. All other GTK classes inherit this class. The only user-callable functions are the signal related ones.

      Signals: destroy Called when the object is destroyed

    Method destroy

      `GTK.Object destroy()`

    Method signal_block

      `GTK.Object signal_block(mixed signal_id)`

    Description

      Temporarily block a signal handler. No signals will be received while the hander is blocked. See signal connect for more info.

    Method signal_connect

      `mixed signal_connect(string signal, function callback, mixed|void callback_arg)`

    Description

      Connect a signal to a pike function. The function will be called with the last argument to this function as it's first argument (defaults to 0), the second argument is always the widget, any other arguments are the ones supplied by GTK.

      The return value of this function can be used to remove a signal with signal_disconnect, and block and unblock the signal will signal_block and signal_unblock.

    Method signal_connect_new

      `mixed signal_connect_new(string signal, function callback, mixed|void callback_arg)`

    Description

      Connect a signal to a pike function.

      This function differs from the signal_connect function in how it calls the callback function.

      The old interface:

             void signal_handler( mixed my_arg, GTK.Object object,
                                  mixed ... signal_arguments )

      The new interface:

             void signal_handler( mixed ... signal_arguments,
                                  mixed my_arg, GTK.Object object )

      The return value of this function can be used to remove a signal with signal_disconnect, and block and unblock the signal will signal_block and signal_unblock.

    Method signal_disconnect

      `GTK.Object signal_disconnect(mixed signal_id)`

    Description

      Remove a signal formerly added by signal_connect. The argument is the return value of signal_connect(). See signal connect for more info.

    Method signal_emit

      `GTK.Object signal_emit(string signal_name)`

    Description

      Halt the emit of the current named signal. Useful in signal handlers when you want to override the behaviour of some default signal handler (key press events, as an example) See signal_connect.

    Method signal_unblock

      `GTK.Object signal_unblock(mixed signal_id)`

    Description

      Unblock a formerly blocked signal handler. See signal_block and signal_connect for more info.

  CLASS GTK.Plug

    Description

      Together with W(Socket), GTK.Plug provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a W(Socket) widget and, passes the XID of that widgets window to the other process, which then creates a GTK.Plug window with that XID. Any widgets contained in the GTK.Plug then will appear inside the first applications window.

    Inherit Window

      inherit GTK.Window : Window

    Method create

      `GTK.Plug GTK.Plug(int socket_id)`

    Description

      Create a new plug, the socket_id is the window into which this plug will be plugged.

    Method get_same_app

      `int get_same_app()`

    Description

      returns 1 if the socket the plug is connected to is in this application.

  CLASS GTK.Socket

    Description

      Together with W(Plug), GTK.Socket provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a GTK.Socket widget and, passes the XID of that widget's window to the other process, which then creates a W(Plug) window with that XID. Any widgets contained in the W(Plug) then will appear inside the first applications window.

      Note that if you pass the XID of the socket to another process that will create a plug in the socket, you must make sure that the socket widget is not destroyed until that plug is created. Violating this rule will cause unpredictable consequences, the most likely consequence being that the plug will appear as a separate toplevel window.

      A socket can also be used to swallow arbitrary pre-existing top-level windows using steal(), though the integration when this is done will not be as close as between a W(Plug) and a GTK.Socket.

    Inherit Container

      inherit GTK.Container : Container

    Method create

      `GTK.Socket GTK.Socket()`

    Method get_same_app

      `int get_same_app()`

    Description

      return 1 if the widow contained in this socket comes from this process.

    Method has_plug

      `int has_plug()`

    Description

      Returns true if this socket is occupied

    Method id

      `int id()`

    Description

      Returns the window id, to be sent to the application providing the plug. You must realize this widget before calling this function.

    Method steal

      `GTK.Socket steal(int window_id)`

    Description

      Reparents a pre-existing toplevel window (not nessesarily a GTK window) into a socket.

  CLASS GTK.Menu

    Description

      A GTK.Menu is a W(MenuShell) that implements a drop down menu consisting of a list of W(MenuItem) objects which can be navigated and activated by the user to perform application functions.

      A GTK.Menu is most commonly dropped down by activating a W(MenuItem) in a W(MenuBar) or popped up by activating a W(MenuItem) in another GTK.Menu.

      A GTK.Menu can also be popped up by activating a W(OptionMenu). Other composite widgets such as the W(Notebook) can pop up a GTK.Menu as well.

      Applications can display a GTK.Menu as a popup menu by calling the popup() function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.

             GTK.Menu menu = create_menu();
             GTK.Window window = create_window();
             window->signal_connect( "button_press_event", lambda(GTK.Menu m,
                                                                  GTK.Window w,
                                                                  mapping e ) {
                       if( e->button == 3 )
                        menu->popup();
                    }, menu );

    Inherit MenuShell

      inherit GTK.MenuShell : MenuShell

    Method append

      `GTK.Menu append(GTK.Widget widget)`

    Description

      Adds a new W(MenuItem) to the end of the menu's item list.

    Method attach_to_widget

      `GTK.Menu attach_to_widget(GTK.Widget widget)`

    Description

      Attach the menu to a widget

    Method create

      `GTK.Menu GTK.Menu()`

    Description

      Create a new GTK.Menu widget.

    Method detach

      `GTK.Menu detach()`

    Description

      Detaches the menu from the widget to which it had been attached.

    Method get_active

      `GTK.Widget get_active()`

    Description

      Returns the selected menu item from the menu. This is used by the W(OptionMenu).

    Method get_attach_widget

      `GTK.Widget get_attach_widget()`

    Description

      Returns the W(Widget) that the menu is attached to.

    Method get_torn_off

      `int get_torn_off()`

    Description

      return 1 if the menu is torn off.

    Method insert

      `GTK.Menu insert(GTK.Widget widget, int position)`

    Description

      Adds a new W(MenuItem) to the menu's item list at the position indicated by position.

    Method popdown

      `GTK.Menu popdown()`

    Description

      Removes the menu from the screen.

    Method popup

      `GTK.Menu popup(int|void button_pressed_to_show_menu)`

    Description

      The default button is 3.

    Method prepend

      `GTK.Menu prepend(GTK.Widget widget)`

    Description

      Adds a new W(MenuItem) to the start of the menu's item list.

    Method reorder_child

      `GTK.Menu reorder_child(GTK.Widget menuitem, int pos)`

    Description

      Moves a W(MenuItem) to a new position within the GTK.Menu.

    Method reposition

      `GTK.Menu reposition()`

    Description

      Repositions the menu according to its position function.

    Method set_accel_group

      `GTK.Menu set_accel_group(GTK.AccelGroup accelerators)`

    Description

      Set the W(AccelGroup) which holds global accelerators for the menu.

    Method set_active

      `GTK.Menu set_active(int activep)`

    Description

      Selects the specified menu item within the menu. This is used by the W(OptionMenu).

    Method set_tearoff_state

      `GTK.Menu set_tearoff_state(int torn_off)`

    Description

      Changes the tearoff state of the menu. A menu is normally displayed as drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.

    Method set_title

      `GTK.Menu set_title(string new_title)`

    Description

      Sets the title string for the menu. The title is displayed when the menu is shown as a tearoff menu.

  CLASS GTK.Dialog

    Description

      A dialog is a window with a few default widgets added. The 'vbox' is the main content area of the widget. The 'action_area' is allocated for buttons (ok, cancel etc)

    Inherit Window

      inherit GTK.Window : Window

    Method create

      `GTK.Dialog GTK.Dialog()`

    Description

      Create a new dialog widget.

    Method get_action_area

      `GTK.HbuttonBox get_action_area()`

    Description

      The action area, this is where the buttons (ok, cancel etc) go

    Method get_vbox

      `GTK.Vbox get_vbox()`

    Description

      The vertical box that should contain the contents of the dialog

  CLASS GTK.Hruler

    Description

      Ruler widgets are used to indicate the location of the mouse pointer in a given window. A window can have a vertical ruler spanning across the width and a horizontal ruler spanning down the height. A small triangular indicator on the ruler shows the exact location of the pointer relative to the ruler.

      `GTK.Hruler()->set_metric(GTK.PIXELS)->set_range(0.0,100.0,50.0,100.0)->draw_ticks()->draw_pos()->set_usize(300,30)`

      `GTK.Hruler()->set_metric(GTK.CENTIMETERS)->set_range(0.0,100.0,50.0,100.0)->draw_ticks()->draw_pos()->set_usize(300,30)`

      `GTK.Hruler()->set_usize(300,30)`

    Inherit Ruler

      inherit GTK.Ruler : Ruler

    Method create

      `GTK.Hruler GTK.Hruler()`

    Description

      Used to create a new hruler widget.

  CLASS GTK.Table

    Description

      The Gtk.Table allow the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically.

      `GTK.Table(2,2,0)->attach_defaults( GTK.Label("0,0"), 0, 1, 0, 1)->attach_defaults( GTK.Label("0,1"), 0, 1, 1, 2)->attach_defaults( GTK.Label("1,0"), 1, 2, 0, 1)->attach_defaults( GTK.Label("1,1"), 1, 2, 1, 2)->set_col_spacings(10)->set_row_spacings(10)`

      `GTK.Table(2,2,0)->attach_defaults( GTK.Label("0,0-1,0"), 0, 2, 0, 1)->attach_defaults( GTK.Label("0,1"), 0, 1, 1, 2)->attach_defaults( GTK.Label("1,1"), 1, 2, 1, 2)->set_col_spacings(10)->set_row_spacings(10)`

    Inherit Container

      inherit GTK.Container : Container

    Method attach

      `GTK.Table attach(GTK.Widget subwidget, int left, int right, int top, int bottom, int xoptions, int yoptions, int xpad, int ypad)`

    Description

      The left and right attach arguments specify where to place the widget, and how many boxes to use. If you want a button in the lower right table entry of our 2x2 table, and want it to fill that entry ONLY. left_attach would be = 1, right_attach = 2, top_attach = 1, bottom_attach = 2.

      Now, if you wanted a widget to take up the whole top row of our 2x2 table, you'd use left_attach = 0, right_attach = 2, top_attach = 0, bottom_attach = 1.

      The xoptions and yoptions are used to specify packing options and may be OR'ed together to allow multiple options.

      These options are: <ul> <li> GTK.Fill - If the table box is larger than the widget, and GTK_FILL is specified, the widget will expand to use all the room available.</li> <li> GTK.Shrink - If the table widget was allocated less space then was requested (usually by the user resizing the window), then the widgets would normally just be pushed off the bottom of the window and disappear. If GTK_SHRINK is specified, the widgets will shrink with the table.</li> <li> GTK.Expand - This will cause the table cell to expand to use up any remaining space in the window.</li> </ul>

      Padding is just like in boxes, creating a clear area around the widget specified in pixels

    Method attach_defaults

      `GTK.Table attach_defaults(GTK.Widget subwidget, int left, int right, int top, int bottom)`

    Description

      As there are many options associated with attach(), this convenience function provides the programmer with a means to add children to a table with identical padding and expansion options.

      xoptions, yoptions, xpadding and ypadding are all set the their default values. For the options that is GTK.Fill|GTK.Expand. For the padding it is 0.

    Method create

      `GTK.Table GTK.Table(int width, int height, int homogeneousp)`

    Description

      Used to create a new table widget. An initial size must be given by specifying how many rows and columns the table should have, although this can be changed later with resize().

      There can never be more than 65535 colums nor more than 65535 rows.

      setting homogeneousp to 1 forces the all tablecells to be exactly the same size.

    Method get_column_spacing

      `int get_column_spacing()`

    Description

      The spacing between all columns, in pixels.

    Method get_homogeneous

      `int get_homogeneous()`

    Description

      If 1, all cells have exactly the same size

    Method get_ncols

      `int get_ncols()`

    Description

      The number of columns. Between 1 and 65535.

    Method get_nrows

      `int get_nrows()`

    Description

      The number of rows. Between 1 and 65535.

    Method get_row_spacing

      `int get_row_spacing()`

    Description

      The spacing between all rows, in pixels.

    Method resize

      `GTK.Table resize(int rows, int columns)`

    Description

      If you need to change a table's size after it has been created, this function allows you to do so.

    Method set_col_spacing

      `GTK.Table set_col_spacing(int x, int spacing)`

    Description

      alters the amount of space between a given table column and the adjacent columns.

    Method set_col_spacings

      `GTK.Table set_col_spacings(int spacing)`

    Description

      Sets the space between every column in the table equal to spacing.

    Method set_homogeneous

      `GTK.Table set_homogeneous(int homogeneousp)`

    Description

      Set the homogeneous flag.

    Method set_row_spacing

      `GTK.Table set_row_spacing(int y, int spacing)`

    Description

      alters the amount of space between a given table row and the adjacent rows.

    Method set_row_spacings

      `GTK.Table set_row_spacings(int spacing)`

    Description

      Sets the space between every row in the table equal to spacing.

  CLASS GTK.ScrolledWindow

    Description

      Scrolled windows are used to create a scrollable area with another widget inside it. You may insert any type of widget into a scrolled window, and it will be accessible regardless of the size by using the scrollbars.

      `GTK.ScrolledWindow(GTK.Adjustment(),GTK.Adjustment())->add(GTK.Label("A small label"))->set_usize(100,80)->set_policy(GTK.POLICY_AUTOMATIC,GTK.POLICY_AUTOMATIC)`

      `GTK.ScrolledWindow(GTK.Adjustment(),GTK.Adjustment())->add(GTK.Label("A small label"))->set_usize(70,80)->set_policy(GTK.POLICY_AUTOMATIC,GTK.POLICY_AUTOMATIC)`

      `GTK.ScrolledWindow(GTK.Adjustment(),GTK.Adjustment())->add(GTK.Label("A small label"))->set_usize(80,80)`

      `GTK.ScrolledWindow(GTK.Adjustment(),GTK.Adjustment())->add(GTK.Label("A very huge label")->set_usize(700,700))->set_usize(80,80)`

    Inherit Window

      inherit GTK.Window : Window

    Method add

      `GTK.ScrolledWindow add(GTK.Widget victim)`

    Description

      Add a widget to this container. This is equivalent to the C-GTK function gtk_scrolled_window_add_with_viewport or gtk_container_add, depeneding on whether or not the child supports the set_scroll_adjustments signal.

      What this means in practice is that you do not have to care about this at all, it's all handled automatically.

    Method create

      `GTK.ScrolledWindow GTK.ScrolledWindow(GTK.Adjustment hadjustment, GTK.Adjustment vadjustments)`

    Description

      The two adjustments are most commonly set to 0.

    Method get_hadjustment

      `GTK.Adjustment get_hadjustment()`

    Description

      Return the horizontal adjustment used to scroll the window

    Method get_hscrollbar

      `GTK.Hscrollbar get_hscrollbar()`

    Description

      The horizontal scrollbar

    Method get_hscrollbar_policy

      `int get_hscrollbar_policy()`

    Description

      One of POLICY_ALWAYS , POLICY_AUTOMATIC and POLICY_NEVER

    Method get_hscrollbar_visible

      `int get_hscrollbar_visible()`

    Description

      1 if the horizontal scrollbar is currently visible

    Method get_vadjustment

      `GTK.Adjustment get_vadjustment()`

    Description

      Return the vertical adjustment used to scroll the window

    Method get_vscrollbar

      `GTK.Vscrollbar get_vscrollbar()`

    Description

      The vertical scrollbar

    Method get_vscrollbar_policy

      `int get_vscrollbar_policy()`

    Description

      One of POLICY_ALWAYS , POLICY_AUTOMATIC and POLICY_NEVER

    Method get_vscrollbar_visible

      `int get_vscrollbar_visible()`

    Description

      1 if the vertical scrollbar is currently visible

    Method get_window_placement

      `int get_window_placement()`

    Description

      The location of the window relative to the scrollbars. One of CORNER_BOTTOM_LEFT , CORNER_BOTTOM_RIGHT , CORNER_TOP_LEFT and CORNER_TOP_RIGHT

    Method set_hadjustment

      `GTK.ScrolledWindow set_hadjustment(GTK.Adjustment hadjustment)`

    Description

      Set the horizontal adjustment object

    Method set_placement

      `GTK.ScrolledWindow set_placement(int window_corner_placement)`

    Description

      The location of the window relative to the scrollbars. One of CORNER_BOTTOM_LEFT , CORNER_BOTTOM_RIGHT , CORNER_TOP_LEFT and CORNER_TOP_RIGHT

    Method set_policy

      `GTK.ScrolledWindow set_policy(int xpolicy, int ypolicy)`

    Description

      vertical and horiz policy. Both are one of POLICY_ALWAYS , POLICY_AUTOMATIC and POLICY_NEVER

    Method set_vadjustment

      `GTK.ScrolledWindow set_vadjustment(GTK.Adjustment vadjustment)`

    Description

      Set the vertical adjustment object

  CLASS GTK.CTreeNode

    Description

      This is one of the nodes (branch or leaf) of the CTree. They are the equivalent of row numbers in a normal CList.

    Method child

      `CTreeNode child()`

    Description

      Returns the first child node

    Method get_expanded

      `int get_expanded()`

    Description

      Returns the previous sibling (the next on the same level)

    Method get_is_leaf

      `int get_is_leaf()`

    Description

      Returns the previous sibling (the next on the same level)

    Method get_level

      `int get_level()`

    Description

      Returns the previous sibling (the next on the same level)

    Method next

      `CTreeNode next()`

    Description

      Returns the next sibling (the next on the same level)

    Method parent

      `GTK.CTreeNode parent()`

    Description

      Returns the parent node

    Method prev

      `CTreeNode prev()`

    Description

      Returns the previous sibling (the next on the same level)

    Method row

      `GTK.CTreeRow row()`

    Description

      Returns the CTreeRow associated with this CTreeNode. DEPRECATED, all CTreeRow functions are also available directly in this object.

  CLASS GTK.OptionMenu

    Description

      A OptionMenu is a widget that allows the user to choose from a list of valid choices. The OptionMenu displays the selected choice. When activated the OptionMenu displays a popup W(Menu) which allows the user to make a new choice.

      `GTK.OptionMenu()->set_menu(GTK.Menu()->add( GTK.Menu_item("Option 1") ));`

    Inherit Button

      inherit GTK.Button : Button

    Method create

      `GTK.OptionMenu GTK.OptionMenu()`

    Description

      Create a new option menu widget

    Method get_menu

      `GTK.Menu get_menu()`

    Description

      Returns the W(Menu) associated with the OptionMenu.

    Method remove_menu

      `GTK.OptionMenu remove_menu()`

    Description

      Remove the menu.

    Method set_history

      `GTK.OptionMenu set_history(int index)`

    Description

      Selects the menu item specified by index making it the newly selected value for the option menu.

    Method set_menu

      `GTK.OptionMenu set_menu(GTK.Menu menu)`

    Description

      Provides the GtkMenu that is popped up to allow the user to choose a new value. You should provide a simple menu avoiding the use of tearoff menu items, submenus, and accelerators.

  CLASS GTK.Box

    Description

      A box is a container that can contain more than one child. The basic 'Box' class cannot be instantiated, it is a virtual class that only defines some common 'Box' functions shared with all other Box widgets.

    Inherit Container

      inherit GTK.Container : Container

    Method pack_end

      `GTK.Box pack_end(GTK.Widget widget, int expandp, int fillp, int padding)`

    Description

      Pack from the right (or bottom) of the box. Arguments are widget, expand, fill, paddingb widget, expand, fill, padding

    Method pack_end_defaults

      `GTK.Box pack_end_defaults(GTK.Widget widget)`

    Description

      The argument is the widget to add.

    Method pack_start

      `GTK.Box pack_start(GTK.Widget widget, int expandp, int fillp, int padding)`

    Description

      Pack from the left (or top) of the box. Argument are widget, expand, fill, padding pack(widget,1,1,0) is equivalent to 'add' or 'pack_start_defaults'

    Method pack_start_defaults

      `GTK.Box pack_start_defaults(GTK.Widget widget)`

    Description

      The argument is the widget to add. This function is equivalent to 'add'

    Method query_child_packing

      `mapping query_child_packing(GTK.Widget child)`

    Description

      Return a mapping: ([ "expand":expandp, "fill":fillp, "padding":paddingp, "type":type ])

    Method reorder_child

      `GTK.Box reorder_child(GTK.Widget child, int new_position)`

    Description

      Move widget to pos, pos is an integer, between 0 and sizeof(box->children())-1

    Method set_child_packing

      `GTK.Box set_child_packing(GTK.Widget child_widget, int expandp, int fillp, int padding, int pack_type)`

    Description

      widget, expand, fill, padding, pack_type. If exand is true, the widget will be expanded when the box is resized. If 'fill' is true, the widget will be resized to fill up all available space. Padding is the amount of padding to use, and pack_type is one of PACK_END , PACK_EXPAND and PACK_START .

      You can emulate pack_start and pack_end with add and set_child_packing.

    Method set_homogeneous

      `GTK.Box set_homogeneous(int homogeneousp)`

    Description

      If true, all widgets in the box will get exactly the same amount of space

    Method set_spacing

      `GTK.Box set_spacing(int spacing)`

    Description

      This is the amount of spacing (in pixels) inserted beween all widgets

  CLASS GTK.Hscale

    Description

      The GTK.HScale widget is used to allow the user to select a value using a horizontal slider. A GTK.Adjustment is used to set the initial value, the lower and upper bounds, and the step and page increments.

      See W(Scale) for details

      The position to show the current value, and the number of decimal places shown can be set using the parent W(Scale) class's functions.

      `GTK.Hscale(GTK.Adjustment())->set_usize(300,30)`

    Inherit Scale

      inherit GTK.Scale : Scale

    Method create

      `GTK.Hscale GTK.Hscale(GTK.Adjustment settings)`

    Description

      Used to create a new hscale widget. The adjustment argument can either be an existing W(Adjustment), or 0, in which case one will be created for you.

  CLASS GTK.Ruler

    Description

      Ruler widgets are used to indicate the location of the mouse pointer in a given window. A window can have a vertical ruler spanning across the width and a horizontal ruler spanning down the height. A small triangular indicator on the ruler shows the exact location of the pointer relative to the ruler.

    Inherit Widget

      inherit GTK.Widget : Widget

    Method draw_pos

      `GTK.Ruler draw_pos()`

    Description

      draw the position

    Method draw_ticks

      `GTK.Ruler draw_ticks()`

    Description

      draw the ticks

    Method get_lower

      `float get_lower()`

    Description

      The currently defined lower extent of the ruler.

    Method get_max_size

      `float get_max_size()`

    Description

      The currently defined max_size of the ruler.

    Method get_position

      `float get_position()`

    Description

      The currently defined initial position of the pointer indicator within the ruler.

    Method get_upper

      `float get_upper()`

    Description

      The currently defined upper extent of the ruler.

    Method set_metric

      `GTK.Ruler set_metric(int unit)`

    Description

      Either GTK.Pixels, GTK.Centimers or GTK.Inches. The default measure is GTK.Pixels.

    Method set_range

      `GTK.Ruler set_range(float lower, float upper, float position, float max_size)`

    Description

      The lower and upper arguments define the extent of the ruler, and max_size is the largest possible number that will be displayed. Position defines the initial position of the pointer indicator within the ruler.

  CLASS GTK.Misc

    Description

      The GTK.Misc widget is an abstract widget which is not useful itself, but is used to derive subclasses which have alignment and padding attributes.

      The horizontal and vertical padding attributes allows extra space to be added around the widget.

      The horizontal and vertical alignment attributes enable the widget to be positioned within its allocated area. Note that if the widget is added to a container in such a way that it expands automatically to fill its allocated area, the alignment settings will not alter the widgets position.

      `GTK.Vbox(0,0)->add(GTK.Label("Label"))->set_usize(100,20)`

      `GTK.Vbox(0,0)->add(GTK.Label("Label")->set_alignment(1.0,0.0))->set_usize(100,20)`

      `GTK.Vbox(0,0)->add(GTK.Label("Label")->set_alignment(0.0,0.0))->set_usize(100,20)`

    Inherit Widget

      inherit GTK.Widget : Widget

    Method get_xalign

      `float get_xalign()`

    Description

      The horizontal alignment, from 0 (left) to 1 (right).

    Method get_xpad

      `int get_xpad()`

    Description

      The amount of space to add on the left and right of the widget, in pixels.

    Method get_yalign

      `float get_yalign()`

    Description

      The vertical alignment, from 0 (top) to 1 (botton).

    Method get_ypad

      `int get_ypad()`

    Description

      The amount of space to add on the top and bottom of the widget, in pixels.

    Method set_alignment

      `GTK.Misc set_alignment(float xalign, float yalign)`

    Description

      Sets the alignment of the widget. 0.0 is left or topmost, 1.0 is right or bottommost.

    Method set_padding

      `GTK.Misc set_padding(int xpad, int ypad)`

    Description

      Sets the amount of space to add around the widget. xpand and ypad are specified in pixels.

  CLASS GTK.Button

    Description

      A container that can only contain one child, and accepts events. draws a bevelbox around itself. `GTK.Button("A button")`

      `GTK.Button("A button\nwith multiple lines\nof text")`

      `GTK.Button()->add(GTK.Image(GDK.Image(0)->set(Image.Image(100,40)->test())))`

      Signals: clicked Called when the button is pressed, and then released

      enter Called when the mouse enters the button

      leave Called when the mouse leaves the button

      pressed Called when the button is pressed

      released Called when the button is released

    Inherit Container

      inherit GTK.Container : Container

    Method clicked

      `GTK.Button clicked()`

    Description

      Emulate a 'clicked' event (press followed by release).

    Method create

      `GTK.Button GTK.Button(string|void label_text)`

    Description

      If a string is supplied, a W(Label) is created and added to the button.

    Method enter

      `GTK.Button enter()`

    Description

      Emulate a 'enter' event.

    Method get_child

      `GTK.Widget get_child()`

    Description

      The (one and only) child of this container.

    Method get_relief

      `int get_relief()`

    Description

      One of RELIEF_HALF , RELIEF_NONE and RELIEF_NORMAL , set with set_relief()

    Method leave

      `GTK.Button leave()`

    Description

      Emulate a 'leave' event.

    Method pressed

      `GTK.Button pressed()`

    Description

      Emulate a 'press' event.

    Method released

      `GTK.Button released()`

    Description

      Emulate a 'release' event.

    Method set_relief

      `GTK.Button set_relief(int newstyle)`

    Description

      One of RELIEF_HALF , RELIEF_NONE and RELIEF_NORMAL

  CLASS GTK.FileSelection

    Description

      GtkFileSelection should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list, the drop-down history menu, or the TAB key can be used to navigate using filename completion common in text based editors such as emacs and jed.

      The default filename can be set using set_filename() and the selected filename retrieved using get_filename().

      Use complete() to display files that match a given pattern. This can be used for example, to show only *.txt files, or only files beginning with gtk*.

      Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using hide_fileop_buttons() and shown again using show_fileop_buttons().

      `GTK.FileSelection("File selector")`

    Inherit Window

      inherit GTK.Window : Window

    Method complete

      `GTK.FileSelection complete(string pattern)`

    Description

      Will attempt to match pattern to a valid filename in the current directory. If a match can be made, the matched filename will appear in the text entry field of the file selection dialog. If a partial match can be made, the "Files" list will contain those file names which have been partially matched.

    Method create

      `GTK.FileSelection GTK.FileSelection(string window_title)`

    Description

      Creates a new file selection dialog box. By default it will list the files in the current working directory. Operation buttons allowing the user to create a directory, delete files, and rename files will also be present by default.

    Method get_cancel_button

      `GTK.Button get_cancel_button()`

    Description

      The cancel button

    Method get_dir_list

      `GTK.Clist get_dir_list()`

    Description

      The list of directories

    Method get_file_list

      `GTK.Clist get_file_list()`

    Description

      The list of files

    Method get_filename

      `string get_filename()`

    Description

      Returns the currently entered filename as a string

    Method get_fileop_c_dir

      `GTK.Button get_fileop_c_dir()`

    Description

      The create directory button in the file operation button group

    Method get_fileop_del_file

      `GTK.Button get_fileop_del_file()`

    Description

      The delete file button in the file operation button group

    Method get_fileop_ren_file

      `GTK.Button get_fileop_ren_file()`

    Description

      The rename file button in the file operation button group

    Method get_help_button

      `GTK.Button get_help_button()`

    Description

      The help button

    Method get_history_pulldown

      `GTK.OptionMenu get_history_pulldown()`

    Description

      Used to create the drop-down directory histor

    Method get_ok_button

      `GTK.Button get_ok_button()`

    Description

      The ok button

    Method hide_fileop_buttons

      `GTK.FileSelection hide_fileop_buttons()`

    Description

      Hides the file operation buttons that normally appear at the top of the dialog. Useful if you wish to create a custom file selector, based on GTK.FileSelection.

    Method set_filename

      `GTK.FileSelection set_filename(string fname)`

    Description

      Sets a default path for the file requestor. If filename includes a directory path, then the requestor will open with that path as its current working directory.

    Method show_fileop_buttons

      `GTK.FileSelection show_fileop_buttons()`

    Description

      Shows the file operation buttons, if they have previously been hidden. The rest of the widgets in the dialog will be resized accordingly.

  CLASS GTK.Curve

    Description

      `GTK.Curve()`

    Inherit DrawingArea

      inherit GTK.DrawingArea : DrawingArea

    Method create

      `GTK.Curve GTK.Curve()`

    Method get_vector

      `array get_vector(int num_points)`

    Method reset

      `GTK.Curve reset()`

    Method set_curve_type

      `GTK.Curve set_curve_type(int type)`

    Description

      One of CURVE_TYPE_FREE , CURVE_TYPE_LINEAR and CURVE_TYPE_SPLINE ;

    Method set_gamma

      `GTK.Curve set_gamma(float gamma)`

    Method set_range

      `GTK.Curve set_range(float min_x, float max_x, float min_y, float max_y)`

    Method set_vector

      `GTK.Curve set_vector(int nelems, array curve)`

  CLASS GTK.Toolbar

    Description

      Toolbars are usually used to group some number of widgets in order to simplify customization of their look and layout. Typically a toolbar consists of buttons with icons, labels and tooltips, but any other widget can also be put inside a toolbar. Finally, items can be arranged horizontally or vertically and buttons can be displayed with icons, labels, or both.

      Examples: `lambda(){object t=GTK.Toolbar( GTK.ORIENTATION_HORIZONTAL, GTK.TOOLBAR_TEXT );t->append_item( "Button 1", "Tooltip 1", "", GTK.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 2", "Tooltip 2", "", GTK.Frame(), lambda(){},0);t->append_item( "Button 3", "Tooltip 3", "", GTK.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 4", "Tooltip 4", "", GTK.Frame(), lambda(){},0);t->append_item( "Button 5", "Tooltip 5", "", GTK.Frame(), lambda(){},0);return t;}()`

      `lambda(){object t=GTK.Toolbar( GTK.ORIENTATION_VERTICAL, GTK.TOOLBAR_TEXT );t->append_item( "Button 1", "Tooltip 1", "", GTK.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 2", "Tooltip 2", "", GTK.Frame(), lambda(){},0);t->append_item( "Button 3", "Tooltip 3", "", GTK.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 4", "Tooltip 4", "", GTK.Frame(), lambda(){},0);t->append_item( "Button 5", "Tooltip 5", "", GTK.Frame(), lambda(){},0);return t;}()`

      `lambda(){object i=GDK.Image()->set(Image.Image(20,20)->test());object t=GTK.Toolbar( GTK.ORIENTATION_HORIZONTAL, GTK.TOOLBAR_BOTH );t->append_item( "Button 1", "Tooltip 1", "", GTK.Image(i), lambda(){},0);t->append_space();t->append_item( "Button 2", "Tooltip 2", "", GTK.Image(i), lambda(){},0);t->append_item( "Button 3", "Tooltip 3", "", GTK.Image(i), lambda(){},0);t->append_space();t->append_item( "Button 4", "Tooltip 4", "", GTK.Image(i), lambda(){},0);t->append_item( "Button 5", "Tooltip 5", "", GTK.Image(i), lambda(){},0);return t;}()`

      Signals: orientation_changed

      style_changed

    Inherit Container

      inherit GTK.Container : Container

    Method append_item

      `GTK.Toolbar append_item(string label, string tooltip, string prv, GTK.Widget icon, function clicked_cb, mixed clicked_arg)`

    Description

      Adds a new button to the start of the toolbar.

    Method append_space

      `GTK.Toolbar append_space()`

    Description

      Adds a small space.

    Method append_widget

      `GTK.Toolbar append_widget(GTK.Widget widget, string tootip, string prv)`

    Description

      Append a custom widgets. Arguments are widget, tooltip, private

    Method create

      `GTK.Toolbar GTK.Toolbar(int orientation, int style)`

    Description

      Orientation is one of ORIENTATION_HORIZONTAL and ORIENTATION_VERTICAL . Style is one of TOOLBAR_BOTH , TOOLBAR_ICONS and TOOLBAR_TEXT

    Method get_button_relief

      `int get_button_relief()`

    Method insert_item

      `GTK.Toolbar insert_item(string label, string tooltip, string prv, GTK.Widget icon, function clicked_cb, mixed clicked_arg, int position)`

    Description

      Arguments as for append_item, but an extra position argument at the end. Adds a new button after the item at the specified position.

    Method insert_space

      `GTK.Toolbar insert_space(int pixels)`

    Description

      Inserts a small space at the specified postion.

    Method insert_widget

      `GTK.Toolbar insert_widget(GTK.Widget widget, string tootip, string prv, int pos)`

    Description

      Insert a custom widgets.

    Method prepend_item

      `GTK.Toolbar prepend_item(string label, string tooltip, string prv, GTK.Widget icon, function clicked_cb, mixed clicked_arg)`

    Description

      Arguments as for append_item Adds a new button to the end of the toolbar.

    Method prepend_space

      `GTK.Toolbar prepend_space()`

    Description

      Adds a small space.

    Method prepend_widget

      `GTK.Toolbar prepend_widget(GTK.Widget widget, string tootip, string prv)`

    Description

      Prepend a custom widgets. Arguments are widget, tooltip, private

    Method set_button_relief

      `GTK.Toolbar set_button_relief(int relief)`

    Method set_orientation

      `GTK.Toolbar set_orientation(int orientation)`

    Description

      Set the orientation, one of ORIENTATION_HORIZONTAL and ORIENTATION_VERTICAL

    Method set_space_size

      `GTK.Toolbar set_space_size(int pixels)`

    Description

      Set the width (or height) of the space created by append_space.

    Method set_space_style

      `GTK.Toolbar set_space_style(int style)`

    Method set_style

      `GTK.Toolbar set_style(int style)`

    Description

      Set the style, one of TOOLBAR_BOTH , TOOLBAR_ICONS and TOOLBAR_TEXT

    Method set_tooltips

      `GTK.Toolbar set_tooltips(int tootipp)`

    Description

      If true, show the tooltips.

Module Unicode

  Method split_words

    `array(string) split_words(string input)`

  Description

    Splits the input string into an array of words, on the boundaries between the different kinds of word characters as defined by is_wordchar . The result is an array of words, with the non-word characters between them thrown away.

  Method split_words_and_normalize

    `array(string) split_words_and_normalize(string input)`

  Description

    A less wasteful equivalent of `<font face='courier'>split_words` (<font face='courier'>normalize (<font face='courier'>input , "NFKD")).

  Method normalize

    `string normalize(string data, string method)`

  Description

    Normalize the given unicode string according to the specified method.

    The methods are:

    NFC, NFD, NFKC and NFKD.

    The methods are described in detail in the UAX #15 document, which can currently be found at http://www.unicode.org/unicode/reports/tr15/tr15-21.html

    A short description:

    C and D specifies whether to decompose (D) complex characters to their parts, or compose (C) single characters to complex ones.

    K specifies whether or not do a canonical or compatibility conversion. When K is present, compatibility transformations are performed as well as the canonical transformations.

    In the following text, 'X' denotes the single character 'X', even if there is more than one character inside the quotation marks. The reson is that it's somewhat hard to describe unicode in iso-8859-1.

    The Unicode Standard defines two equivalences between characters: canonical equivalence and compatibility equivalence. Canonical equivalence is a basic equivalency between characters or sequences of characters.

    'Å' and 'A' '° (combining ring above)' are canonically equivalent.

    For round-trip compatibility with existing standards, Unicode has encoded many entities that are really variants of existing nominal characters. The visual representations of these character are typically a subset of the possible visual representations of the nominal character. These are given compatibility decompositions in the standard. Because the characters are visually distinguished, replacing a character by a compatibility equivalent may lose formatting information unless supplemented by markup or styling.

    Examples of compatibility equivalences:

    - Font variants (thin, italic, extra wide characters etc)

    - Circled and squared characters

    - super/subscript ('²' -> '2')

    - Fractions ('½' -> '1/2')

    - Other composed characters ('fi' -> 'f' 'i', 'kg' -> 'k' 'g')

  Method is_wordchar

    `int is_wordchar(int c)`

  Description

    Returns whether a unicode character c is a word, part of a word or not.

  Returns

    `2` | The character is an ideograph (a CJK single-word character)
    `1` | The character is a letter, number or non-spacing mark, as defined by its unicode (general category) specification
    `0` | Any other character (such as symbols, punctuation and separators)

  Constant version

    `constant Unicode.version`

  Description

    Contains the version of the current Unicode database as a string, e.g. `"5.0.0"`.

Module Bz2

  Description

    The Bz2 module contains functions to compress and uncompress strings using the same algorithm as the program `bzip2`. Compressing and decompressing can be done in streaming mode feeding the compress and decompress objects with arbitrarily large pieces of data. The Bz2 module consists of three classes; Bz2.Deflate,Bz2.Inflate. and Bz2.File Bz2.Deflate is used to compress data and Bz2.Inflate is used to uncompress data. (Think "inflatable boat") Bz2.File is used to handle Bzip2 files.

  Note

    Note that this module is only available if libbzip2 was available when Pike was compiled.

    Note that although the functions in Inflate and Deflate use the same algorithm as `bzip2`, they do not use the exact same format, so you can not directly zip files or unzip zip-files using those functions. That is why there exists a third class for files.

  CLASS Bz2.Deflate

    Description

      Bz2.Deflate is a builtin program written in C. It interfaces the packing routines in the bzlib library.

    Note

      This program is only available if libz was available and found when Pike was compiled.

    See also

      Bz2.Inflate()

    Method create

      `void Bz2.Deflate(int(1..9)|void block_size)`

    Description

      If given, block_size should be a number from 1 to 9 indicating the block size used when doing compression. The actual block size will be a 100000 times this number. Low numbers are considered 'fast', higher numbers are considered 'slow' but give better packing. The parameter is set to 9 if it is omitted.

      This function can also be used to re-initialize a Bz2.Deflate object so it can be re-used.

    Method feed

      `void feed(string data)`

    Description

      This function feeds the data to the internal buffers of the Deflate object. All data is buffered until a read or a finish is done.

    See also

      Bz2.Deflate->read() Bz2.Deflate->finish()

    Method read

      `string read(string data)`

    Description

      This function feeds the data to the internal buffers of the Deflate object. Then it compresses all buffered data and returns the compressed data as a string

    See also

      Bz2.Deflate->feed() Bz2.Deflate->finish()

    Method finish

      `string finish(string data)`

    Description

      This method feeds the data to the internal buffers of the Deflate object. Then it compresses all buffered data adds a end of data marker ot it, returns the compressed data as a string, and reinitializes the deflate object.

    See also

      Bz2.Deflate->feed() Bz2.Deflate->read()

    Method deflate

      `string deflate(string data, int(0..2)|void flush_mode)`

    Description

      This function performs bzip2 style compression on a string data and returns the packed data. Streaming can be done by calling this function several times and concatenating the returned data.

      The optional argument flush_mode should be one of the following:

      `Bz2.BZ_RUN` | Runs Bz2.Deflate->feed()
      `Bz2.BZ_FLUSH` | Runs Bz2.Deflate->read()
      `Bz2.BZ_FINISH` | Runs Bz2.Deflate->finish()

    See also

      Bz2.Inflate->inflate()

  CLASS Bz2.Inflate

    Description

      Bz2.Inflate is a builtin program written in C. It interfaces the unpacking routines in the libz library.

    Note

      This program is only available if bzlib was available and found when Pike was compiled.

    See also

      Deflate

    Method create

      `void Bz2.Inflate()`

    Method inflate

      `string inflate(string data)`

    Description

      This function performs bzip2 style decompression. It can do decompression with arbitrarily large pieces of data. When fed with data, it decompresses as much as it can and buffers the rest.

    Example

          while(..){
             foo = compressed_data[i..i+9];
             uncompressed_concatenated_data += inflate_object->inflate(foo);
             i = i+10;
           }

    See also

      Bz2.Deflate->deflate()

  CLASS Bz2.File

    Description

      Low-level implementation of read/write support for Bzip2 files

    Note

      This class is currently not available on Windows.

    Method close

      `int(0..1) close()`

    Description

      closes the file

    Method create

      `void Bz2.File()`

    Description

      Creates a Bz2.File object

    Method read_open

      `int(0..1) read_open(string file)`

    Description

      Opens a file for reading.

    Parameter `file`

      The name of the file to be opened

    Method write_open

      `int(0..1) write_open(string file)`

    Description

      Opens a file for writing.

    Parameter `file`

      The name of the file to be opened

    Method open

      `int(0..1) open(string file, void|string mode)`

    Description

      Opens a file for I/O.

    Parameter `file`

      The name of the file to be opened

    Parameter `mode`

      Mode for the file operations. Can be either "r" (read) or "w". Read is default.

    Method write

      `int write(string data)`

    Description

      Writes the data to the file.

    Returns

      the number of bytes written to the file.

    Method read

      `string read(int len)`

    Description

      Reads len (uncompressed) bytes from the file. If len is omitted the whole file is read. If read is unsuccessful, 0 is returned.

    Method eof

      `int(0..1) eof()`

    Returns

      1 if EOF has been reached, 0 otherwise

Module Shuffler

    `constant Shuffler.INITIAL`
    `constant Shuffler.RUNNING`
    `constant Shuffler.PAUSED`
    `constant Shuffler.DONE`
    `constant Shuffler.WRITE_ERROR`
    `constant Shuffler.READ_ERROR`
    `constant Shuffler.USER_ABORT`

  CLASS Shuffler.Throttler

    Note

      This is an interface that all Throttler s must implement. It's not an actual class in this module.

    Method request

      `void request(Shuffle shuffle, int amount, function(int:void) callback)`

    Description

      This function is called when the Shuffle wants to send some data to a client.

      When data can be sent, the callback function should be called with the amount of data that can be sent as the argument.

    Method give_back

      `void give_back(Shuffle shuffle, int amount)`

    Description

      This function will be called by the Shuffle object to report that some data assigned to it by this throttler was unusued, and can be given to another Shuffle object instead.

  CLASS Shuffler.Shuffle

    Description

      This class contains the state for one ongoing data shuffling operation. To create a Shuffle instance, use the Shuffler()->shuffle method.

    Variable shuffler

      `Shuffler Shuffler.Shuffle.shuffler`

    Description

      The Shuffler that owns this Shuffle object

    Variable throttler

      `Throttler Shuffler.Shuffle.throttler`

    Description

      The Throttler that is associated with this Shuffle object, if any.

    Method set_throttler

      `void set_throttler(Throttler t)`

    Description

      Calling this function overrides the Shuffler global throttler.

    Method sent_data

      `int sent_data()`

    Description

      Returns the amount of data that has been sent so far.

    Method state

      `int state()`

    Description

      Returns the current state of the shuffler. This is one of the following: INITIAL , RUNNING , PAUSED , DONE , WRITE_ERROR , READ_ERROR and USER_ABORT

    Method set_done_callback

      `void set_done_callback(function(Shuffle:void) cb)`

    Description

      Sets the done callback. This function will be called when all sources have been processed, or if an error occurs.

    Method set_request_arg

      `void set_request_arg(mixed arg)`

    Description

      Sets the extra argument sent to Throttler()->request() and Throttler()->give_back .

    Method send_more_callback

      `void send_more_callback(int amount)`

    Method write_callback

      `void write_callback(mixed|void x)`

    Method create

      `void Shuffler.Shuffle(object fd, object shuffler, mixed throttler, mixed backend)`

    Method start

      `void start()`

    Description

      Start sending data from the sources.

    Method pause

      `void pause()`

    Description

      Temporarily pause all data transmission

    Method stop

      `void stop()`

    Description

      Stop all data transmission, and then call the done callback

    Method add_source

      `void add_source(mixed source, int|void start, int|void length)`

    Description

      Add a new source to the list of data sources. The data from the sources will be sent in order.

      If start and length are not specified, the whole source will be sent, if start but not length is specified, the whole source, excluding the first start bytes will be sent.

      Currently supported sources

      String

        An ordinary 8-bit wide pike string.

      Memory

        An initialized instance of the System.Memory class.

      NormalFile

        Stdio.File instance pointing to a normal file.

      Stream

        Stdio.File instance pointing to a stream of some kind (network socket, named pipe, stdin etc).

      Pike-stream

        Stdio.File lookalike with read callback support (set_read_callback and set_close_callback).

  CLASS Shuffler.Shuffler

    Description

      A data shuffler. An instance of this class handles a list of Shuffle objects. Each Shuffle object can send data from one or more sources to a destination in the background.

    Method set_backend

      `void set_backend(Pike.Backend b)`

    Description

      Set the backend that will be used by all Shuffle objects created from this shuffler.

    Method set_throttler

      `void set_throttler(Throttler t)`

    Description

      Set the throttler that will be used in all Shuffle objects created from this shuffler, unless overridden in the Shuffle objects.

    Method pause

      `void pause()`

    Description

      Pause all Shuffle objects associated with this Shuffler

    Method start

      `void start()`

    Description

      Unpause all Shuffle objects associated with this Shuffler

    Method shuffle

      `Shuffle shuffle(Stdio.File destination)`

    Description

      Create a new Shuffle object.

Module Nettle

  Description

    Low level crypto functions used by the Crypto module. Unless you are doing something very special, you would want to use the Crypto module instead.

  Method crypt_md5

    `string crypt_md5(string password, string salt)`

  Description

    Does the crypt_md5 abrakadabra (MD5 + snakeoil). It is assumed that salt does not contain "$".

  CLASS Nettle.HashInfo

    Description

      Represents information about a hash algorithm, such as name, digest size, and internal block size.

    Method name

      `string name()`

    Description

      Returns a human readable name for the algorithm.

    Method digest_size

      `string digest_size()`

    Description

      Returns the size of a hash digests.

    Method block_size

      `string block_size()`

    Description

      Returns the internal block size of the hash algorithm.

    Method hash

      `string hash(string data)`

    Description

      Works as a (faster) shortcut for `HashState()->update(data)->digest()`, where HashState is the hash state class corresponding to this HashInfo.

    See also

      HashState()->update() and HashState()->digest() .

    Method hash

      `string hash(Stdio.File file, void|int bytes)`

    Description

      Works as a (faster) shortcut for `HashState()->update(Stdio.read_file(file))->digest()`, where HashState is the hash state class corresponding to this HashInfo.

    Parameter `bytes`

      The number of bytes of the file object file that should be hashed. Negative numbers are ignored and the whole file is hashed.

    See also

      Stdio.File , HashState()->update() and HashState()->digest() .

  CLASS Nettle.HashState

    Description

      Base class for hashing contexts.

    Method update

      `HashState update(string data)`

    Description

      Hashes more data.

    Method digest

      `string digest(int|void length)`

    Description

      Generates a digests, and resets the hashing contents.

    Parameter `length`

      If the length argument is provided, the digest is truncated to the given length.

    Returns

      The digest.

  CLASS Nettle.MD5_Info

    Description

      Internal mixin class, intended to be multiply inherited together with HashInfo.

  CLASS Nettle.MD5_State

    Description

      State for MD5 hashing.

  CLASS Nettle.MD4_Info

    Description

      Internal mixin class, intended to be multiply inherited together with HashInfo.

  CLASS Nettle.MD4_State

    Description

      State for MD4 hashing.

  CLASS Nettle.MD2_Info

    Description

      Internal mixin class, intended to be multiply inherited together with HashInfo.

  CLASS Nettle.MD2_State

    Description

      State for MD2 hashing.

  CLASS Nettle.SHA1_Info

    Description

      Internal mixin class, intended to be multiply inherited together with HashInfo.

  CLASS Nettle.SHA1_State

    Description

      State for SHA1 hashing.

  CLASS Nettle.SHA256_Info

    Description

      Internal mixin class, intended to be multiply inherited together with HashInfo.

  CLASS Nettle.SHA256_State

    Description

      State for SHA256 hashing.

  CLASS Nettle.CipherInfo

    Description

      Represents information about a cipher algorithm, such as name, key size, and block size.

    Method name

      `string name()`

    Returns

      A human readable name for the algorithm.

    Method key_size

      `string key_size()`

    Returns

      The recommended key size for the cipher.

    Method block_size

      `string block_size()`

    Returns

      The block size of the cipher (1 for stream ciphers).

  CLASS Nettle.CipherState

    Description

      Base class for hashing contexts.

    Method set_encrypt_key

      `CipherState set_encrypt_key(string key, void|int force)`

    Description

      Initializes the object for encryption.

    See also

      set_decrypt_key , crypt

    Method set_decrypt_key

      `CipherState set_decrypt_key(string key, void|int force)`

    Description

      Initializes the object for decryption.

    See also

      set_encrypt_key , crypt

    Method make_key

      `string make_key()`

    Description

      Generate a key by calling Crypto.Random.random_string and initialize this object for encryption with that key.

    Returns

      The generated key.

    See also

      set_encrypt_key

    Method crypt

      `string crypt(string data)`

    Description

      Encrypts or decrypts data, using the current key.

    Parameter `data`

      For block ciphers, data must be an integral number of blocks.

    Returns

      The encrypted or decrypted data.

    Method key_size

      `string key_size()`

    Returns

      The actual key size for this cipher.

  CLASS Nettle.AES_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.AES_State

    Description

      State for AES encyption

  CLASS Nettle.ARCFOUR_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.ARCFOUR_State

    Description

      State for ARCFOUR encyption

  CLASS Nettle.BLOWFISH_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.BLOWFISH_State

    Description

      State for Blowfish encyption

  CLASS Nettle.CAST128_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.CAST128_State

    Description

      State for CAST128 encyption

  CLASS Nettle.DES_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

    Method fix_parity

      `string fix_parity(string key)`

    Description

      Sets the last bit in every byte in key to reflect the parity. If a seven byte key is used, it will be expanded into eight bytes. If a key longer than eight characters is used, it will be truncated to eight characters.

  CLASS Nettle.DES_State

    Description

      State for DES encyption

  CLASS Nettle.DES3_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

    Method fix_parity

      `string fix_parity(string key)`

    Description

      Sets the last bit in every byte in key to reflect the parity. If a 21 byte key is used, it will be expanded into 24 bytes. If a key longer than 24 characters is used, it will be truncated to 24 characters.

  CLASS Nettle.DES3_State

    Description

      State for DES3 encyption

  CLASS Nettle.Serpent_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.Serpent_State

    Description

      State for Serpent encyption

  CLASS Nettle.Twofish_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.Twofish_State

    Description

      State for Twofish encyption

  CLASS Nettle.IDEA_Info

    Description

      Internal mixin class, intended to be multiply inherited together with CipherInfo.

  CLASS Nettle.IDEA_State

    Description

      State for IDEA encyption

  CLASS Nettle.Yarrow

    Description

      Yarrow is a family of pseudo-randomness generators, designed for cryptographic use, by John Kelsey, Bruce Schneier and Niels Ferguson. Yarrow-160 is described in a paper at http://www.counterpane.com/yarrow.html, and it uses SHA1 and triple-DES, and has a 160-bit internal state. Nettle implements Yarrow-256, which is similar, but uses SHA256 and AES to get an internal state of 256 bits.

    Method create

      `void Nettle.Yarrow(void|int sources)`

    Description

      The number of entropy sources that will feed entropy to the random number generator is given as an argument to Yarrow during instantiation.

    See also

      update

    Method seed

      `Yarrow seed(string data)`

    Description

      The random generator needs to be seeded before it can be used. The seed must be at least 32 characters long. The seed could be stored from a previous run by inserting the value returned from get_seed .

    Returns

      Returns the called object.

    See also

      min_seed_size , get_seed , is_seeded

    Method min_seed_size

      `int(0..) min_seed_size()`

    Description

      Returns the minimal number of characters that the seed needs to properly seed the random number generator.

    See also

      seed

    Method get_seed

      `string get_seed()`

    Description

      Returns part of the internal state so that it can be saved for later seeding.

    See also

      seed() , random_string()

    Method is_seeded

      `int(0..1) is_seeded()`

    Description

      Returns 1 if the random generator is seeded and ready to generator output. 0 otherwise.

    See also

      seed

    Method force_reseed

      `void force_reseed()`

    Description

      By calling this function entropy is moved from the slow pool to the fast pool. Read more about Yarrow before using this.

    Method update

      `int(0..1) update(string data, int source, int entropy)`

    Description

      Inject additional entropy into the random number generator.

    See also

      create

    Method needed_sources

      `int(0..) needed_sources()`

    Description

      The number of sources that must reach the threshold before a slow reseed will happen.

    Method random_string

      `string random_string(int length)`

    Description

      Returns a pseudo-random string of the requested length .

Module Crypto

  Description

    Various cryptographic classes and functions.

    Hash functions These are based on the Hash API; MD2 , MD4 , MD5 , SHA1 , SHA256 .

    Stream cipher functions These are based on the Cipher API; AES , Arcfour , Blowfish , CAST , DES , DES3 , IDEA , Serpent , Twofish . The Substitution program is compatible with the CipherState. Also conforming to the API are the helper programs Buffer , CBC and Pipe .

    As the cryptographic services offered from this module isn't necessarily used for security applications, none of the strings inputted or outputted are marked as secure. This is up to the caller.

  Note

    This module is only available if Pike has been compiled with Nettle enabled (this is the default).

  Method make_crypt_md5

    `string make_crypt_md5(string password, void|string salt)`

  Description

    Hashes a password together with a salt with the crypt_md5 algorithm and returns the result.

  See also

    verify_crypt_md5

  Method verify_crypt_md5

    `int(0..1) verify_crypt_md5(string password, string hash)`

  Description

    Verifies the password against the crypt_md5 hash.

  Throws

    May throw an exception if the hash value is bad.

  See also

    make_crypt_md5

  Method rot13

    `string rot13(string data)`

  Description

    Convenience function that accesses the crypt function of a substitution object keyed to perform standard ROT13 (de)ciphering.

  CLASS Crypto.Hash

    Description

      Abstract class for hash algorithms. Contains some tools useful for all hashes.

    Inherit HashInfo

      inherit Nettle.HashInfo : HashInfo

    Method `()

      `HashState `()()`

    Description

      Calling `() will return a Nettle.HashState object.

  CLASS Crypto.Cipher

    Description

      Abstract class for crypto algorithms. Contains some tools useful for all ciphers.

    Inherit CipherInfo

      inherit Nettle.CipherInfo : CipherInfo

    Method `()

      `CipherState `()()`

    Description

      Calling `() will return a Nettle.CipherState object.

    Method encrypt

      `string encrypt(string key, string data)`

    Description

      Works as a shortcut for `obj->set_encrypt_key(key)->crypt(data)`

    Method decrypt

      `string decrypt(string key, string data)`

    Description

      Works as a shortcut for `obj->set_decrypt_key(key)->crypt(data)`

  CLASS Crypto.Substitution

    Description

      Implements a simple substitution crypto, ie. one of the first crypto systems ever invented and thus one of the least secure ones available.

    Method set_key

      `this_program set_key(mapping(string:string|array(string)) key)`

    Description

      Sets the encryption and decryption key. The decryption key is derived from the encryption key by reversing the mapping. If one index maps to an array of strings, one element from the array will be chosen at random in such substitution.

    Throws

      An error is thrown if the encryption key can not be made reversible.

    Method set_null_chars

      `this_program set_null_chars(int|float p, array(string) chars)`

    Description

      Set null characters (fillers). Characters from chars will be inserted into the output stream with a probability p .

    Parameter `p`

      A float between 0.0 and 1.0 or an integer between 0 and 100.

    Parameter `chars`

      An array of one character strings.

    Method set_rot_key

      `this_program set_rot_key(void|int steps, void|array(string) alphabet)`

    Description

      Sets the key to a ROT substitution system. steps defaults to 13 and alphabet defaults to A-Z, i.e. this function defaults to set the substitution crypto to be ROT13. If no alphabet is given the key will be case insensitive, e.g. the key will really be two ROT13 alphabets, one a-z and one A-Z, used simultaneously.

    Method set_ACA_K1_key

      `this_program set_ACA_K1_key(string key, void|int offset, void|array(string) alphabet)`

    Description

      Sets the key according to ACA K1 key generation. The plaintext alphabet is prepended with a keyword key that shifts the alphabet positions compared to the cryptogram alphabet. The plaintext alphabet is then reduced with the characters in the keyword. It is also optionally rotated offset number of steps.

    Method set_ACA_K2_key

      `this_program set_ACA_K2_key(string key, void|int offset, void|array(string) alphabet)`

    Description

      Sets the key according to ACA K2 key generation. The cryptogram alphabet is prepended with a keyword key that shifts the alphabet positions compared to the plaintext alphabet. The cryptogram alphabet is then reduced with the characters in the keyword. It is als optionally reotated offset number of steps.

    Method set_ACA_K3_key

      `this_program set_ACA_K3_key(string key, int offset, void|array(string) alphabet)`

    Description

      Sets the key according to ACA K3 key generation. Both the plaintext and the cryptogram alphabets are prepended with a keyword key , which characters are removed from the rest of the alphabet. The plaintext alphabet is then rotated offset number of steps.

    Method set_ACA_K4_key

      `this_program set_ACA_K4_key(string key1, string key2, void|int offset, void|array(string) alphabet)`

    Description

      Sets the key according to ACA K4 key generation. Both the plaintext and the cryptogram alphabets are prepended with the keywords key1 and key2 . The plaintext alphabet is then rotated offset number of steps.

    Method encrypt

      `string encrypt(string m)`

    Description

      Encrypts the message m .

    Method decrypt

      `string decrypt(string c)`

    Description

      Decrypts the cryptogram c .

    Method filter

      `string filter(string m, void|multiset(int) save)`

    Description

      Removes characters not in the encryption key or in the save multiset from the message m .

  CLASS Crypto.DSA

    Description

      The Digital Signature Algorithm (aka DSS, Digital Signature Standard).

    Method get_p

      `Gmp.mpz get_p()`

    Description

      Returns the modulo.

    Method get_q

      `Gmp.mpz get_q()`

    Description

      Returns the group order.

    Method get_g

      `Gmp.mpz get_g()`

    Description

      Returns the generator.

    Method get_y

      `Gmp.mpz get_y()`

    Description

      Returns the public key.

    Method get_x

      `Gmp.mpz get_x()`

    Description

      Returns the private key.

    Method set_public_key

      `this_program set_public_key(Gmp.mpz p_, Gmp.mpz q_, Gmp.mpz g_, Gmp.mpz y_)`

    Description

      Sets the public key in this DSA object.

    Method set_private_key

      `this_program set_private_key(Gmp.mpz secret)`

    Description

      Sets the private key in this DSA object.

    Method set_random

      `this_program set_random(function(int:string) r)`

    Description

      Sets the random function, used to generate keys and parameters, to the function r . Default is Crypto.Random.random_string .

    Method hash

      `Gmp.mpz hash(string msg)`

    Description

      Makes a DSA hash of the messge msg .

    Method raw_sign

      `array(Gmp.mpz) raw_sign(Gmp.mpz h, void|Gmp.mpz k)`

    Description

      Sign the message h . Returns the signature as two Gmp.mpz objects.

    Method raw_verify

      `int(0..1) raw_verify(Gmp.mpz h, Gmp.mpz r, Gmp.mpz s)`

    Description

      Verify the signature r ,s against the message h .

    Method sign_rsaref

      `string sign_rsaref(string msg)`

    Description

      Make a RSA ref signature of message msg .

    Method verify_rsaref

      `int(0..1) verify_rsaref(string msg, string s)`

    Description

      Verify a RSA ref signature s of message msg .

    Method sign_ssl

      `string sign_ssl(string msg)`

    Description

      Make an SSL signatrue of message msg .

    Method verify_ssl

      `int(0..1) verify_ssl(string msg, string s)`

    Description

      Verify an SSL signature s of message msg .

    Method nist_primes

      `array(Gmp.mpz) nist_primes(int l)`

    Description

      The (slow) NIST method of generating a DSA prime pair. Algorithm 4.56 of Handbook of Applied Cryptography.

    Method generate_parameters

      `this_program generate_parameters(int bits)`

    Description

      Generate key parameters using nist_primes .

    Method generate_key

      `this_program generate_key()`

    Description

      Generates a public/private key pair. Needs the public parameters p, q and g set, either through set_public_key or generate_parameters .

    Method public_key_equal

      `int(0..1) public_key_equal(.DSA dsa)`

    Description

      Compares the public key in this object with that in the provided DSA object.

    Method name

      `string name()`

    Description

      Returns the string `"DSA"`.

  CLASS Crypto.RSA

    Method get_n

      `Gmp.mpz get_n()`

    Description

      Returns the RSA modulo (n).

    Method get_e

      `Gmp.mpz get_e()`

    Description

      Returns the RSA public exponent (e).

    Method get_d

      `Gmp.mpz get_d()`

    Description

      Returns the RSA private exponent (d), if known.

    Method get_p

      `Gmp.mpz get_p()`

    Description

      Returns the first RSA prime (p), if known.

    Method get_q

      `Gmp.mpz get_q()`

    Description

      Returns the second RSA prime (q), if known.

    Method cooked_get_n

      `string cooked_get_n()`

    Description

      Returns the RSA modulo (n) as a binary string.

    Method cooked_get_e

      `string cooked_get_e()`

    Description

      Returns the RSA public exponent (e) as a binary string.

    Method cooked_get_d

      `string cooked_get_d()`

    Description

      Returns the RSA private exponent (d) as a binary string, if known.

    Method cooked_get_p

      `string cooked_get_p()`

    Description

      Returns the first RSA prime (p) as a binary string, if known.

    Method cooked_get_q

      `string cooked_get_q()`

    Description

      Returns the second RSA prime (q) as a binary string, if known.

    Method set_public_key

      `this_program set_public_key(Gmp.mpz|int modulo, Gmp.mpz|int pub)`

    Description

      Sets the public key.

    Parameter `modulo`

      The RSA modulo, often called n. This value needs to be >=12.

    Parameter `pub`

      The public RSA exponent, often called e.

    Method set_private_key

      `this_program set_private_key(Gmp.mpz|int priv, array(Gmp.mpz|int)|void extra)`

    Description

      Sets the private key.

    Parameter `priv`

      The private RSA exponent, often called d.

    Parameter `extra`

      Array
      `Gmp.mpz|int 0` | The first prime, often called p.
      `Gmp.mpz|int 1` | The second prime, often called q.

    Method query_blocksize

      `int query_blocksize()`

    Description

      Returns the crypto block size, or zero if not yet set.

    Method rsa_pad

      `Gmp.mpz rsa_pad(string message, int(1..2) type, function(int:string)|void random)`

    Description

      Pads the message to the current block size with method type and returns the result as an integer. This is equvivalent to OS2IP(EME-PKCS1-V1_5-ENCODE(message)) in PKCS-1.

    Parameter `type`

      `1` | The message is padded with `0xff` bytes.
      `2` | The message is padded with random data, using the random function if provided. Otherwise Crypto.Random.random_string will be used.

    Method rsa_unpad

      `string rsa_unpad(Gmp.mpz block, int type)`

    Description

      Reverse the effect of rsa_pad .

    Method raw_sign

      `Gmp.mpz raw_sign(string digest)`

    Description

      Pads the digest with rsa_pad type 1 and signs it.

    Method cooked_sign

      `string cooked_sign(string digest)`

    Description

      Signs digest as raw_sign and returns the signature as a byte string.

    Method raw_verify

      `int(0..1) raw_verify(string digest, Gmp.mpz s)`

    Description

      Verifies the digest against the signature s , assuming pad type 1.

    See also

      rsa_pad , raw_sign

    Method encrypt

      `string encrypt(string s, function(int:string)|void r)`

    Description

      Pads the message s with rsa_pad type 2, signs it and returns the signature as a byte string.

    Parameter `r`

      Optional random function to be passed down to rsa_pad .

    Method decrypt

      `string decrypt(string s)`

    Description

      Decrypt a message encrypted with encrypt .

    Method rsa_size

      `int(0..) rsa_size()`

    Description

      Returns the size of the key in terms of number of bits.

    Method public_key_equal

      `int(0..1) public_key_equal(this_program rsa)`

    Description

      Compares the public key of this RSA object with another RSA object.

    Method sign

      `Gmp.mpz sign(string message, .Hash h)`

    Description

      Signs the message with a PKCS-1 signature using hash algorithm h .

    Method verify

      `int(0..1) verify(string msg, .Hash h, Gmp.mpz sign)`

    Description

      Verify PKCS-1 signature sign of message msg using hash algorithm h .

    Method sha_sign

      `string sha_sign(string message, mixed|void r)`

    FIXME

      Document this function.

    Method sha_verify

      `int sha_verify(string message, string signature)`

    FIXME

      Document this function.

    Method get_prime

      `Gmp.mpz get_prime(int bits, function(int:string) r)`

    Description

      Generate a prime with bits number of bits using random function r .

    Method generate_key

      `this_program generate_key(int(128..) bits, function(int:string)|void r)`

    Description

      Generate a valid RSA key pair with the size bits . A random function may be provided as arguemnt r , otherwise Crypto.Random.random_string will be used. Keys must be at least 128 bits.

    Method set_encrypt_key

      `this_program set_encrypt_key(array(Gmp.mpz) key)`

    Description

      Sets the public key to key and the mode to encryption.

    See also

      set_decrypt_key , crypt

    Method set_decrypt_key

      `this_program set_decrypt_key(array(Gmp.mpz) key)`

    Description

      Sets the public key to key and the mod to decryption.

    See also

      set_encrypt_key , crypt

    Method crypt

      `string crypt(string s)`

    Description

      Encrypt or decrypt depending on set mode.

    See also

      set_encrypt_key , set_decrypt_key

    Method name

      `string name()`

    Description

      Returns the string `"RSA"`.

  CLASS Crypto.Pipe

    Description

      A wrapper class that connects several cipher algorithms into one algorithm. E.g. triple DES can be emulated with `Crypto.Pipe(Crypto.DES, Crypto.DES, Crypto.DES)`.

  CLASS Crypto.HMAC

    Description

      HMAC, defined by RFC-2104

    Method create

      `void Crypto.HMAC(.Hash h, int|void b)`

    Parameter `h`

      The hash object on which the HMAC object should base its operations. Typical input is Crypto.MD5 .

    Parameter `b`

      The block size of one compression block, in octets. Defaults to 64.

    Method raw_hash

      `string raw_hash(string s)`

    Description

      Calls the hash function given to create and returns the hash value of s .

    Method pkcs_digest

      `string pkcs_digest(string s)`

    Description

      Makes a PKCS-1 digestinfo block with the message s .

    See also

      Standards.PKCS.Signature.build_digestinfo

    CLASS Crypto.HMAC.`()

      Description

        Calling the HMAC object with a password returns a new object that can perform the actual HMAC hashing. E.g. doing a HMAC hash with MD5 and the password `"bar"` of the string `"foo"` would require the code `Crypto.HMAC(Crypto.MD5)("bar")("foo")`.

      Method create

        `void Crypto.HMAC.`()(string passwd)`

      Parameter `passwd`

        The secret password (K).

      Method `()

        `string `()(string text)`

      Description

        Hashes the text according to the HMAC algorithm and returns the hash value.

      Method digest_info

        `string digest_info(string text)`

      Description

        Hashes the text according to the HMAC algorithm and returns the hash value as a PKCS-1 digestinfo block.

  CLASS Crypto.CBC

    Description

      Implementation of the cipher block chaining mode (CBC). Works as a wrapper for the cipher algorithm put in create.

    Method create

      `void Crypto.CBC(program|object|function cipher, mixed ... args)`

    Description

      Initialize the CBC wrapper with a cipher algorithm. If it is a program, an object will be instantiated with args as arguments. If it is an object that doesn't conform to the cipher API, but has an LFUN::`() , that LFUN will be called. If it is a function, that function will be called with args as arguments.

    Method name

      `string name()`

    Description

      Returns the string `"CBC(x)"` where x is the encapsulated algorithm.

    Method block_size

      `int block_size()`

    Description

      Reurns the block size of the encapsulated cipher.

    Method key_size

      `int key_size()`

    Description

      Returns the key size of the encapsulated cipher.

    Method set_encrypt_key

      `this_program set_encrypt_key(string key)`

    Description

      Prepare the cipher and the wrapper for encrypting with the given key .

    Method set_decrypt_key

      `this_program set_decrypt_key(string key)`

    Description

      Prepare the cipher and the wrapper for decrypting with the given key .

    Method set_iv

      `this_program set_iv(string iv)`

    Description

      Set the initialization vector to iv .

    Method crypt

      `string crypt(string data)`

    Description

      Encrypt/decrypt data and return the result. data must be an integral number of blocks.

  CLASS Crypto.Buffer

    Description

      Acts as a buffer so that data can be fed to a cipher in blocks that don't correspond to cipher block sizes.

    Method create

      `void Crypto.Buffer(program|object|function cipher, mixed ... args)`

    Description

      Initialize the Proxy wrapper with a cipher algorithm. If it is a program, an object will be instantiated with args as arguments. If it is an object that doesn't conform to the cipher API, but has an LFUN::`() , that LFUN will be called. If it is a function, that function will be called with args as arguments.

    Method name

      `string name()`

    Description

      Returns the string `"Proxy(x)"` where x is the encapsulated algorithm.

    Method block_size

      `int block_size()`

    Description

      Get the block size of the contained block crypto.

    Method key_size

      `int key_size()`

    Description

      Get the key size of the contained block crypto.

    Method set_encrypt_key

      `this_program set_encrypt_key(string key)`

    Description

      Set the encryption key.

    Note

      As a side-effect any buffered data will be cleared.

    Method set_decrypt_key

      `this_program set_decrypt_key(string key)`

    Description

      Set the decryption key.

    Note

      As a side-effect any buffered data will be cleared.

    Method crypt

      `string crypt(string data)`

    Description

      Encrypt some data.

      Adds data to be encrypted to the buffer. If there's enough data to en/decrypt a block, that will be done, and the result returned. Any uncrypted data will be left in the buffer.

    Method pad

      `string pad(void|int method)`

    Description

      Pad and encrypt any data left in the buffer.

    Parameter `method`

      The type of padding to apply to the buffer.

      `Crypto.PAD_SSL`
      `Crypto.PAD_ISO_10126`
      `Crypto.PAD_ANSI_X923`
      `Crypto.PAD_PKCS7`
      `Crypto.PAD_ZERO`

      Defaults to Crypto.PAD_SSL for compatibility reasons.

    See also

      unpad()

    Method unpad

      `string unpad(string data, void|int method)`

    Description

      Decrypt and unpad a block of data.

      This performs the reverse operation of pad() .

    Parameter `method`

      The type of padding that was applied to the original buffer.

      `Crypto.PAD_SSL`
      `Crypto.PAD_ISO_10126`
      `Crypto.PAD_ANSI_X923`
      `Crypto.PAD_PKCS7`
      `Crypto.PAD_ZERO`

      Defaults to Crypto.PAD_SSL for compatibility reasons.

    See also

      pad()

  Module Crypto.NT

    CLASS Crypto.NT.CryptContext

      Description

        Class representing an HCRYPTPROV handle.

      Method create

        `void Crypto.NT.CryptContext(string name, string csp, int type, int flags)`

      Parameter `name`

        Key container name. When flags is set to CRYPT_VERIFYCONTEXT the name must be `0`.

      Parameter `csp`

        The name of the Crypto Service Provider to use. If set to `0` the user default CSP will be used.

      Method read

        `string read(int size, string|void init)`

      Description

        Retreive some random data. Calls CryptGenRandom in the NT API.

  Module Crypto.Serpent

    Description

      SERPENT is one of the AES finalists, designed by Ross Anderson, Eli Biham and Lars Knudsen. Thus, the interface and properties are similar to AES '. One peculiarity is that it is quite pointless to use it with anything but the maximum key size, smaller keys are just padded to larger ones.

    Inherit Serpent_Info

      inherit Nettle.Serpent_Info : Serpent_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.AES

    Description

      AES (American Encryption Standard) is a quite new block cipher, specified by NIST as a replacement for the older DES standard. The standard is the result of a competition between cipher designers. The winning design, also known as RIJNDAEL, was constructed by Joan Daemen and Vincent Rijnmen.

      Like all the AES candidates, the winning design uses a block size of 128 bits, or 16 octets, and variable key-size, 128, 192 and 256 bits (16, 24 and 32 octets) being the allowed key sizes. It does not have any weak keys.

    Inherit AES_Info

      inherit Nettle.AES_Info : AES_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.MD2

    Description

      MD2 is a message digest function constructed by Burton Kaliski, and is described in RFC 1319. It outputs message digests of 128 bits, or 16 octets.

    Inherit MD2_Info

      inherit Nettle.MD2_Info : MD2_Info

    Inherit Hash

      inherit .Hash : Hash

  Module Crypto.Random

    Description

      This module contains stuff to that tries to give you the best possible random generation.

    Method random_string

      `string random_string(int len)`

    Description

      Returns a string of length len with random content. The content is generated by a Yarrow random generator that is constantly updated with output from /dev/random on UNIX and CryptGenRandom on NT. The Yarrow random generator is fed at least the amount of random data from its sources as it outputs, thus doing its best to give at least good pseudo- random data on operating systems with bad /dev/random.

    Method random

      `Gmp.mpz random(int top)`

    Description

      Returns a Gmp.mpz object with a random value between `0` and top . Uses random_string .

    Method blocking_random_string

      `string blocking_random_string(int len)`

    Description

      Works as random_string , but may block in order to gather enough entropy to make a truely random output. Using this function is probably overkill for about all applications.

    Method add_entropy

      `void add_entropy(string data, int entropy)`

    Description

      Inject additional entropy into the random generator.

    Parameter `data`

      The random string.

    Parameter `entropy`

      The number of bits in the random string that is truely random.

  Module Crypto.SHA256

    Description

      SHA256 is another hash function specified by NIST, intended as a replacement for SHA1 , generating larger digests. It outputs hash values of 256 bits, or 32 octets.

    Inherit SHA256_Info

      inherit Nettle.SHA256_Info : SHA256_Info

    Inherit Hash

      inherit .Hash : Hash

  Module Crypto.SHA1

    Description

      SHA1 is a hash function specified by NIST (The U.S. National Institute for Standards and Technology). It outputs hash values of 160 bits, or 20 octets.

    Inherit SHA1_Info

      inherit Nettle.SHA1_Info : SHA1_Info

    Inherit Hash

      inherit .Hash : Hash

  Module Crypto.Blowfish

    Description

      BLOWFISH is a block cipher designed by Bruce Schneier. It uses a block size of 64 bits (8 octets), and a variable key size, up to 448 bits. It has some weak keys.

    Inherit BLOWFISH_Info

      inherit Nettle.BLOWFISH_Info : BLOWFISH_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.DES3

    Description

      The inadequate key size of DES has already been mentioned. One way to increase the key size is to pipe together several DES boxes with independent keys. It turns out that using two DES ciphers is not as secure as one might think, even if the key size of the combination is a respectable 112 bits.

      The standard way to increase DES's key size is to use three DES boxes. The mode of operation is a little peculiar: the middle DES box is wired in the reverse direction. To encrypt a block with DES3, you encrypt it using the first 56 bits of the key, then decrypt it using the middle 56 bits of the key, and finally encrypt it again using the last 56 bits of the key. This is known as "ede" triple-DES, for "encrypt-decrypt-encrypt".

      The "ede" construction provides some backward compatibility, as you get plain single DES simply by feeding the same key to all three boxes. That should help keeping down the gate count, and the price, of hardware circuits implementing both plain DES and DES3.

      DES3 has a key size of 168 bits, but just like plain DES, useless parity bits are inserted, so that keys are represented as 24 octets (192 bits). As a 112 bit key is large enough to make brute force attacks impractical, some applications uses a "two-key" variant of triple-DES. In this mode, the same key bits are used for the first and the last DES box in the pipe, while the middle box is keyed independently. The two-key variant is believed to be secure, i.e. there are no known attacks significantly better than brute force.

    Inherit DES3_Info

      inherit Nettle.DES3_Info : DES3_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.Arcfour

    Description

      Arcfour is a stream cipher, also known under the trade marked name RC4, and it is one of the fastest ciphers around. A problem is that the key setup of Arcfour is quite weak, you should never use keys with structure, keys that are ordinary passwords, or sequences of keys like `"secret:1"`, `"secret:2"`, ..... If you have keys that don't look like random bit strings, and you want to use Arcfour, always hash the key before feeding it to Arcfour.

    Inherit ARCFOUR_Info

      inherit Nettle.ARCFOUR_Info : ARCFOUR_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.PGP

    Description

      PGP stuff. See RFC 2440.

    Method decode

      `mapping(string:string|mapping) decode(string s)`

    Description

      Decodes PGP data.

    Method verify_signature

      `int verify_signature(string text, string sig, string pubkey)`

    Description

      Verify text against signature sig with the public key pubkey .

    Method encode_radix64

      `string encode_radix64(string data, string type, void|mapping(string:string) extra)`

    Description

      Encode PGP data with ASCII armour.

    Method decode_radix64

      `mapping(string:mixed) decode_radix64(string data)`

    Description

      Decode ASCII armour.

  Module Crypto.Twofish

    Description

      Another AES finalist, this one designed by Bruce Schneier and others.

    Inherit Twofish_Info

      inherit Nettle.Twofish_Info : Twofish_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.DES

    Description

      DES is the old Data Encryption Standard, specified by NIST. It uses a block size of 64 bits (8 octets), and a key size of 56 bits. However, the key bits are distributed over 8 octets, where the least significant bit of each octet is used for parity. A common way to use DES is to generate 8 random octets in some way, then set the least significant bit of each octet to get odd parity, and initialize DES with the resulting key.

      The key size of DES is so small that keys can be found by brute force, using specialized hardware or lots of ordinary work stations in parallel. One shouldn't be using plain DES at all today, if one uses DES at all one should be using DES3 or "triple DES".

      DES also has some weak keys.

    Inherit DES_Info

      inherit Nettle.DES_Info : DES_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.MD4

    Description

      MD4 is a message digest function constructed by Ronald Rivest, and is described in RFC 1320. It outputs message digests of 128 bits, or 16 octets.

    Inherit MD4_Info

      inherit Nettle.MD4_Info : MD4_Info

    Inherit Hash

      inherit .Hash : Hash

  Module Crypto.Koremutake

    Description

      Quote from Koremutake home page http://shorl.com/koremutake:

      In an attempt to temporarily solve the fact that human beings seem to be inable to remember important things (such as their names, car keys and seemingly random numbers with fourteen digits in 'em), we invented Koremutake.

      It is, in plain language, a way to express any large number as a sequence of syllables. The general idea is that word-sounding pieces of information are a lot easier to remember than a sequence of digits.

    Method encrypt

      `string encrypt(int m)`

    Description

      Encode an integer as a koremutake string.

    Method decrypt

      `int decrypt(string c)`

    Description

      Decode a koremutake string into an integer.

  Module Crypto.MD5

    Description

      MD5 is a message digest function constructed by Ronald Rivest, and is described in RFC 1321. It outputs message digests of 128 bits, or 16 octets.

    Inherit MD5_Info

      inherit Nettle.MD5_Info : MD5_Info

    Inherit Hash

      inherit .Hash : Hash

  Module Crypto.IDEA

    Description

      The IDEA(tm) block cipher is covered by patents held by ETH and a Swiss company called Ascom-Tech AG. The Swiss patent number is PCT/CH91/00117, the European patent number is EP 0 482 154 B1, and the U.S. patent number is US005214703. IDEA(tm) is a trademark of Ascom-Tech AG. There is no license fee required for noncommercial use.

    Inherit IDEA_Info

      inherit Nettle.IDEA_Info : IDEA_Info

    Inherit Cipher

      inherit .Cipher : Cipher

  Module Crypto.CAST

    Description

      CAST-128 is a block cipher, specified in RFC 2144. It uses a 64 bit (8 octets) block size, and a variable key size of up to 128 bits.

    Inherit CAST128_Info

      inherit Nettle.CAST128_Info : CAST128_Info

    Inherit Cipher

      inherit .Cipher : Cipher

Module GL

  Description

    Not implemented OpenGL methods:

    glAreTexturesResident
    glBitmap
    glBlendColorEXT
    glCallLists
    glColorPointer
    glDeleteTextures
    glDrawElements
    glEdgeFlagPointer
    glEdgeFlagv
    glEvalMesh
    glFeedbackBuffer
    glGenTextures
    glGetBooleanv
    glGetClipPlane
    glGetDoublev
    glGetFloatv
    glGetIntegerv
    glGetLight
    glGetMap
    glGetMaterial
    glGetPixelMap
    glGetPointerv
    glGetPolygonStipple
    glGetTexEnv
    glGetTexGen
    glGetTexImage
    glGetTexLevelParameter
    glGetTexParameter
    glIndexPointer
    glInterleavedArrays
    glMap1
    glMap2
    glMapGrid
    glNormalPointer
    glPixelMap
    glPixelStore
    glPixelTransfer
    glPolygonStipple
    glPrioritizeTextures
    glReadPixels
    glRect
    glSelectBuffer
    glTexCoordPointer
    glTexImage1D
    glTexSubImage1D
    glVertexPointer

  Method glAccum

    `void glAccum(int op, float value)`

  Description

    The accumulation buffer is an extended-range color buffer. Images are not rendered into it. Rather, images rendered into one of the color buffers are added to the contents of the accumulation buffer after rendering. Effects such as antialiasing (of points, lines, and polygons), motion blur, and depth of field can be created by accumulating images generated with different transformation matrices.

    Each pixel in the accumulation buffer consists of red, green, blue, and alpha values. The number of bits per component in the accumulation buffer depends on the implementation. You can examine this number by calling glGetIntegerv four times, with arguments GL_ACCUM_RED_BITS , GL_ACCUM_GREEN_BITS , GL_ACCUM_BLUE_BITS , and GL_ACCUM_ALPHA_BITS . Regardless of the number of bits per component, the range of values stored by each component is [-1, 1]. The accumulation buffer pixels are mapped one-to-one with frame buffer pixels.

    glAccum operates on the accumulation buffer. The first argument, op, is a symbolic constant that selects an accumulation buffer operation. The second argument, value, is a floating-point value to be used in that operation. Five operations are specified: GL_ACCUM , GL_LOAD , GL_ADD , GL_MULT , and GL_RETURN .

    All accumulation buffer operations are limited to the area of the current scissor box and applied identically to the red, green, blue, and alpha components of each pixel. If a glAccum operation results in a value outside the range [-1, 1], the contents of an accumulation buffer pixel component are undefined.

    The operations are as follows:

    GL_ACCUM

    Obtains R, G, B, and A values from the buffer currently selected for reading (see glReadBuffer ). Each component value is divided by 2n1, where n is the number of bits allocated to each color component in the currently selected buffer. The result is a floating-point value in the range [0, 1], which is multiplied by value and added to the corresponding pixel component in the accumulation buffer, thereby updating the accumulation buffer.

    GL_LOAD | Similar to GL_ACCUM , except that the current value in the accumulation buffer is not used in the calculation of the new value. That is, the R, G, B, and A values from the currently selected buffer are divided by 2n1, multiplied by value, and then stored in the corresponding accumulation buffer cell, overwriting the current value.
    GL_ADD | Adds value to each R, G, B, and A in the accumulation buffer.
    GL_MULT | Multiplies each R, G, B, and A in the accumulation buffer by value and returns the scaled component to its corresponding accumulation buffer location.
    GL_RETURN | Transfers accumulation buffer values to the color buffer or buffers currently selected for writing. Each R, G, B, and A component is multiplied by value, then multiplied by 2n1, clamped to the range [0, 2n1 ], and stored in the corresponding display buffer cell. The only fragment operations that are applied to this transfer are pixel ownership, scissor, dithering, and color writemasks.

    To clear the accumulation buffer, call glClearAccum with R, G, B, and A values to set it to, then call glClear with the accumulation buffer enabled.

  Parameter `op`

    Specifies the accumulation buffer operation. Symbolic constants GL_ACCUM , GL_LOAD , GL_ADD , GL_MULT , and GL_RETURN are accepted.

  Parameter `value`

    Specifies a floating-point value used in the accumulation buffer operation. op determines how value is used.

  Throws

    GL_INVALID_ENUM is generated if op is not an accepted value.

    GL_INVALID_OPERATION is generated if there is no accumulation buffer.

    GL_INVALID_OPERATION is generated if glAccum is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glAlphaFunc

    `void glAlphaFunc(int func, float ref)`

  Description

    The alpha test discards fragments depending on the outcome of a comparison between an incoming fragment's alpha value and a constant reference value. glAlphaFunc specifies the reference value and the comparison function. The comparison is performed only if alpha testing is enabled. By default, it is not enabled. (See glEnable and glDisable of GL_ALPHA_TEST .)

    func and ref specify the conditions under which the pixel is drawn. The incoming alpha value is compared to ref using the function specified by func. If the value passes the comparison, the incoming fragment is drawn if it also passes subsequent stencil and depth buffer tests. If the value fails the comparison, no change is made to the frame buffer at that pixel location. The comparison functions are as follows:

    GL_NEVER | Never passes.
    GL_LESS | Passes if the incoming alpha value is less than the reference value.
    GL_EQUAL | Passes if the incoming alpha value is equal to the reference value.
    GL_LEQUAL | Passes if the incoming alpha value is less than or equal to the reference value.
    GL_GREATER | Passes if the incoming alpha value is greater than the reference value.
    GL_NOTEQUAL | Passes if the incoming alpha value is not equal to the reference value.
    GL_GEQUAL | Passes if the incoming alpha value is greater than or equal to the reference value.
    GL_ALWAYS | Always passes (initial value).

    glAlphaFunc operates on all pixel write operations, including those resulting from the scan conversion of points, lines, polygons, and bitmaps, and from pixel draw and copy operations. glAlphaFunc does not affect screen clear operations.

  Parameter `func`

    Specifies the alpha comparison function. Symbolic constants GL_NEVER , GL_LESS , GL_EQUAL , GL_LEQUAL , GL_GREATER , GL_NOTEQUAL , GL_GEQUAL , and GL_ALWAYS are accepted. The initial value is GL_ALWAYS .

  Parameter `ref`

    Specifies the reference value that incoming alpha values are compared to. This value is clamped to the range 0 through 1, where 0 represents the lowest possible alpha value and 1 the highest possible value. The initial reference value is 0.

  Throws

    GL_INVALID_ENUM is generated if func is not an accepted value.

    GL_INVALID_OPERATION is generated if glAlphaFunc is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glArrayElement

    `void glArrayElement(int i)`

  Description

    glArrayElement commands are used within glBegin /glEnd pairs to specify vertex and attribute data for point, line, and polygon primitives. If GL_VERTEX_ARRAY is enabled when glArrayElement is called, a single vertex is drawn, using vertex and attribute data taken from location i of the enabled arrays. If GL_VERTEX_ARRAY is not enabled, no drawing occurs but the attributes corresponding to the enabled arrays are modified.

    Use glArrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal per individual triangle.

    Changes made to array data between the execution of glBegin and the corresponding execution of glEnd may affect calls to glArrayElement that are made within the same glBegin /glEnd period in non-sequential ways. That is, a call to

    glArrayElement that precedes a change to array data may access the changed data, and a call that follows a change to array data may access original data.

  Parameter `i`

    Specifies an index into the enabled vertex data arrays.

  Method glBindTexture

    `void glBindTexture(int target, int texture)`

  Description

    glBindTexture lets you create or use a named texture. Calling glBindTexture with

    target set to GL_TEXTURE_1D or GL_TEXTURE_2D and texture set to the name of the newtexture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.

    Texture names are unsigned integers. The value zero is reserved to represent the default texture for each texture target. Texture names and the corresponding texture contents are local to the shared display-list space (see glXCreateContext ) of the current GL rendering context; two rendering contexts share texture names only if they also share display lists.

    You may use glGenTextures to generate a set of new texture names.

    When a texture is first bound, it assumes the dimensionality of its target: A texture first bound to GL_TEXTURE_1D becomes 1-dimensional and a texture first bound to GL_TEXTURE_2D becomes 2-dimensional. The state of a 1-dimensional texture immediately after it is first bound is equivalent to the state of the default GL_TEXTURE_1D at GL initialization, and similarly for 2-dimensional textures.

    While a texture is bound, GL operations on the target to which it is bound affect the bound texture, and queries of the target to which it is bound return state from the bound texture. If texture mapping of the dimensionality of the target to which a texture is bound is active, the bound texture is used. In effect, the texture targets become aliases for the textures currently bound to them, and the texture name zero refers to the default textures that were bound to them at initialization.

    A texture binding created with glBindTexture remains active until a different texture is bound to the same target, or until the bound texture is deleted with glDeleteTextures .

    Once created, a named texture may be re-bound to the target of the matching dimensionality as often as needed. It is usually much faster to use glBindTexture to bind an existing named texture to one of the texture targets than it is to reload the texture image using glTexImage1D or glTexImage2D . For additional control over performance, use glPrioritizeTextures .

    glBindTexture is included in display lists.

  Parameter `target`

    Specifies the target to which the texture is bound. Must be either GL_TEXTURE_1D or GL_TEXTURE_2D .

  Parameter `texture`

    Specifies the name of a texture.

  Throws

    GL_INVALID_ENUM is generated if target is not one of the allowable values.

    GL_INVALID_OPERATION is generated if texture has a dimensionality which doesn't match that of target.

    GL_INVALID_OPERATION is generated if glBindTexture is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glBlendFunc

    `void glBlendFunc(int sfactor, int dfactor)`

  Description

    In RGBA mode, pixels can be drawn using a function that blends the incoming (source) RGBA values with the RGBA values that are already in the frame buffer (the destination values). Blending is initially disabled. Use glEnable and glDisable with argument GL_BLEND to enable and disable blending.

    glBlendFunc defines the operation of blending when it is enabled. sfactor specifies which of nine methods is used to scale the source color components. dfactor specifies which of eight methods is used to scale the destination color components. The eleven possible methods are described in the following table. Each method defines four scale factors, one each for red, green, blue, and alpha.

    In the table and in subsequent equations, source and destination color components are referred to as (R sub s , G sub s , B sub s , A sub s ) and (R sub d , G sub d , B sub d , A sub d ). They are understood to have integer values between 0 and (k sub R , k sub G , k sub B , k sub A ), where

    .RS .ce k sub c ~=~ 2 sup m sub c - 1 .RE

    and (m sub R , m sub G , m sub B , m sub A ) is the number of red, green, blue, and alpha bitplanes.

    Source and destination scale factors are referred to as (s sub R , s sub G , s sub B , s sub A ) and (d sub R , d sub G , d sub B , d sub A ). The scale factors described in the table, denoted (f sub R , f sub G , f sub B , f sub A ), represent either source or destination factors. All scale factors have range [0,1].

    .TS center box ; ci | ci c | c . parameter (f sub R , ~~ f sub G , ~~ f sub B , ~~ f sub A ) = GL_ZERO (0, ~0, ~0, ~0 ) GL_ONE (1, ~1, ~1, ~1 ) GL_SRC_COLOR (R sub s / k sub R , ~G sub s / k sub G , ~B sub s / k sub B , ~A sub s / k sub A ) GL_ONE_MINUS_SRC_COLOR (1, ~1, ~1, ~1 ) ~-~ (R sub s / k sub R , ~G sub s / k sub G , ~B sub s / k sub B , ~A sub s / k sub A ) GL_DST_COLOR (R sub d / k sub R , ~G sub d / k sub G , ~B sub d / k sub B , ~A sub d / k sub A ) GL_ONE_MINUS_DST_COLOR (1, ~1, ~1, ~1 ) ~-~ (R sub d / k sub R , ~G sub d / k sub G , ~B sub d / k sub B , ~A sub d / k sub A ) GL_SRC_ALPHA (A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A ) GL_ONE_MINUS_SRC_ALPHA (1, ~1, ~1, ~1 ) ~-~ (A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A ) GL_DST_ALPHA (A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A ) GL_ONE_MINUS_DST_ALPHA (1, ~1, ~1, ~1 ) ~-~ (A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A ) GL_SRC_ALPHA_SATURATE (i, ~i, ~i, ~1 ) .TE .sp In the table,

    .RS .nf

    i ~=~ min (A sub s , ~k sub A - A sub d ) ~/~ k sub A .fi .RE

    To determine the blended RGBA values of a pixel when drawing in RGBA mode, the system uses the following equations:

    .RS .nf

    R sub d ~=~ min ( k sub R , ~~ R sub s s sub R + R sub d d sub R ) G sub d ~=~ min ( k sub G , ~~ G sub s s sub G + G sub d d sub G ) B sub d ~=~ min ( k sub B , ~~ B sub s s sub B + B sub d d sub B ) A sub d ~=~ min ( k sub A , ~~ A sub s s sub A + A sub d d sub A ) .fi .RE

    Despite the apparent precision of the above equations, blending arithmetic is not exactly specified, because blending operates with imprecise integer color values. However, a blend factor that should be equal to 1 is guaranteed not to modify its multiplicand, and a blend factor equal to 0 reduces its multiplicand to 0. For example, when sfactor is GL_SRC_ALPHA , dfactor is GL_ONE_MINUS_SRC_ALPHA , and A sub s is equal to k sub A, the equations reduce to simple replacement:

    .RS .nf

    R sub d ~=~ R sub s G sub d ~=~ G sub s B sub d ~=~ B sub s A sub d ~=~ A sub s .fi .RE

  Parameter `sfactor`

    Specifies how the red, green, blue, and alpha source blending factors are computed. Nine symbolic constants are accepted: GL_ZERO , GL_ONE , GL_DST_COLOR , GL_ONE_MINUS_DST_COLOR , GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA , GL_DST_ALPHA , GL_ONE_MINUS_DST_ALPHA , and GL_SRC_ALPHA_SATURATE . The initial value is GL_ONE .

  Parameter `dfactor`

    Specifies how the red, green, blue, and alpha destination blending factors are computed. Eight symbolic constants are accepted: GL_ZERO , GL_ONE , GL_SRC_COLOR , GL_ONE_MINUS_SRC_COLOR , GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA , GL_DST_ALPHA , and GL_ONE_MINUS_DST_ALPHA . The initial value is GL_ZERO .

  Throws

    GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.

    GL_INVALID_OPERATION is generated if glBlendFunc is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glCallList

    `void glCallList(int list)`

  Description

    glCallList causes the named display list to be executed. The commands saved in the display list are executed in order, just as if they were called without using a display list. If list has not been defined as a display list, glCallList is ignored.

    glCallList can appear inside a display list. To avoid the possibility of infinite recursion resulting from display lists calling one another, a limit is placed on the nesting level of display lists during display-list execution. This limit is at least 64, and it depends on the implementation.

    GL state is not saved and restored across a call to glCallList . Thus, changes made to GL state during the execution of a display list remain after execution of the display list is completed. Use glPushAttrib , glPopAttrib , glPushMatrix , and glPopMatrix to preserve GL state across glCallList calls.

  Parameter `list`

    Specifies the integer name of the display list to be executed.

  Method glClear

    `void glClear(int mask)`

  Description

    glClear sets the bitplane area of the window to values previously selected by glClearColor , glClearIndex , glClearDepth , glClearStencil , and glClearAccum . Multiple color buffers can be cleared simultaneously by selecting more than one buffer at a time using glDrawBuffer .

    The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClear . The scissor box bounds the cleared region. Alpha function, blend function, logical operation, stenciling, texture mapping, and depth-buffering are ignored by glClear .

    glClear takes a single argument that is the bitwise OR of several values indicating which buffer is to be cleared.

    The values are as follows:

    GL_COLOR_BUFFER_BIT | Indicates the buffers currently enabled for color writing.
    GL_DEPTH_BUFFER_BIT | Indicates the depth buffer.
    GL_ACCUM_BUFFER_BIT | Indicates the accumulation buffer.
    GL_STENCIL_BUFFER_BIT | Indicates the stencil buffer.

    The value to which each buffer is cleared depends on the setting of the clear value for that buffer.

  Parameter `mask`

    Bitwise OR of masks that indicate the buffers to be cleared. The four masks are GL_COLOR_BUFFER_BIT , GL_DEPTH_BUFFER_BIT , GL_ACCUM_BUFFER_BIT , and GL_STENCIL_BUFFER_BIT .

  Throws

    GL_INVALID_VALUE is generated if any bit other than the four defined bits is set in mask.

    GL_INVALID_OPERATION is generated if glClear is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glClearAccum

    `void glClearAccum(float|array(float) red, float|void green, float|void blue, float|void alpha)`

  Description

    glClearAccum specifies the red, green, blue, and alpha values used by glClear to clear the accumulation buffer.

    Values specified by glClearAccum are clamped to the range [-1,1].

  Parameter `red`

    Specify the red, green, blue, and alpha values used when the accumulation buffer is cleared. The initial values are all 0.

  Throws

    GL_INVALID_OPERATION is generated if glClearAccum is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glClearColor

    `void glClearColor(float|array(float) red, float|void green, float|void blue, float|void alpha)`

  Description

    glClearColor specifies the red, green, blue, and alpha values used by glClear to clear the color buffers. Values specified by glClearColor are clamped to the range [0,1].

  Parameter `red`

    Specify the red, green, blue, and alpha values used when the color buffers are cleared. The initial values are all 0.

  Throws

    GL_INVALID_OPERATION is generated if glClearColor is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glClearDepth

    `void glClearDepth(float depth)`

  Description

    glClearDepth specifies the depth value used by glClear to clear the depth buffer. Values specified by glClearDepth are clamped to the range [0,1].

  Parameter `depth`

    Specifies the depth value used when the depth buffer is cleared. The initial value is 1.

  Throws

    GL_INVALID_OPERATION is generated if glClearDepth is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glClearIndex

    `void glClearIndex(float c)`

  Description

    glClearIndex specifies the index used by glClear to clear the color index buffers. c is not clamped. Rather, c is converted to a fixed-point value with unspecified precision to the right of the binary point. The integer part of this value is then masked with 2 sup m -1, where m is the number of bits in a color index stored in the frame buffer.

  Parameter `c`

    Specifies the index used when the color index buffers are cleared. The initial value is 0.

  Throws

    GL_INVALID_OPERATION is generated if glClearIndex is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glClearStencil

    `void glClearStencil(int s)`

  Description

    glClearStencil specifies the index used by glClear to clear the stencil buffer. s is masked with 2 sup m - 1, where m is the number of bits in the stencil buffer.

  Parameter `s`

    Specifies the index used when the stencil buffer is cleared. The initial value is 0.

  Throws

    GL_INVALID_OPERATION is generated if glClearStencil is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glColor

    `void glColor(float|int red, float|int green, float|int blue, float|int|void alpha)`
    `void glColor(array(float|int) rgb)`

  Description

    The GL stores both a current single-valued color index and a current four-valued RGBA color. If no alpha value has been give, 1.0 (full intensity) is implied.

    Current color values are stored in floating-point format, with unspecified mantissa and exponent sizes. Unsigned integer color components, when specified, are linearly mapped to floating-point values such that the largest representable value maps to 1.0 (full intensity), and 0 maps to 0.0 (zero intensity). Signed integer color components, when specified, are linearly mapped to floating-point values such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.) Floating-point values are mapped directly.

    Neither floating-point nor signed integer values are clamped to the range [0,1] before the current color is updated. However, color components are clamped to this range before they are interpolated or written into a color buffer.

  Parameter `red`

    Specify new red, green, and blue values for the current color.

  Parameter `alpha`

    Specifies a new alpha value for the current color.

  Method glColorMask

    `void glColorMask(int red, int green, int blue, int alpha)`

  Description

    glColorMask specifies whether the individual color components in the frame buffer can or cannot be written. If red is GL_FALSE , for example, no change is made to the red component of any pixel in any of the color buffers, regardless of the drawing operation attempted.

    Changes to individual bits of components cannot be controlled. Rather, changes are either enabled or disabled for entire color components.

  Parameter `red`

    Specify whether red, green, blue, and alpha can or cannot be written into the frame buffer. The initial values are all GL_TRUE , indicating that the color components can be written.

  Throws

    GL_INVALID_OPERATION is generated if glColorMask is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glColorMaterial

    `void glColorMaterial(int face, int mode)`

  Description

    glColorMaterial specifies which material parameters track the current color. When GL_COLOR_MATERIAL is enabled, the material parameter or parameters specified by mode, of the material or materials specified by face, track the current color at all times.

    To enable and disable GL_COLOR_MATERIAL , call glEnable and glDisable with argument GL_COLOR_MATERIAL . GL_COLOR_MATERIAL is initially disabled.

  Parameter `face`

    Specifies whether front, back, or both front and back material parameters should track the current color. Accepted values are GL_FRONT , GL_BACK , and GL_FRONT_AND_BACK . The initial value is GL_FRONT_AND_BACK .

  Parameter `mode`

    Specifies which of several material parameters track the current color. Accepted values are GL_EMISSION , GL_AMBIENT , GL_DIFFUSE , GL_SPECULAR , and GL_AMBIENT_AND_DIFFUSE . The initial value is GL_AMBIENT_AND_DIFFUSE .

  Throws

    GL_INVALID_ENUM is generated if face or mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glColorMaterial is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glCopyPixels

    `void glCopyPixels(int x, int y, int width, int height, int type)`

  Description

    glCopyPixels copies a screen-aligned rectangle of pixels from the specified frame buffer location to a region relative to the current raster position. Its operation is well defined only if the entire pixel source region is within the exposed portion of the window. Results of copies from outside the window, or from regions of the window that are not exposed, are hardware dependent and undefined.

    x and y specify the window coordinates of the lower left corner of the rectangular region to be copied. width and height specify the dimensions of the rectangular region to be copied. Both width and height must not be negative.

    Several parameters control the processing of the pixel data while it is being copied. These parameters are set with three commands: glPixelTransfer , glPixelMap , and glPixelZoom . This reference page describes the effects on glCopyPixels of most, but not all, of the parameters specified by these three commands.

    glCopyPixels copies values from each pixel with the lower left-hand corner at (x + i, y + j) for 0\(<=i<width and 0\(<=j<height. This pixel is said to be the ith pixel in the jth row. Pixels are copied in row order from the lowest to the highest row, left to right in each row.

    type specifies whether color, depth, or stencil data is to be copied. The details of the transfer for each data type are as follows:

    GL_COLOR

    Indices or RGBA colors are read from the buffer currently specified as the read source buffer (see glReadBuffer ). If the GL is in color index mode, each index that is read from this buffer is converted to a fixed-point format with an unspecified number of bits to the right of the binary point. Each index is then shifted left by GL_INDEX_SHIFT bits, and added to GL_INDEX_OFFSET . If GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table GL_PIXEL_MAP_I_TO_I . Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in a color index buffer. If the GL is in RGBA mode, the red, green, blue, and alpha components of each pixel that is read are converted to an internal floating-point format with unspecified precision. The conversion maps the largest representable component value to 1.0, and component value 0 to 0.0. The resulting floating-point color values are then multiplied by GL_c_SCALE and added to GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0,1]. If GL_MAP_COLOR is true, each color component is scaled by the size of lookup table GL_PIXEL_MAP_c_TO_c , then replaced by the value that it references in that table. c is R, G, B, or A. The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning window coordinates (x sub r + i , y sub r + j), where (x sub r , y sub r) is the current raster position, and the pixel was the ith pixel in the jth row. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

    GL_DEPTH

    Depth values are read from the depth buffer and converted directly to an internal floating-point format with unspecified precision. The resulting floating-point depth value is then multiplied by GL_DEPTH_SCALE and added to GL_DEPTH_BIAS . The result is clamped to the range [0,1]. The GL then converts the resulting depth components to fragments by attaching the current raster position color or color index and texture coordinates to each pixel, then assigning window coordinates (x sub r + i , y sub r + j), where (x sub r , y sub r) is the current raster position, and the pixel was the ith pixel in the jth row. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

    GL_STENCIL

    Stencil indices are read from the stencil buffer and converted to an internal fixed-point format with an unspecified number of bits to the right of the binary point. Each fixed-point index is then shifted left by GL_INDEX_SHIFT bits, and added to GL_INDEX_OFFSET . If GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table GL_PIXEL_MAP_S_TO_S . Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the index read from the ith location of the jth row is written to location (x sub r + i , y sub r + j), where (x sub r , y sub r) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil writemask affect these write operations.

    The rasterization described thus far assumes pixel zoom factors of 1.0. If

    glPixelZoom is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x sub r, y sub r) is the current raster position, and a given pixel is in the ith location in the jth row of the source pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at

    .ce (x sub r + zoom sub x i, y sub r + zoom sub y j) .sp .5 .ce and .sp .5 .ce (x sub r + zoom sub x (i + 1), y sub r + zoom sub y ( j + 1 ))

    where zoom sub x is the value of GL_ZOOM_X and zoom sub y is the value of GL_ZOOM_Y .

  Parameter `x`

    Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

  Parameter `width`

    Specify the dimensions of the rectangular region of pixels to be copied. Both must be nonnegative.

  Parameter `type`

    Specifies whether color values, depth values, or stencil values are to be copied. Symbolic constants GL_COLOR , GL_DEPTH , and GL_STENCIL are accepted.

  Throws

    GL_INVALID_ENUM is generated if type is not an accepted value.

    GL_INVALID_VALUE is generated if either width or height is negative.

    GL_INVALID_OPERATION is generated if type is GL_DEPTH and there is no depth buffer.

    GL_INVALID_OPERATION is generated if type is GL_STENCIL and there is no stencil buffer.

    GL_INVALID_OPERATION is generated if glCopyPixels is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glCopyTexImage1D

    `void glCopyTexImage1D(int target, int level, int internalFormat, int x, int y, int width, int border)`

  Description

    glCopyTexImage1D defines a one-dimensional texture image with pixels from the current GL_READ_BUFFER .

    The screen-aligned pixel row with left corner at ("x", "y") and with a length of "width"~+~2~*~"border" defines the texture array at the mipmap level specified by level. internalFormat specifies the internal format of the texture array.

    The pixels in the row are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0,\ 1] and then converted to the texture's internal format for storage in the texel array.

    Pixel ordering is such that lower x screen coordinates correspond to lower texture coordinates.

    If any of the pixels within the specified row of the current GL_READ_BUFFER are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.

  Parameter `target`

    Specifies the target texture. Must be GL_TEXTURE_1D .

  Parameter `level`

    Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

  Parameter `internalFormat`

    Specifies the internal format of the texture. Must be one of the following symbolic constants: GL_ALPHA , GL_ALPHA4 , GL_ALPHA8 , GL_ALPHA12 , GL_ALPHA16 , GL_LUMINANCE , GL_LUMINANCE4 , GL_LUMINANCE8 , GL_LUMINANCE12 , GL_LUMINANCE16 , GL_LUMINANCE_ALPHA , GL_LUMINANCE4_ALPHA4 , GL_LUMINANCE6_ALPHA2 , GL_LUMINANCE8_ALPHA8 , GL_LUMINANCE12_ALPHA4 , GL_LUMINANCE12_ALPHA12 , GL_LUMINANCE16_ALPHA16 , GL_INTENSITY , GL_INTENSITY4 , GL_INTENSITY8 , GL_INTENSITY12 , GL_INTENSITY16 , GL_RGB , GL_R3_G3_B2 , GL_RGB4 , GL_RGB5 , GL_RGB8 , GL_RGB10 , GL_RGB12 , GL_RGB16 , GL_RGBA , GL_RGBA2 , GL_RGBA4 , GL_RGB5_A1 , GL_RGBA8 , GL_RGB10_A2 , GL_RGBA12 , or GL_RGBA16 .

  Parameter `x`

    Specify the window coordinates of the left corner of the row of pixels to be copied.

  Parameter `width`

    Specifies the width of the texture image. Must be 0 or 2**n ~+~ 2*border for some integer n. The height of the texture image is 1.

  Parameter `border`

    Specifies the width of the border. Must be either 0 or 1.

  Throws

    GL_INVALID_ENUM is generated if target is not one of the allowable values.

    GL_INVALID_VALUE is generated if level is less than 0. .P GL_INVALID_VALUE may be generated if level is greater than log sub 2 max, where max is the returned value of GL_MAX_TEXTURE_SIZE . .P GL_INVALID_VALUE is generated if internalFormat is not an allowable value.

    GL_INVALID_VALUE is generated if width is less than 0 or greater than 2 + GL_MAX_TEXTURE_SIZE , or if it cannot be represented as 2 ** n ~+~ 2~*~("border") for some integer value of n.

    GL_INVALID_VALUE is generated if border is not 0 or 1.

    GL_INVALID_OPERATION is generated if glCopyTexImage1D is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glCopyTexImage2D

    `void glCopyTexImage2D(int target, int level, int internalFormat, int x, int y, int width, int height, int border)`

  Description

    glCopyTexImage2D defines a two-dimensional texture image with pixels from the current GL_READ_BUFFER .

    The screen-aligned pixel rectangle with lower left corner at (x, y) and with a width of width~+~2~*~border and a height of height~+~2~*~border defines the texture array at the mipmap level specified by level. internalFormat specifies the internal format of the texture array.

    The pixels in the rectangle are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0,1] and then converted to the texture's internal format for storage in the texel array.

    Pixel ordering is such that lower x and y screen coordinates correspond to lower s and t texture coordinates.

    If any of the pixels within the specified rectangle of the current GL_READ_BUFFER are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.

  Parameter `target`

    Specifies the target texture. Must be GL_TEXTURE_2D .

  Parameter `level`

    Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

  Parameter `internalFormat`

    Specifies the internal format of the texture. Must be one of the following symbolic constants: GL_ALPHA , GL_ALPHA4 , GL_ALPHA8 , GL_ALPHA12 , GL_ALPHA16 , GL_LUMINANCE , GL_LUMINANCE4 , GL_LUMINANCE8 , GL_LUMINANCE12 , GL_LUMINANCE16 , GL_LUMINANCE_ALPHA , GL_LUMINANCE4_ALPHA4 , GL_LUMINANCE6_ALPHA2 , GL_LUMINANCE8_ALPHA8 , GL_LUMINANCE12_ALPHA4 , GL_LUMINANCE12_ALPHA12 , GL_LUMINANCE16_ALPHA16 , GL_INTENSITY , GL_INTENSITY4 , GL_INTENSITY8 , GL_INTENSITY12 , GL_INTENSITY16 , GL_RGB , GL_R3_G3_B2 , GL_RGB4 , GL_RGB5 , GL_RGB8 , GL_RGB10 , GL_RGB12 , GL_RGB16 , GL_RGBA , GL_RGBA2 , GL_RGBA4 , GL_RGB5_A1 , GL_RGBA8 , GL_RGB10_A2 , GL_RGBA12 , or GL_RGBA16 .

  Parameter `x`

    Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

  Parameter `width`

    Specifies the width of the texture image. Must be 0 or 2**n ~+~ 2*border for some integer n.

  Parameter `height`

    Specifies the height of the texture image. Must be 0 or 2**m ~+~ 2*border for some integer m.

  Parameter `border`

    Specifies the width of the border. Must be either 0 or 1.

  Throws

    GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D .

    GL_INVALID_VALUE is generated if level is less than 0. .P GL_INVALID_VALUE may be generated if level is greater than log sub 2 max, where max is the returned value of GL_MAX_TEXTURE_SIZE .

    GL_INVALID_VALUE is generated if width or height is less than 0, greater than 2~+~GL_MAX_TEXTURE_SIZE , or if width or height cannot be represented as 2**k ~+~ 2~*~border for some integer k.

    GL_INVALID_VALUE is generated if border is not 0 or 1.

    GL_INVALID_VALUE is generated if internalFormat is not one of the allowable values.

    GL_INVALID_OPERATION is generated if glCopyTexImage2D is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glCopyTexSubImage1D

    `void glCopyTexSubImage1D(int target, int level, int xoffset, int x, int y, int width)`

  Description

    glCopyTexSubImage1D replaces a portion of a one-dimensional texture image with pixels from the current GL_READ_BUFFER (rather than from main memory, as is the case for glTexSubImage1D ).

    The screen-aligned pixel row with left corner at (x,\ y), and with length width replaces the portion of the texture array with x indices xoffset through "xoffset" ~+~ "width" ~-~ 1, inclusive. The destination in the texture array may not include any texels outside the texture array as it was originally specified.

    The pixels in the row are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0,\ 1] and then converted to the texture's internal format for storage in the texel array.

    It is not an error to specify a subtexture with zero width, but such a specification has no effect. If any of the pixels within the specified row of the current GL_READ_BUFFER are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.

    No change is made to the internalformat, width, or border parameters of the specified texture array or to texel values outside the specified subregion.

  Parameter `target`

    Specifies the target texture. Must be GL_TEXTURE_1D .

  Parameter `level`

    Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

  Parameter `xoffset`

    Specifies the texel offset within the texture array.

  Parameter `x`

    Specify the window coordinates of the left corner of the row of pixels to be copied.

  Parameter `width`

    Specifies the width of the texture subimage.

  Throws

    GL_INVALID_ENUM is generated if target is not GL_TEXTURE_1D .

    GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage1D or glCopyTexImage1D operation.

    GL_INVALID_VALUE is generated if level is less than 0. .P GL_INVALID_VALUE may be generated if level>log sub 2 max, where max is the returned value of GL_MAX_TEXTURE_SIZE .

    GL_INVALID_VALUE is generated if y ~<~ ~-b or if width ~<~ ~-b, where b is the border width of the texture array.

    GL_INVALID_VALUE is generated if "xoffset" ~<~ ~-b, or ("xoffset"~+~"width") ~>~ (w-b), where w is the GL_TEXTURE_WIDTH , and b is the GL_TEXTURE_BORDER of the texture image being modified. Note that w includes twice the border width.

  Method glCopyTexSubImage2D

    `void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height)`

  Description

    glCopyTexSubImage2D replaces a rectangular portion of a two-dimensional texture image with pixels from the current GL_READ_BUFFER (rather than from main memory, as is the case for glTexSubImage2D ).

    The screen-aligned pixel rectangle with lower left corner at (x,\ y) and with width width and height height replaces the portion of the texture array with x indices xoffset through xoffset~+~width~-~1, inclusive, and y indices yoffset through yoffset~+~height~-~1, inclusive, at the mipmap level specified by level.

    The pixels in the rectangle are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion. At this point, all pixel component values are clamped to the range [0,\ 1] and then converted to the texture's internal format for storage in the texel array.

    The destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.

    If any of the pixels within the specified rectangle of the current GL_READ_BUFFER are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.

    No change is made to the internalformat, width, height, or border parameters of the specified texture array or to texel values outside the specified subregion.

  Parameter `target`

    Specifies the target texture. Must be GL_TEXTURE_2D

  Parameter `level`

    Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

  Parameter `xoffset`

    Specifies a texel offset in the x direction within the texture array.

  Parameter `yoffset`

    Specifies a texel offset in the y direction within the texture array.

  Parameter `x`

    Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

  Parameter `width`

    Specifies the width of the texture subimage.

  Parameter `height`

    Specifies the height of the texture subimage.

  Throws

    GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D .

    GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage2D or glCopyTexImage2D operation.

    GL_INVALID_VALUE is generated if level is less than 0. .P GL_INVALID_VALUE may be generated if level is greater than log sub 2 max, where max is the returned value of GL_MAX_TEXTURE_SIZE .

    GL_INVALID_VALUE is generated if x ~<~ ~-b or if y ~<~ ~-b, where b is the border width of the texture array.

    GL_INVALID_VALUE is generated if "xoffset" ~<~ -b, (xoffset~+~width)~>~(w ~-~b), yoffset~<~ ~-b, or (yoffset~+~height)~>~(h ~-~b), where w is the GL_TEXTURE_WIDTH , h is the GL_TEXTURE_HEIGHT , and b is the GL_TEXTURE_BORDER of the texture image being modified. Note that w and h include twice the border width.

    GL_INVALID_OPERATION is generated if glCopyTexSubImage2D is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDeleteLists

    `void glDeleteLists(int list, int range)`

  Description

    glDeleteLists causes a contiguous group of display lists to be deleted. list is the name of the first display list to be deleted, and range is the number of display lists to delete. All display lists \fId\fP with list \(<= \fId\fP \(<= list + range - 1 are deleted.

    All storage locations allocated to the specified display lists are freed, and the names are available for reuse at a later time. Names within the range that do not have an associated display list are ignored. If range is 0, nothing happens.

  Parameter `list`

    Specifies the integer name of the first display list to delete.

  Parameter `range`

    Specifies the number of display lists to delete.

  Throws

    GL_INVALID_VALUE is generated if range is negative.

    GL_INVALID_OPERATION is generated if glDeleteLists is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDepthMask

    `void glDepthMask(int flag)`

  Description

    glDepthMask specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE , depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.

  Parameter `flag`

    Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE , depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.

  Throws

    GL_INVALID_OPERATION is generated if glDepthMask is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDepthRange

    `void glDepthRange(float zNear, float zFar)`

  Description

    After clipping and division by w, depth coordinates range from -1 to 1, corresponding to the near and far clipping planes. glDepthRange specifies a linear mapping of the normalized depth coordinates in this range to window depth coordinates. Regardless of the actual depth buffer implementation, window coordinate depth values are treated as though they range from 0 through 1 (like color components). Thus, the values accepted by glDepthRange are both clamped to this range before they are accepted.

    The setting of (0,1) maps the near plane to 0 and the far plane to 1. With this mapping, the depth buffer range is fully utilized.

  Parameter `zNear`

    Specifies the mapping of the near clipping plane to window coordinates. The initial value is 0.

  Parameter `zFar`

    Specifies the mapping of the far clipping plane to window coordinates. The initial value is 1.

  Throws

    GL_INVALID_OPERATION is generated if glDepthRange is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDrawArrays

    `void glDrawArrays(int mode, int first, int count)`

  Description

    glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertexes, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArrays .

    When glDrawArrays is called, it uses count sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element first. mode specifies what kind of primitives are constructed, and how the array elements construct those primitives. If GL_VERTEX_ARRAY is not enabled, no geometric primitives are generated.

    Vertex attributes that are modified by glDrawArrays have an unspecified value after glDrawArrays returns. For example, if GL_COLOR_ARRAY is enabled, the value of the current color is undefined after glDrawArrays executes. Attributes that aren't modified remain well defined.

  Parameter `mode`

    Specifies what kind of primitives to render. Symbolic constants GL_POINTS , GL_LINE_STRIP , GL_LINE_LOOP , GL_LINES , GL_TRIANGLE_STRIP , GL_TRIANGLE_FAN , GL_TRIANGLES , GL_QUAD_STRIP , GL_QUADS , and GL_POLYGON are accepted.

  Parameter `first`

    Specifies the starting index in the enabled arrays.

  Parameter `count`

    Specifies the number of indices to be rendered.

  Throws

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_VALUE is generated if count is negative.

    GL_INVALID_OPERATION is generated if glDrawArrays is executed between the execution of glBegin and the corresponding glEnd .

  Method glDrawPixels

    `void glDrawPixels(object|mapping(string:object) width, object|mapping(string:object) height, object|mapping(string:object) format, object|mapping(string:object) type, array(object|mapping(string:object)) pixels)`

  Description

    glDrawPixels reads pixel data from memory and writes it into the frame buffer relative to the current raster position. Use glRasterPos to set the current raster position; use glGet with argument GL_CURRENT_RASTER_POSITION to query the raster position.

    Several parameters define the encoding of pixel data in memory and control the processing of the pixel data before it is placed in the frame buffer. These parameters are set with four commands: glPixelStore , glPixelTransfer , glPixelMap , and glPixelZoom . This reference page describes the effects on glDrawPixels of many, but not all, of the parameters specified by these four commands.

    Data is read from pixels as a sequence of signed or unsigned bytes, signed or unsigned shorts, signed or unsigned integers, or single-precision floating-point values, depending on type. Each of these bytes, shorts, integers, or floating-point values is interpreted as one color or depth component, or one index, depending on format. Indices are always treated individually. Color components are treated as groups of one, two, three, or four values, again based on format. Both individual indices and groups of components are referred to as pixels. If type is GL_BITMAP , the data must be unsigned bytes, and format must be either GL_COLOR_INDEX or GL_STENCIL_INDEX . Each unsigned byte is treated as eight 1-bit pixels, with bit ordering determined by GL_UNPACK_LSB_FIRST (see glPixelStore ).

    widthtimesheight pixels are read from memory, starting at location pixels. By default, these pixels are taken from adjacent memory locations, except that after all width pixels are read, the read pointer is advanced to the next four-byte boundary. The four-byte row alignment is specified by glPixelStore with argument GL_UNPACK_ALIGNMENT , and it can be set to one, two, four, or eight bytes. Other pixel store parameters specify different read pointer advancements, both before the first pixel is read and after all width pixels are read. See the

    glPixelStore reference page for details on these options.

    The widthtimesheight pixels that are read from memory are each operated on in the same way, based on the values of several parameters specified by glPixelTransfer and glPixelMap . The details of these operations, as well as the target buffer into which the pixels are drawn, are specific to the format of the pixels, as specified by format. format can assume one of eleven symbolic values:

    GL_COLOR_INDEX

    Each pixel is a single value, a color index. It is converted to fixed-point format, with an unspecified number of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0. Bitmap data convert to either 0 or 1. Each fixed-point index is then shifted left by GL_INDEX_SHIFT bits and added to GL_INDEX_OFFSET . If GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If the GL is in RGBA mode, the resulting index is converted to an RGBA pixel with the help of the GL_PIXEL_MAP_I_TO_R , GL_PIXEL_MAP_I_TO_G , GL_PIXEL_MAP_I_TO_B , and GL_PIXEL_MAP_I_TO_A tables. If the GL is in color index mode, and if GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table GL_PIXEL_MAP_I_TO_I . Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in a color index buffer. The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that .sp .RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .ce 0 .sp .RE where (x sub r , y sub r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

    GL_STENCIL_INDEX

    Each pixel is a single value, a stencil index. It is converted to fixed-point format, with an unspecified number of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0. Bitmap data convert to either 0 or 1. Each fixed-point index is then shifted left by GL_INDEX_SHIFT bits, and added to GL_INDEX_OFFSET . If GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table GL_PIXEL_MAP_S_TO_S . Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the nth index is written to location

    .RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .fi .sp .RE

    where (x sub r , y sub r) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil writemask affect these write operations.

    GL_DEPTH_COMPONENT

    Each pixel is a single-depth component. Floating-point data is converted directly to an internal floating-point format with unspecified precision. Signed integer data is mapped linearly to the internal floating-point format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to -1.0. Unsigned integer data is mapped similarly: the largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point depth value is then multiplied by by GL_DEPTH_SCALE and added to GL_DEPTH_BIAS . The result is clamped to the range [0,1]. The GL then converts the resulting depth components to fragments by attaching the current raster position color or color index and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that

    .RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .ce 0 .sp .RE

    where (x sub r , y sub r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

    GL_RGBA

    Each pixel is a four-component group: for GL_RGBA , the red component is first, followed by green, followed by blue, followed by alpha. Floating-point values are converted directly to an internal floating-point format with unspecified precision. Signed integer values are mapped linearly to the internal floating-point format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.) Unsigned integer data is mapped similarly: the largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point color values are then multiplied by GL_c_SCALE and added to GL_c_BIAS , where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0,1]. If GL_MAP_COLOR is true, each color component is scaled by the size of lookup table GL_PIXEL_MAP_c_TO_c , then replaced by the value that it references in that table. c is R, G, B, or A respectively. The GL then converts the resulting RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that

    .RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .ce 0 .sp .RE

    where (x sub r , y sub r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

    GL_RED | Each pixel is a single red component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with green and blue set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
    GL_GREEN | Each pixel is a single green component. This component is converted to the internal floating-point format in the same way the green component of an RGBA pixel is. It is then converted to an RGBA pixel with red and blue set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
    GL_BLUE | Each pixel is a single blue component. This component is converted to the internal floating-point format in the same way the blue component of an RGBA pixel is. It is then converted to an RGBA pixel with red and green set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
    GL_ALPHA | Each pixel is a single alpha component. This component is converted to the internal floating-point format in the same way the alpha component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green, and blue set to 0. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
    GL_RGB | Each pixel is a three-component group: red first, followed by green, followed by blue. Each component is converted to the internal floating-point format in the same way the red, green, and blue components of an RGBA pixel are. The color triple is converted to an RGBA pixel with alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
    GL_LUMINANCE | Each pixel is a single luminance component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.

    GL_LUMINANCE_ALPHA

    Each pixel is a two-component group: luminance first, followed by alpha. The two components are converted to the internal floating-point format in the same way the red component of an RGBA pixel is. They are then converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to the converted alpha value. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.

    The following table summarizes the meaning of the valid constants for the type parameter: .sp 2 .TS center box ; ci | ci c | c . type corresponding type = GL_UNSIGNED_BYTE unsigned 8-bit integer GL_BYTE signed 8-bit integer GL_BITMAP single bits in unsigned 8-bit integers GL_UNSIGNED_SHORT unsigned 16-bit integer GL_SHORT signed 16-bit integer GL_UNSIGNED_INT unsigned 32-bit integer GL_INT 32-bit integer GL_FLOAT single-precision floating-point .TE .sp

    The rasterization described so far assumes pixel zoom factors of 1. If

    glPixelZoom is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x sub r, y sub r) is the current raster position, and a given pixel is in the nth column and mth row of the pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at .sp .RS .ce (x sub r + zoom sub x n, y sub r + zoom sub y m) .sp .ce (x sub r + zoom sub x (n + 1), y sub r + zoom sub y ( m + 1 )) .ce 0 .sp .RE

    where zoom sub x is the value of GL_ZOOM_X and zoom sub y is the value of GL_ZOOM_Y .

  Parameter `width`

    Specify the dimensions of the pixel rectangle to be written into the frame buffer.

  Parameter `format`

    Specifies the format of the pixel data. Symbolic constants GL_COLOR_INDEX , GL_STENCIL_INDEX , GL_DEPTH_COMPONENT , GL_RGBA , GL_RED , GL_GREEN , GL_BLUE , GL_ALPHA , GL_RGB , GL_LUMINANCE , and GL_LUMINANCE_ALPHA are accepted.

  Parameter `type`

    Specifies the data type for pixels. Symbolic constants GL_UNSIGNED_BYTE , GL_BYTE , GL_BITMAP , GL_UNSIGNED_SHORT , GL_SHORT , GL_UNSIGNED_INT , GL_INT , and GL_FLOAT are accepted.

  Parameter `pixels`

    Specifies a pointer to the pixel data.

  Throws

    GL_INVALID_VALUE is generated if either width or height is negative.

    GL_INVALID_ENUM is generated if format or type is not one of the accepted values.

    GL_INVALID_OPERATION is generated if format is GL_RED , GL_GREEN , GL_BLUE , GL_ALPHA , GL_RGB , GL_RGBA , GL_LUMINANCE , or GL_LUMINANCE_ALPHA , and the GL is in color index mode.

    GL_INVALID_ENUM is generated if type is GL_BITMAP and format is not either GL_COLOR_INDEX or GL_STENCIL_INDEX .

    GL_INVALID_OPERATION is generated if format is GL_STENCIL_INDEX and there is no stencil buffer.

    GL_INVALID_OPERATION is generated if glDrawPixels is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glEdgeFlag

    `void glEdgeFlag(int flag)`

  Description

    Each vertex of a polygon, separate triangle, or separate quadrilateral specified between a glBegin /glEnd pair is marked as the start of either a boundary or nonboundary edge. If the current edge flag is true when the vertex is specified, the vertex is marked as the start of a boundary edge. Otherwise, the vertex is marked as the start of a nonboundary edge. glEdgeFlag sets the edge flag bit to GL_TRUE if flag is GL_TRUE , and to GL_FALSE otherwise.

    The vertices of connected triangles and connected quadrilaterals are always marked as boundary, regardless of the value of the edge flag.

    Boundary and nonboundary edge flags on vertices are significant only if GL_POLYGON_MODE is set to GL_POINT or GL_LINE . See glPolygonMode .

  Parameter `flag`

    Specifies the current edge flag value, either GL_TRUE or GL_FALSE . The initial value is GL_TRUE .

  Parameter `flag`

    Specifies a pointer to an array that contains a single boolean element, which replaces the current edge flag value.

  Method glEvalCoord

    `void glEvalCoord(float|int|array(float|int) u, float|int|void v)`

  Description

    glEvalCoord evaluates enabled one-dimensional maps at argument u or two-dimensional maps using two domain values, u and v . To define a map, call glMap1 and glMap2 ; to enable and disable it, call glEnable and glDisable .

    When one of the glEvalCoord commands is issued, all currently enabled maps of the indicated dimension are evaluated. Then, for each enabled map, it is as if the corresponding GL command had been issued with the computed value. That is, if GL_MAP1_INDEX or GL_MAP2_INDEX is enabled, a glIndex command is simulated. If GL_MAP1_COLOR_4 or GL_MAP2_COLOR_4 is enabled, a glColor command is simulated. If GL_MAP1_NORMAL or GL_MAP2_NORMAL is enabled, a normal vector is produced, and if any of GL_MAP1_TEXTURE_COORD_1 , GL_MAP1_TEXTURE_COORD_2 , GL_MAP1_TEXTURE_COORD_3 , GL_MAP1_TEXTURE_COORD_4 , GL_MAP2_TEXTURE_COORD_1 , GL_MAP2_TEXTURE_COORD_2 , GL_MAP2_TEXTURE_COORD_3 , or GL_MAP2_TEXTURE_COORD_4 is enabled, then an appropriate glTexCoord command is simulated.

    For color, color index, normal, and texture coordinates the GL uses evaluated values instead of current values for those evaluations that are enabled, and current values otherwise, However, the evaluated values do not update the current values. Thus, if glVertex commands are interspersed with glEvalCoord commands, the color, normal, and texture coordinates associated with the glVertex commands are not affected by the values generated by the glEvalCoord commands, but only by the most recent glColor , glIndex , glNormal , and glTexCoord commands.

    No commands are issued for maps that are not enabled. If more than one texture evaluation is enabled for a particular dimension (for example, GL_MAP2_TEXTURE_COORD_1 and GL_MAP2_TEXTURE_COORD_2 ), then only the evaluation of the map that produces the larger number of coordinates (in this case, GL_MAP2_TEXTURE_COORD_2 ) is carried out. GL_MAP1_VERTEX_4 overrides GL_MAP1_VERTEX_3 , and GL_MAP2_VERTEX_4 overrides GL_MAP2_VERTEX_3 , in the same manner. If neither a three- nor a four-component vertex map is enabled for the specified dimension, the glEvalCoord command is ignored.

    If you have enabled automatic normal generation, by calling glEnable with argument GL_AUTO_NORMAL , glEvalCoord generates surface normals analytically, regardless of the contents or enabling of the GL_MAP2_NORMAL map. Let .sp .nf Pp Pp m = -- X -- Pu Pv .sp .fi

    Then the generated normal n is

    n = m over ~ over { || m || }

    .sp

    If automatic normal generation is disabled, the corresponding normal map GL_MAP2_NORMAL , if enabled, is used to produce a normal. If neither automatic normal generation nor a normal map is enabled, no normal is generated for glEvalCoord commands.

  Parameter `u`

    Specifies a value that is the domain coordinate u to the basis function defined in a previous glMap1 or glMap2 command.

  Parameter `v`

    Specifies a value that is the domain coordinate v to the basis function defined in a previous glMap2 command.

  Parameter `u`

    Specifies a pointer to an array containing either one or two domain coordinates. The first coordinate is u. The second coordinate is v.

  Method glEvalPoint

    `void glEvalPoint(int|array(int) i, int|void j)`

  Description

    glMapGrid and glEvalMesh are used in tandem to efficiently generate and evaluate a series of evenly spaced map domain values. glEvalPoint can be used to evaluate a single grid point in the same gridspace that is traversed by glEvalMesh . Calling glEvalPoint is equivalent to calling .nf

    glEvalCoord1(i . DELTA u + u ); 1 where

    DELTA u = (u - u ) / n 2 1

    and n, u , and u 1 2

    .fi are the arguments to the most recent glMapGrid1 command. The one absolute numeric requirement is that if i~=~n, then the value computed from .nf i . DELTA u + u is exactly u . 1 2

    .fi

    In the two-dimensional case, glEvalPoint , let .nf DELTA u = (u - u )/n 2 1

    DELTA v = (v - v )/m 2 1

    where n, u , u , m, v , and v 1 2 1 2

    .fi are the arguments to the most recent glMapGrid2 command. Then the glEvalPoint command is equivalent to calling .nf

    glEvalCoord2(i . DELTA u + u , j . DELTA v + v ); 1 1

    .fi The only absolute numeric requirements are that if i~=~n, then the value computed from .nf

    i . DELTA u + u is exactly u , 1 2 .fi and if j~=~m, then the value computed from .nf

    j cdot DELTA v + v is exactly v . 1 2

  Parameter `i`

    Specifies the integer value for grid domain variable i.

  Parameter `j`

    Specifies the integer value for grid domain variable j (glEvalPoint only).

  Method glFog

    `void glFog(int pname, float|int|array(float|int) param)`

  Description

    Fog is initially disabled. While enabled, fog affects rasterized geometry, bitmaps, and pixel blocks, but not buffer clear operations. To enable and disable fog, call glEnable and glDisable with argument GL_FOG .

    glFog assigns the value or values in params to the fog parameter specified by pname. The following values are accepted for pname:

    GL_FOG_MODE | params is a single integer or floating-point value that specifies the equation to be used to compute the fog blend factor, f. Three symbolic constants are accepted: GL_LINEAR , GL_EXP , and GL_EXP2 . The equations corresponding to these symbolic constants are defined below. The initial fog mode is GL_EXP .
    GL_FOG_DENSITY | params is a single integer or floating-point value that specifies density, the fog density used in both exponential fog equations. Only nonnegative densities are accepted. The initial fog density is 1.
    GL_FOG_START | params is a single integer or floating-point value that specifies start, the near distance used in the linear fog equation. The initial near distance is 0.
    GL_FOG_END | params is a single integer or floating-point value that specifies end, the far distance used in the linear fog equation. The initial far distance is 1.
    GL_FOG_INDEX | params is a single integer or floating-point value that specifies i sub f, the fog color index. The initial fog index is 0.

    GL_FOG_COLOR

    params contains four integer or floating-point values that specify C sub f, the fog color. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. After conversion, all color components are clamped to the range [0,1]. The initial fog color is (0, 0, 0, 0).

    Fog blends a fog color with each rasterized pixel fragment's posttexturing color using a blending factor f. Factor f is computed in one of three ways, depending on the fog mode. Let z be the distance in eye coordinates from the origin to the fragment being fogged. The equation for GL_LINEAR fog is .ce

    .EQ f ~=~ {end ~-~ z} over {end ~-~ start} .EN

    .RE

    The equation for GL_EXP fog is .ce

    .EQ f ~=~ e ** (-(density ~cdot~ z)) .EN

    The equation for GL_EXP2 fog is .ce

    .EQ f ~=~ e ** (-(density ~cdot~ z) ** 2) .EN

    Regardless of the fog mode, f is clamped to the range [0,1] after it is computed. Then, if the GL is in RGBA color mode, the fragment's color C sub r is replaced by .sp .ce .EQ {C sub r} prime ~=~ f C sub r + (1 - f) C sub f .EN

    In color index mode, the fragment's color index i sub r is replaced by .sp .ce .EQ {i sub r} prime ~=~ i sub r + (1 - f) i sub f .EN

  Parameter `pname`

    Specifies a single-valued fog parameter. GL_FOG_MODE , GL_FOG_DENSITY , GL_FOG_START , GL_FOG_END , and GL_FOG_INDEX are accepted.

  Parameter `param`

    Specifies the value that pname will be set to.

  Parameter `pname`

    Specifies a fog parameter. GL_FOG_MODE , GL_FOG_DENSITY , GL_FOG_START , GL_FOG_END , GL_FOG_INDEX , and GL_FOG_COLOR are accepted.

  Parameter `params`

    Specifies the value or values to be assigned to pname. GL_FOG_COLOR requires an array of four values. All other parameters accept an array containing only a single value.

  Throws

    GL_INVALID_ENUM is generated if pname is not an accepted value, or if pname is GL_FOG_MODE and params is not an accepted value.

    GL_INVALID_VALUE is generated if pname is GL_FOG_DENSITY , and params is negative.

    GL_INVALID_OPERATION is generated if glFog is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glFrustum

    `void glFrustum(float left, float right, float bottom, float top, float zNear, float zFar)`

  Description

    glFrustum describes a perspective matrix that produces a perspective projection. The current matrix (see glMatrixMode ) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument:

    .sp 5 .ce .EQ down 130 {left ( ~~ matrix { ccol { {{2 ~ "zNear"} over {"right" - "left"}} above 0 above 0 above 0 } ccol { 0 above {{2 ~ "zNear"} over {"top" - "bottom"}} ~ above 0 above 0 } ccol { A ~~~~ above B ~~~~ above C ~~~~ above -1 ~~~~} ccol { 0 above 0 above D above 0} } ~~~ right )} .EN .sp .ce .EQ down 130 {A ~=~ {"right" + "left"} over {"right" - "left"}} .EN .sp .ce .EQ down 130 {B ~=~ {"top" + "bottom"} over {"top" - "bottom"}} .EN .sp .ce .EQ down 130 {C ~=~ -{{"zFar" + "zNear"} over {"zFar" - "zNear"}}} .EN .sp .ce .EQ down 130 {D ~=~ -{{2 ~ "zFar" ~ "zNear"} over {"zFar" - "zNear"}}} .EN .sp

    Typically, the matrix mode is GL_PROJECTION , and (left, bottom, -zNear) and (right, top, -zNear) specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, assuming that the eye is located at (0, 0, 0). -zFar specifies the location of the far clipping plane. Both zNear and zFar must be positive.

    Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.

  Parameter `left`

    Specify the coordinates for the left and right vertical clipping planes.

  Parameter `bottom`

    Specify the coordinates for the bottom and top horizontal clipping planes.

  Parameter `zNear`

    Specify the distances to the near and far depth clipping planes. Both distances must be positive.

  Throws

    GL_INVALID_VALUE is generated if zNear or zFar is not positive.

    GL_INVALID_OPERATION is generated if glFrustum is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glGenLists

    `int glGenLists(int range)`

  Description

    glGenLists has one argument, range. It returns an integer n such that range contiguous empty display lists, named n, n+1, ..., n+range -1, are created. If range is 0, if there is no group of range contiguous names available, or if any error is generated, no display lists are generated, and 0 is returned.

  Parameter `range`

    Specifies the number of contiguous empty display lists to be generated.

  Throws

    GL_INVALID_VALUE is generated if range is negative.

    GL_INVALID_OPERATION is generated if glGenLists is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glGetError

    `int glGetError()`

  Description

    glGetError returns the value of the error flag. Each detectable error is assigned a numeric code and symbolic name. When an error occurs, the error flag is set to the appropriate error code value. No other errors are recorded until glGetError is called, the error code is returned, and the flag is reset to GL_NO_ERROR . If a call to glGetError returns GL_NO_ERROR , there has been no detectable error since the last call to glGetError , or since the GL was initialized.

    To allow for distributed implementations, there may be several error flags. If any single error flag has recorded an error, the value of that flag is returned and that flag is reset to GL_NO_ERROR when glGetError is called. If more than one flag has recorded an error, glGetError returns and clears an arbitrary error flag value. Thus, glGetError should always be called in a loop, until it returns GL_NO_ERROR , if all error flags are to be reset.

    Initially, all error flags are set to GL_NO_ERROR .

    The following errors are currently defined:

    GL_NO_ERROR | No error has been recorded. The value of this symbolic constant is guaranteed to be 0.
    GL_INVALID_ENUM | An unacceptable value is specified for an enumerated argument. The offending command is ignored, and has no other side effect than to set the error flag.
    GL_INVALID_VALUE | A numeric argument is out of range. The offending command is ignored, and has no other side effect than to set the error flag.
    GL_INVALID_OPERATION | The specified operation is not allowed in the current state. The offending command is ignored, and has no other side effect than to set the error flag.
    GL_STACK_OVERFLOW | This command would cause a stack overflow. The offending command is ignored, and has no other side effect than to set the error flag.
    GL_STACK_UNDERFLOW | This command would cause a stack underflow. The offending command is ignored, and has no other side effect than to set the error flag.
    GL_OUT_OF_MEMORY | There is not enough memory left to execute the command. The state of the GL is undefined, except for the state of the error flags, after this error is recorded.

    When an error flag is set, results of a GL operation are undefined only if GL_OUT_OF_MEMORY has occurred. In all other cases, the command generating the error is ignored and has no effect on the GL state or frame buffer contents. If the generating command returns a value, it returns 0. If glGetError itself generates an error, it returns 0.

  Throws

    GL_INVALID_OPERATION is generated if glGetError is executed between the execution of glBegin and the corresponding execution of glEnd . In this case glGetError returns 0.

  Method glGetString

    `string glGetString(int name)`

  Description

    glGetString returns a pointer to a static string describing some aspect of the current GL connection. name can be one of the following:

    GL_VENDOR | Returns the company responsible for this GL implementation. This name does not change from release to release.
    GL_RENDERER | Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release.
    GL_VERSION | Returns a version or release number.
    GL_EXTENSIONS | Returns a space-separated list of supported extensions to GL.

    Because the GL does not include queries for the performance characteristics of an implementation, some applications are written to recognize known platforms and modify their GL usage based on known performance characteristics of these platforms. Strings GL_VENDOR and GL_RENDERER together uniquely specify a platform. They do not change from release to release and should be used by platform-recognition algorithms.

    Some applications want to make use of features that are not part of the standard GL. These features may be implemented as extensions to the standard GL. The GL_EXTENSIONS string is a space-separated list of supported GL extensions. (Extension names never contain a space character.)

    The GL_VERSION string begins with a version number. The version number uses one of these forms:

    major_number.minor_number

    major_number.minor_number.release_number

    Vendor-specific information may follow the version number. Its format depends on the implementation, but a space always separates the version number and the vendor-specific information.

    All strings are null-terminated.

  Parameter `name`

    Specifies a symbolic constant, one of GL_VENDOR , GL_RENDERER , GL_VERSION , or GL_EXTENSIONS .

  Throws

    GL_INVALID_ENUM is generated if name is not an accepted value.

    GL_INVALID_OPERATION is generated if glGetString is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glHint

    `void glHint(int target, int mode)`

  Description

    Certain aspects of GL behavior, when there is room for interpretation, can be controlled with hints. A hint is specified with two arguments. target is a symbolic constant indicating the behavior to be controlled, and mode is another symbolic constant indicating the desired behavior. The initial value for each target is GL_DONT_CARE . mode can be one of the following:

    GL_FASTEST | The most efficient option should be chosen.
    GL_NICEST | The most correct, or highest quality, option should be chosen.
    GL_DONT_CARE | No preference.

    Though the implementation aspects that can be hinted are well defined, the interpretation of the hints depends on the implementation. The hint aspects that can be specified with target, along with suggested semantics, are as follows:

    GL_FOG_HINT | Indicates the accuracy of fog calculation. If per-pixel fog calculation is not efficiently supported by the GL implementation, hinting GL_DONT_CARE or GL_FASTEST can result in per-vertex calculation of fog effects.
    GL_LINE_SMOOTH_HINT | Indicates the sampling quality of antialiased lines. If a larger filter function is applied, hinting GL_NICEST can result in more pixel fragments being generated during rasterization,
    GL_PERSPECTIVE_CORRECTION_HINT | Indicates the quality of color and texture coordinate interpolation. If perspective-corrected parameter interpolation is not efficiently supported by the GL implementation, hinting GL_DONT_CARE or GL_FASTEST can result in simple linear interpolation of colors and/or texture coordinates.
    GL_POINT_SMOOTH_HINT | Indicates the sampling quality of antialiased points. If a larger filter function is applied, hinting GL_NICEST can result in more pixel fragments being generated during rasterization,
    GL_POLYGON_SMOOTH_HINT | Indicates the sampling quality of antialiased polygons. Hinting GL_NICEST can result in more pixel fragments being generated during rasterization, if a larger filter function is applied.

  Parameter `target`

    Specifies a symbolic constant indicating the behavior to be controlled. GL_FOG_HINT , GL_LINE_SMOOTH_HINT , GL_PERSPECTIVE_CORRECTION_HINT , GL_POINT_SMOOTH_HINT , and GL_POLYGON_SMOOTH_HINT are accepted.

  Parameter `mode`

    Specifies a symbolic constant indicating the desired behavior. GL_FASTEST , GL_NICEST , and GL_DONT_CARE are accepted.

  Throws

    GL_INVALID_ENUM is generated if either target or mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glHint is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glIndex

    `void glIndex(float|int c)`

  Description

    glIndex updates the current (single-valued) color index. It takes one argument, the new value for the current color index.

    The current index is stored as a floating-point value. Integer values are converted directly to floating-point values, with no special mapping. The initial value is 1.

    Index values outside the representable range of the color index buffer are not clamped. However, before an index is dithered (if enabled) and written to the frame buffer, it is converted to fixed-point format. Any bits in the integer portion of the resulting fixed-point value that do not correspond to bits in the frame buffer are masked out.

  Parameter `c`

    Specifies the new value for the current color index.

  Parameter `c`

    Specifies a pointer to a one-element array that contains the new value for the current color index.

  Method glIndexMask

    `void glIndexMask(int mask)`

  Description

    glIndexMask controls the writing of individual bits in the color index buffers. The least significant n bits of mask, where n is the number of bits in a color index buffer, specify a mask. Where a 1 (one) appears in the mask, it's possible to write to the corresponding bit in the color index buffer (or buffers). Where a 0 (zero) appears, the corresponding bit is write-protected.

    This mask is used only in color index mode, and it affects only the buffers currently selected for writing (see glDrawBuffer ). Initially, all bits are enabled for writing.

  Parameter `mask`

    Specifies a bit mask to enable and disable the writing of individual bits in the color index buffers. Initially, the mask is all 1's.

  Throws

    GL_INVALID_OPERATION is generated if glIndexMask is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glIsEnabled

    `int glIsEnabled(int cap)`

  Description

    glIsEnabled returns GL_TRUE if cap is an enabled capability and returns GL_FALSE otherwise. Initially all capabilities except GL_DITHER are disabled; GL_DITHER is initially enabled.

    The following capabilities are accepted for cap:

    .TS lb lb l l l. Constant See _

    GL_ALPHA_TEST glAlphaFunc GL_AUTO_NORMAL glEvalCoord GL_BLEND glBlendFunc , glLogicOp GL_CLIP_PLANE i glClipPlane GL_COLOR_ARRAY glColorPointer GL_COLOR_LOGIC_OP glLogicOp GL_COLOR_MATERIAL glColorMaterial GL_CULL_FACE glCullFace GL_DEPTH_TEST glDepthFunc , glDepthRange GL_DITHER glEnable GL_EDGE_FLAG_ARRAY glEdgeFlagPointer GL_FOG glFog GL_INDEX_ARRAY glIndexPointer GL_INDEX_LOGIC_OP glLogicOp GL_LIGHT i glLightModel , glLight GL_LIGHTING glMaterial , glLightModel , glLight GL_LINE_SMOOTH glLineWidth GL_LINE_STIPPLE glLineStipple GL_MAP1_COLOR_4 glMap1 , glMap2 GL_MAP2_TEXTURE_COORD_2 glMap2 GL_MAP2_TEXTURE_COORD_3 glMap2 GL_MAP2_TEXTURE_COORD_4 glMap2 GL_MAP2_VERTEX_3 glMap2 GL_MAP2_VERTEX_4 glMap2 GL_NORMAL_ARRAY glNormalPointer GL_NORMALIZE glNormal GL_POINT_SMOOTH glPointSize GL_POLYGON_SMOOTH glPolygonMode GL_POLYGON_OFFSET_FILL glPolygonOffset GL_POLYGON_OFFSET_LINE glPolygonOffset GL_POLYGON_OFFSET_POINT glPolygonOffset GL_POLYGON_STIPPLE glPolygonStipple GL_SCISSOR_TEST glScissor GL_STENCIL_TEST glStencilFunc , glStencilOp GL_TEXTURE_1D glTexImage1D GL_TEXTURE_2D glTexImage2D GL_TEXTURE_COORD_ARRAY glTexCoordPointer GL_TEXTURE_GEN_Q glTexGen GL_TEXTURE_GEN_R glTexGen GL_TEXTURE_GEN_S glTexGen GL_TEXTURE_GEN_T glTexGen GL_VERTEX_ARRAY glVertexPointer .TE

  Parameter `cap`

    Specifies a symbolic constant indicating a GL capability.

  Throws

    GL_INVALID_ENUM is generated if cap is not an accepted value.

    GL_INVALID_OPERATION is generated if glIsEnabled is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glIsList

    `int glIsList(int list)`

  Description

    glIsList returns GL_TRUE if list is the name of a display list and returns GL_FALSE otherwise.

  Parameter `list`

    Specifies a potential display-list name.

  Throws

    GL_INVALID_OPERATION is generated if glIsList is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glIsTexture

    `int glIsTexture(int texture)`

  Description

    glIsTexture returns GL_TRUE if texture is currently the name of a texture. If texture is zero, or is a non-zero value that is not currently the name of a texture, or if an error occurs, glIsTexture returns GL_FALSE .

  Parameter `texture`

    Specifies a value that may be the name of a texture.

  Throws

    GL_INVALID_OPERATION is generated if glIsTexture is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLight

    `void glLight(int light, int pname, float|int|array(float|int) param)`

  Description

    glLight sets the values of individual light source parameters. light names the light and is a symbolic name of the form GL_LIGHT i, where 0 \(<= i < GL_MAX_LIGHTS . pname specifies one of ten light source parameters, again by symbolic name. params is either a single value or a pointer to an array that contains the new values.

    To enable and disable lighting calculation, call glEnable and glDisable with argument GL_LIGHTING . Lighting is initially disabled. When it is enabled, light sources that are enabled contribute to the lighting calculation. Light source i is enabled and disabled using glEnable and glDisable with argument GL_LIGHT i.

    The ten light parameters are as follows:

    GL_AMBIENT

    params contains four integer or floating-point values that specify the ambient RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient light intensity is (0, 0, 0, 1).

    GL_DIFFUSE

    params contains four integer or floating-point values that specify the diffuse RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial value for GL_LIGHT0 is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0).

    GL_SPECULAR

    params contains four integer or floating-point values that specify the specular RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial value for GL_LIGHT0 is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0).

    GL_POSITION

    params contains four integer or floating-point values that specify the position of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The position is transformed by the modelview matrix when glLight is called (just as if it were a point), and it is stored in eye coordinates. If the w component of the position is 0, the light is treated as a directional source. Diffuse and specular lighting calculations take the light's direction, but not its actual position, into account, and attenuation is disabled. Otherwise, diffuse and specular lighting calculations are based on the actual location of the light in eye coordinates, and attenuation is enabled. The initial position is (0, 0, 1, 0); thus, the initial light source is directional, parallel to, and in the direction of the -z axis.

    GL_SPOT_DIRECTION

    params contains three integer or floating-point values that specify the direction of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The spot direction is transformed by the inverse of the modelview matrix when glLight is called (just as if it were a normal), and it is stored in eye coordinates. It is significant only when GL_SPOT_CUTOFF is not 180, which it is initially. The initial direction is (0, 0, -1).

    GL_SPOT_EXPONENT

    params is a single integer or floating-point value that specifies the intensity distribution of the light. Integer and floating-point values are mapped directly. Only values in the range [0,128] are accepted. Effective light intensity is attenuated by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lighted, raised to the power of the spot exponent. Thus, higher spot exponents result in a more focused light source, regardless of the spot cutoff angle (see GL_SPOT_CUTOFF , next paragraph). The initial spot exponent is 0, resulting in uniform light distribution.

    GL_SPOT_CUTOFF

    params is a single integer or floating-point value that specifies the maximum spread angle of a light source. Integer and floating-point values are mapped directly. Only values in the range [0,90] and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the vertex being lighted is greater than the spot cutoff angle, the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The initial spot cutoff is 180, resulting in uniform light distribution.

    GL_CONSTANT_ATTENUATION |
    GL_LINEAR_ATTENUATION |

    GL_QUADRATIC_ATTENUATION

    params is a single integer or floating-point value that specifies one of the three light attenuation factors. Integer and floating-point values are mapped directly. Only nonnegative values are accepted. If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant factor, the linear factor times the distance between the light and the vertex being lighted, and the quadratic factor times the square of the same distance. The initial attenuation factors are (1, 0, 0), resulting in no attenuation.

  Parameter `light`

    Specifies a light. The number of lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form GL_LIGHT i where 0 \(<= i < GL_MAX_LIGHTS .

  Parameter `pname`

    Specifies a single-valued light source parameter for light. GL_SPOT_EXPONENT , GL_SPOT_CUTOFF , GL_CONSTANT_ATTENUATION , GL_LINEAR_ATTENUATION , and GL_QUADRATIC_ATTENUATION are accepted.

  Parameter `param`

    Specifies the value that parameter pname of light source light will be set to.

  Parameter `light`

    Specifies a light. The number of lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form GL_LIGHT i where 0 \(<= i < GL_MAX_LIGHTS .

  Parameter `pname`

    Specifies a light source parameter for light. GL_AMBIENT , GL_DIFFUSE , GL_SPECULAR , GL_POSITION , GL_SPOT_CUTOFF , GL_SPOT_DIRECTION , GL_SPOT_EXPONENT , GL_CONSTANT_ATTENUATION , GL_LINEAR_ATTENUATION , and GL_QUADRATIC_ATTENUATION are accepted.

  Parameter `params`

    Specifies a pointer to the value or values that parameter pname of light source light will be set to.

  Throws

    GL_INVALID_ENUM is generated if either light or pname is not an accepted value.

    GL_INVALID_VALUE is generated if a spot exponent value is specified outside the range [0,128], or if spot cutoff is specified outside the range [0,90] (except for the special value 180), or if a negative attenuation factor is specified.

    GL_INVALID_OPERATION is generated if glLight is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLightModel

    `void glLightModel(int pname, float|int|array(float|int) param)`

  Description

    glLightModel sets the lighting model parameter. pname names a parameter and params gives the new value. There are three lighting model parameters:

    GL_LIGHT_MODEL_AMBIENT

    params contains four integer or floating-point values that specify the ambient RGBA intensity of the entire scene. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient scene intensity is (0.2, 0.2, 0.2, 1.0).

    GL_LIGHT_MODEL_LOCAL_VIEWER

    params is a single integer or floating-point value that specifies how specular reflection angles are computed. If params is 0 (or 0.0), specular reflection angles take the view direction to be parallel to and in the direction of the -z axis, regardless of the location of the vertex in eye coordinates. Otherwise, specular reflections are computed from the origin of the eye coordinate system. The initial value is 0.

    GL_LIGHT_MODEL_TWO_SIDE

    params is a single integer or floating-point value that specifies whether one- or two-sided lighting calculations are done for polygons. It has no effect on the lighting calculations for points, lines, or bitmaps. If params is 0 (or 0.0), one-sided lighting is specified, and only the front material parameters are used in the lighting equation. Otherwise, two-sided lighting is specified. In this case, vertices of back-facing polygons are lighted using the back material parameters, and have their normals reversed before the lighting equation is evaluated. Vertices of front-facing polygons are always lighted using the front material parameters, with no change to their normals. The initial value is 0.

    In RGBA mode, the lighted color of a vertex is the sum of the material emission intensity, the product of the material ambient reflectance and the lighting model full-scene ambient intensity, and the contribution of each enabled light source. Each light source contributes the sum of three terms: ambient, diffuse, and specular. The ambient light source contribution is the product of the material ambient reflectance and the light's ambient intensity. The diffuse light source contribution is the product of the material diffuse reflectance, the light's diffuse intensity, and the dot product of the vertex's normal with the normalized vector from the vertex to the light source. The specular light source contribution is the product of the material specular reflectance, the light's specular intensity, and the dot product of the normalized vertex-to-eye and vertex-to-light vectors, raised to the power of the shininess of the material. All three light source contributions are attenuated equally based on the distance from the vertex to the light source and on light source direction, spread exponent, and spread cutoff angle. All dot products are replaced with 0 if they evaluate to a negative value.

    The alpha component of the resulting lighted color is set to the alpha value of the material diffuse reflectance.

    In color index mode, the value of the lighted index of a vertex ranges from the ambient to the specular values passed to glMaterial using GL_COLOR_INDEXES . Diffuse and specular coefficients, computed with a (.30, .59, .11) weighting of the lights' colors, the shininess of the material, and the same reflection and attenuation equations as in the RGBA case, determine how much above ambient the resulting index is.

  Parameter `pname`

    Specifies a single-valued lighting model parameter. GL_LIGHT_MODEL_LOCAL_VIEWER and GL_LIGHT_MODEL_TWO_SIDE are accepted.

  Parameter `param`

    Specifies the value that param will be set to.

  Parameter `pname`

    Specifies a lighting model parameter. GL_LIGHT_MODEL_AMBIENT , GL_LIGHT_MODEL_LOCAL_VIEWER , and GL_LIGHT_MODEL_TWO_SIDE are accepted.

  Parameter `params`

    Specifies a pointer to the value or values that params will be set to.

  Throws

    GL_INVALID_ENUM is generated if pname is not an accepted value.

    GL_INVALID_OPERATION is generated if glLightModel is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLineStipple

    `void glLineStipple(int factor, int pattern)`

  Description

    Line stippling masks out certain fragments produced by rasterization; those fragments will not be drawn. The masking is achieved by using three parameters: the 16-bit line stipple pattern pattern, the repeat count factor, and an integer stipple counter s.

    Counter s is reset to 0 whenever glBegin is called, and before each line segment of a glBegin (GL_LINES )/glEnd sequence is generated. It is incremented after each fragment of a unit width aliased line segment is generated, or after each i fragments of an i width line segment are generated. The i fragments associated with count s are masked out if .sp .ce pattern bit (s ~/~ "factor") ~roman mod~ 16 .sp is 0, otherwise these fragments are sent to the frame buffer. Bit zero of pattern is the least significant bit.

    Antialiased lines are treated as a sequence of 1 times width rectangles for purposes of stippling. Whether rectagle s is rasterized or not depends on the fragment rule described for aliased lines, counting rectangles rather than groups of fragments.

    To enable and disable line stippling, call glEnable and glDisable with argument GL_LINE_STIPPLE . When enabled, the line stipple pattern is applied as described above. When disabled, it is as if the pattern were all 1's. Initially, line stippling is disabled.

  Parameter `factor`

    Specifies a multiplier for each bit in the line stipple pattern. If factor is 3, for example, each bit in the pattern is used three times before the next bit in the pattern is used. factor is clamped to the range [1, 256] and defaults to 1.

  Parameter `pattern`

    Specifies a 16-bit integer whose bit pattern determines which fragments of a line will be drawn when the line is rasterized. Bit zero is used first; the default pattern is all 1's.

  Throws

    GL_INVALID_OPERATION is generated if glLineStipple is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLineWidth

    `void glLineWidth(float width)`

  Description

    glLineWidth specifies the rasterized width of both aliased and antialiased lines. Using a line width other than 1 has different effects, depending on whether line antialiasing is enabled. To enable and disable line antialiasing, call glEnable and glDisable with argument GL_LINE_SMOOTH . Line antialiasing is initially disabled.

    If line antialiasing is disabled, the actual width is determined by rounding the supplied width to the nearest integer. (If the rounding results in the value 0, it is as if the line width were 1.) If .nf | DELTA x | >= | DELTA y |, .fi i pixels are filled in each column that is rasterized, where i is the rounded value of width. Otherwise, i pixels are filled in each row that is rasterized.

    If antialiasing is enabled, line rasterization produces a fragment for each pixel square that intersects the region lying within the rectangle having width equal to the current line width, length equal to the actual length of the line, and centered on the mathematical line segment. The coverage value for each fragment is the window coordinate area of the intersection of the rectangular region with the corresponding pixel square. This value is saved and used in the final rasterization step.

    Not all widths can be supported when line antialiasing is enabled. If an unsupported width is requested, the nearest supported width is used. Only width 1 is guaranteed to be supported; others depend on the implementation. To query the range of supported widths and the size difference between supported widths within the range, call glGet with arguments GL_LINE_WIDTH_RANGE and GL_LINE_WIDTH_GRANULARITY .

  Parameter `width`

    Specifies the width of rasterized lines. The initial value is 1.

  Throws

    GL_INVALID_VALUE is generated if width is less than or equal to 0.

    GL_INVALID_OPERATION is generated if glLineWidth is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glListBase

    `void glListBase(int base)`

  Description

    glCallLists specifies an array of offsets. Display-list names are generated by adding base to each offset. Names that reference valid display lists are executed; the others are ignored.

  Parameter `base`

    Specifies an integer offset that will be added to glCallLists offsets to generate display-list names. The initial value is 0.

  Throws

    GL_INVALID_OPERATION is generated if glListBase is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLoadMatrix

    `void glLoadMatrix(array(array(float|int)) m)`

  Description

    glLoadMatrix replaces the current matrix with the one whose elements are specified by m. The current matrix is the projection matrix, modelview matrix, or texture matrix, depending on the current matrix mode (see glMatrixMode ).

    The current matrix, M, defines a transformation of coordinates. For instance, assume M refers to the modelview matrix. If v ~=~ (v[0], v[1], v[2], v[3]) is the set of object coordinates of a vertex, and m points to an array of 16 single- or double-precision floating-point values m[0], m[1],. . .,m[15], then the modelview transformation M(v) does the following:

    .ce .EQ down 130 {M(v) ~ = ~ {{ left ( matrix { ccol { ~m[0] above m[1] above m[2] above m[3] ~} ccol { ~m[4] above m[5] above m[6] above m[7] ~} ccol { ~m[8] above m[9] above m[10] above m[11] ~} ccol { ~m[12]~ above m[13]~ above m[14]~ above m[15]~} } right ) } ~~ times ~~ {left ( matrix { ccol { ~v[0]~ above ~v[1]~ above ~v[2]~ above ~v[3]~ } } right )} }} .EN

    .sp

    Where 'times' denotes matrix multiplication.

    Projection and texture transformations are similarly defined.

  Parameter `m`

    Specifies a pointer to 16 consecutive values, which are used as the elements of a 4 times 4 column-major matrix.

  Throws

    GL_INVALID_OPERATION is generated if glLoadMatrix is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLoadName

    `void glLoadName(int name)`

  Description

    The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers. glLoadName causes name to replace the value on the top of the name stack, which is initially empty.

    The name stack is always empty while the render mode is not GL_SELECT . Calls to glLoadName while the render mode is not GL_SELECT are ignored.

  Parameter `name`

    Specifies a name that will replace the top value on the name stack.

  Throws

    GL_INVALID_OPERATION is generated if glLoadName is called while the name stack is empty.

    GL_INVALID_OPERATION is generated if glLoadName is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glMaterial

    `void glMaterial(int face, int pname, float|int|array(float|int) param)`

  Description

    glMaterial assigns values to material parameters. There are two matched sets of material parameters. One, the front-facing set, is used to shade points, lines, bitmaps, and all polygons (when two-sided lighting is disabled), or just front-facing polygons (when two-sided lighting is enabled). The other set, back-facing, is used to shade back-facing polygons only when two-sided lighting is enabled. Refer to the glLightModel reference page for details concerning one- and two-sided lighting calculations.

    glMaterial takes three arguments. The first, face, specifies whether the GL_FRONT materials, the GL_BACK materials, or both GL_FRONT_AND_BACK materials will be modified. The second, pname, specifies which of several parameters in one or both sets will be modified. The third, params, specifies what value or values will be assigned to the specified parameter.

    Material parameters are used in the lighting equation that is optionally applied to each vertex. The equation is discussed in the glLightModel reference page. The parameters that can be specified using glMaterial , and their interpretations by the lighting equation, are as follows:

    GL_AMBIENT

    params contains four integer or floating-point values that specify the ambient RGBA reflectance of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient reflectance for both front- and back-facing materials is (0.2, 0.2, 0.2, 1.0).

    GL_DIFFUSE

    params contains four integer or floating-point values that specify the diffuse RGBA reflectance of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial diffuse reflectance for both front- and back-facing materials is (0.8, 0.8, 0.8, 1.0).

    GL_SPECULAR

    params contains four integer or floating-point values that specify the specular RGBA reflectance of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial specular reflectance for both front- and back-facing materials is (0, 0, 0, 1).

    GL_EMISSION

    params contains four integer or floating-point values that specify the RGBA emitted light intensity of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial emission intensity for both front- and back-facing materials is (0, 0, 0, 1).

    GL_SHININESS | params is a single integer or floating-point value that specifies the RGBA specular exponent of the material. Integer and floating-point values are mapped directly. Only values in the range [0,128] are accepted. The initial specular exponent for both front- and back-facing materials is 0.
    GL_AMBIENT_AND_DIFFUSE | Equivalent to calling glMaterial twice with the same parameter values, once with GL_AMBIENT and once with GL_DIFFUSE .
    GL_COLOR_INDEXES | params contains three integer or floating-point values specifying the color indices for ambient, diffuse, and specular lighting. These three values, and GL_SHININESS , are the only material values used by the color index mode lighting equation. Refer to the glLightModel reference page for a discussion of color index lighting.

  Parameter `face`

    Specifies which face or faces are being updated. Must be one of GL_FRONT , GL_BACK , or GL_FRONT_AND_BACK .

  Parameter `pname`

    Specifies the single-valued material parameter of the face or faces that is being updated. Must be GL_SHININESS .

  Parameter `param`

    Specifies the value that parameter GL_SHININESS will be set to.

  Parameter `face`

    Specifies which face or faces are being updated. Must be one of GL_FRONT , GL_BACK , or GL_FRONT_AND_BACK .

  Parameter `pname`

    Specifies the material parameter of the face or faces that is being updated. Must be one of GL_AMBIENT , GL_DIFFUSE , GL_SPECULAR , GL_EMISSION , GL_SHININESS , GL_AMBIENT_AND_DIFFUSE , or GL_COLOR_INDEXES .

  Parameter `params`

    Specifies a pointer to the value or values that pname will be set to.

  Throws

    GL_INVALID_ENUM is generated if either face or pname is not an accepted value.

    GL_INVALID_VALUE is generated if a specular exponent outside the range [0,128] is specified.

  Method glMultMatrix

    `void glMultMatrix(array(array(float|int)) m)`

  Description

    glMultMatrix multiplies the current matrix with the one specified using m, and replaces the current matrix with the product.

    The current matrix is determined by the current matrix mode (see glMatrixMode ). It is either the projection matrix, modelview matrix, or the texture matrix.

  Parameter `m`

    Points to 16 consecutive values that are used as the elements of a 4 times 4 column-major matrix.

  Throws

    GL_INVALID_OPERATION is generated if glMultMatrix is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glNewList

    `void glNewList(int list, int mode)`

  Description

    Display lists are groups of GL commands that have been stored for subsequent execution. Display lists are created with glNewList . All subsequent commands are placed in the display list, in the order issued, until glEndList is called.

    glNewList has two arguments. The first argument, list, is a positive integer that becomes the unique name for the display list. Names can be created and reserved with glGenLists and tested for uniqueness with glIsList . The second argument, mode, is a symbolic constant that can assume one of two values:

    GL_COMPILE | Commands are merely compiled.
    GL_COMPILE_AND_EXECUTE | Commands are executed as they are compiled into the display list.

    Certain commands are not compiled into the display list but are executed immediately, regardless of the display-list mode. These commands are glColorPointer , glDeleteLists , glDisableClientState , glEdgeFlagPointer , glEnableClientState , glFeedbackBuffer , glFinish , glFlush , glGenLists , glIndexPointer , glInterleavedArrays , glIsEnabled , glIsList , glNormalPointer , glPopClientAttrib , glPixelStore , glPushClientAttrib , glReadPixels , glRenderMode , glSelectBuffer , glTexCoordPointer , glVertexPointer , and all of the glGet commands.

    Similarly, glTexImage2D and glTexImage1D are executed immediately and not compiled into the display list when their first argument is GL_PROXY_TEXTURE_2D or GL_PROXY_TEXTURE_1D , respectively.

    When glEndList is encountered, the display-list definition is completed by associating the list with the unique name list (specified in the glNewList command). If a display list with name list already exists, it is replaced only when glEndList is called.

  Parameter `list`

    Specifies the display-list name.

  Parameter `mode`

    Specifies the compilation mode, which can be GL_COMPILE or GL_COMPILE_AND_EXECUTE .

  Throws

    GL_INVALID_VALUE is generated if list is 0.

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glEndList is called without a preceding glNewList , or if glNewList is called while a display list is being defined.

    GL_INVALID_OPERATION is generated if glNewList or glEndList is executed between the execution of glBegin and the corresponding execution of glEnd .

    GL_OUT_OF_MEMORY is generated if there is insufficient memory to compile the display list. If the GL version is 1.1 or greater, no change is made to the previous contents of the display list, if any, and no other change is made to the GL state. (It is as if no attempt had been made to create the new display list.)

  Method glNormal

    `void glNormal(float|int|array(float|int) nx, float|int|void ny, float|int|void nz)`

  Description

    The current normal is set to the given coordinates whenever glNormal is issued. Byte, short, or integer arguments are converted to floating-point format with a linear mapping that maps the most positive representable integer value to 1.0, and the most negative representable integer value to -1.0.

    Normals specified with glNormal need not have unit length. If normalization is enabled, then normals specified with glNormal are normalized after transformation. To enable and disable normalization, call glEnable and glDisable with the argument GL_NORMALIZE . Normalization is initially disabled.

  Parameter `nx`

    Specify the x, y, and z coordinates of the new current normal. The initial value of the current normal is the unit vector, (0, 0, 1).

  Parameter `v`

    Specifies a pointer to an array of three elements: the x, y, and z coordinates of the new current normal.

  Method glOrtho

    `void glOrtho(float left, float right, float bottom, float top, float zNear, float zFar)`

  Description

    glOrtho describes a transformation that produces a parallel projection. The current matrix (see glMatrixMode ) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument: .sp .ce .EQ left ( matrix { ccol { {2 over {"right" - "left"}} above 0 above 0 above 0 } ccol { 0 above {2 over {"top" - "bottom"}} above 0 above 0 } ccol { 0 above 0 above {-2 over {"zFar" - "zNear"}} above 0 } ccol { {t sub x}~ above {t sub y}~ above {t sub z}~ above 1~ } } right ) .EN

    where .ce .EQ t sub x ~=~ -{{"right" + "left"} over {"right" - "left"}} .EN

    .ce .EQ t sub y ~=~ -{{"top" + "bottom"} over {"top" - "bottom"}} .EN

    .ce .EQ t sub z ~=~ -{{"zFar" + "zNear"} over {"zFar" - "zNear"}} .EN

    .RE

    Typically, the matrix mode is GL_PROJECTION , and (left, bottom, -zNear) and (right, top, -zNear) specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, respectively, assuming that the eye is located at (0, 0, 0). -zFar specifies the location of the far clipping plane. Both zNear and zFar can be either positive or negative.

    Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.

  Parameter `left`

    Specify the coordinates for the left and right vertical clipping planes.

  Parameter `bottom`

    Specify the coordinates for the bottom and top horizontal clipping planes.

  Parameter `zNear`

    Specify the distances to the nearer and farther depth clipping planes. These values are negative if the plane is to be behind the viewer.

  Throws

    GL_INVALID_OPERATION is generated if glOrtho is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPassThrough

    `void glPassThrough(float token)`

  Description

    Feedback is a GL render mode. The mode is selected by calling glRenderMode with GL_FEEDBACK . When the GL is in feedback mode, no pixels are produced by rasterization. Instead, information about primitives that would have been rasterized is fed back to the application using the GL. See the glFeedbackBuffer reference page for a description of the feedback buffer and the values in it.

    glPassThrough inserts a user-defined marker in the feedback buffer when it is executed in feedback mode. token is returned as if it were a primitive; it is indicated with its own unique identifying value: GL_PASS_THROUGH_TOKEN . The order of glPassThrough commands with respect to the specification of graphics primitives is maintained.

  Parameter `token`

    Specifies a marker value to be placed in the feedback buffer following a GL_PASS_THROUGH_TOKEN .

  Throws

    GL_INVALID_OPERATION is generated if glPassThrough is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPixelZoom

    `void glPixelZoom(float xfactor, float yfactor)`

  Description

    glPixelZoom specifies values for the x and y zoom factors. During the execution of glDrawPixels or glCopyPixels , if (xr , yr ) is the current raster position, and a given element is in the mth row and nth column of the pixel rectangle, then pixels whose centers are in the rectangle with corners at .sp .ce (xr ~+~ n cdot "xfactor", yr ~+~ m cdot "yfactor") .sp .ce (xr ~+~ (n+1) cdot "xfactor", yr ~+~ (m+1) cdot "yfactor") .sp are candidates for replacement. Any pixel whose center lies on the bottom or left edge of this rectangular region is also modified.

    Pixel zoom factors are not limited to positive values. Negative zoom factors reflect the resulting image about the current raster position.

  Parameter `xfactor`

    Specify the x and y zoom factors for pixel write operations.

  Throws

    GL_INVALID_OPERATION is generated if glPixelZoom is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPointSize

    `void glPointSize(float size)`

  Description

    glPointSize specifies the rasterized diameter of both aliased and antialiased points. Using a point size other than 1 has different effects, depending on whether point antialiasing is enabled. To enable and disable point antialiasing, call glEnable and glDisable with argument GL_POINT_SMOOTH . Point antialiasing is initially disabled.

    If point antialiasing is disabled, the actual size is determined by rounding the supplied size to the nearest integer. (If the rounding results in the value 0, it is as if the point size were 1.) If the rounded size is odd, then the center point ( x , y ) of the pixel fragment that represents the point is computed as .sp .ce ( \(lf ~ x sub w ~ \(rf ~+~ .5 , \(lf ~ y sub w ~ \(rf ~+~ .5 ) .sp where w subscripts indicate window coordinates. All pixels that lie within the square grid of the rounded size centered at ( x , y ) make up the fragment. If the size is even, the center point is .sp .ce ( \(lf ~ x sub w ~+~ .5 ~ \(rf, \(lf ~ y sub w ~+~ .5 ~ \(rf ) .sp and the rasterized fragment's centers are the half-integer window coordinates within the square of the rounded size centered at ( x , y ). All pixel fragments produced in rasterizing a nonantialiased point are assigned the same associated data, that of the vertex corresponding to the point.

    If antialiasing is enabled, then point rasterization produces a fragment for each pixel square that intersects the region lying within the circle having diameter equal to the current point size and centered at the point's ( x sub w , y sub w ). The coverage value for each fragment is the window coordinate area of the intersection of the circular region with the corresponding pixel square. This value is saved and used in the final rasterization step. The data associated with each fragment is the data associated with the point being rasterized.

    Not all sizes are supported when point antialiasing is enabled. If an unsupported size is requested, the nearest supported size is used. Only size 1 is guaranteed to be supported; others depend on the implementation. To query the range of supported sizes and the size difference between supported sizes within the range, call glGet with arguments GL_POINT_SIZE_RANGE and GL_POINT_SIZE_GRANULARITY .

  Parameter `size`

    Specifies the diameter of rasterized points. The initial value is 1.

  Throws

    GL_INVALID_VALUE is generated if size is less than or equal to 0.

    GL_INVALID_OPERATION is generated if glPointSize is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPolygonMode

    `void glPolygonMode(int face, int mode)`

  Description

    glPolygonMode controls the interpretation of polygons for rasterization. face describes which polygons mode applies to: front-facing polygons (GL_FRONT ), back-facing polygons (GL_BACK ), or both (GL_FRONT_AND_BACK ). The polygon mode affects only the final rasterization of polygons. In particular, a polygon's vertices are lit and the polygon is clipped and possibly culled before these modes are applied.

    Three modes are defined and can be specified in mode:

    GL_POINT | Polygon vertices that are marked as the start of a boundary edge are drawn as points. Point attributes such as GL_POINT_SIZE and GL_POINT_SMOOTH control the rasterization of the points. Polygon rasterization attributes other than GL_POLYGON_MODE have no effect.
    GL_LINE | Boundary edges of the polygon are drawn as line segments. They are treated as connected line segments for line stippling; the line stipple counter and pattern are not reset between segments (see glLineStipple ). Line attributes such as GL_LINE_WIDTH and GL_LINE_SMOOTH control the rasterization of the lines. Polygon rasterization attributes other than GL_POLYGON_MODE have no effect.
    GL_FILL | The interior of the polygon is filled. Polygon attributes such as GL_POLYGON_STIPPLE and GL_POLYGON_SMOOTH control the rasterization of the polygon.

  Parameter `face`

    Specifies the polygons that mode applies to. Must be GL_FRONT for front-facing polygons, GL_BACK for back-facing polygons, or GL_FRONT_AND_BACK for front- and back-facing polygons.

  Parameter `mode`

    Specifies how polygons will be rasterized. Accepted values are GL_POINT , GL_LINE , and GL_FILL . The initial value is GL_FILL for both front- and back-facing polygons.

  Throws

    GL_INVALID_ENUM is generated if either face or mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glPolygonMode is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPolygonOffset

    `void glPolygonOffset(float factor, float units)`

  Description

    When GL_POLYGON_OFFSET is enabled, each fragment's depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The value of the offset is "factor" ~*~ DZ ~~+~~ r ~*~ "units", where DZ~ is a measurement of the change in depth relative to the screen area of the polygon, and r is the smallest value that is guaranteed to produce a resolvable offset for a given implementation. The offset is added before the depth test is performed and before the value is written into the depth buffer.

    glPolygonOffset is useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges.

  Parameter `factor`

    Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0.

  Parameter `units`

    Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.

  Throws

    GL_INVALID_OPERATION is generated if glPolygonOffset is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPushAttrib

    `void glPushAttrib(int mask)`

  Description

    glPushAttrib takes one argument, a mask that indicates which groups of state variables to save on the attribute stack. Symbolic constants are used to set bits in the mask. mask is typically constructed by ORing several of these constants together. The special mask GL_ALL_ATTRIB_BITS can be used to save all stackable states.

    The symbolic mask constants and their associated GL state are as follows (the second column lists which attributes are saved):

    .TS ; l l . GL_ACCUM_BUFFER_BIT Accumulation buffer clear value

    GL_COLOR_BUFFER_BIT GL_ALPHA_TEST enable bit Alpha test function and reference value GL_BLEND enable bit Blending source and destination functions Constant blend color Blending equation GL_DITHER enable bit GL_DRAW_BUFFER setting GL_COLOR_LOGIC_OP enable bit GL_INDEX_LOGIC_OP enable bit Logic op function Color mode and index mode clear values Color mode and index mode writemasks

    GL_CURRENT_BIT Current RGBA color Current color index Current normal vector Current texture coordinates Current raster position GL_CURRENT_RASTER_POSITION_VALID flag RGBA color associated with current raster position Color index associated with current raster position Texture coordinates associated with current raster position GL_EDGE_FLAG flag

    GL_DEPTH_BUFFER_BIT GL_DEPTH_TEST enable bit Depth buffer test function Depth buffer clear value GL_DEPTH_WRITEMASK enable bit

    GL_ENABLE_BIT GL_ALPHA_TEST flag GL_AUTO_NORMAL flag GL_BLEND flag Enable bits for the user-definable clipping planes GL_COLOR_MATERIAL GL_CULL_FACE flag GL_DEPTH_TEST flag GL_DITHER flag GL_FOG flag GL_LIGHT i where 0\ <= i<GL_MAX_LIGHTS GL_LIGHTING flag GL_LINE_SMOOTH flag GL_LINE_STIPPLE flag GL_COLOR_LOGIC_OP flag GL_INDEX_LOGIC_OP flag GL_MAP1_ x where x is a map type GL_MAP2_ x where x is a map type GL_NORMALIZE flag GL_POINT_SMOOTH flag GL_POLYGON_OFFSET_LINE flag GL_POLYGON_OFFSET_FILL flag GL_POLYGON_OFFSET_POINT flag GL_POLYGON_SMOOTH flag GL_POLYGON_STIPPLE flag GL_SCISSOR_TEST flag GL_STENCIL_TEST flag GL_TEXTURE_1D flag GL_TEXTURE_2D flag Flags GL_TEXTURE_GEN_ x where x is S, T, R, or Q

    GL_EVAL_BIT GL_MAP1_ x enable bits, where x is a map type GL_MAP2_ x enable bits, where x is a map type 1D grid endpoints and divisions 2D grid endpoints and divisions GL_AUTO_NORMAL enable bit

    GL_FOG_BIT GL_FOG enable bit Fog color Fog density Linear fog start Linear fog end Fog index GL_FOG_MODE value

    GL_HINT_BIT GL_PERSPECTIVE_CORRECTION_HINT setting GL_POINT_SMOOTH_HINT setting GL_LINE_SMOOTH_HINT setting GL_POLYGON_SMOOTH_HINT setting GL_FOG_HINT setting

    GL_LIGHTING_BIT GL_COLOR_MATERIAL enable bit GL_COLOR_MATERIAL_FACE value Color material parameters that are tracking the current color Ambient scene color GL_LIGHT_MODEL_LOCAL_VIEWER value GL_LIGHT_MODEL_TWO_SIDE setting GL_LIGHTING enable bit Enable bit for each light Ambient, diffuse, and specular intensity for each light Direction, position, exponent, and cutoff angle for each light Constant, linear, and quadratic attenuation factors for each light Ambient, diffuse, specular, and emissive color for each material Ambient, diffuse, and specular color indices for each material Specular exponent for each material GL_SHADE_MODEL setting

    GL_LINE_BIT GL_LINE_SMOOTH flag GL_LINE_STIPPLE enable bit Line stipple pattern and repeat counter Line width

    GL_LIST_BIT GL_LIST_BASE setting

    GL_PIXEL_MODE_BIT GL_RED_BIAS and GL_RED_SCALE settings GL_GREEN_BIAS and GL_GREEN_SCALE values GL_BLUE_BIAS and GL_BLUE_SCALE GL_ALPHA_BIAS and GL_ALPHA_SCALE GL_DEPTH_BIAS and GL_DEPTH_SCALE GL_INDEX_OFFSET and GL_INDEX_SHIFT values GL_MAP_COLOR and GL_MAP_STENCIL flags GL_ZOOM_X and GL_ZOOM_Y factors GL_READ_BUFFER setting

    GL_POINT_BIT GL_POINT_SMOOTH flag Point size

    GL_POLYGON_BIT GL_CULL_FACE enable bit GL_CULL_FACE_MODE value GL_FRONT_FACE indicator GL_POLYGON_MODE setting GL_POLYGON_SMOOTH flag GL_POLYGON_STIPPLE enable bit GL_POLYGON_OFFSET_FILL flag GL_POLYGON_OFFSET_LINE flag GL_POLYGON_OFFSET_POINT flag GL_POLYGON_OFFSET_FACTOR GL_POLYGON_OFFSET_UNITS

    GL_POLYGON_STIPPLE_BIT Polygon stipple image

    GL_SCISSOR_BIT GL_SCISSOR_TEST flag Scissor box

    GL_STENCIL_BUFFER_BIT GL_STENCIL_TEST enable bit Stencil function and reference value Stencil value mask Stencil fail, pass, and depth buffer pass actions Stencil buffer clear value Stencil buffer writemask

    GL_TEXTURE_BIT Enable bits for the four texture coordinates Border color for each texture image Minification function for each texture image Magnification function for each texture image Texture coordinates and wrap mode for each texture image Color and mode for each texture environment Enable bits GL_TEXTURE_GEN_ x, x is S, T, R, and Q GL_TEXTURE_GEN_MODE setting for S, T, R, and Q glTexGen plane equations for S, T, R, and Q Current texture bindings (for example, GL_TEXTURE_2D_BINDING )

    GL_TRANSFORM_BIT Coefficients of the six clipping planes Enable bits for the user-definable clipping planes GL_MATRIX_MODE value GL_NORMALIZE flag

    GL_VIEWPORT_BIT Depth range (near and far) Viewport origin and extent .TE

    glPopAttrib restores the values of the state variables saved with the last

    glPushAttrib command. Those not saved are left unchanged.

    It is an error to push attributes onto a full stack, or to pop attributes off an empty stack. In either case, the error flag is set and no other change is made to GL state.

    Initially, the attribute stack is empty.

  Parameter `mask`

    Specifies a mask that indicates which attributes to save. Values for mask are listed below.

  Throws

    GL_STACK_OVERFLOW is generated if glPushAttrib is called while the attribute stack is full.

    GL_STACK_UNDERFLOW is generated if glPopAttrib is called while the attribute stack is empty.

    GL_INVALID_OPERATION is generated if glPushAttrib or glPopAttrib is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPushClientAttrib

    `void glPushClientAttrib(int mask)`

  Description

    glPushClientAttrib takes one argument, a mask that indicates which groups of client-state variables to save on the client attribute stack. Symbolic constants are used to set bits in the mask. mask is typically constructed by OR'ing several of these constants together. The special mask GL_CLIENT_ALL_ATTRIB_BITS can be used to save all stackable client state.

    The symbolic mask constants and their associated GL client state are as follows (the second column lists which attributes are saved):

    GL_CLIENT_PIXEL_STORE_BIT Pixel storage modes

    GL_CLIENT_VERTEX_ARRAY_BIT Vertex arrays (and enables)

    glPopClientAttrib restores the values of the client-state variables saved with the last glPushClientAttrib . Those not saved are left unchanged.

    It is an error to push attributes onto a full client attribute stack, or to pop attributes off an empty stack. In either case, the error flag is set, and no other change is made to GL state.

    Initially, the client attribute stack is empty.

  Parameter `mask`

    Specifies a mask that indicates which attributes to save. Values for mask are listed below.

  Throws

    GL_STACK_OVERFLOW is generated if glPushClientAttrib is called while the attribute stack is full.

    GL_STACK_UNDERFLOW is generated if glPopClientAttrib is called while the attribute stack is empty.

  Method glPushName

    `void glPushName(int name)`

  Description

    The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers and is initially empty.

    glPushName causes name to be pushed onto the name stack. glPopName pops one name off the top of the stack.

    The maximum name stack depth is implementation-dependent; call GL_MAX_NAME_STACK_DEPTH to find out the value for a particular implementation. It is an error to push a name onto a full stack, or to pop a name off an empty stack. It is also an error to manipulate the name stack between the execution of glBegin and the corresponding execution of glEnd . In any of these cases, the error flag is set and no other change is made to GL state.

    The name stack is always empty while the render mode is not GL_SELECT . Calls to glPushName or glPopName while the render mode is not GL_SELECT are ignored.

  Parameter `name`

    Specifies a name that will be pushed onto the name stack.

  Throws

    GL_STACK_OVERFLOW is generated if glPushName is called while the name stack is full.

    GL_STACK_UNDERFLOW is generated if glPopName is called while the name stack is empty.

    GL_INVALID_OPERATION is generated if glPushName or glPopName is executed between a call to glBegin and the corresponding call to glEnd .

  Method glRasterPos

    `void glRasterPos(float|int x, float|int y, float|int|void z, float|int|void w)`
    `void glRasterPos(array(float|int) pos)`

  Description

    The GL maintains a 3D position in window coordinates. This position, called the raster position, is used to position pixel and bitmap write operations. It is maintained with subpixel accuracy. See glBitmap , glDrawPixels , and glCopyPixels .

    The current raster position consists of three window coordinates (x, y, z), a clip coordinate value (w), an eye coordinate distance, a valid bit, and associated color data and texture coordinates. The w coordinate is a clip coordinate, because w is not projected to window coordinates. The variable z defaults to 0 and w defaults to 1.

    The object coordinates presented by glRasterPos are treated just like those of a glVertex command: They are transformed by the current modelview and projection matrices and passed to the clipping stage. If the vertex is not culled, then it is projected and scaled to window coordinates, which become the new current raster position, and the GL_CURRENT_RASTER_POSITION_VALID flag is set. If the vertex .I is culled, then the valid bit is cleared and the current raster position and associated color and texture coordinates are undefined.

    The current raster position also includes some associated color data and texture coordinates. If lighting is enabled, then GL_CURRENT_RASTER_COLOR (in RGBA mode) or GL_CURRENT_RASTER_INDEX (in color index mode) is set to the color produced by the lighting calculation (see glLight , glLightModel , and

    glShadeModel ). If lighting is disabled, current color (in RGBA mode, state variable GL_CURRENT_COLOR ) or color index (in color index mode, state variable GL_CURRENT_INDEX ) is used to update the current raster color.

    Likewise, GL_CURRENT_RASTER_TEXTURE_COORDS is updated as a function of GL_CURRENT_TEXTURE_COORDS , based on the texture matrix and the texture generation functions (see glTexGen ). Finally, the distance from the origin of the eye coordinate system to the vertex as transformed by only the modelview matrix replaces GL_CURRENT_RASTER_DISTANCE .

    Initially, the current raster position is (0, 0, 0, 1), the current raster distance is 0, the valid bit is set, the associated RGBA color is (1, 1, 1, 1), the associated color index is 1, and the associated texture coordinates are (0, 0, 0, 1). In RGBA mode, GL_CURRENT_RASTER_INDEX is always 1; in color index mode, the current raster RGBA color always maintains its initial value.

  Parameter `x`

    Specify the x, y, z, and w object coordinates (if present) for the raster position.

  Parameter `v`

    Specifies a pointer to an array of two, three, or four elements, specifying x, y, z, and w coordinates, respectively.

  Throws

    GL_INVALID_OPERATION is generated if glRasterPos is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glRotate

    `void glRotate(float|int|array(float|int) angle, float|int|void x, float|int|void y, float|int|void z)`

  Description

    glRotate produces a rotation of angle degrees around the vector ("x", "y", "z"). The current matrix (see glMatrixMode ) is multiplied by a rotation matrix with the product replacing the current matrix, as if glMultMatrix were called with the following matrix as its argument:

    .ce .EQ left ( ~ down 20 matrix { ccol { "x" "x" (1 - c)+ c above "y" "x" (1 - c)+ "z" s above "x" "z" (1 - c)-"y" s above ~0 } ccol {"x" "y" (1 - c)-"z" s above "y" "y" (1 - c)+ c above "y" "z" (1 - c)+ "x" s above ~0 } ccol { "x" "z" (1 - c)+ "y" s above "y" "z" (1 - c)- "x" s above "z" "z" (1 - c) + c above ~0 } ccol { ~0 above ~0 above ~0 above ~1} } ~~ right ) .EN

    .sp Where c ~=~ cos("angle"), s ~=~ sine("angle"), and ||(~"x", "y", "z"~)|| ~=~ 1 (if not, the GL will normalize this vector). .sp .sp

    If the matrix mode is either GL_MODELVIEW or GL_PROJECTION , all objects drawn after glRotate is called are rotated. Use glPushMatrix and glPopMatrix to save and restore the unrotated coordinate system.

  Parameter `angle`

    Specifies the angle of rotation, in degrees.

  Parameter `x`

    Specify the x, y, and z coordinates of a vector, respectively.

  Throws

    GL_INVALID_OPERATION is generated if glRotate is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glScale

    `void glScale(float|int|array(float|int) x, float|int|void y, float|int|void z)`

  Description

    glScale produces a nonuniform scaling along the x, y, and z axes. The three parameters indicate the desired scale factor along each of the three axes.

    The current matrix (see glMatrixMode ) is multiplied by this scale matrix, and the product replaces the current matrix as if glScale were called with the following matrix as its argument:

    .ce .EQ left ( ~ down 20 matrix { ccol { ~"x" above ~0 above ~0 above ~0 } ccol { ~0 above ~"y" above ~0 above ~0 } ccol { ~0 above ~0 above ~"z" above ~0 } ccol { ~0 above ~0 above ~0 above ~1} } ~~ right ) .EN .sp If the matrix mode is either GL_MODELVIEW or GL_PROJECTION , all objects drawn after glScale is called are scaled.

    Use glPushMatrix and glPopMatrix to save and restore the unscaled coordinate system.

  Parameter `x`

    Specify scale factors along the x, y, and z axes, respectively.

  Throws

    GL_INVALID_OPERATION is generated if glScale is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glScissor

    `void glScissor(int x, int y, int width, int height)`

  Description

    glScissor defines a rectangle, called the scissor box, in window coordinates. The first two arguments, x and y, specify the lower left corner of the box. width and height specify the width and height of the box.

    To enable and disable the scissor test, call glEnable and glDisable with argument GL_SCISSOR_TEST . The test is initially disabled. While the test is enabled, only pixels that lie within the scissor box can be modified by drawing commands. Window coordinates have integer values at the shared corners of frame buffer pixels. \f7glScissor(0,0,1,1)\fP allows modification of only the lower left pixel in the window, and \f7glScissor(0,0,0,0)\fP doesn't allow modification of any pixels in the window.

    When the scissor test is disabled, it is as though the scissor box includes the entire window.

  Parameter `x`

    Specify the lower left corner of the scissor box. Initially (0, 0).

  Parameter `width`

    Specify the width and height of the scissor box. When a GL context is first attached to a window, width and height are set to the dimensions of that window.

  Throws

    GL_INVALID_VALUE is generated if either width or height is negative.

    GL_INVALID_OPERATION is generated if glScissor is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glStencilFunc

    `void glStencilFunc(int func, int ref, int mask)`

  Description

    Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.

    The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the reference value and the value in the stencil buffer. To enable and disable the test, call glEnable and glDisable with argument GL_STENCIL_TEST . To specify actions based on the outcome of the stencil test, call glStencilOp .

    func is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. ref is an integer reference value that is used in the stencil comparison. It is clamped to the range [0,2 sup n - 1], where n is the number of bitplanes in the stencil buffer. mask is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison. .P If stencil represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by func. Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see glStencilOp ). All tests treat stencil values as unsigned integers in the range [0,2 sup n - 1], where n is the number of bitplanes in the stencil buffer.

    The following values are accepted by func:

    GL_NEVER | Always fails.
    GL_LESS | Passes if ( ref & mask ) < ( stencil & mask ).
    GL_LEQUAL | Passes if ( ref & mask ) \(<= ( stencil & mask ).
    GL_GREATER | Passes if ( ref & mask ) > ( stencil & mask ).
    GL_GEQUAL | Passes if ( ref & mask ) \(>= ( stencil & mask ).
    GL_EQUAL | Passes if ( ref & mask ) = ( stencil & mask ).
    GL_NOTEQUAL | Passes if ( ref & mask ) \(!= ( stencil & mask ).
    GL_ALWAYS | Always passes.

  Parameter `func`

    Specifies the test function. Eight tokens are valid: GL_NEVER , GL_LESS , GL_LEQUAL , GL_GREATER , GL_GEQUAL , GL_EQUAL , GL_NOTEQUAL , and GL_ALWAYS . The initial value is GL_ALWAYS .

  Parameter `ref`

    Specifies the reference value for the stencil test. ref is clamped to the range [0,2 sup n - 1], where n is the number of bitplanes in the stencil buffer. The initial value is 0.

  Parameter `mask`

    Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1's.

  Throws

    GL_INVALID_ENUM is generated if func is not one of the eight accepted values.

    GL_INVALID_OPERATION is generated if glStencilFunc is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glStencilMask

    `void glStencilMask(int mask)`

  Description

    glStencilMask controls the writing of individual bits in the stencil planes. The least significant n bits of mask, where n is the number of bits in the stencil buffer, specify a mask. Where a 1 appears in the mask, it's possible to write to the corresponding bit in the stencil buffer. Where a 0 appears, the corresponding bit is write-protected. Initially, all bits are enabled for writing.

  Parameter `mask`

    Specifies a bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is all 1's.

  Throws

    GL_INVALID_OPERATION is generated if glStencilMask is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glStencilOp

    `void glStencilOp(int fail, int zfail, int zpass)`

  Description

    Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.

    The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the value in the stencil buffer and a reference value. To enable and disable the test, call glEnable and glDisable with argument GL_STENCIL_TEST ; to control it, call glStencilFunc .

    glStencilOp takes three arguments that indicate what happens to the stored stencil value while stenciling is enabled. If the stencil test fails, no change is made to the pixel's color or depth buffers, and fail specifies what happens to the stencil buffer contents. The following six actions are possible.

    GL_KEEP | Keeps the current value.
    GL_ZERO | Sets the stencil buffer value to 0.
    GL_REPLACE | Sets the stencil buffer value to ref, as specified by glStencilFunc .
    GL_INCR | Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.
    GL_DECR | Decrements the current stencil buffer value. Clamps to 0.
    GL_INVERT | Bitwise inverts the current stencil buffer value.

    Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and 2 sup n - 1, where n is the value returned by querying GL_STENCIL_BITS .

    The other two arguments to glStencilOp specify stencil buffer actions that depend on whether subsequent depth buffer tests succeed (zpass) or fail (zfail) (see

    glDepthFunc ). The actions are specified using the same six symbolic constants as fail. Note that zfail is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, fail and zpass specify stencil action when the stencil test fails and passes, respectively.

  Parameter `fail`

    Specifies the action to take when the stencil test fails. Six symbolic constants are accepted: GL_KEEP , GL_ZERO , GL_REPLACE , GL_INCR , GL_DECR , and GL_INVERT . The initial value is GL_KEEP .

  Parameter `zfail`

    Specifies the stencil action when the stencil test passes, but the depth test fails. zfail accepts the same symbolic constants as fail. The initial value is GL_KEEP .

  Parameter `zpass`

    Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled. zpass accepts the same symbolic constants as fail. The initial value is GL_KEEP .

  Throws

    GL_INVALID_ENUM is generated if fail, zfail, or zpass is any value other than the six defined constant values.

    GL_INVALID_OPERATION is generated if glStencilOp is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glTexCoord

    `void glTexCoord(float|int|array(float|int) s, float|int|void t, float|int|void r, float|int|void q)`

  Description

    glTexCoord specifies texture coordinates in one, two, three, or four dimensions. glTexCoord1 sets the current texture coordinates to (s, 0, 0, 1); a call to

    glTexCoord2 sets them to (s, t, 0, 1). Similarly, glTexCoord3 specifies the texture coordinates as (s, t, r, 1), and glTexCoord4 defines all four components explicitly as (s, t, r, q).

    The current texture coordinates are part of the data that is associated with each vertex and with the current raster position. Initially, the values for s, t, r, and q are (0, 0, 0, 1).

  Parameter `s`

    Specify s, t, r, and q texture coordinates. Not all parameters are present in all forms of the command.

  Parameter `v`

    Specifies a pointer to an array of one, two, three, or four elements, which in turn specify the s, t, r, and q texture coordinates.

  Method glTexEnv

    `void glTexEnv(int target, int pname, float|int|array(float|int) param)`

  Description

    A texture environment specifies how texture values are interpreted when a fragment is textured. target must be GL_TEXTURE_ENV . pname can be either GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR .

    If pname is GL_TEXTURE_ENV_MODE , then params is (or points to) the symbolic name of a texture function. Four texture functions may be specified: GL_MODULATE , GL_DECAL , GL_BLEND , and GL_REPLACE .

    A texture function acts on the fragment to be textured using the texture image value that applies to the fragment (see glTexParameter ) and produces an RGBA color for that fragment. The following table shows how the RGBA color is produced for each of the three texture functions that can be chosen. C is a triple of color values (RGB) and A is the associated alpha value. RGBA values extracted from a texture image are in the range [0,1]. The subscript f refers to the incoming fragment, the subscript t to the texture image, the subscript c to the texture environment color, and subscript v indicates a value produced by the texture function.

    A texture image can have up to four components per texture element (see glTexImage1D , glTexImage2D , glCopyTexImage1D , and glCopyTexImage2D ). In a one-component image, L sub t indicates that single component. A two-component image uses L sub t and A sub t. A three-component image has only a color value, C sub t. A four-component image has both a color value C sub t and an alpha value A sub t.

    .ne .TS center box tab(:) ; ci || ci s s s ci || c c c c c || c | c | c | c. Base internal:Texture functions format:GL_MODULATE :GL_DECAL :GL_BLEND :GL_REPLACE = GL_ALPHA :C sub v = C sub f:undefined:C sub v = C sub f:C sub v = C sub f \^ :A sub v = A sub f A sub t:\^:A sub v = A sub f:A sub v = A sub t _ GL_LUMINANCE :C sub v = L sub t C sub f:undefined:C sub v = ( 1 - L sub t ) C sub f:C sub v = L sub t 1: : :+ L sub t C sub c: : : : : : A sub v = A sub f:\^: A sub v = A sub f:A sub v = A sub f _ GL_LUMINANCE :C sub v = L sub t C sub f:undefined:C sub v = ( 1 - L sub t ) C sub f :C sub v = L sub t \_ALPHA : : : + L sub t C sub c 2: : : : :A sub v = A sub t A sub f:\^:A sub v = A sub t A sub f:A sub v = A sub t _ GL_INTENSITY :C sub v = C sub f I sub t:undefined:C sub v = ( 1 - I sub t ) C sub f :C sub v = I sub t : : :+ I sub t C sub c : : : : \^ :A sub v = A sub f I sub t:\^:A sub v = ( 1 - I sub t ) A sub f :A sub v = I sub t : : :+ I sub t A sub c: _ GL_RGB :C sub v = C sub t C sub f:C sub v = C sub t:C sub v = (1 - C sub t) C sub f :C sub v = C sub t 3: : : + C sub t C sub c : : : : :A sub v = A sub f:A sub v = A sub f:A sub v = A sub f:A sub v = A sub f _ GL_RGBA :C sub v = C sub t C sub f:C sub v = ( 1 - A sub t ) C sub f :C sub v = (1 - C sub t) C sub f :C sub v = C sub t 4: :+ A sub t C sub t: + C sub t C sub c : : : : :A sub v = A sub t A sub f:A sub v = A sub f:A sub v = A sub t A sub f:A sub v = A sub t .TE .sp If pname is GL_TEXTURE_ENV_COLOR , params is a pointer to an array that holds an RGBA color consisting of four values. Integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0. The values are clamped to the range [0,1] when they are specified. C sub c takes these four values.

    GL_TEXTURE_ENV_MODE defaults to GL_MODULATE and GL_TEXTURE_ENV_COLOR defaults to (0, 0, 0, 0).

  Parameter `target`

    Specifies a texture environment. Must be GL_TEXTURE_ENV .

  Parameter `pname`

    Specifies the symbolic name of a single-valued texture environment parameter. Must be GL_TEXTURE_ENV_MODE .

  Parameter `param`

    Specifies a single symbolic constant, one of GL_MODULATE , GL_DECAL , GL_BLEND , or GL_REPLACE .

  Parameter `target`

    Specifies a texture environment. Must be GL_TEXTURE_ENV .

  Parameter `pname`

    Specifies the symbolic name of a texture environment parameter. Accepted values are GL_TEXTURE_ENV_MODE and GL_TEXTURE_ENV_COLOR .

  Parameter `params`

    Specifies a pointer to a parameter array that contains either a single symbolic constant or an RGBA color.

  Throws

    GL_INVALID_ENUM is generated when target or pname is not one of the accepted defined values, or when params should have a defined constant value (based on the value of pname) and does not.

    GL_INVALID_OPERATION is generated if glTexEnv is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glTexGen

    `void glTexGen(int coord, int pname, float|int|array(float|int) param)`

  Description

    glTexGen selects a texture-coordinate generation function or supplies coefficients for one of the functions. coord names one of the (s, t, r, q) texture coordinates; it must be one of the symbols GL_S , GL_T , GL_R , or GL_Q . pname must be one of three symbolic constants: GL_TEXTURE_GEN_MODE , GL_OBJECT_PLANE , or GL_EYE_PLANE . If pname is GL_TEXTURE_GEN_MODE , then params chooses a mode, one of GL_OBJECT_LINEAR , GL_EYE_LINEAR , or GL_SPHERE_MAP . If pname is either GL_OBJECT_PLANE or GL_EYE_PLANE , params contains coefficients for the corresponding texture generation function. .P If the texture generation function is GL_OBJECT_LINEAR , the function

    .ce g = p sub 1 x sub o + p sub 2 y sub o + p sub 3 z sub o + p sub 4 w sub o

    is used, where g is the value computed for the coordinate named in coord, p sub 1, p sub 2, p sub 3, and p sub 4 are the four values supplied in params, and x sub o, y sub o, z sub o, and w sub o are the object coordinates of the vertex. This function can be used, for example, to texture-map terrain using sea level as a reference plane (defined by p sub 1, p sub 2, p sub 3, and p sub 4). The altitude of a terrain vertex is computed by the GL_OBJECT_LINEAR coordinate generation function as its distance from sea level; that altitude can then be used to index the texture image to map white snow onto peaks and green grass onto foothills.

    If the texture generation function is GL_EYE_LINEAR , the function

    .ce g = {p sub 1} sup prime ~x sub e + {p sub 2} sup prime ~y sub e + {p sub 3} sup prime ~z sub e + {p sub 4} sup prime ~w sub e

    is used, where

    .ce $( {p sub 1} sup prime ~~{p sub 2} sup prime~~{p sub 3} sup prime~~ {{p sub 4}sup prime}) = ( p sub 1~~ p sub 2~~ p sub 3~~ p sub 4 ) ~M sup -1$

    and x sub e, y sub e, z sub e, and w sub e are the eye coordinates of the vertex, p sub 1, p sub 2, p sub 3, and p sub 4 are the values supplied in params, and M is the modelview matrix when glTexGen is invoked. If M is poorly conditioned or singular, texture coordinates generated by the resulting function may be inaccurate or undefined.

    Note that the values in params define a reference plane in eye coordinates. The modelview matrix that is applied to them may not be the same one in effect when the polygon vertices are transformed. This function establishes a field of texture coordinates that can produce dynamic contour lines on moving objects.

    If pname is GL_SPHERE_MAP and coord is either GL_S or GL_T , s and t texture coordinates are generated as follows. Let u be the unit vector pointing from the origin to the polygon vertex (in eye coordinates). Let n sup prime be the current normal, after transformation to eye coordinates. Let

    .ce f ~=~ ( f sub x~~f sub y~~f sub z ) sup T be the reflection vector such that

    .ce f ~=~ u ~-~ 2 n sup prime n sup prime sup T u

    Finally, let m ~=~ 2 sqrt { f sub x sup {~2} + f sub y sup {~2} + (f sub z + 1 ) sup 2}. Then the values assigned to the s and t texture coordinates are

    .ce 1 s ~=~ f sub x over m ~+~ 1 over 2 .sp .ce 1 t ~=~ f sub y over m ~+~ 1 over 2

    To enable or disable a texture-coordinate generation function, call glEnable or glDisable with one of the symbolic texture-coordinate names (GL_TEXTURE_GEN_S , GL_TEXTURE_GEN_T , GL_TEXTURE_GEN_R , or GL_TEXTURE_GEN_Q ) as the argument. When enabled, the specified texture coordinate is computed according to the generating function associated with that coordinate. When disabled, subsequent vertices take the specified texture coordinate from the current set of texture coordinates. Initially, all texture generation functions are set to GL_EYE_LINEAR and are disabled. Both s plane equations are (1, 0, 0, 0), both t plane equations are (0, 1, 0, 0), and all r and q plane equations are (0, 0, 0, 0).

  Parameter `coord`

    Specifies a texture coordinate. Must be one of GL_S , GL_T , GL_R , or GL_Q .

  Parameter `pname`

    Specifies the symbolic name of the texture-coordinate generation function. Must be GL_TEXTURE_GEN_MODE .

  Parameter `param`

    Specifies a single-valued texture generation parameter, one of GL_OBJECT_LINEAR , GL_EYE_LINEAR , or GL_SPHERE_MAP .

  Parameter `coord`

    Specifies a texture coordinate. Must be one of GL_S , GL_T , GL_R , or GL_Q .

  Parameter `pname`

    Specifies the symbolic name of the texture-coordinate generation function or function parameters. Must be GL_TEXTURE_GEN_MODE , GL_OBJECT_PLANE , or GL_EYE_PLANE .

  Parameter `params`

    Specifies a pointer to an array of texture generation parameters. If pname is GL_TEXTURE_GEN_MODE , then the array must contain a single symbolic constant, one of GL_OBJECT_LINEAR , GL_EYE_LINEAR , or GL_SPHERE_MAP . Otherwise, params holds the coefficients for the texture-coordinate generation function specified by pname.

  Throws

    GL_INVALID_ENUM is generated when coord or pname is not an accepted defined value, or when pname is GL_TEXTURE_GEN_MODE and params is not an accepted defined value.

    GL_INVALID_ENUM is generated when pname is GL_TEXTURE_GEN_MODE , params is GL_SPHERE_MAP , and coord is either GL_R or GL_Q .

    GL_INVALID_OPERATION is generated if glTexGen is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glTexImage2D

    `void glTexImage2D(int target, int level, int internalformat, object|mapping(string:object) width, object|mapping(string:object) height, int border, object|mapping(string:object) format, object|mapping(string:object) type, array(object|mapping(string:object)) pixels)`

  Description

    Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable two-dimensional texturing, call glEnable and glDisable with argument GL_TEXTURE_2D .

    To define texture images, call glTexImage2D . The arguments describe the parameters of the texture image, such as height, width, width of the border, level-of-detail number (see glTexParameter ), and number of color components provided. The last three arguments describe how the image is represented in memory; they are identical to the pixel formats used for glDrawPixels .

    If target is GL_PROXY_TEXTURE_2D , no data is read from pixels, but all of the texture image state is recalculated, checked for consistency, and checked against the implementation's capabilities. If the implementation cannot handle a texture of the requested texture size, it sets all of the image state to 0, but does not generate an error (see glGetError ). To query for an entire mipmap array, use an image array level greater than or equal to 1. .P If target is GL_TEXTURE_2D , data is read from pixels as a sequence of signed or unsigned bytes, shorts, or longs, or single-precision floating-point values, depending on type. These values are grouped into sets of one, two, three, or four values, depending on format, to form elements. If type is GL_BITMAP , the data is considered as a string of unsigned bytes (and format must be GL_COLOR_INDEX ). Each data byte is treated as eight 1-bit elements, with bit ordering determined by GL_UNPACK_LSB_FIRST (see glPixelStore ).

    The first element corresponds to the lower left corner of the texture image. Subsequent elements progress left-to-right through the remaining texels in the lowest row of the texture image, and then in successively higher rows of the texture image. The final element corresponds to the upper right corner of the texture image.

    format determines the composition of each element in pixels. It can assume one of nine symbolic values:

    GL_COLOR_INDEX

    Each element is a single value, a color index. The GL converts it to fixed point (with an unspecified number of zero bits to the right of the binary point), shifted left or right depending on the value and sign of GL_INDEX_SHIFT , and added to GL_INDEX_OFFSET (see glPixelTransfer ). The resulting index is converted to a set of color components using the GL_PIXEL_MAP_I_TO_R , GL_PIXEL_MAP_I_TO_G , GL_PIXEL_MAP_I_TO_B , and GL_PIXEL_MAP_I_TO_A tables, and clamped to the range [0,1].

    GL_RED | Each element is a single red component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for green and blue, and 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_GREEN | Each element is a single green component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for red and blue, and 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_BLUE | Each element is a single blue component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for red and green, and 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_ALPHA | Each element is a single alpha component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for red, green, and blue. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_RGB | Each element is an RGB triple. The GL converts it to floating point and assembles it into an RGBA element by attaching 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_RGBA | Each element contains all four components. Each component is multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_LUMINANCE | Each element is a single luminance value. The GL converts it to floating point, then assembles it into an RGBA element by replicating the luminance value three times for red, green, and blue and attaching 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).
    GL_LUMINANCE_ALPHA | Each element is a luminance/alpha pair. The GL converts it to floating point, then assembles it into an RGBA element by replicating the luminance value three times for red, green, and blue. Each component is then multiplied by the signed scale factor GL_c_SCALE , added to the signed bias GL_c_BIAS , and clamped to the range [0,1] (see glPixelTransfer ).

    Refer to the glDrawPixels reference page for a description of the acceptable values for the type parameter.

    If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution and format with internalformat. The GL will choose an internal representation that closely approximates that requested by internalformat, but it may not match exactly. (The representations specified by GL_LUMINANCE , GL_LUMINANCE_ALPHA , GL_RGB , and GL_RGBA must match exactly. The numeric values 1, 2, 3, and 4 may also be used to specify the above representations.)

    Use the GL_PROXY_TEXTURE_2D target to try out a resolution and format. The implementation will update and recompute its best match for the requested storage resolution and format. To then query this state, call glGetTexLevelParameter . If the texture cannot be accommodated, texture state is set to 0.

    A one-component texture image uses only the red component of the RGBA color extracted from pixels. A two-component image uses the R and A values. A three-component image uses the R, G, and B values. A four-component image uses all of the RGBA components.

  Parameter `target`

    Specifies the target texture. Must be GL_TEXTURE_2D or GL_PROXY_TEXTURE_2D .

  Parameter `level`

    Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

  Parameter `internalformat`

    Specifies the number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: GL_ALPHA , GL_ALPHA4 , GL_ALPHA8 , GL_ALPHA12 , GL_ALPHA16 , GL_LUMINANCE , GL_LUMINANCE4 , GL_LUMINANCE8 , GL_LUMINANCE12 , GL_LUMINANCE16 , GL_LUMINANCE_ALPHA , GL_LUMINANCE4_ALPHA4 , GL_LUMINANCE6_ALPHA2 , GL_LUMINANCE8_ALPHA8 , GL_LUMINANCE12_ALPHA4 , GL_LUMINANCE12_ALPHA12 , GL_LUMINANCE16_ALPHA16 , GL_INTENSITY , GL_INTENSITY4 , GL_INTENSITY8 , GL_INTENSITY12 , GL_INTENSITY16 , GL_R3_G3_B2 , GL_RGB , GL_RGB4 , GL_RGB5 , GL_RGB8 , GL_RGB10 , GL_RGB12 , GL_RGB16 , GL_RGBA , GL_RGBA2 , GL_RGBA4 , GL_RGB5_A1 , GL_RGBA8 , GL_RGB10_A2 , GL_RGBA12 , or GL_RGBA16 .

  Parameter `width`

    Specifies the width of the texture image. Must be 2 sup n + 2 ( "border" ) for some integer n. All implementations support texture images that are at least 64 texels wide.

  Parameter `height`

    Specifies the height of the texture image. Must be 2 sup m + 2 ( "border" ) for some integer m. All implementations support texture images that are at least 64 texels high.

  Parameter `border`

    Specifies the width of the border. Must be either 0 or 1.

  Parameter `format`

    Specifies the format of the pixel data. The following symbolic values are accepted: GL_COLOR_INDEX , GL_RED , GL_GREEN , GL_BLUE , GL_ALPHA , GL_RGB , GL_RGBA , GL_LUMINANCE , and GL_LUMINANCE_ALPHA .

  Parameter `type`

    Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE , GL_BYTE , GL_BITMAP , GL_UNSIGNED_SHORT , GL_SHORT , GL_UNSIGNED_INT , GL_INT , and GL_FLOAT .

  Parameter `pixels`

    Specifies a pointer to the image data in memory.

  Throws

    GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_PROXY_TEXTURE_2D .

    GL_INVALID_ENUM is generated if format is not an accepted format constant. Format constants other than GL_STENCIL_INDEX and GL_DEPTH_COMPONENT are accepted.

    GL_INVALID_ENUM is generated if type is not a type constant.

    GL_INVALID_ENUM is generated if type is GL_BITMAP and format is not GL_COLOR_INDEX .

    GL_INVALID_VALUE is generated if level is less than 0. .P .P GL_INVALID_VALUE may be generated if level is greater than $log sub 2$max, where max is the returned value of GL_MAX_TEXTURE_SIZE .

    GL_INVALID_VALUE is generated if internalformat is not 1, 2, 3, 4, or one of the accepted resolution and format symbolic constants.

    GL_INVALID_VALUE is generated if width or height is less than 0 or greater than 2 + GL_MAX_TEXTURE_SIZE , or if either cannot be represented as 2 sup k + 2("border") for some integer value of k.

    GL_INVALID_VALUE is generated if border is not 0 or 1.

    GL_INVALID_OPERATION is generated if glTexImage2D is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glTexParameter

    `void glTexParameter(int target, int pname, float|int|array(float|int) param)`

  Description

    Texture mapping is a technique that applies an image onto an object's surface as if the image were a decal or cellophane shrink-wrap. The image is created in texture space, with an (s, t) coordinate system. A texture is a one- or two-dimensional image and a set of parameters that determine how samples are derived from the image.

    glTexParameter assigns the value or values in params to the texture parameter specified as pname. target defines the target texture, either GL_TEXTURE_1D or GL_TEXTURE_2D . The following symbols are accepted in pname:

    GL_TEXTURE_MIN_FILTER

    The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps. A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2 sup n times 2 sup m, there are bold max ( n, m ) + 1 mipmaps. The first mipmap is the original texture, with dimensions 2 sup n times 2 sup m. Each subsequent mipmap has dimensions 2 sup { k - 1 } times 2 sup { l - 1 }, where 2 sup k times 2 sup l are the dimensions of the previous mipmap, until either k = 0 or l=0. At that point, subsequent mipmaps have dimension 1 times 2 sup { l - 1 } or 2 sup { k - 1} times 1 until the final mipmap, which has dimension 1 times 1. To define the mipmaps, call glTexImage1D , glTexImage2D , glCopyTexImage1D , or glCopyTexImage2D with the level argument indicating the order of the mipmaps. Level 0 is the original texture; level bold max ( n, m ) is the final 1 times 1 mipmap. params supplies a function for minifying the texture as one of the following: .RS 10

    GL_NEAREST | Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.
    GL_LINEAR | Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T , and on the exact mapping.
    GL_NEAREST_MIPMAP_NEAREST | Chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value.
    GL_LINEAR_MIPMAP_NEAREST | Chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value.
    GL_NEAREST_MIPMAP_LINEAR | Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

    GL_LINEAR_MIPMAP_LINEAR

    Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values. .RE As more texture elements are sampled in the minification process, fewer aliasing artifacts will be apparent. While the GL_NEAREST and GL_LINEAR minification functions can be faster than the other four, they sample only one or four texture elements to determine the texture value of the pixel being rendered and can produce moire patterns or ragged transitions. The initial value of GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR .

    GL_TEXTURE_MAG_FILTER

    The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element. It sets the texture magnification function to either GL_NEAREST or GL_LINEAR (see below). GL_NEAREST is generally faster than GL_LINEAR , but it can produce textured images with sharper edges because the transition between texture elements is not as smooth. The initial value of GL_TEXTURE_MAG_FILTER is GL_LINEAR . .RS 10

    GL_NEAREST | Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.
    GL_LINEAR | Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T , and on the exact mapping.

    .RE

    GL_TEXTURE_WRAP_S

    Sets the wrap parameter for texture coordinate s to either GL_CLAMP or GL_REPEAT . GL_CLAMP causes s coordinates to be clamped to the range [0,1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. GL_REPEAT causes the integer part of the s coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to GL_CLAMP . Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT .

    GL_TEXTURE_WRAP_T | Sets the wrap parameter for texture coordinate t to either GL_CLAMP or GL_REPEAT . See the discussion under GL_TEXTURE_WRAP_S . Initially, GL_TEXTURE_WRAP_T is set to GL_REPEAT .
    GL_TEXTURE_BORDER_COLOR | Sets a border color. params contains four values that comprise the RGBA color of the texture border. Integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0. The values are clamped to the range [0,1] when they are specified. Initially, the border color is (0, 0, 0, 0).
    GL_TEXTURE_PRIORITY | Specifies the texture residence priority of the currently bound texture. Permissible values are in the range [0,\ 1]. See glPrioritizeTextures and glBindTexture for more information.

  Parameter `target`

    Specifies the target texture, which must be either GL_TEXTURE_1D or GL_TEXTURE_2D .

  Parameter `pname`

    Specifies the symbolic name of a single-valued texture parameter. pname can be one of the following: GL_TEXTURE_MIN_FILTER , GL_TEXTURE_MAG_FILTER , GL_TEXTURE_WRAP_S , GL_TEXTURE_WRAP_T , or GL_TEXTURE_PRIORITY .

  Parameter `param`

    Specifies the value of pname.

  Parameter `target`

    Specifies the target texture, which must be either GL_TEXTURE_1D or GL_TEXTURE_2D .

  Parameter `pname`

    Specifies the symbolic name of a texture parameter. pname can be one of the following: GL_TEXTURE_MIN_FILTER , GL_TEXTURE_MAG_FILTER , GL_TEXTURE_WRAP_S , GL_TEXTURE_WRAP_T , GL_TEXTURE_BORDER_COLOR , or GL_TEXTURE_PRIORITY .

  Parameter `params`

    Specifies a pointer to an array where the value or values of pname are stored.

  Throws

    GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.

    GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.

    GL_INVALID_OPERATION is generated if glTexParameter is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glTexSubImage2D

    `void glTexSubImage2D(int target, int level, int xoffset, int yoffset, object|mapping(string:object) width, object|mapping(string:object) height, object|mapping(string:object) format, object|mapping(string:object) type, array(object|mapping(string:object)) pixels)`

  Description

    Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable two-dimensional texturing, call glEnable and glDisable with argument GL_TEXTURE_2D .

    glTexSubImage2D redefines a contiguous subregion of an existing two-dimensional texture image. The texels referenced by pixels replace the portion of the existing texture array with x indices xoffset and "xoffset"~+~"width"~-~1, inclusive, and y indices yoffset and "yoffset"~+~"height"~-~1, inclusive. This region may not include any texels outside the range of the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.

  Parameter `target`

    Specifies the target texture. Must be GL_TEXTURE_2D .

  Parameter `level`

    Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

  Parameter `xoffset`

    Specifies a texel offset in the x direction within the texture array.

  Parameter `yoffset`

    Specifies a texel offset in the y direction within the texture array.

  Parameter `width`

    Specifies the width of the texture subimage.

  Parameter `height`

    Specifies the height of the texture subimage.

  Parameter `format`

    Specifies the format of the pixel data. The following symbolic values are accepted: GL_COLOR_INDEX , GL_RED , GL_GREEN , GL_BLUE , GL_ALPHA , GL_RGB , GL_RGBA , GL_LUMINANCE , and GL_LUMINANCE_ALPHA .

  Parameter `type`

    Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE , GL_BYTE , GL_BITMAP , GL_UNSIGNED_SHORT , GL_SHORT , GL_UNSIGNED_INT , GL_INT , and GL_FLOAT .

  Parameter `pixels`

    Specifies a pointer to the image data in memory.

  Throws

    GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D .

    GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage2D operation.

    GL_INVALID_VALUE is generated if level is less than 0. .P P GL_INVALID_VALUE may be generated if level is greater than log sub 2max, where max is the returned value of GL_MAX_TEXTURE_SIZE .

    GL_INVALID_VALUE is generated if "xoffset" ~<~ ~-b, ("xoffset"~+~"width") ~>~ (w~-~b), "yoffset" ~<~ ~-b, or ("yoffset" ~+~ "height") ~>~ (h~-~b). Where w is the GL_TEXTURE_WIDTH , h is the GL_TEXTURE_HEIGHT , and b is the border width of the texture image being modified. Note that w and h include twice the border width.

    GL_INVALID_VALUE is generated if width or height is less than 0.

    GL_INVALID_ENUM is generated if format is not an accepted format constant.

    GL_INVALID_ENUM is generated if type is not a type constant.

    GL_INVALID_ENUM is generated if type is GL_BITMAP and format is not GL_COLOR_INDEX .

    GL_INVALID_OPERATION is generated if glTexSubImage2D is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glTranslate

    `void glTranslate(float|int|array(float|int) x, float|int|void y, float|int|void z)`

  Description

    glTranslate produces a translation by ("x","y","z"). The current matrix (see

    glMatrixMode ) is multiplied by this translation matrix, with the product replacing the current matrix, as if glMultMatrix were called with the following matrix for its argument: .sp .ce .EQ left ( ~ down 20 matrix { ccol { 1~~ above 0~~ above 0~~ above 0~~ } ccol { 0~~ above 1~~ above 0~~ above 0~~ } ccol { 0~~ above 0~~ above 1~~ above 0~~ } ccol { "x"~ above "y"~ above "z"~ above 1} } ~~right ) .EN .sp .RE If the matrix mode is either GL_MODELVIEW or GL_PROJECTION , all objects drawn after a call to glTranslate are translated.

    Use glPushMatrix and glPopMatrix to save and restore the untranslated coordinate system.

  Parameter `x`

    Specify the x, y, and z coordinates of a translation vector.

  Throws

    GL_INVALID_OPERATION is generated if glTranslate is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glVertex

    `void glVertex(float|int|array(float|int) x, float|int|void y, float|int|void z, float|int|void w)`

  Description

    glVertex commands are used within glBegin /glEnd pairs to specify point, line, and polygon vertices. The current color, normal, and texture coordinates are associated with the vertex when glVertex is called.

    When only x and y are specified, z defaults to 0 and w defaults to 1. When x, y, and z are specified, w defaults to 1.

  Parameter `x`

    Specify x, y, z, and w coordinates of a vertex. Not all parameters are present in all forms of the command.

  Parameter `v`

    Specifies a pointer to an array of two, three, or four elements. The elements of a two-element array are x and y; of a three-element array, x, y, and z; and of a four-element array, x, y, z, and w.

  Method glViewport

    `void glViewport(int x, int y, int width, int height)`

  Description

    glViewport specifies the affine transformation of x and y from normalized device coordinates to window coordinates. Let (x sub nd, y sub nd) be normalized device coordinates. Then the window coordinates (x sub w, y sub w) are computed as follows: .sp .ce .EQ x sub w ~=~ ( x sub nd + 1 ) left ( "width" over 2 right ) ~+~ "x" .EN .sp .ce .EQ y sub w ~=~ ( y sub nd + 1 ) left ( "height" over 2 right ) ~+~ "y" .EN .RE

    Viewport width and height are silently clamped to a range that depends on the implementation. To query this range, call glGet with argument GL_MAX_VIEWPORT_DIMS .

  Parameter `x`

    Specify the lower left corner of the viewport rectangle, in pixels. The initial value is (0,0).

  Parameter `width`

    Specify the width and height of the viewport. When a GL context is first attached to a window, width and height are set to the dimensions of that window.

  Throws

    GL_INVALID_VALUE is generated if either width or height is negative.

    GL_INVALID_OPERATION is generated if glViewport is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glEnd

    `void glEnd()`

  Description

    glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives. glBegin accepts a single argument that specifies in which of ten ways the vertices are interpreted. Taking n as an integer count starting at one, and N as the total number of vertices specified, the interpretations are as follows:

    GL_POINTS | Treats each vertex as a single point. Vertex n defines point n. N points are drawn.
    GL_LINES | Treats each pair of vertices as an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines are drawn.
    GL_LINE_STRIP | Draws a connected group of line segments from the first vertex to the last. Vertices n and n+1 define line n. N-1 lines are drawn.
    GL_LINE_LOOP | Draws a connected group of line segments from the first vertex to the last, then back to the first. Vertices n and n+1 define line n. The last line, however, is defined by vertices N and 1. N lines are drawn.
    GL_TRIANGLES | Treats each triplet of vertices as an independent triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are drawn.
    GL_TRIANGLE_STRIP | Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. For odd n, vertices n, n+1, and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define triangle n. N-2 triangles are drawn.
    GL_TRIANGLE_FAN | Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are drawn.
    GL_QUADS | Treats each group of four vertices as an independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define quadrilateral n. N/4 quadrilaterals are drawn.
    GL_QUAD_STRIP | Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair of vertices presented after the first pair. Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1 quadrilaterals are drawn. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data.
    GL_POLYGON | Draws a single, convex polygon. Vertices 1 through N define this polygon.

    Only a subset of GL commands can be used between glBegin and glEnd . The commands are glVertex , glColor , glIndex , glNormal , glTexCoord , glEvalCoord , glEvalPoint , glArrayElement , glMaterial , and glEdgeFlag . Also, it is acceptable to use glCallList or glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between glBegin and glEnd , the error flag is set and the command is ignored.

    Regardless of the value chosen for mode, there is no limit to the number of vertices that can be defined between glBegin and glEnd . Lines, triangles, quadrilaterals, and polygons that are incompletely specified are not drawn. Incomplete specification results when either too few vertices are provided to specify even a single primitive or when an incorrect multiple of vertices is specified. The incomplete primitive is ignored; the rest are drawn.

    The minimum specification of vertices for each primitive is as follows: 1 for a point, 2 for a line, 3 for a triangle, 4 for a quadrilateral, and 3 for a polygon. Modes that require a certain multiple of vertices are GL_LINES (2), GL_TRIANGLES (3), GL_QUADS (4), and GL_QUAD_STRIP (2).

  Parameter `mode`

    Specifies the primitive or primitives that will be created from vertices presented between glBegin and the subsequent glEnd . Ten symbolic constants are accepted: GL_POINTS , GL_LINES , GL_LINE_STRIP , GL_LINE_LOOP , GL_TRIANGLES , GL_TRIANGLE_STRIP , GL_TRIANGLE_FAN , GL_QUADS , GL_QUAD_STRIP , and GL_POLYGON .

  Throws

    GL_INVALID_ENUM is generated if mode is set to an unaccepted value.

    GL_INVALID_OPERATION is generated if glBegin is executed between a glBegin and the corresponding execution of glEnd .

    GL_INVALID_OPERATION is generated if glEnd is executed without being preceded by a glBegin .

    GL_INVALID_OPERATION is generated if a command other than glVertex , glColor , glIndex , glNormal , glTexCoord , glEvalCoord , glEvalPoint , glArrayElement , glMaterial , glEdgeFlag , glCallList , or glCallLists is executed between the execution of glBegin and the corresponding execution glEnd .

    Execution of glEnableClientState , glDisableClientState , glEdgeFlagPointer , glTexCoordPointer , glColorPointer , glIndexPointer , glNormalPointer ,

    glVertexPointer , glInterleavedArrays , or glPixelStore is not allowed after a call to glBegin and before the corresponding call to glEnd , but an error may or may not be generated.

  Method glEndList

    `void glEndList()`

  Description

    Display lists are groups of GL commands that have been stored for subsequent execution. Display lists are created with glNewList . All subsequent commands are placed in the display list, in the order issued, until glEndList is called.

    glNewList has two arguments. The first argument, list, is a positive integer that becomes the unique name for the display list. Names can be created and reserved with glGenLists and tested for uniqueness with glIsList . The second argument, mode, is a symbolic constant that can assume one of two values:

    GL_COMPILE | Commands are merely compiled.
    GL_COMPILE_AND_EXECUTE | Commands are executed as they are compiled into the display list.

    Certain commands are not compiled into the display list but are executed immediately, regardless of the display-list mode. These commands are glColorPointer , glDeleteLists , glDisableClientState , glEdgeFlagPointer , glEnableClientState , glFeedbackBuffer , glFinish , glFlush , glGenLists , glIndexPointer , glInterleavedArrays , glIsEnabled , glIsList , glNormalPointer , glPopClientAttrib , glPixelStore , glPushClientAttrib , glReadPixels , glRenderMode , glSelectBuffer , glTexCoordPointer , glVertexPointer , and all of the glGet commands.

    Similarly, glTexImage2D and glTexImage1D are executed immediately and not compiled into the display list when their first argument is GL_PROXY_TEXTURE_2D or GL_PROXY_TEXTURE_1D , respectively.

    When glEndList is encountered, the display-list definition is completed by associating the list with the unique name list (specified in the glNewList command). If a display list with name list already exists, it is replaced only when glEndList is called.

  Parameter `list`

    Specifies the display-list name.

  Parameter `mode`

    Specifies the compilation mode, which can be GL_COMPILE or GL_COMPILE_AND_EXECUTE .

  Throws

    GL_INVALID_VALUE is generated if list is 0.

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glEndList is called without a preceding glNewList , or if glNewList is called while a display list is being defined.

    GL_INVALID_OPERATION is generated if glNewList or glEndList is executed between the execution of glBegin and the corresponding execution of glEnd .

    GL_OUT_OF_MEMORY is generated if there is insufficient memory to compile the display list. If the GL version is 1.1 or greater, no change is made to the previous contents of the display list, if any, and no other change is made to the GL state. (It is as if no attempt had been made to create the new display list.)

  Method glFinish

    `void glFinish()`

  Description

    glFinish does not return until the effects of all previously called GL commands are complete. Such effects include all changes to GL state, all changes to connection state, and all changes to the frame buffer contents.

  Throws

    GL_INVALID_OPERATION is generated if glFinish is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glFlush

    `void glFlush()`

  Description

    Different GL implementations buffer commands in several different locations, including network buffers and the graphics accelerator itself. glFlush empties all of these buffers, causing all issued commands to be executed as quickly as they are accepted by the actual rendering engine. Though this execution may not be completed in any particular time period, it does complete in finite time.

    Because any GL program might be executed over a network, or on an accelerator that buffers commands, all programs should call glFlush whenever they count on having all of their previously issued commands completed. For example, call glFlush before waiting for user input that depends on the generated image.

  Throws

    GL_INVALID_OPERATION is generated if glFlush is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glInitNames

    `void glInitNames()`

  Description

    The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers. glInitNames causes the name stack to be initialized to its default empty state.

    The name stack is always empty while the render mode is not GL_SELECT . Calls to glInitNames while the render mode is not GL_SELECT are ignored.

  Throws

    GL_INVALID_OPERATION is generated if glInitNames is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLoadIdentity

    `void glLoadIdentity()`

  Description

    glLoadIdentity replaces the current matrix with the identity matrix. It is semantically equivalent to calling glLoadMatrix with the identity matrix

    .ce

    .EQ left ( down 20 { ~ matrix { ccol { 1 above 0 above 0 above 0~ } ccol { 0 above 1 above 0 above 0~ } ccol { 0 above 0 above 1 above 0~ } ccol { 0 above 0 above 0 above 1 } } } ~~ right ) .EN

    but in some cases it is more efficient.

  Throws

    GL_INVALID_OPERATION is generated if glLoadIdentity is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPopAttrib

    `void glPopAttrib()`

  Description

    glPushAttrib takes one argument, a mask that indicates which groups of state variables to save on the attribute stack. Symbolic constants are used to set bits in the mask. mask is typically constructed by ORing several of these constants together. The special mask GL_ALL_ATTRIB_BITS can be used to save all stackable states.

    The symbolic mask constants and their associated GL state are as follows (the second column lists which attributes are saved):

    .TS ; l l . GL_ACCUM_BUFFER_BIT Accumulation buffer clear value

    GL_COLOR_BUFFER_BIT GL_ALPHA_TEST enable bit Alpha test function and reference value GL_BLEND enable bit Blending source and destination functions Constant blend color Blending equation GL_DITHER enable bit GL_DRAW_BUFFER setting GL_COLOR_LOGIC_OP enable bit GL_INDEX_LOGIC_OP enable bit Logic op function Color mode and index mode clear values Color mode and index mode writemasks

    GL_CURRENT_BIT Current RGBA color Current color index Current normal vector Current texture coordinates Current raster position GL_CURRENT_RASTER_POSITION_VALID flag RGBA color associated with current raster position Color index associated with current raster position Texture coordinates associated with current raster position GL_EDGE_FLAG flag

    GL_DEPTH_BUFFER_BIT GL_DEPTH_TEST enable bit Depth buffer test function Depth buffer clear value GL_DEPTH_WRITEMASK enable bit

    GL_ENABLE_BIT GL_ALPHA_TEST flag GL_AUTO_NORMAL flag GL_BLEND flag Enable bits for the user-definable clipping planes GL_COLOR_MATERIAL GL_CULL_FACE flag GL_DEPTH_TEST flag GL_DITHER flag GL_FOG flag GL_LIGHT i where 0\ <= i<GL_MAX_LIGHTS GL_LIGHTING flag GL_LINE_SMOOTH flag GL_LINE_STIPPLE flag GL_COLOR_LOGIC_OP flag GL_INDEX_LOGIC_OP flag GL_MAP1_ x where x is a map type GL_MAP2_ x where x is a map type GL_NORMALIZE flag GL_POINT_SMOOTH flag GL_POLYGON_OFFSET_LINE flag GL_POLYGON_OFFSET_FILL flag GL_POLYGON_OFFSET_POINT flag GL_POLYGON_SMOOTH flag GL_POLYGON_STIPPLE flag GL_SCISSOR_TEST flag GL_STENCIL_TEST flag GL_TEXTURE_1D flag GL_TEXTURE_2D flag Flags GL_TEXTURE_GEN_ x where x is S, T, R, or Q

    GL_EVAL_BIT GL_MAP1_ x enable bits, where x is a map type GL_MAP2_ x enable bits, where x is a map type 1D grid endpoints and divisions 2D grid endpoints and divisions GL_AUTO_NORMAL enable bit

    GL_FOG_BIT GL_FOG enable bit Fog color Fog density Linear fog start Linear fog end Fog index GL_FOG_MODE value

    GL_HINT_BIT GL_PERSPECTIVE_CORRECTION_HINT setting GL_POINT_SMOOTH_HINT setting GL_LINE_SMOOTH_HINT setting GL_POLYGON_SMOOTH_HINT setting GL_FOG_HINT setting

    GL_LIGHTING_BIT GL_COLOR_MATERIAL enable bit GL_COLOR_MATERIAL_FACE value Color material parameters that are tracking the current color Ambient scene color GL_LIGHT_MODEL_LOCAL_VIEWER value GL_LIGHT_MODEL_TWO_SIDE setting GL_LIGHTING enable bit Enable bit for each light Ambient, diffuse, and specular intensity for each light Direction, position, exponent, and cutoff angle for each light Constant, linear, and quadratic attenuation factors for each light Ambient, diffuse, specular, and emissive color for each material Ambient, diffuse, and specular color indices for each material Specular exponent for each material GL_SHADE_MODEL setting

    GL_LINE_BIT GL_LINE_SMOOTH flag GL_LINE_STIPPLE enable bit Line stipple pattern and repeat counter Line width

    GL_LIST_BIT GL_LIST_BASE setting

    GL_PIXEL_MODE_BIT GL_RED_BIAS and GL_RED_SCALE settings GL_GREEN_BIAS and GL_GREEN_SCALE values GL_BLUE_BIAS and GL_BLUE_SCALE GL_ALPHA_BIAS and GL_ALPHA_SCALE GL_DEPTH_BIAS and GL_DEPTH_SCALE GL_INDEX_OFFSET and GL_INDEX_SHIFT values GL_MAP_COLOR and GL_MAP_STENCIL flags GL_ZOOM_X and GL_ZOOM_Y factors GL_READ_BUFFER setting

    GL_POINT_BIT GL_POINT_SMOOTH flag Point size

    GL_POLYGON_BIT GL_CULL_FACE enable bit GL_CULL_FACE_MODE value GL_FRONT_FACE indicator GL_POLYGON_MODE setting GL_POLYGON_SMOOTH flag GL_POLYGON_STIPPLE enable bit GL_POLYGON_OFFSET_FILL flag GL_POLYGON_OFFSET_LINE flag GL_POLYGON_OFFSET_POINT flag GL_POLYGON_OFFSET_FACTOR GL_POLYGON_OFFSET_UNITS

    GL_POLYGON_STIPPLE_BIT Polygon stipple image

    GL_SCISSOR_BIT GL_SCISSOR_TEST flag Scissor box

    GL_STENCIL_BUFFER_BIT GL_STENCIL_TEST enable bit Stencil function and reference value Stencil value mask Stencil fail, pass, and depth buffer pass actions Stencil buffer clear value Stencil buffer writemask

    GL_TEXTURE_BIT Enable bits for the four texture coordinates Border color for each texture image Minification function for each texture image Magnification function for each texture image Texture coordinates and wrap mode for each texture image Color and mode for each texture environment Enable bits GL_TEXTURE_GEN_ x, x is S, T, R, and Q GL_TEXTURE_GEN_MODE setting for S, T, R, and Q glTexGen plane equations for S, T, R, and Q Current texture bindings (for example, GL_TEXTURE_2D_BINDING )

    GL_TRANSFORM_BIT Coefficients of the six clipping planes Enable bits for the user-definable clipping planes GL_MATRIX_MODE value GL_NORMALIZE flag

    GL_VIEWPORT_BIT Depth range (near and far) Viewport origin and extent .TE

    glPopAttrib restores the values of the state variables saved with the last

    glPushAttrib command. Those not saved are left unchanged.

    It is an error to push attributes onto a full stack, or to pop attributes off an empty stack. In either case, the error flag is set and no other change is made to GL state.

    Initially, the attribute stack is empty.

  Parameter `mask`

    Specifies a mask that indicates which attributes to save. Values for mask are listed below.

  Throws

    GL_STACK_OVERFLOW is generated if glPushAttrib is called while the attribute stack is full.

    GL_STACK_UNDERFLOW is generated if glPopAttrib is called while the attribute stack is empty.

    GL_INVALID_OPERATION is generated if glPushAttrib or glPopAttrib is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPopClientAttrib

    `void glPopClientAttrib()`

  Description

    glPushClientAttrib takes one argument, a mask that indicates which groups of client-state variables to save on the client attribute stack. Symbolic constants are used to set bits in the mask. mask is typically constructed by OR'ing several of these constants together. The special mask GL_CLIENT_ALL_ATTRIB_BITS can be used to save all stackable client state.

    The symbolic mask constants and their associated GL client state are as follows (the second column lists which attributes are saved):

    GL_CLIENT_PIXEL_STORE_BIT Pixel storage modes

    GL_CLIENT_VERTEX_ARRAY_BIT Vertex arrays (and enables)

    glPopClientAttrib restores the values of the client-state variables saved with the last glPushClientAttrib . Those not saved are left unchanged.

    It is an error to push attributes onto a full client attribute stack, or to pop attributes off an empty stack. In either case, the error flag is set, and no other change is made to GL state.

    Initially, the client attribute stack is empty.

  Parameter `mask`

    Specifies a mask that indicates which attributes to save. Values for mask are listed below.

  Throws

    GL_STACK_OVERFLOW is generated if glPushClientAttrib is called while the attribute stack is full.

    GL_STACK_UNDERFLOW is generated if glPopClientAttrib is called while the attribute stack is empty.

  Method glPopMatrix

    `void glPopMatrix()`

  Description

    There is a stack of matrices for each of the matrix modes. In GL_MODELVIEW mode, the stack depth is at least 32. In the other two modes, GL_PROJECTION and GL_TEXTURE , the depth is at least 2. The current matrix in any mode is the matrix on the top of the stack for that mode.

    glPushMatrix pushes the current matrix stack down by one, duplicating the current matrix. That is, after a glPushMatrix call, the matrix on top of the stack is identical to the one below it.

    glPopMatrix pops the current matrix stack, replacing the current matrix with the one below it on the stack.

    Initially, each of the stacks contains one matrix, an identity matrix.

    It is an error to push a full matrix stack, or to pop a matrix stack that contains only a single matrix. In either case, the error flag is set and no other change is made to GL state.

  Throws

    GL_STACK_OVERFLOW is generated if glPushMatrix is called while the current matrix stack is full.

    GL_STACK_UNDERFLOW is generated if glPopMatrix is called while the current matrix stack contains only a single matrix.

    GL_INVALID_OPERATION is generated if glPushMatrix or glPopMatrix is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glPopName

    `void glPopName()`

  Description

    The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers and is initially empty.

    glPushName causes name to be pushed onto the name stack. glPopName pops one name off the top of the stack.

    The maximum name stack depth is implementation-dependent; call GL_MAX_NAME_STACK_DEPTH to find out the value for a particular implementation. It is an error to push a name onto a full stack, or to pop a name off an empty stack. It is also an error to manipulate the name stack between the execution of glBegin and the corresponding execution of glEnd . In any of these cases, the error flag is set and no other change is made to GL state.

    The name stack is always empty while the render mode is not GL_SELECT . Calls to glPushName or glPopName while the render mode is not GL_SELECT are ignored.

  Parameter `name`

    Specifies a name that will be pushed onto the name stack.

  Throws

    GL_STACK_OVERFLOW is generated if glPushName is called while the name stack is full.

    GL_STACK_UNDERFLOW is generated if glPopName is called while the name stack is empty.

    GL_INVALID_OPERATION is generated if glPushName or glPopName is executed between a call to glBegin and the corresponding call to glEnd .

  Method glPushMatrix

    `void glPushMatrix()`

  Description

    There is a stack of matrices for each of the matrix modes. In GL_MODELVIEW mode, the stack depth is at least 32. In the other two modes, GL_PROJECTION and GL_TEXTURE , the depth is at least 2. The current matrix in any mode is the matrix on the top of the stack for that mode.

    glPushMatrix pushes the current matrix stack down by one, duplicating the current matrix. That is, after a glPushMatrix call, the matrix on top of the stack is identical to the one below it.

    glPopMatrix pops the current matrix stack, replacing the current matrix with the one below it on the stack.

    Initially, each of the stacks contains one matrix, an identity matrix.

    It is an error to push a full matrix stack, or to pop a matrix stack that contains only a single matrix. In either case, the error flag is set and no other change is made to GL state.

  Throws

    GL_STACK_OVERFLOW is generated if glPushMatrix is called while the current matrix stack is full.

    GL_STACK_UNDERFLOW is generated if glPopMatrix is called while the current matrix stack contains only a single matrix.

    GL_INVALID_OPERATION is generated if glPushMatrix or glPopMatrix is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glBegin

    `void glBegin(int mode)`

  Description

    glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives. glBegin accepts a single argument that specifies in which of ten ways the vertices are interpreted. Taking n as an integer count starting at one, and N as the total number of vertices specified, the interpretations are as follows:

    GL_POINTS | Treats each vertex as a single point. Vertex n defines point n. N points are drawn.
    GL_LINES | Treats each pair of vertices as an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines are drawn.
    GL_LINE_STRIP | Draws a connected group of line segments from the first vertex to the last. Vertices n and n+1 define line n. N-1 lines are drawn.
    GL_LINE_LOOP | Draws a connected group of line segments from the first vertex to the last, then back to the first. Vertices n and n+1 define line n. The last line, however, is defined by vertices N and 1. N lines are drawn.
    GL_TRIANGLES | Treats each triplet of vertices as an independent triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are drawn.
    GL_TRIANGLE_STRIP | Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. For odd n, vertices n, n+1, and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define triangle n. N-2 triangles are drawn.
    GL_TRIANGLE_FAN | Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are drawn.
    GL_QUADS | Treats each group of four vertices as an independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define quadrilateral n. N/4 quadrilaterals are drawn.
    GL_QUAD_STRIP | Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair of vertices presented after the first pair. Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1 quadrilaterals are drawn. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data.
    GL_POLYGON | Draws a single, convex polygon. Vertices 1 through N define this polygon.

    Only a subset of GL commands can be used between glBegin and glEnd . The commands are glVertex , glColor , glIndex , glNormal , glTexCoord , glEvalCoord , glEvalPoint , glArrayElement , glMaterial , and glEdgeFlag . Also, it is acceptable to use glCallList or glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between glBegin and glEnd , the error flag is set and the command is ignored.

    Regardless of the value chosen for mode, there is no limit to the number of vertices that can be defined between glBegin and glEnd . Lines, triangles, quadrilaterals, and polygons that are incompletely specified are not drawn. Incomplete specification results when either too few vertices are provided to specify even a single primitive or when an incorrect multiple of vertices is specified. The incomplete primitive is ignored; the rest are drawn.

    The minimum specification of vertices for each primitive is as follows: 1 for a point, 2 for a line, 3 for a triangle, 4 for a quadrilateral, and 3 for a polygon. Modes that require a certain multiple of vertices are GL_LINES (2), GL_TRIANGLES (3), GL_QUADS (4), and GL_QUAD_STRIP (2).

  Parameter `mode`

    Specifies the primitive or primitives that will be created from vertices presented between glBegin and the subsequent glEnd . Ten symbolic constants are accepted: GL_POINTS , GL_LINES , GL_LINE_STRIP , GL_LINE_LOOP , GL_TRIANGLES , GL_TRIANGLE_STRIP , GL_TRIANGLE_FAN , GL_QUADS , GL_QUAD_STRIP , and GL_POLYGON .

  Throws

    GL_INVALID_ENUM is generated if mode is set to an unaccepted value.

    GL_INVALID_OPERATION is generated if glBegin is executed between a glBegin and the corresponding execution of glEnd .

    GL_INVALID_OPERATION is generated if glEnd is executed without being preceded by a glBegin .

    GL_INVALID_OPERATION is generated if a command other than glVertex , glColor , glIndex , glNormal , glTexCoord , glEvalCoord , glEvalPoint , glArrayElement , glMaterial , glEdgeFlag , glCallList , or glCallLists is executed between the execution of glBegin and the corresponding execution glEnd .

    Execution of glEnableClientState , glDisableClientState , glEdgeFlagPointer , glTexCoordPointer , glColorPointer , glIndexPointer , glNormalPointer ,

    glVertexPointer , glInterleavedArrays , or glPixelStore is not allowed after a call to glBegin and before the corresponding call to glEnd , but an error may or may not be generated.

  Method glCullFace

    `void glCullFace(int mode)`

  Description

    glCullFace specifies whether front- or back-facing facets are culled (as specified by mode) when facet culling is enabled. Facet culling is initially disabled. To enable and disable facet culling, call the glEnable and glDisable commands with the argument GL_CULL_FACE . Facets include triangles, quadrilaterals, polygons, and rectangles.

    glFrontFace specifies which of the clockwise and counterclockwise facets are front-facing and back-facing. See glFrontFace .

  Parameter `mode`

    Specifies whether front- or back-facing facets are candidates for culling. Symbolic constants GL_FRONT , GL_BACK , and GL_FRONT_AND_BACK are accepted. The initial value is GL_BACK .

  Throws

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glCullFace is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDepthFunc

    `void glDepthFunc(int func)`

  Description

    glDepthFunc specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer. The comparison is performed only if depth testing is enabled. (See glEnable and glDisable of GL_DEPTH_TEST .)

    func specifies the conditions under which the pixel will be drawn. The comparison functions are as follows:

    GL_NEVER | Never passes.
    GL_LESS | Passes if the incoming depth value is less than the stored depth value.
    GL_EQUAL | Passes if the incoming depth value is equal to the stored depth value.
    GL_LEQUAL | Passes if the incoming depth value is less than or equal to the stored depth value.
    GL_GREATER | Passes if the incoming depth value is greater than the stored depth value.
    GL_NOTEQUAL | Passes if the incoming depth value is not equal to the stored depth value.
    GL_GEQUAL | Passes if the incoming depth value is greater than or equal to the stored depth value.
    GL_ALWAYS | Always passes.

    The initial value of func is GL_LESS . Initially, depth testing is disabled. .NOTES Even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled.

  Parameter `func`

    Specifies the depth comparison function. Symbolic constants GL_NEVER , GL_LESS , GL_EQUAL , GL_LEQUAL , GL_GREATER , GL_NOTEQUAL , GL_GEQUAL , and GL_ALWAYS are accepted. The initial value is GL_LESS .

  Throws

    GL_INVALID_ENUM is generated if func is not an accepted value.

    GL_INVALID_OPERATION is generated if glDepthFunc is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDisable

    `void glDisable(int cap)`

  Description

    glEnable and glDisable enable and disable various capabilities. Use glIsEnabled or glGet to determine the current setting of any capability. The initial value for each capability with the exception of GL_DITHER is GL_FALSE . The initial value for GL_DITHER is GL_TRUE .

    Both glEnable and glDisable take a single argument, cap, which can assume one of the following values:

    GL_ALPHA_TEST | If enabled, do alpha testing. See glAlphaFunc .
    GL_AUTO_NORMAL | If enabled, generate normal vectors when either GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4 is used to generate vertices. See glMap2 .
    GL_BLEND | If enabled, blend the incoming RGBA color values with the values in the color buffers. See glBlendFunc .
    GL_CLIP_PLANE i | If enabled, clip geometry against user-defined clipping plane i. See glClipPlane .
    GL_COLOR_LOGIC_OP | If enabled, apply the currently selected logical operation to the incoming RGBA color and color buffer values. See glLogicOp .
    GL_COLOR_MATERIAL | If enabled, have one or more material parameters track the current color. See glColorMaterial .
    GL_CULL_FACE | If enabled, cull polygons based on their winding in window coordinates. See glCullFace .
    GL_DEPTH_TEST | If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRange .
    GL_DITHER | If enabled, dither color components or indices before they are written to the color buffer.
    GL_FOG | If enabled, blend a fog color into the posttexturing color. See glFog .
    GL_INDEX_LOGIC_OP | If enabled, apply the currently selected logical operation to the incoming index and color buffer indices. See glLogicOp .
    GL_LIGHT i | If enabled, include light i in the evaluation of the lighting equation. See glLightModel and glLight .
    GL_LIGHTING | If enabled, use the current lighting parameters to compute the vertex color or index. Otherwise, simply associate the current color or index with each vertex. See glMaterial , glLightModel , and glLight .
    GL_LINE_SMOOTH | If enabled, draw lines with correct filtering. Otherwise, draw aliased lines. See glLineWidth .
    GL_LINE_STIPPLE | If enabled, use the current line stipple pattern when drawing lines. See glLineStipple .
    GL_MAP1_COLOR_4 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate RGBA values. See glMap1 .
    GL_MAP1_INDEX | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate color indices. See glMap1 .
    GL_MAP1_NORMAL | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate normals. See glMap1 .
    GL_MAP1_TEXTURE_COORD_1 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s texture coordinates. See glMap1 .
    GL_MAP1_TEXTURE_COORD_2 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s and t texture coordinates. See glMap1 .
    GL_MAP1_TEXTURE_COORD_3 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s, t, and r texture coordinates. See glMap1 .
    GL_MAP1_TEXTURE_COORD_4 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s, t, r, and q texture coordinates. See glMap1 .
    GL_MAP1_VERTEX_3 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate x, y, and z vertex coordinates. See glMap1 .
    GL_MAP1_VERTEX_4 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate homogeneous x, y, z, and w vertex coordinates. See glMap1 .
    GL_MAP2_COLOR_4 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate RGBA values. See glMap2 .
    GL_MAP2_INDEX | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate color indices. See glMap2 .
    GL_MAP2_NORMAL | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate normals. See glMap2 .
    GL_MAP2_TEXTURE_COORD_1 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s texture coordinates. See glMap2 .
    GL_MAP2_TEXTURE_COORD_2 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s and t texture coordinates. See glMap2 .
    GL_MAP2_TEXTURE_COORD_3 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s, t, and r texture coordinates. See glMap2 .
    GL_MAP2_TEXTURE_COORD_4 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s, t, r, and q texture coordinates. See glMap2 .
    GL_MAP2_VERTEX_3 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate x, y, and z vertex coordinates. See glMap2 .
    GL_MAP2_VERTEX_4 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate homogeneous x, y, z, and w vertex coordinates. See glMap2 .
    GL_NORMALIZE | If enabled, normal vectors specified with glNormal are scaled to unit length after transformation. See glNormal .
    GL_POINT_SMOOTH | If enabled, draw points with proper filtering. Otherwise, draw aliased points. See glPointSize .
    GL_POLYGON_OFFSET_FILL | If enabled, and if the polygon is rendered in GL_FILL mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset .
    GL_POLYGON_OFFSET_LINE | If enabled, and if the polygon is rendered in GL_LINE mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset .
    GL_POLYGON_OFFSET_POINT | If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed, if the polygon is rendered in GL_POINT mode. See glPolygonOffset .
    GL_POLYGON_SMOOTH | If enabled, draw polygons with proper filtering. Otherwise, draw aliased polygons. For correct anti-aliased polygons, an alpha buffer is needed and the polygons must be sorted front to back.
    GL_POLYGON_STIPPLE | If enabled, use the current polygon stipple pattern when rendering polygons. See glPolygonStipple .
    GL_SCISSOR_TEST | If enabled, discard fragments that are outside the scissor rectangle. See glScissor .
    GL_STENCIL_TEST | If enabled, do stencil testing and update the stencil buffer. See glStencilFunc and glStencilOp .
    GL_TEXTURE_1D | If enabled, one-dimensional texturing is performed (unless two-dimensional texturing is also enabled). See glTexImage1D .
    GL_TEXTURE_2D | If enabled, two-dimensional texturing is performed. See glTexImage2D .
    GL_TEXTURE_GEN_Q | If enabled, the q texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current q texture coordinate is used. See glTexGen .
    GL_TEXTURE_GEN_R | If enabled, the r texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current r texture coordinate is used. See glTexGen .
    GL_TEXTURE_GEN_S | If enabled, the s texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current s texture coordinate is used. See glTexGen .
    GL_TEXTURE_GEN_T | If enabled, the t texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current t texture coordinate is used. See glTexGen .

  Parameter `cap`

    Specifies a symbolic constant indicating a GL capability.

  Parameter `cap`

    Specifies a symbolic constant indicating a GL capability.

  Throws

    GL_INVALID_ENUM is generated if cap is not one of the values listed previously.

    GL_INVALID_OPERATION is generated if glEnable or glDisable is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glDisableClientState

    `void glDisableClientState(int cap)`

  Description

    glEnableClientState and glDisableClientState enable or disable individual client-side capabilities. By default, all client-side capabilities are disabled. Both glEnableClientState and glDisableClientState take a single argument, cap, which can assume one of the following values:

    GL_COLOR_ARRAY | If enabled, the color array is enabled for writing and used during rendering when glDrawArrays or glDrawElement is called. See glColorPointer .
    GL_EDGE_FLAG_ARRAY | If enabled, the edge flag array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glEdgeFlagPointer .
    GL_INDEX_ARRAY | If enabled, the index array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glIndexPointer .
    GL_NORMAL_ARRAY | If enabled, the normal array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glNormalPointer .
    GL_TEXTURE_COORD_ARRAY | If enabled, the texture coordinate array is enabled for writing and used for rendering when glDrawArrays or glDrawElements is called. See glTexCoordPointer .
    GL_VERTEX_ARRAY | If enabled, the vertex array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glVertexPointer .

  Parameter `cap`

    Specifies the capability to enable. Symbolic constants GL_COLOR_ARRAY , GL_EDGE_FLAG_ARRAY , GL_INDEX_ARRAY , GL_NORMAL_ARRAY , GL_TEXTURE_COORD_ARRAY , and GL_VERTEX_ARRAY are accepted.

  Parameter `cap`

    Specifies the capability to disable.

  Throws

    GL_INVALID_ENUM is generated if cap is not an accepted value.

    glEnableClientState is not allowed between the execution of glBegin and the corresponding glEnd , but an error may or may not be generated. If no error is generated, the behavior is undefined.

  Method glDrawBuffer

    `void glDrawBuffer(int mode)`

  Description

    When colors are written to the frame buffer, they are written into the color buffers specified by glDrawBuffer . The specifications are as follows:

    GL_NONE | No color buffers are written.
    GL_FRONT_LEFT | Only the front left color buffer is written.
    GL_FRONT_RIGHT | Only the front right color buffer is written.
    GL_BACK_LEFT | Only the back left color buffer is written.
    GL_BACK_RIGHT | Only the back right color buffer is written.
    GL_FRONT | Only the front left and front right color buffers are written. If there is no front right color buffer, only the front left color buffer is written.
    GL_BACK | Only the back left and back right color buffers are written. If there is no back right color buffer, only the back left color buffer is written.
    GL_LEFT | Only the front left and back left color buffers are written. If there is no back left color buffer, only the front left color buffer is written.
    GL_RIGHT | Only the front right and back right color buffers are written. If there is no back right color buffer, only the front right color buffer is written.

    GL_FRONT_AND_BACK

    All the front and back color buffers (front left, front right, back left, back right) are written. If there are no back color buffers, only the front left and front right color buffers are written. If there are no right color buffers, only the front left and back left color buffers are written. If there are no right or back color buffers, only the front left color buffer is written.

    GL_AUXi | Only auxiliary color buffer i is written.

    If more than one color buffer is selected for drawing, then blending or logical operations are computed and applied independently for each color buffer and can produce different results in each buffer.

    Monoscopic contexts include only .I left buffers, and stereoscopic contexts include both .I left and .I right buffers. Likewise, single-buffered contexts include only .I front buffers, and double-buffered contexts include both .I front and .I back buffers. The context is selected at GL initialization.

  Parameter `mode`

    Specifies up to four color buffers to be drawn into. Symbolic constants GL_NONE , GL_FRONT_LEFT , GL_FRONT_RIGHT , GL_BACK_LEFT , GL_BACK_RIGHT , GL_FRONT , GL_BACK , GL_LEFT , GL_RIGHT , GL_FRONT_AND_BACK , and GL_AUXi, where i is between 0 and ``GL_AUX_BUFFERS '' -1, are accepted (GL_AUX_BUFFERS is not the upper limit; use glGet to query the number of available aux buffers.) The initial value is GL_FRONT for single-buffered contexts, and GL_BACK for double-buffered contexts.

  Throws

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_OPERATION is generated if none of the buffers indicated by mode exists.

    GL_INVALID_OPERATION is generated if glDrawBuffer is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glEnable

    `void glEnable(int cap)`

  Description

    glEnable and glDisable enable and disable various capabilities. Use glIsEnabled or glGet to determine the current setting of any capability. The initial value for each capability with the exception of GL_DITHER is GL_FALSE . The initial value for GL_DITHER is GL_TRUE .

    Both glEnable and glDisable take a single argument, cap, which can assume one of the following values:

    GL_ALPHA_TEST | If enabled, do alpha testing. See glAlphaFunc .
    GL_AUTO_NORMAL | If enabled, generate normal vectors when either GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4 is used to generate vertices. See glMap2 .
    GL_BLEND | If enabled, blend the incoming RGBA color values with the values in the color buffers. See glBlendFunc .
    GL_CLIP_PLANE i | If enabled, clip geometry against user-defined clipping plane i. See glClipPlane .
    GL_COLOR_LOGIC_OP | If enabled, apply the currently selected logical operation to the incoming RGBA color and color buffer values. See glLogicOp .
    GL_COLOR_MATERIAL | If enabled, have one or more material parameters track the current color. See glColorMaterial .
    GL_CULL_FACE | If enabled, cull polygons based on their winding in window coordinates. See glCullFace .
    GL_DEPTH_TEST | If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRange .
    GL_DITHER | If enabled, dither color components or indices before they are written to the color buffer.
    GL_FOG | If enabled, blend a fog color into the posttexturing color. See glFog .
    GL_INDEX_LOGIC_OP | If enabled, apply the currently selected logical operation to the incoming index and color buffer indices. See glLogicOp .
    GL_LIGHT i | If enabled, include light i in the evaluation of the lighting equation. See glLightModel and glLight .
    GL_LIGHTING | If enabled, use the current lighting parameters to compute the vertex color or index. Otherwise, simply associate the current color or index with each vertex. See glMaterial , glLightModel , and glLight .
    GL_LINE_SMOOTH | If enabled, draw lines with correct filtering. Otherwise, draw aliased lines. See glLineWidth .
    GL_LINE_STIPPLE | If enabled, use the current line stipple pattern when drawing lines. See glLineStipple .
    GL_MAP1_COLOR_4 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate RGBA values. See glMap1 .
    GL_MAP1_INDEX | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate color indices. See glMap1 .
    GL_MAP1_NORMAL | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate normals. See glMap1 .
    GL_MAP1_TEXTURE_COORD_1 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s texture coordinates. See glMap1 .
    GL_MAP1_TEXTURE_COORD_2 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s and t texture coordinates. See glMap1 .
    GL_MAP1_TEXTURE_COORD_3 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s, t, and r texture coordinates. See glMap1 .
    GL_MAP1_TEXTURE_COORD_4 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate s, t, r, and q texture coordinates. See glMap1 .
    GL_MAP1_VERTEX_3 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate x, y, and z vertex coordinates. See glMap1 .
    GL_MAP1_VERTEX_4 | If enabled, calls to glEvalCoord , glEvalMesh1 , and glEvalPoint generate homogeneous x, y, z, and w vertex coordinates. See glMap1 .
    GL_MAP2_COLOR_4 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate RGBA values. See glMap2 .
    GL_MAP2_INDEX | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate color indices. See glMap2 .
    GL_MAP2_NORMAL | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate normals. See glMap2 .
    GL_MAP2_TEXTURE_COORD_1 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s texture coordinates. See glMap2 .
    GL_MAP2_TEXTURE_COORD_2 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s and t texture coordinates. See glMap2 .
    GL_MAP2_TEXTURE_COORD_3 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s, t, and r texture coordinates. See glMap2 .
    GL_MAP2_TEXTURE_COORD_4 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate s, t, r, and q texture coordinates. See glMap2 .
    GL_MAP2_VERTEX_3 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate x, y, and z vertex coordinates. See glMap2 .
    GL_MAP2_VERTEX_4 | If enabled, calls to glEvalCoord , glEvalMesh2 , and glEvalPoint generate homogeneous x, y, z, and w vertex coordinates. See glMap2 .
    GL_NORMALIZE | If enabled, normal vectors specified with glNormal are scaled to unit length after transformation. See glNormal .
    GL_POINT_SMOOTH | If enabled, draw points with proper filtering. Otherwise, draw aliased points. See glPointSize .
    GL_POLYGON_OFFSET_FILL | If enabled, and if the polygon is rendered in GL_FILL mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset .
    GL_POLYGON_OFFSET_LINE | If enabled, and if the polygon is rendered in GL_LINE mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset .
    GL_POLYGON_OFFSET_POINT | If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed, if the polygon is rendered in GL_POINT mode. See glPolygonOffset .
    GL_POLYGON_SMOOTH | If enabled, draw polygons with proper filtering. Otherwise, draw aliased polygons. For correct anti-aliased polygons, an alpha buffer is needed and the polygons must be sorted front to back.
    GL_POLYGON_STIPPLE | If enabled, use the current polygon stipple pattern when rendering polygons. See glPolygonStipple .
    GL_SCISSOR_TEST | If enabled, discard fragments that are outside the scissor rectangle. See glScissor .
    GL_STENCIL_TEST | If enabled, do stencil testing and update the stencil buffer. See glStencilFunc and glStencilOp .
    GL_TEXTURE_1D | If enabled, one-dimensional texturing is performed (unless two-dimensional texturing is also enabled). See glTexImage1D .
    GL_TEXTURE_2D | If enabled, two-dimensional texturing is performed. See glTexImage2D .
    GL_TEXTURE_GEN_Q | If enabled, the q texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current q texture coordinate is used. See glTexGen .
    GL_TEXTURE_GEN_R | If enabled, the r texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current r texture coordinate is used. See glTexGen .
    GL_TEXTURE_GEN_S | If enabled, the s texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current s texture coordinate is used. See glTexGen .
    GL_TEXTURE_GEN_T | If enabled, the t texture coordinate is computed using the texture generation function defined with glTexGen . Otherwise, the current t texture coordinate is used. See glTexGen .

  Parameter `cap`

    Specifies a symbolic constant indicating a GL capability.

  Parameter `cap`

    Specifies a symbolic constant indicating a GL capability.

  Throws

    GL_INVALID_ENUM is generated if cap is not one of the values listed previously.

    GL_INVALID_OPERATION is generated if glEnable or glDisable is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glEnableClientState

    `void glEnableClientState(int cap)`

  Description

    glEnableClientState and glDisableClientState enable or disable individual client-side capabilities. By default, all client-side capabilities are disabled. Both glEnableClientState and glDisableClientState take a single argument, cap, which can assume one of the following values:

    GL_COLOR_ARRAY | If enabled, the color array is enabled for writing and used during rendering when glDrawArrays or glDrawElement is called. See glColorPointer .
    GL_EDGE_FLAG_ARRAY | If enabled, the edge flag array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glEdgeFlagPointer .
    GL_INDEX_ARRAY | If enabled, the index array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glIndexPointer .
    GL_NORMAL_ARRAY | If enabled, the normal array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glNormalPointer .
    GL_TEXTURE_COORD_ARRAY | If enabled, the texture coordinate array is enabled for writing and used for rendering when glDrawArrays or glDrawElements is called. See glTexCoordPointer .
    GL_VERTEX_ARRAY | If enabled, the vertex array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glVertexPointer .

  Parameter `cap`

    Specifies the capability to enable. Symbolic constants GL_COLOR_ARRAY , GL_EDGE_FLAG_ARRAY , GL_INDEX_ARRAY , GL_NORMAL_ARRAY , GL_TEXTURE_COORD_ARRAY , and GL_VERTEX_ARRAY are accepted.

  Parameter `cap`

    Specifies the capability to disable.

  Throws

    GL_INVALID_ENUM is generated if cap is not an accepted value.

    glEnableClientState is not allowed between the execution of glBegin and the corresponding glEnd , but an error may or may not be generated. If no error is generated, the behavior is undefined.

  Method glFrontFace

    `void glFrontFace(int mode)`

  Description

    In a scene composed entirely of opaque closed surfaces, back-facing polygons are never visible. Eliminating these invisible polygons has the obvious benefit of speeding up the rendering of the image. To enable and disable elimination of back-facing polygons, call glEnable and glDisable with argument GL_CULL_FACE .

    The projection of a polygon to window coordinates is said to have clockwise winding if an imaginary object following the path from its first vertex, its second vertex, and so on, to its last vertex, and finally back to its first vertex, moves in a clockwise direction about the interior of the polygon. The polygon's winding is said to be counterclockwise if the imaginary object following the same path moves in a counterclockwise direction about the interior of the polygon. glFrontFace specifies whether polygons with clockwise winding in window coordinates, or counterclockwise winding in window coordinates, are taken to be front-facing. Passing GL_CCW to mode selects counterclockwise polygons as front-facing; GL_CW selects clockwise polygons as front-facing. By default, counterclockwise polygons are taken to be front-facing.

  Parameter `mode`

    Specifies the orientation of front-facing polygons. GL_CW and GL_CCW are accepted. The initial value is GL_CCW .

  Throws

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glFrontFace is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glLogicOp

    `void glLogicOp(int opcode)`

  Description

    glLogicOp specifies a logical operation that, when enabled, is applied between the incoming color index or RGBA color and the color index or RGBA color at the corresponding location in the frame buffer. To enable or disable the logical operation, call glEnable and glDisable using the symbolic constant GL_COLOR_LOGIC_OP for RGBA mode or GL_INDEX_LOGIC_OP for color index mode. The initial value is disabled for both operations.

    .ne .TS center box ; ci | ci c | c . opcode resulting value = GL_CLEAR 0 GL_SET 1 GL_COPY s GL_COPY_INVERTED ~s GL_NOOP d GL_INVERT ~d GL_AND s & d GL_NAND ~(s & d) GL_OR s | d GL_NOR ~(s | d) GL_XOR s ^ d GL_EQUIV ~(s ^ d) GL_AND_REVERSE s & ~d GL_AND_INVERTED ~s & d GL_OR_REVERSE s | ~d GL_OR_INVERTED ~s | d .TE

    opcode is a symbolic constant chosen from the list above. In the explanation of the logical operations, s represents the incoming color index and d represents the index in the frame buffer. Standard C-language operators are used. As these bitwise operators suggest, the logical operation is applied independently to each bit pair of the source and destination indices or colors.

  Parameter `opcode`

    Specifies a symbolic constant that selects a logical operation. The following symbols are accepted: GL_CLEAR , GL_SET , GL_COPY , GL_COPY_INVERTED , GL_NOOP , GL_INVERT , GL_AND , GL_NAND , GL_OR , GL_NOR , GL_XOR , GL_EQUIV , GL_AND_REVERSE , GL_AND_INVERTED , GL_OR_REVERSE , and GL_OR_INVERTED . The initial value is GL_COPY .

  Throws

    GL_INVALID_ENUM is generated if opcode is not an accepted value.

    GL_INVALID_OPERATION is generated if glLogicOp is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glMatrixMode

    `void glMatrixMode(int mode)`

  Description

    glMatrixMode sets the current matrix mode. mode can assume one of three values:

    GL_MODELVIEW | Applies subsequent matrix operations to the modelview matrix stack.
    GL_PROJECTION | Applies subsequent matrix operations to the projection matrix stack.
    GL_TEXTURE | Applies subsequent matrix operations to the texture matrix stack.

    To find out which matrix stack is currently the target of all matrix operations, call glGet with argument GL_MATRIX_MODE . The initial value is GL_MODELVIEW .

  Parameter `mode`

    Specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted: GL_MODELVIEW , GL_PROJECTION , and GL_TEXTURE . The initial value is GL_MODELVIEW .

  Throws

    GL_INVALID_ENUM is generated if mode is not an accepted value.

    GL_INVALID_OPERATION is generated if glMatrixMode is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glReadBuffer

    `void glReadBuffer(int mode)`

  Description

    glReadBuffer specifies a color buffer as the source for subsequent glReadPixels , glCopyTexImage1D , glCopyTexImage2D , glCopyTexSubImage1D , glCopyTexSubImage2D , and glCopyPixels commands. mode accepts one of twelve or more predefined values. (GL_AUX0 through GL_AUX3 are always defined.) In a fully configured system, GL_FRONT , GL_LEFT , and GL_FRONT_LEFT all name the front left buffer, GL_FRONT_RIGHT and GL_RIGHT name the front right buffer, and GL_BACK_LEFT and GL_BACK name the back left buffer.

    Nonstereo double-buffered configurations have only a front left and a back left buffer. Single-buffered configurations have a front left and a front right buffer if stereo, and only a front left buffer if nonstereo. It is an error to specify a nonexistent buffer to glReadBuffer .

    mode is initially GL_FRONT in single-buffered configurations, and GL_BACK in double-buffered configurations.

  Parameter `mode`

    Specifies a color buffer. Accepted values are GL_FRONT_LEFT , GL_FRONT_RIGHT , GL_BACK_LEFT , GL_BACK_RIGHT , GL_FRONT , GL_BACK , GL_LEFT , GL_RIGHT , and GL_AUXi, where i is between 0 and GL_AUX_BUFFERS -1.

  Throws

    GL_INVALID_ENUM is generated if mode is not one of the twelve (or more) accepted values.

    GL_INVALID_OPERATION is generated if mode specifies a buffer that does not exist.

    GL_INVALID_OPERATION is generated if glReadBuffer is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glRenderMode

    `void glRenderMode(int mode)`

  Description

    glRenderMode sets the rasterization mode. It takes one argument, mode, which can assume one of three predefined values:

    GL_RENDER | Render mode. Primitives are rasterized, producing pixel fragments, which are written into the frame buffer. This is the normal mode and also the default mode.
    GL_SELECT | Selection mode. No pixel fragments are produced, and no change to the frame buffer contents is made. Instead, a record of the names of primitives that would have been drawn if the render mode had been GL_RENDER is returned in a select buffer, which must be created (see glSelectBuffer ) before selection mode is entered.
    GL_FEEDBACK | Feedback mode. No pixel fragments are produced, and no change to the frame buffer contents is made. Instead, the coordinates and attributes of vertices that would have been drawn if the render mode had been GL_RENDER is returned in a feedback buffer, which must be created (see glFeedbackBuffer ) before feedback mode is entered.

    The return value of glRenderMode is determined by the render mode at the time glRenderMode is called, rather than by mode. The values returned for the three render modes are as follows:

    GL_RENDER | 0.
    GL_SELECT | The number of hit records transferred to the select buffer.
    GL_FEEDBACK | The number of values (not vertices) transferred to the feedback buffer.

    See the glSelectBuffer and glFeedbackBuffer reference pages for more details concerning selection and feedback operation.

  Parameter `mode`

    Specifies the rasterization mode. Three values are accepted: GL_RENDER , GL_SELECT , and GL_FEEDBACK . The initial value is GL_RENDER .

  Throws

    GL_INVALID_ENUM is generated if mode is not one of the three accepted values.

    GL_INVALID_OPERATION is generated if glSelectBuffer is called while the render mode is GL_SELECT , or if glRenderMode is called with argument GL_SELECT before glSelectBuffer is called at least once.

    GL_INVALID_OPERATION is generated if glFeedbackBuffer is called while the render mode is GL_FEEDBACK , or if glRenderMode is called with argument GL_FEEDBACK before glFeedbackBuffer is called at least once.

    GL_INVALID_OPERATION is generated if glRenderMode is executed between the execution of glBegin and the corresponding execution of glEnd .

  Method glShadeModel

    `void glShadeModel(int mode)`

  Description

    GL primitives can have either flat or smooth shading. Smooth shading, the default, causes the computed colors of vertices to be interpolated as the primitive is rasterized, typically assigning different colors to each resulting pixel fragment. Flat shading selects the computed color of just one vertex and assigns it to all the pixel fragments generated by rasterizing a single primitive. In either case, the computed color of a vertex is the result of lighting if lighting is enabled, or it is the current color at the time the vertex was specified if lighting is disabled.

    Flat and smooth shading are indistinguishable for points. Starting when glBegin is issued and counting vertices and primitives from 1, the GL gives each flat-shaded line segment i the computed color of vertex i + 1, its second vertex. Counting similarly from 1, the GL gives each flat-shaded polygon the computed color of the vertex listed in the following table. This is the last vertex to specify the polygon in all cases except single polygons, where the first vertex specifies the flat-shaded color. .sp .TS center box; l | c . primitive type of polygon i vertex = Single polygon ( i == 1 ) 1 Triangle strip i + 2 Triangle fan i + 2 Independent triangle 3 i Quad strip 2 i + 2 Independent quad 4 i .TE .sp Flat and smooth shading are specified by glShadeModel with mode set to GL_FLAT and GL_SMOOTH , respectively.

  Parameter `mode`

    Specifies a symbolic value representing a shading technique. Accepted values are GL_FLAT and GL_SMOOTH . The initial value is GL_SMOOTH .

  Throws

    GL_INVALID_ENUM is generated if mode is any value other than GL_FLAT or GL_SMOOTH .

    GL_INVALID_OPERATION is generated if glShadeModel is executed between the execution of glBegin and the corresponding execution of glEnd .

  Constant GL_2D

    `constant GL.GL_2D`

  Description

    Used in glFeedbackBuffer

  Constant GL_2_BYTES

    `constant GL.GL_2_BYTES`

  Description

    Used in glCallLists

  Constant GL_3D

    `constant GL.GL_3D`

  Description

    Used in glFeedbackBuffer

  Constant GL_3D_COLOR

    `constant GL.GL_3D_COLOR`

  Description

    Used in glFeedbackBuffer

  Constant GL_3D_COLOR_TEXTURE

    `constant GL.GL_3D_COLOR_TEXTURE`

  Description

    Used in glFeedbackBuffer

  Constant GL_3_BYTES

    `constant GL.GL_3_BYTES`

  Description

    Used in glCallLists

  Constant GL_4D_COLOR_TEXTURE

    `constant GL.GL_4D_COLOR_TEXTURE`

  Description

    Used in glFeedbackBuffer

  Constant GL_4_BYTES

    `constant GL.GL_4_BYTES`

  Description

    Used in glCallLists

  Constant GL_ABGR_EXT

    `constant GL.GL_ABGR_EXT`

  Constant GL_ACCUM

    `constant GL.GL_ACCUM`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glAccum , glGetDoublev and glClear

  Constant GL_ACCUM_ALPHA_BITS

    `constant GL.GL_ACCUM_ALPHA_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glAccum and glGetDoublev

  Constant GL_ACCUM_BLUE_BITS

    `constant GL.GL_ACCUM_BLUE_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glAccum and glGetDoublev

  Constant GL_ACCUM_BUFFER_BIT

    `constant GL.GL_ACCUM_BUFFER_BIT`

  Description

    Used in glPopAttrib , glPushAttrib and glClear

  Constant GL_ACCUM_CLEAR_VALUE

    `constant GL.GL_ACCUM_CLEAR_VALUE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_ACCUM_GREEN_BITS

    `constant GL.GL_ACCUM_GREEN_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glAccum and glGetDoublev

  Constant GL_ACCUM_RED_BITS

    `constant GL.GL_ACCUM_RED_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glAccum and glGetDoublev

  Constant GL_ADD

    `constant GL.GL_ADD`

  Description

    Used in glAccum

  Constant GL_ALL_ATTRIB_BITS

    `constant GL.GL_ALL_ATTRIB_BITS`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_ALPHA

    `constant GL.GL_ALPHA`

  Description

    Used in glIsEnabled , glTexEnv , glGetIntegerv , glDrawPixels , glDisable , glCopyTexImage1D , glTexSubImage2D , glPopAttrib , glEnable , glPixelTransfer , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glAlphaFunc , glReadPixels , glCopyTexImage2D , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_ALPHA12

    `constant GL.GL_ALPHA12`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_ALPHA16

    `constant GL.GL_ALPHA16`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_ALPHA4

    `constant GL.GL_ALPHA4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_ALPHA8

    `constant GL.GL_ALPHA8`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_ALPHA_BIAS

    `constant GL.GL_ALPHA_BIAS`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_ALPHA_BITS

    `constant GL.GL_ALPHA_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_ALPHA_SCALE

    `constant GL.GL_ALPHA_SCALE`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_ALPHA_TEST

    `constant GL.GL_ALPHA_TEST`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glAlphaFunc

  Constant GL_ALPHA_TEST_FUNC

    `constant GL.GL_ALPHA_TEST_FUNC`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_ALPHA_TEST_REF

    `constant GL.GL_ALPHA_TEST_REF`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_ALWAYS

    `constant GL.GL_ALWAYS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev , glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_AMBIENT

    `constant GL.GL_AMBIENT`

  Description

    Used in glGetIntegerv , glColorMaterial , glGetLight , glGetBooleanv , glGetFloatv , glMaterial , glGetDoublev , glLight and glGetMaterial

  Constant GL_AMBIENT_AND_DIFFUSE

    `constant GL.GL_AMBIENT_AND_DIFFUSE`

  Description

    Used in glGetIntegerv , glColorMaterial , glGetBooleanv , glGetFloatv , glMaterial and glGetDoublev

  Constant GL_AND

    `constant GL.GL_AND`

  Description

    Used in glLogicOp

  Constant GL_AND_INVERTED

    `constant GL.GL_AND_INVERTED`

  Description

    Used in glLogicOp

  Constant GL_AND_REVERSE

    `constant GL.GL_AND_REVERSE`

  Description

    Used in glLogicOp

  Constant GL_ATTRIB_STACK_DEPTH

    `constant GL.GL_ATTRIB_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_AUTO_NORMAL

    `constant GL.GL_AUTO_NORMAL`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glEvalCoord

  Constant GL_AUX0

    `constant GL.GL_AUX0`

  Description

    Used in glReadBuffer

  Constant GL_AUX1

    `constant GL.GL_AUX1`

  Constant GL_AUX2

    `constant GL.GL_AUX2`

  Constant GL_AUX3

    `constant GL.GL_AUX3`

  Description

    Used in glReadBuffer

  Constant GL_AUX_BUFFERS

    `constant GL.GL_AUX_BUFFERS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glReadBuffer , glGetDoublev and glDrawBuffer

  Constant GL_AVERAGE_EXT

    `constant GL.GL_AVERAGE_EXT`

  Constant GL_BACK

    `constant GL.GL_BACK`

  Description

    Used in glGetIntegerv , glColorMaterial , glCullFace , glPolygonMode , glGetBooleanv , glGetFloatv , glReadBuffer , glMaterial , glGetDoublev , glDrawBuffer and glGetMaterial

  Constant GL_BACK_LEFT

    `constant GL.GL_BACK_LEFT`

  Description

    Used in glReadBuffer and glDrawBuffer

  Constant GL_BACK_RIGHT

    `constant GL.GL_BACK_RIGHT`

  Description

    Used in glReadBuffer and glDrawBuffer

  Constant GL_BGR

    `constant GL.GL_BGR`

  Constant GL_BGRA

    `constant GL.GL_BGRA`

  Constant GL_BITMAP

    `constant GL.GL_BITMAP`

  Description

    Used in glDrawPixels , glTexSubImage2D , glGetTexImage , glReadPixels , glTexImage2D , glFeedbackBuffer , glGetPolygonStipple , glBitmap , glTexSubImage1D , glTexImage1D and glPolygonStipple

  Constant GL_BITMAP_TOKEN

    `constant GL.GL_BITMAP_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_BLEND

    `constant GL.GL_BLEND`

  Description

    Used in glIsEnabled , glTexEnv , glGetIntegerv , glBlendColorEXT , glBlendFunc , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_BLEND_COLOR_EXT

    `constant GL.GL_BLEND_COLOR_EXT`

  Description

    Used in glGetIntegerv , glBlendColorEXT , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_BLEND_DST

    `constant GL.GL_BLEND_DST`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_BLEND_EQUATION_EXT

    `constant GL.GL_BLEND_EQUATION_EXT`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_BLEND_SRC

    `constant GL.GL_BLEND_SRC`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_BLUE

    `constant GL.GL_BLUE`

  Description

    Used in glGetIntegerv , glDrawPixels , glTexSubImage2D , glPopAttrib , glPixelTransfer , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_BLUE_BIAS

    `constant GL.GL_BLUE_BIAS`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_BLUE_BITS

    `constant GL.GL_BLUE_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_BLUE_SCALE

    `constant GL.GL_BLUE_SCALE`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_BYTE

    `constant GL.GL_BYTE`

  Description

    Used in glDrawPixels , glColorPointer , glTexSubImage2D , glNormalPointer , glGetTexImage , glCallLists , glReadPixels , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_C3F_V3F

    `constant GL.GL_C3F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_C4F_N3F_V3F

    `constant GL.GL_C4F_N3F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_C4UB_V2F

    `constant GL.GL_C4UB_V2F`

  Description

    Used in glInterleavedArrays

  Constant GL_C4UB_V3F

    `constant GL.GL_C4UB_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_CCW

    `constant GL.GL_CCW`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glFrontFace

  Constant GL_CLAMP

    `constant GL.GL_CLAMP`

  Description

    Used in glTexParameter

  Constant GL_CLEAR

    `constant GL.GL_CLEAR`

  Description

    Used in glLogicOp

  Constant GL_CLIENT_ALL_ATTRIB_BITS

    `constant GL.GL_CLIENT_ALL_ATTRIB_BITS`

  Description

    Used in glPopClientAttrib and glPushClientAttrib

  Constant GL_CLIENT_ATTRIB_STACK_DEPTH

    `constant GL.GL_CLIENT_ATTRIB_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_CLIENT_PIXEL_STORE_BIT

    `constant GL.GL_CLIENT_PIXEL_STORE_BIT`

  Description

    Used in glPopClientAttrib and glPushClientAttrib

  Constant GL_CLIENT_VERTEX_ARRAY_BIT

    `constant GL.GL_CLIENT_VERTEX_ARRAY_BIT`

  Description

    Used in glPopClientAttrib and glPushClientAttrib

  Constant GL_CLIP_PLANE0

    `constant GL.GL_CLIP_PLANE0`

  Constant GL_CLIP_PLANE1

    `constant GL.GL_CLIP_PLANE1`

  Constant GL_CLIP_PLANE2

    `constant GL.GL_CLIP_PLANE2`

  Constant GL_CLIP_PLANE3

    `constant GL.GL_CLIP_PLANE3`

  Constant GL_CLIP_PLANE4

    `constant GL.GL_CLIP_PLANE4`

  Constant GL_CLIP_PLANE5

    `constant GL.GL_CLIP_PLANE5`

  Constant GL_COEFF

    `constant GL.GL_COEFF`

  Description

    Used in glGetMap

  Constant GL_COLOR

    `constant GL.GL_COLOR`

  Description

    Used in glIsEnabled , glGetIntegerv , glDrawElements , glDrawArrays , glColorMaterial , glDrawPixels , glDisable , glColorPointer , glTexSubImage2D , glPopAttrib , glEnable , glEnableClientState , glGetPointerv , glPixelTransfer , glLogicOp , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glMaterial , glGetDoublev , glReadPixels , glTexImage2D , glGetPolygonStipple , glBitmap , glCopyPixels , glLightModel , glDisableClientState , glTexSubImage1D , glTexImage1D , glGetMaterial , glClear and glPolygonStipple

  Constant GL_COLOR_ARRAY

    `constant GL.GL_COLOR_ARRAY`

  Description

    Used in glIsEnabled , glGetIntegerv , glDrawElements , glDrawArrays , glColorPointer , glEnableClientState , glGetPointerv , glGetBooleanv , glGetFloatv , glGetDoublev and glDisableClientState

  Constant GL_COLOR_ARRAY_POINTER

    `constant GL.GL_COLOR_ARRAY_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_COLOR_ARRAY_SIZE

    `constant GL.GL_COLOR_ARRAY_SIZE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_COLOR_ARRAY_STRIDE

    `constant GL.GL_COLOR_ARRAY_STRIDE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_COLOR_ARRAY_TYPE

    `constant GL.GL_COLOR_ARRAY_TYPE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_COLOR_BUFFER_BIT

    `constant GL.GL_COLOR_BUFFER_BIT`

  Description

    Used in glPopAttrib , glPushAttrib and glClear

  Constant GL_COLOR_CLEAR_VALUE

    `constant GL.GL_COLOR_CLEAR_VALUE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_COLOR_INDEX

    `constant GL.GL_COLOR_INDEX`

  Description

    Used in glDrawPixels , glTexSubImage2D , glPixelTransfer , glGetTexImage , glMaterial , glReadPixels , glTexImage2D , glGetPolygonStipple , glBitmap , glLightModel , glTexSubImage1D , glTexImage1D , glGetMaterial and glPolygonStipple

  Constant GL_COLOR_INDEXES

    `constant GL.GL_COLOR_INDEXES`

  Description

    Used in glMaterial , glLightModel and glGetMaterial

  Constant GL_COLOR_LOGIC_OP

    `constant GL.GL_COLOR_LOGIC_OP`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glLogicOp , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_COLOR_MATERIAL

    `constant GL.GL_COLOR_MATERIAL`

  Description

    Used in glIsEnabled , glGetIntegerv , glColorMaterial , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_COLOR_MATERIAL_FACE

    `constant GL.GL_COLOR_MATERIAL_FACE`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_COLOR_MATERIAL_PARAMETER

    `constant GL.GL_COLOR_MATERIAL_PARAMETER`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_COLOR_TABLE_ALPHA_SIZE_SGI

    `constant GL.GL_COLOR_TABLE_ALPHA_SIZE_SGI`

  Constant GL_COLOR_TABLE_BIAS_SGI

    `constant GL.GL_COLOR_TABLE_BIAS_SGI`

  Constant GL_COLOR_TABLE_BLUE_SIZE_SGI

    `constant GL.GL_COLOR_TABLE_BLUE_SIZE_SGI`

  Constant GL_COLOR_TABLE_FORMAT_SGI

    `constant GL.GL_COLOR_TABLE_FORMAT_SGI`

  Constant GL_COLOR_TABLE_GREEN_SIZE_SGI

    `constant GL.GL_COLOR_TABLE_GREEN_SIZE_SGI`

  Constant GL_COLOR_TABLE_INTENSITY_SIZE_SGI

    `constant GL.GL_COLOR_TABLE_INTENSITY_SIZE_SGI`

  Constant GL_COLOR_TABLE_LUMINANCE_SIZE_SGI

    `constant GL.GL_COLOR_TABLE_LUMINANCE_SIZE_SGI`

  Constant GL_COLOR_TABLE_RED_SIZE_SGI

    `constant GL.GL_COLOR_TABLE_RED_SIZE_SGI`

  Constant GL_COLOR_TABLE_SCALE_SGI

    `constant GL.GL_COLOR_TABLE_SCALE_SGI`

  Constant GL_COLOR_TABLE_SGI

    `constant GL.GL_COLOR_TABLE_SGI`

  Constant GL_COLOR_TABLE_WIDTH_SGI

    `constant GL.GL_COLOR_TABLE_WIDTH_SGI`

  Constant GL_COLOR_WRITEMASK

    `constant GL.GL_COLOR_WRITEMASK`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_COMPILE

    `constant GL.GL_COMPILE`

  Description

    Used in glNewList and glEndList

  Constant GL_COMPILE_AND_EXECUTE

    `constant GL.GL_COMPILE_AND_EXECUTE`

  Description

    Used in glNewList and glEndList

  Constant GL_COMPRESSED_GEOM_ACCELERATED_SUNX

    `constant GL.GL_COMPRESSED_GEOM_ACCELERATED_SUNX`

  Constant GL_COMPRESSED_GEOM_VERSION_SUNX

    `constant GL.GL_COMPRESSED_GEOM_VERSION_SUNX`

  Constant GL_CONSTANT_ALPHA_EXT

    `constant GL.GL_CONSTANT_ALPHA_EXT`

  Constant GL_CONSTANT_ATTENUATION

    `constant GL.GL_CONSTANT_ATTENUATION`

  Description

    Used in glGetLight and glLight

  Constant GL_CONSTANT_BORDER_HP

    `constant GL.GL_CONSTANT_BORDER_HP`

  Constant GL_CONSTANT_COLOR_EXT

    `constant GL.GL_CONSTANT_COLOR_EXT`

  Constant GL_CONVOLUTION_1D_EXT

    `constant GL.GL_CONVOLUTION_1D_EXT`

  Constant GL_CONVOLUTION_2D_EXT

    `constant GL.GL_CONVOLUTION_2D_EXT`

  Constant GL_CONVOLUTION_BORDER_COLOR_HP

    `constant GL.GL_CONVOLUTION_BORDER_COLOR_HP`

  Constant GL_CONVOLUTION_BORDER_MODE_EXT

    `constant GL.GL_CONVOLUTION_BORDER_MODE_EXT`

  Constant GL_CONVOLUTION_FILTER_BIAS_EXT

    `constant GL.GL_CONVOLUTION_FILTER_BIAS_EXT`

  Constant GL_CONVOLUTION_FILTER_SCALE_EXT

    `constant GL.GL_CONVOLUTION_FILTER_SCALE_EXT`

  Constant GL_CONVOLUTION_FORMAT_EXT

    `constant GL.GL_CONVOLUTION_FORMAT_EXT`

  Constant GL_CONVOLUTION_HEIGHT_EXT

    `constant GL.GL_CONVOLUTION_HEIGHT_EXT`

  Constant GL_CONVOLUTION_WIDTH_EXT

    `constant GL.GL_CONVOLUTION_WIDTH_EXT`

  Constant GL_COPY

    `constant GL.GL_COPY`

  Description

    Used in glGetIntegerv , glLogicOp , glGetBooleanv , glGetFloatv , glGetDoublev and glFeedbackBuffer

  Constant GL_COPY_INVERTED

    `constant GL.GL_COPY_INVERTED`

  Description

    Used in glLogicOp

  Constant GL_COPY_PIXEL_TOKEN

    `constant GL.GL_COPY_PIXEL_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_CUBIC_EXT

    `constant GL.GL_CUBIC_EXT`

  Constant GL_CULL_FACE

    `constant GL.GL_CULL_FACE`

  Description

    Used in glIsEnabled , glGetIntegerv , glCullFace , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glFrontFace

  Constant GL_CULL_FACE_MODE

    `constant GL.GL_CULL_FACE_MODE`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_CURRENT_BIT

    `constant GL.GL_CURRENT_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_CURRENT_COLOR

    `constant GL.GL_CURRENT_COLOR`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_INDEX

    `constant GL.GL_CURRENT_INDEX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_NORMAL

    `constant GL.GL_CURRENT_NORMAL`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_CURRENT_RASTER_COLOR

    `constant GL.GL_CURRENT_RASTER_COLOR`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_RASTER_DISTANCE

    `constant GL.GL_CURRENT_RASTER_DISTANCE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_RASTER_INDEX

    `constant GL.GL_CURRENT_RASTER_INDEX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_RASTER_POSITION

    `constant GL.GL_CURRENT_RASTER_POSITION`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_RASTER_POSITION_VALID

    `constant GL.GL_CURRENT_RASTER_POSITION_VALID`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_RASTER_TEXTURE_COORDS

    `constant GL.GL_CURRENT_RASTER_TEXTURE_COORDS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CURRENT_TEXTURE_COORDS

    `constant GL.GL_CURRENT_TEXTURE_COORDS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glRasterPos

  Constant GL_CW

    `constant GL.GL_CW`

  Description

    Used in glFrontFace

  Constant GL_DECAL

    `constant GL.GL_DECAL`

  Description

    Used in glTexEnv

  Constant GL_DECR

    `constant GL.GL_DECR`

  Description

    Used in glStencilOp

  Constant GL_DEPTH

    `constant GL.GL_DEPTH`

  Description

    Used in glIsEnabled , glGetIntegerv , glDrawPixels , glDisable , glPopAttrib , glEnable , glPixelTransfer , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glCopyPixels , glDepthFunc , glTexImage1D and glClear

  Constant GL_DEPTH_BIAS

    `constant GL.GL_DEPTH_BIAS`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels and glCopyPixels

  Constant GL_DEPTH_BITS

    `constant GL.GL_DEPTH_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_DEPTH_BUFFER_BIT

    `constant GL.GL_DEPTH_BUFFER_BIT`

  Description

    Used in glPopAttrib , glPushAttrib and glClear

  Constant GL_DEPTH_CLEAR_VALUE

    `constant GL.GL_DEPTH_CLEAR_VALUE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_DEPTH_COMPONENT

    `constant GL.GL_DEPTH_COMPONENT`

  Description

    Used in glDrawPixels , glGetTexImage , glReadPixels , glTexImage2D and glTexImage1D

  Constant GL_DEPTH_FUNC

    `constant GL.GL_DEPTH_FUNC`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_DEPTH_RANGE

    `constant GL.GL_DEPTH_RANGE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_DEPTH_SCALE

    `constant GL.GL_DEPTH_SCALE`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels and glCopyPixels

  Constant GL_DEPTH_TEST

    `constant GL.GL_DEPTH_TEST`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glDepthFunc

  Constant GL_DEPTH_WRITEMASK

    `constant GL.GL_DEPTH_WRITEMASK`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_DIFFUSE

    `constant GL.GL_DIFFUSE`

  Description

    Used in glColorMaterial , glGetLight , glMaterial , glLight and glGetMaterial

  Constant GL_DITHER

    `constant GL.GL_DITHER`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_DOMAIN

    `constant GL.GL_DOMAIN`

  Description

    Used in glGetMap

  Constant GL_DONT_CARE

    `constant GL.GL_DONT_CARE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glHint

  Constant GL_DOUBLE

    `constant GL.GL_DOUBLE`

  Description

    Used in glGetIntegerv , glVertexPointer , glColorPointer , glNormalPointer , glGetBooleanv , glGetFloatv , glGetDoublev , glTexCoordPointer and glIndexPointer

  Constant GL_DOUBLEBUFFER

    `constant GL.GL_DOUBLEBUFFER`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_DRAW_BUFFER

    `constant GL.GL_DRAW_BUFFER`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_DRAW_PIXEL_TOKEN

    `constant GL.GL_DRAW_PIXEL_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_DST_ALPHA

    `constant GL.GL_DST_ALPHA`

  Description

    Used in glBlendFunc

  Constant GL_DST_COLOR

    `constant GL.GL_DST_COLOR`

  Description

    Used in glBlendFunc

  Constant GL_EDGE_FLAG

    `constant GL.GL_EDGE_FLAG`

  Description

    Used in glIsEnabled , glGetIntegerv , glPopAttrib , glEnableClientState , glGetPointerv , glGetBooleanv , glPushAttrib , glGetFloatv , glEdgeFlagPointer , glGetDoublev and glDisableClientState

  Constant GL_EDGE_FLAG_ARRAY

    `constant GL.GL_EDGE_FLAG_ARRAY`

  Description

    Used in glIsEnabled , glGetIntegerv , glEnableClientState , glGetPointerv , glGetBooleanv , glGetFloatv , glEdgeFlagPointer , glGetDoublev and glDisableClientState

  Constant GL_EDGE_FLAG_ARRAY_POINTER

    `constant GL.GL_EDGE_FLAG_ARRAY_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_EDGE_FLAG_ARRAY_STRIDE

    `constant GL.GL_EDGE_FLAG_ARRAY_STRIDE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_EMISSION

    `constant GL.GL_EMISSION`

  Description

    Used in glColorMaterial , glMaterial and glGetMaterial

  Constant GL_ENABLE_BIT

    `constant GL.GL_ENABLE_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_EQUAL

    `constant GL.GL_EQUAL`

  Description

    Used in glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_EQUIV

    `constant GL.GL_EQUIV`

  Description

    Used in glLogicOp

  Constant GL_EVAL_BIT

    `constant GL.GL_EVAL_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_EXP

    `constant GL.GL_EXP`

  Description

    Used in glFog , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_EXP2

    `constant GL.GL_EXP2`

  Description

    Used in glFog

  Constant GL_EXTENSIONS

    `constant GL.GL_EXTENSIONS`

  Description

    Used in glGetString

  Constant GL_EXT_abgr

    `constant GL.GL_EXT_abgr`

  Constant GL_EXT_blend_color

    `constant GL.GL_EXT_blend_color`

  Constant GL_EXT_blend_minmax

    `constant GL.GL_EXT_blend_minmax`

  Constant GL_EXT_blend_subtract

    `constant GL.GL_EXT_blend_subtract`

  Constant GL_EXT_convolution

    `constant GL.GL_EXT_convolution`

  Constant GL_EXT_histogram

    `constant GL.GL_EXT_histogram`

  Constant GL_EXT_pixel_transform

    `constant GL.GL_EXT_pixel_transform`

  Constant GL_EXT_rescale_normal

    `constant GL.GL_EXT_rescale_normal`

  Constant GL_EXT_texture3D

    `constant GL.GL_EXT_texture3D`

  Constant GL_EYE_LINEAR

    `constant GL.GL_EYE_LINEAR`

  Description

    Used in glGetTexGen and glTexGen

  Constant GL_EYE_PLANE

    `constant GL.GL_EYE_PLANE`

  Description

    Used in glGetTexGen and glTexGen

  Constant GL_FALSE

    `constant GL.GL_FALSE`

  Description

    Used in glIsEnabled , glDepthMask , glIsList , glAreTexturesResident , glGetIntegerv , glIsTexture , glDisable , glEdgeFlag , glEnable , glColorMask , glGetBooleanv , glGetFloatv , glGetDoublev and glEdgeFlagv

  Constant GL_FASTEST

    `constant GL.GL_FASTEST`

  Description

    Used in glHint

  Constant GL_FEEDBACK

    `constant GL.GL_FEEDBACK`

  Description

    Used in glRenderMode , glPassThrough , glGetPointerv and glFeedbackBuffer

  Constant GL_FEEDBACK_BUFFER_POINTER

    `constant GL.GL_FEEDBACK_BUFFER_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_FEEDBACK_BUFFER_SIZE

    `constant GL.GL_FEEDBACK_BUFFER_SIZE`

  Constant GL_FEEDBACK_BUFFER_TYPE

    `constant GL.GL_FEEDBACK_BUFFER_TYPE`

  Constant GL_FILL

    `constant GL.GL_FILL`

  Description

    Used in glGetIntegerv , glDisable , glEnable , glPolygonMode , glGetBooleanv , glGetFloatv , glGetDoublev and glEvalMesh

  Constant GL_FLAT

    `constant GL.GL_FLAT`

  Description

    Used in glShadeModel

  Constant GL_FLOAT

    `constant GL.GL_FLOAT`

  Description

    Used in glGetIntegerv , glDrawPixels , glVertexPointer , glColorPointer , glTexSubImage2D , glNormalPointer , glGetBooleanv , glGetTexImage , glGetFloatv , glGetDoublev , glCallLists , glReadPixels , glTexImage2D , glTexCoordPointer , glIndexPointer , glTexSubImage1D and glTexImage1D

  Constant GL_FOG

    `constant GL.GL_FOG`

  Description

    Used in glIsEnabled , glFog , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_FOG_BIT

    `constant GL.GL_FOG_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_FOG_COLOR

    `constant GL.GL_FOG_COLOR`

  Description

    Used in glFog , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_FOG_DENSITY

    `constant GL.GL_FOG_DENSITY`

  Description

    Used in glFog , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_FOG_END

    `constant GL.GL_FOG_END`

  Description

    Used in glFog , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_FOG_HINT

    `constant GL.GL_FOG_HINT`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_FOG_INDEX

    `constant GL.GL_FOG_INDEX`

  Description

    Used in glFog , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_FOG_MODE

    `constant GL.GL_FOG_MODE`

  Description

    Used in glFog , glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_FOG_START

    `constant GL.GL_FOG_START`

  Description

    Used in glFog , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_FRONT

    `constant GL.GL_FRONT`

  Description

    Used in glGetIntegerv , glColorMaterial , glCullFace , glPopAttrib , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glReadBuffer , glMaterial , glGetDoublev , glDrawBuffer and glGetMaterial

  Constant GL_FRONT_AND_BACK

    `constant GL.GL_FRONT_AND_BACK`

  Description

    Used in glGetIntegerv , glColorMaterial , glCullFace , glPolygonMode , glGetBooleanv , glGetFloatv , glMaterial , glGetDoublev and glDrawBuffer

  Constant GL_FRONT_FACE

    `constant GL.GL_FRONT_FACE`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_FRONT_LEFT

    `constant GL.GL_FRONT_LEFT`

  Description

    Used in glReadBuffer and glDrawBuffer

  Constant GL_FRONT_RIGHT

    `constant GL.GL_FRONT_RIGHT`

  Description

    Used in glReadBuffer and glDrawBuffer

  Constant GL_FUNC_ADD_EXT

    `constant GL.GL_FUNC_ADD_EXT`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_FUNC_REVERSE_SUBTRACT_EXT

    `constant GL.GL_FUNC_REVERSE_SUBTRACT_EXT`

  Constant GL_FUNC_SUBTRACT_EXT

    `constant GL.GL_FUNC_SUBTRACT_EXT`

  Constant GL_GEQUAL

    `constant GL.GL_GEQUAL`

  Description

    Used in glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_GREATER

    `constant GL.GL_GREATER`

  Description

    Used in glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_GREEN

    `constant GL.GL_GREEN`

  Description

    Used in glGetIntegerv , glDrawPixels , glTexSubImage2D , glPopAttrib , glPixelTransfer , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_GREEN_BIAS

    `constant GL.GL_GREEN_BIAS`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_GREEN_BITS

    `constant GL.GL_GREEN_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_GREEN_SCALE

    `constant GL.GL_GREEN_SCALE`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_HINT_BIT

    `constant GL.GL_HINT_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_HISTOGRAM_ALPHA_SIZE_EXT

    `constant GL.GL_HISTOGRAM_ALPHA_SIZE_EXT`

  Constant GL_HISTOGRAM_BLUE_SIZE_EXT

    `constant GL.GL_HISTOGRAM_BLUE_SIZE_EXT`

  Constant GL_HISTOGRAM_EXT

    `constant GL.GL_HISTOGRAM_EXT`

  Constant GL_HISTOGRAM_FORMAT_EXT

    `constant GL.GL_HISTOGRAM_FORMAT_EXT`

  Constant GL_HISTOGRAM_GREEN_SIZE_EXT

    `constant GL.GL_HISTOGRAM_GREEN_SIZE_EXT`

  Constant GL_HISTOGRAM_LUMINANCE_SIZE_EXT

    `constant GL.GL_HISTOGRAM_LUMINANCE_SIZE_EXT`

  Constant GL_HISTOGRAM_RED_SIZE_EXT

    `constant GL.GL_HISTOGRAM_RED_SIZE_EXT`

  Constant GL_HISTOGRAM_SINK_EXT

    `constant GL.GL_HISTOGRAM_SINK_EXT`

  Constant GL_HISTOGRAM_WIDTH_EXT

    `constant GL.GL_HISTOGRAM_WIDTH_EXT`

  Constant GL_HP_convolution_border_modes

    `constant GL.GL_HP_convolution_border_modes`

  Constant GL_HP_occlusion_test

    `constant GL.GL_HP_occlusion_test`

  Constant GL_IGNORE_BORDER_HP

    `constant GL.GL_IGNORE_BORDER_HP`

  Constant GL_INCR

    `constant GL.GL_INCR`

  Description

    Used in glStencilOp

  Constant GL_INDEX_ARRAY

    `constant GL.GL_INDEX_ARRAY`

  Description

    Used in glIsEnabled , glGetIntegerv , glEnableClientState , glGetPointerv , glGetBooleanv , glGetFloatv , glGetDoublev , glIndexPointer and glDisableClientState

  Constant GL_INDEX_ARRAY_POINTER

    `constant GL.GL_INDEX_ARRAY_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_INDEX_ARRAY_STRIDE

    `constant GL.GL_INDEX_ARRAY_STRIDE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_INDEX_ARRAY_TYPE

    `constant GL.GL_INDEX_ARRAY_TYPE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_INDEX_BITS

    `constant GL.GL_INDEX_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_INDEX_CLEAR_VALUE

    `constant GL.GL_INDEX_CLEAR_VALUE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_INDEX_LOGIC_OP

    `constant GL.GL_INDEX_LOGIC_OP`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glLogicOp , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_INDEX_MODE

    `constant GL.GL_INDEX_MODE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_INDEX_OFFSET

    `constant GL.GL_INDEX_OFFSET`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glCopyPixels and glTexImage1D

  Constant GL_INDEX_SHIFT

    `constant GL.GL_INDEX_SHIFT`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glCopyPixels and glTexImage1D

  Constant GL_INDEX_WRITEMASK

    `constant GL.GL_INDEX_WRITEMASK`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_INT

    `constant GL.GL_INT`

  Description

    Used in glTexEnv , glDrawPixels , glVertexPointer , glColorPointer , glCopyTexImage1D , glTexSubImage2D , glNormalPointer , glGetTexImage , glCallLists , glReadPixels , glCopyTexImage2D , glTexImage2D , glTexCoordPointer , glIndexPointer , glTexSubImage1D and glTexImage1D

  Constant GL_INTENSITY

    `constant GL.GL_INTENSITY`

  Description

    Used in glTexEnv , glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_INTENSITY12

    `constant GL.GL_INTENSITY12`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_INTENSITY16

    `constant GL.GL_INTENSITY16`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_INTENSITY4

    `constant GL.GL_INTENSITY4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_INTENSITY8

    `constant GL.GL_INTENSITY8`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_INVALID_ENUM

    `constant GL.GL_INVALID_ENUM`

  Description

    Used in glMatrixMode , glPixelStore , glIsEnabled , glGetTexLevelParameter , glFog , glTexEnv , glMap1 , glRenderMode , glGetTexGen , glGetIntegerv , glEnd , glDrawElements , glDrawArrays , glCopyTexSubImage2D , glColorMaterial , glBindTexture , glGetClipPlane , glCullFace , glGetError , glClipPlane , glDrawPixels , glBlendFunc , glVertexPointer , glGetLight , glDisable , glMap2 , glColorPointer , glCopyTexImage1D , glGetPixelMap , glTexSubImage2D , glNormalPointer , glEnable , glEnableClientState , glGetPointerv , glPixelTransfer , glPolygonMode , glGetTexParameter , glLogicOp , glGetBooleanv , glGetTexImage , glPixelMap , glGetFloatv , glGetMap , glAccum , glReadBuffer , glMaterial , glEdgeFlagPointer , glGetDoublev , glCallLists , glInterleavedArrays , glAlphaFunc , glShadeModel , glNewList , glReadPixels , glCopyTexImage2D , glTexImage2D , glGetTexEnv , glFeedbackBuffer , glEndList , glBegin , glLight , glStencilOp , glTexCoordPointer , glCopyPixels , glDepthFunc , glLightModel , glIndexPointer , glGetString , glTexParameter , glDisableClientState , glTexSubImage1D , glDrawBuffer , glHint , glTexImage1D , glStencilFunc , glGetMaterial , glCopyTexSubImage1D , glFrontFace , glEvalMesh and glTexGen

  Constant GL_INVALID_OPERATION

    `constant GL.GL_INVALID_OPERATION`

  Description

    Used in glPolygonOffset , glPushMatrix , glMatrixMode , glLoadName , glPixelStore , glIsEnabled , glGetTexLevelParameter , glGenTextures , glFog , glTexEnv , glClearColor , glMap1 , glPrioritizeTextures , glDepthMask , glPushName , glRenderMode , glMultMatrix , glIsList , glFrustum , glDepthRange , glAreTexturesResident , glDeleteTextures , glGetTexGen , glGetIntegerv , glEnd , glIsTexture , glDrawElements , glGenLists , glBlendColorEXT , glViewport , glDrawArrays , glCopyTexSubImage2D , glColorMaterial , glBindTexture , glGetClipPlane , glFinish , glCullFace , glGetError , glStencilMask , glClipPlane , glDrawPixels , glBlendFunc , glSelectBuffer , glGetLight , glInitNames , glPassThrough , glDisable , glMap2 , glLineStipple , glCopyTexImage1D , glGetPixelMap , glTexSubImage2D , glPopAttrib , glEnable , glListBase , glColorMask , glPixelTransfer , glPolygonMode , glGetTexParameter , glPopName , glLogicOp , glIndexMask , glGetBooleanv , glGetTexImage , glPixelMap , glTranslate , glPushAttrib , glGetFloatv , glGetMap , glAccum , glReadBuffer , glGetDoublev , glClearDepth , glRasterPos , glAlphaFunc , glShadeModel , glNewList , glReadPixels , glCopyTexImage2D , glRect , glTexImage2D , glGetTexEnv , glClearIndex , glFeedbackBuffer , glRotate , glEndList , glBegin , glLight , glGetPolygonStipple , glStencilOp , glClearStencil , glBitmap , glScale , glCopyPixels , glFlush , glOrtho , glDepthFunc , glMapGrid , glLightModel , glGetString , glTexParameter , glScissor , glTexSubImage1D , glLoadIdentity , glPixelZoom , glDrawBuffer , glLineWidth , glHint , glTexImage1D , glStencilFunc , glGetMaterial , glClear , glCopyTexSubImage1D , glPopMatrix , glPointSize , glPolygonStipple , glFrontFace , glLoadMatrix , glEvalMesh , glTexGen , glClearAccum and glDeleteLists

  Constant GL_INVALID_VALUE

    `constant GL.GL_INVALID_VALUE`

  Description

    Used in glPixelStore , glGetTexLevelParameter , glGenTextures , glFog , glMap1 , glPrioritizeTextures , glFrustum , glAreTexturesResident , glDeleteTextures , glDrawElements , glGenLists , glViewport , glDrawArrays , glCopyTexSubImage2D , glGetError , glDrawPixels , glVertexPointer , glSelectBuffer , glMap2 , glColorPointer , glCopyTexImage1D , glTexSubImage2D , glNormalPointer , glGetTexImage , glPixelMap , glMaterial , glCallLists , glInterleavedArrays , glNewList , glReadPixels , glCopyTexImage2D , glTexImage2D , glFeedbackBuffer , glEndList , glLight , glBitmap , glTexCoordPointer , glCopyPixels , glMapGrid , glIndexPointer , glScissor , glTexSubImage1D , glLineWidth , glTexImage1D , glClear , glCopyTexSubImage1D , glPointSize and glDeleteLists

  Constant GL_INVERT

    `constant GL.GL_INVERT`

  Description

    Used in glLogicOp and glStencilOp

  Constant GL_KEEP

    `constant GL.GL_KEEP`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glStencilOp

  Constant GL_LARGE_SUNX

    `constant GL.GL_LARGE_SUNX`

  Constant GL_LEFT

    `constant GL.GL_LEFT`

  Description

    Used in glReadBuffer and glDrawBuffer

  Constant GL_LEQUAL

    `constant GL.GL_LEQUAL`

  Description

    Used in glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_LESS

    `constant GL.GL_LESS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev , glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_LIGHT0

    `constant GL.GL_LIGHT0`

  Description

    Used in glGetLight and glLight

  Constant GL_LIGHT1

    `constant GL.GL_LIGHT1`

  Constant GL_LIGHT2

    `constant GL.GL_LIGHT2`

  Constant GL_LIGHT3

    `constant GL.GL_LIGHT3`

  Constant GL_LIGHT4

    `constant GL.GL_LIGHT4`

  Constant GL_LIGHT5

    `constant GL.GL_LIGHT5`

  Constant GL_LIGHT6

    `constant GL.GL_LIGHT6`

  Constant GL_LIGHT7

    `constant GL.GL_LIGHT7`

  Constant GL_LIGHTING

    `constant GL.GL_LIGHTING`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glLight

  Constant GL_LIGHTING_BIT

    `constant GL.GL_LIGHTING_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_LIGHT_MODEL_AMBIENT

    `constant GL.GL_LIGHT_MODEL_AMBIENT`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glLightModel

  Constant GL_LIGHT_MODEL_LOCAL_VIEWER

    `constant GL.GL_LIGHT_MODEL_LOCAL_VIEWER`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glLightModel

  Constant GL_LIGHT_MODEL_TWO_SIDE

    `constant GL.GL_LIGHT_MODEL_TWO_SIDE`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glLightModel

  Constant GL_LINE

    `constant GL.GL_LINE`

  Description

    Used in glIsEnabled , glFog , glGetIntegerv , glEnd , glDrawElements , glDrawArrays , glGetLight , glDisable , glLineStipple , glEdgeFlag , glPopAttrib , glEnable , glPolygonMode , glGetTexParameter , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glFeedbackBuffer , glBegin , glLight , glTexParameter , glLineWidth , glHint , glEdgeFlagv and glEvalMesh

  Constant GL_LINEAR

    `constant GL.GL_LINEAR`

  Description

    Used in glFog , glGetLight , glGetTexParameter , glLight and glTexParameter

  Constant GL_LINEAR_ATTENUATION

    `constant GL.GL_LINEAR_ATTENUATION`

  Description

    Used in glGetLight and glLight

  Constant GL_LINEAR_MIPMAP_LINEAR

    `constant GL.GL_LINEAR_MIPMAP_LINEAR`

  Description

    Used in glTexParameter

  Constant GL_LINEAR_MIPMAP_NEAREST

    `constant GL.GL_LINEAR_MIPMAP_NEAREST`

  Description

    Used in glTexParameter

  Constant GL_LINES

    `constant GL.GL_LINES`

  Description

    Used in glEnd , glDrawElements , glDrawArrays , glLineStipple , glBegin and glEvalMesh

  Constant GL_LINE_BIT

    `constant GL.GL_LINE_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_LINE_LOOP

    `constant GL.GL_LINE_LOOP`

  Description

    Used in glEnd , glDrawElements , glDrawArrays and glBegin

  Constant GL_LINE_RESET_TOKEN

    `constant GL.GL_LINE_RESET_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_LINE_SMOOTH

    `constant GL.GL_LINE_SMOOTH`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glLineWidth and glHint

  Constant GL_LINE_SMOOTH_HINT

    `constant GL.GL_LINE_SMOOTH_HINT`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_LINE_STIPPLE

    `constant GL.GL_LINE_STIPPLE`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glLineStipple , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_LINE_STIPPLE_PATTERN

    `constant GL.GL_LINE_STIPPLE_PATTERN`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_LINE_STIPPLE_REPEAT

    `constant GL.GL_LINE_STIPPLE_REPEAT`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_LINE_STRIP

    `constant GL.GL_LINE_STRIP`

  Description

    Used in glEnd , glDrawElements , glDrawArrays , glBegin and glEvalMesh

  Constant GL_LINE_TOKEN

    `constant GL.GL_LINE_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_LINE_WIDTH

    `constant GL.GL_LINE_WIDTH`

  Description

    Used in glGetIntegerv , glPolygonMode , glGetBooleanv , glGetFloatv , glGetDoublev and glLineWidth

  Constant GL_LINE_WIDTH_GRANULARITY

    `constant GL.GL_LINE_WIDTH_GRANULARITY`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glLineWidth

  Constant GL_LINE_WIDTH_RANGE

    `constant GL.GL_LINE_WIDTH_RANGE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glLineWidth

  Constant GL_LIST_BASE

    `constant GL.GL_LIST_BASE`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_LIST_BIT

    `constant GL.GL_LIST_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_LIST_INDEX

    `constant GL.GL_LIST_INDEX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_LIST_MODE

    `constant GL.GL_LIST_MODE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_LOAD

    `constant GL.GL_LOAD`

  Description

    Used in glAccum

  Constant GL_LOGIC_OP

    `constant GL.GL_LOGIC_OP`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_LOGIC_OP_MODE

    `constant GL.GL_LOGIC_OP_MODE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_LUMINANCE

    `constant GL.GL_LUMINANCE`

  Description

    Used in glTexEnv , glDrawPixels , glCopyTexImage1D , glTexSubImage2D , glGetTexImage , glReadPixels , glCopyTexImage2D , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_LUMINANCE12

    `constant GL.GL_LUMINANCE12`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE12_ALPHA12

    `constant GL.GL_LUMINANCE12_ALPHA12`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE12_ALPHA4

    `constant GL.GL_LUMINANCE12_ALPHA4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE16

    `constant GL.GL_LUMINANCE16`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE16_ALPHA16

    `constant GL.GL_LUMINANCE16_ALPHA16`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE4

    `constant GL.GL_LUMINANCE4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE4_ALPHA4

    `constant GL.GL_LUMINANCE4_ALPHA4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE6_ALPHA2

    `constant GL.GL_LUMINANCE6_ALPHA2`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE8

    `constant GL.GL_LUMINANCE8`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE8_ALPHA8

    `constant GL.GL_LUMINANCE8_ALPHA8`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_LUMINANCE_ALPHA

    `constant GL.GL_LUMINANCE_ALPHA`

  Description

    Used in glDrawPixels , glCopyTexImage1D , glTexSubImage2D , glGetTexImage , glReadPixels , glCopyTexImage2D , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_MAP1_COLOR_4

    `constant GL.GL_MAP1_COLOR_4`

  Description

    Used in glIsEnabled , glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_GRID_DOMAIN

    `constant GL.GL_MAP1_GRID_DOMAIN`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAP1_GRID_SEGMENTS

    `constant GL.GL_MAP1_GRID_SEGMENTS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAP1_INDEX

    `constant GL.GL_MAP1_INDEX`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_NORMAL

    `constant GL.GL_MAP1_NORMAL`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_TEXTURE_COORD_1

    `constant GL.GL_MAP1_TEXTURE_COORD_1`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_TEXTURE_COORD_2

    `constant GL.GL_MAP1_TEXTURE_COORD_2`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_TEXTURE_COORD_3

    `constant GL.GL_MAP1_TEXTURE_COORD_3`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_TEXTURE_COORD_4

    `constant GL.GL_MAP1_TEXTURE_COORD_4`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_VERTEX_3

    `constant GL.GL_MAP1_VERTEX_3`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP1_VERTEX_4

    `constant GL.GL_MAP1_VERTEX_4`

  Description

    Used in glMap1 , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_COLOR_4

    `constant GL.GL_MAP2_COLOR_4`

  Description

    Used in glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_GRID_DOMAIN

    `constant GL.GL_MAP2_GRID_DOMAIN`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAP2_GRID_SEGMENTS

    `constant GL.GL_MAP2_GRID_SEGMENTS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAP2_INDEX

    `constant GL.GL_MAP2_INDEX`

  Description

    Used in glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_NORMAL

    `constant GL.GL_MAP2_NORMAL`

  Description

    Used in glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_TEXTURE_COORD_1

    `constant GL.GL_MAP2_TEXTURE_COORD_1`

  Description

    Used in glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_TEXTURE_COORD_2

    `constant GL.GL_MAP2_TEXTURE_COORD_2`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_TEXTURE_COORD_3

    `constant GL.GL_MAP2_TEXTURE_COORD_3`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_TEXTURE_COORD_4

    `constant GL.GL_MAP2_TEXTURE_COORD_4`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_VERTEX_3

    `constant GL.GL_MAP2_VERTEX_3`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP2_VERTEX_4

    `constant GL.GL_MAP2_VERTEX_4`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glMap2 , glEnable , glGetBooleanv , glGetFloatv , glGetMap , glGetDoublev and glEvalCoord

  Constant GL_MAP_COLOR

    `constant GL.GL_MAP_COLOR`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels and glCopyPixels

  Constant GL_MAP_STENCIL

    `constant GL.GL_MAP_STENCIL`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels and glCopyPixels

  Constant GL_MATRIX_MODE

    `constant GL.GL_MATRIX_MODE`

  Description

    Used in glMatrixMode , glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_MAX_3D_TEXTURE_SIZE_EXT

    `constant GL.GL_MAX_3D_TEXTURE_SIZE_EXT`

  Constant GL_MAX_ATTRIB_STACK_DEPTH

    `constant GL.GL_MAX_ATTRIB_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_CLIENT_ATTRIB_STACK_DEPTH

    `constant GL.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_CLIP_PLANES

    `constant GL.GL_MAX_CLIP_PLANES`

  Description

    Used in glGetIntegerv , glGetClipPlane , glClipPlane , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_CONVOLUTION_HEIGHT_EXT

    `constant GL.GL_MAX_CONVOLUTION_HEIGHT_EXT`

  Constant GL_MAX_CONVOLUTION_WIDTH_EXT

    `constant GL.GL_MAX_CONVOLUTION_WIDTH_EXT`

  Constant GL_MAX_EVAL_ORDER

    `constant GL.GL_MAX_EVAL_ORDER`

  Description

    Used in glMap1 , glGetIntegerv , glMap2 , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_EXT

    `constant GL.GL_MAX_EXT`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_LIGHTS

    `constant GL.GL_MAX_LIGHTS`

  Description

    Used in glGetIntegerv , glGetLight , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glLight

  Constant GL_MAX_LIST_NESTING

    `constant GL.GL_MAX_LIST_NESTING`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_MODELVIEW_STACK_DEPTH

    `constant GL.GL_MAX_MODELVIEW_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_NAME_STACK_DEPTH

    `constant GL.GL_MAX_NAME_STACK_DEPTH`

  Description

    Used in glPushName , glGetIntegerv , glPopName , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_PIXEL_MAP_TABLE

    `constant GL.GL_MAX_PIXEL_MAP_TABLE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glPixelMap , glGetFloatv and glGetDoublev

  Constant GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT

    `constant GL.GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT`

  Constant GL_MAX_PROJECTION_STACK_DEPTH

    `constant GL.GL_MAX_PROJECTION_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_TEXTURE_SIZE

    `constant GL.GL_MAX_TEXTURE_SIZE`

  Description

    Used in glGetTexLevelParameter , glGetIntegerv , glCopyTexSubImage2D , glCopyTexImage1D , glTexSubImage2D , glGetBooleanv , glGetTexImage , glGetFloatv , glGetDoublev , glCopyTexImage2D , glTexImage2D , glTexSubImage1D , glTexImage1D and glCopyTexSubImage1D

  Constant GL_MAX_TEXTURE_STACK_DEPTH

    `constant GL.GL_MAX_TEXTURE_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MAX_VIEWPORT_DIMS

    `constant GL.GL_MAX_VIEWPORT_DIMS`

  Description

    Used in glGetIntegerv , glViewport , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MINMAX_EXT

    `constant GL.GL_MINMAX_EXT`

  Constant GL_MINMAX_FORMAT_EXT

    `constant GL.GL_MINMAX_FORMAT_EXT`

  Constant GL_MINMAX_SINK_EXT

    `constant GL.GL_MINMAX_SINK_EXT`

  Constant GL_MIN_EXT

    `constant GL.GL_MIN_EXT`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MODELVIEW

    `constant GL.GL_MODELVIEW`

  Description

    Used in glPushMatrix , glMatrixMode , glGetIntegerv , glGetBooleanv , glTranslate , glGetFloatv , glGetDoublev , glRotate , glScale and glPopMatrix

  Constant GL_MODELVIEW_MATRIX

    `constant GL.GL_MODELVIEW_MATRIX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MODELVIEW_STACK_DEPTH

    `constant GL.GL_MODELVIEW_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_MODULATE

    `constant GL.GL_MODULATE`

  Description

    Used in glTexEnv and glGetTexEnv

  Constant GL_MULT

    `constant GL.GL_MULT`

  Description

    Used in glAccum

  Constant GL_N3F_V3F

    `constant GL.GL_N3F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_NAME_STACK_DEPTH

    `constant GL.GL_NAME_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_NAND

    `constant GL.GL_NAND`

  Description

    Used in glLogicOp

  Constant GL_NEAREST

    `constant GL.GL_NEAREST`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_NEAREST_MIPMAP_LINEAR

    `constant GL.GL_NEAREST_MIPMAP_LINEAR`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_NEAREST_MIPMAP_NEAREST

    `constant GL.GL_NEAREST_MIPMAP_NEAREST`

  Description

    Used in glTexParameter

  Constant GL_NEVER

    `constant GL.GL_NEVER`

  Description

    Used in glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_NICEST

    `constant GL.GL_NICEST`

  Description

    Used in glHint

  Constant GL_NONE

    `constant GL.GL_NONE`

  Description

    Used in glDrawBuffer

  Constant GL_NOOP

    `constant GL.GL_NOOP`

  Description

    Used in glLogicOp

  Constant GL_NOR

    `constant GL.GL_NOR`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glNormalPointer , glPopAttrib , glEnable , glEnableClientState , glGetPointerv , glLogicOp , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glNormal and glDisableClientState

  Constant GL_NORMALIZE

    `constant GL.GL_NORMALIZE`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glNormal

  Constant GL_NORMAL_ARRAY

    `constant GL.GL_NORMAL_ARRAY`

  Description

    Used in glIsEnabled , glGetIntegerv , glNormalPointer , glEnableClientState , glGetPointerv , glGetBooleanv , glGetFloatv , glGetDoublev and glDisableClientState

  Constant GL_NORMAL_ARRAY_POINTER

    `constant GL.GL_NORMAL_ARRAY_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_NORMAL_ARRAY_STRIDE

    `constant GL.GL_NORMAL_ARRAY_STRIDE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_NORMAL_ARRAY_TYPE

    `constant GL.GL_NORMAL_ARRAY_TYPE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_NOTEQUAL

    `constant GL.GL_NOTEQUAL`

  Description

    Used in glAlphaFunc , glDepthFunc and glStencilFunc

  Constant GL_NO_ERROR

    `constant GL.GL_NO_ERROR`

  Description

    Used in glGetError

  Constant GL_OBJECT_LINEAR

    `constant GL.GL_OBJECT_LINEAR`

  Description

    Used in glTexGen

  Constant GL_OBJECT_PLANE

    `constant GL.GL_OBJECT_PLANE`

  Description

    Used in glGetTexGen and glTexGen

  Constant GL_OCCLUSION_RESULT_HP

    `constant GL.GL_OCCLUSION_RESULT_HP`

  Constant GL_OCCLUSION_TEST_HP

    `constant GL.GL_OCCLUSION_TEST_HP`

  Constant GL_ONE

    `constant GL.GL_ONE`

  Description

    Used in glGetIntegerv , glBlendFunc , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_ONE_MINUS_CONSTANT_ALPHA_EXT

    `constant GL.GL_ONE_MINUS_CONSTANT_ALPHA_EXT`

  Constant GL_ONE_MINUS_CONSTANT_COLOR_EXT

    `constant GL.GL_ONE_MINUS_CONSTANT_COLOR_EXT`

  Constant GL_ONE_MINUS_DST_ALPHA

    `constant GL.GL_ONE_MINUS_DST_ALPHA`

  Description

    Used in glBlendFunc

  Constant GL_ONE_MINUS_DST_COLOR

    `constant GL.GL_ONE_MINUS_DST_COLOR`

  Description

    Used in glBlendFunc

  Constant GL_ONE_MINUS_SRC_ALPHA

    `constant GL.GL_ONE_MINUS_SRC_ALPHA`

  Description

    Used in glBlendFunc

  Constant GL_ONE_MINUS_SRC_COLOR

    `constant GL.GL_ONE_MINUS_SRC_COLOR`

  Description

    Used in glBlendFunc

  Constant GL_OR

    `constant GL.GL_OR`

  Description

    Used in glLogicOp and glGetMap

  Constant GL_ORDER

    `constant GL.GL_ORDER`

  Description

    Used in glGetMap

  Constant GL_OR_INVERTED

    `constant GL.GL_OR_INVERTED`

  Description

    Used in glLogicOp

  Constant GL_OR_REVERSE

    `constant GL.GL_OR_REVERSE`

  Description

    Used in glLogicOp

  Constant GL_OUT_OF_MEMORY

    `constant GL.GL_OUT_OF_MEMORY`

  Description

    Used in glGetError , glNewList and glEndList

  Constant GL_PACK_ALIGNMENT

    `constant GL.GL_PACK_ALIGNMENT`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetTexImage , glGetFloatv and glGetDoublev

  Constant GL_PACK_IMAGE_HEIGHT_EXT

    `constant GL.GL_PACK_IMAGE_HEIGHT_EXT`

  Constant GL_PACK_LSB_FIRST

    `constant GL.GL_PACK_LSB_FIRST`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glReadPixels

  Constant GL_PACK_ROW_LENGTH

    `constant GL.GL_PACK_ROW_LENGTH`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PACK_SKIP_IMAGES_EXT

    `constant GL.GL_PACK_SKIP_IMAGES_EXT`

  Constant GL_PACK_SKIP_PIXELS

    `constant GL.GL_PACK_SKIP_PIXELS`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PACK_SKIP_ROWS

    `constant GL.GL_PACK_SKIP_ROWS`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PACK_SWAP_BYTES

    `constant GL.GL_PACK_SWAP_BYTES`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glReadPixels

  Constant GL_PASS_THROUGH_TOKEN

    `constant GL.GL_PASS_THROUGH_TOKEN`

  Description

    Used in glPassThrough and glFeedbackBuffer

  Constant GL_PERSPECTIVE_CORRECTION_HINT

    `constant GL.GL_PERSPECTIVE_CORRECTION_HINT`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_PIXEL_CUBIC_WEIGHT_EXT

    `constant GL.GL_PIXEL_CUBIC_WEIGHT_EXT`

  Constant GL_PIXEL_MAG_FILTER_EXT

    `constant GL.GL_PIXEL_MAG_FILTER_EXT`

  Constant GL_PIXEL_MAP_A_TO_A

    `constant GL.GL_PIXEL_MAP_A_TO_A`

  Description

    Used in glGetIntegerv , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_A_TO_A_SIZE

    `constant GL.GL_PIXEL_MAP_A_TO_A_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_B_TO_B

    `constant GL.GL_PIXEL_MAP_B_TO_B`

  Description

    Used in glGetIntegerv , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_B_TO_B_SIZE

    `constant GL.GL_PIXEL_MAP_B_TO_B_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_G_TO_G

    `constant GL.GL_PIXEL_MAP_G_TO_G`

  Description

    Used in glGetIntegerv , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_G_TO_G_SIZE

    `constant GL.GL_PIXEL_MAP_G_TO_G_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_I_TO_A

    `constant GL.GL_PIXEL_MAP_I_TO_A`

  Description

    Used in glGetIntegerv , glDrawPixels , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D and glTexImage1D

  Constant GL_PIXEL_MAP_I_TO_A_SIZE

    `constant GL.GL_PIXEL_MAP_I_TO_A_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_I_TO_B

    `constant GL.GL_PIXEL_MAP_I_TO_B`

  Description

    Used in glGetIntegerv , glDrawPixels , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D and glTexImage1D

  Constant GL_PIXEL_MAP_I_TO_B_SIZE

    `constant GL.GL_PIXEL_MAP_I_TO_B_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_I_TO_G

    `constant GL.GL_PIXEL_MAP_I_TO_G`

  Description

    Used in glGetIntegerv , glDrawPixels , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D and glTexImage1D

  Constant GL_PIXEL_MAP_I_TO_G_SIZE

    `constant GL.GL_PIXEL_MAP_I_TO_G_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_I_TO_I

    `constant GL.GL_PIXEL_MAP_I_TO_I`

  Description

    Used in glGetIntegerv , glDrawPixels , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv , glGetDoublev , glReadPixels and glCopyPixels

  Constant GL_PIXEL_MAP_I_TO_I_SIZE

    `constant GL.GL_PIXEL_MAP_I_TO_I_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_I_TO_R

    `constant GL.GL_PIXEL_MAP_I_TO_R`

  Description

    Used in glGetIntegerv , glDrawPixels , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D and glTexImage1D

  Constant GL_PIXEL_MAP_I_TO_R_SIZE

    `constant GL.GL_PIXEL_MAP_I_TO_R_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_R_TO_R

    `constant GL.GL_PIXEL_MAP_R_TO_R`

  Description

    Used in glGetIntegerv , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_R_TO_R_SIZE

    `constant GL.GL_PIXEL_MAP_R_TO_R_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MAP_S_TO_S

    `constant GL.GL_PIXEL_MAP_S_TO_S`

  Description

    Used in glGetIntegerv , glDrawPixels , glGetPixelMap , glPixelTransfer , glGetBooleanv , glPixelMap , glGetFloatv , glGetDoublev , glReadPixels and glCopyPixels

  Constant GL_PIXEL_MAP_S_TO_S_SIZE

    `constant GL.GL_PIXEL_MAP_S_TO_S_SIZE`

  Description

    Used in glGetIntegerv , glPixelTransfer , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PIXEL_MIN_FILTER_EXT

    `constant GL.GL_PIXEL_MIN_FILTER_EXT`

  Constant GL_PIXEL_MODE_BIT

    `constant GL.GL_PIXEL_MODE_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_PIXEL_TRANSFORM_2D_EXT

    `constant GL.GL_PIXEL_TRANSFORM_2D_EXT`

  Constant GL_PIXEL_TRANSFORM_2D_MATRIX_EXT

    `constant GL.GL_PIXEL_TRANSFORM_2D_MATRIX_EXT`

  Constant GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT

    `constant GL.GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT`

  Constant GL_PIXEL_TRANSFORM_COLOR_TABLE_EXT

    `constant GL.GL_PIXEL_TRANSFORM_COLOR_TABLE_EXT`

  Constant GL_POINT

    `constant GL.GL_POINT`

  Description

    Used in glIsEnabled , glGetIntegerv , glEnd , glDrawElements , glDrawArrays , glDisable , glEdgeFlag , glPopAttrib , glEnable , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glFeedbackBuffer , glBegin , glHint , glEdgeFlagv , glPointSize and glEvalMesh

  Constant GL_POINTS

    `constant GL.GL_POINTS`

  Description

    Used in glEnd , glDrawElements , glDrawArrays , glBegin and glEvalMesh

  Constant GL_POINT_BIT

    `constant GL.GL_POINT_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_POINT_SIZE

    `constant GL.GL_POINT_SIZE`

  Description

    Used in glGetIntegerv , glPolygonMode , glGetBooleanv , glGetFloatv , glGetDoublev and glPointSize

  Constant GL_POINT_SIZE_GRANULARITY

    `constant GL.GL_POINT_SIZE_GRANULARITY`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glPointSize

  Constant GL_POINT_SIZE_RANGE

    `constant GL.GL_POINT_SIZE_RANGE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glPointSize

  Constant GL_POINT_SMOOTH

    `constant GL.GL_POINT_SMOOTH`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glHint and glPointSize

  Constant GL_POINT_SMOOTH_HINT

    `constant GL.GL_POINT_SMOOTH_HINT`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_POINT_TOKEN

    `constant GL.GL_POINT_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_POLYGON

    `constant GL.GL_POLYGON`

  Description

    Used in glPolygonOffset , glIsEnabled , glGetIntegerv , glEnd , glDrawElements , glDrawArrays , glDisable , glEdgeFlag , glPopAttrib , glEnable , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glRect , glFeedbackBuffer , glBegin , glHint , glEdgeFlagv and glPolygonStipple

  Constant GL_POLYGON_BIT

    `constant GL.GL_POLYGON_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_POLYGON_MODE

    `constant GL.GL_POLYGON_MODE`

  Description

    Used in glGetIntegerv , glEdgeFlag , glPopAttrib , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glEdgeFlagv

  Constant GL_POLYGON_OFFSET_FACTOR

    `constant GL.GL_POLYGON_OFFSET_FACTOR`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_POLYGON_OFFSET_FILL

    `constant GL.GL_POLYGON_OFFSET_FILL`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_POLYGON_OFFSET_LINE

    `constant GL.GL_POLYGON_OFFSET_LINE`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_POLYGON_OFFSET_POINT

    `constant GL.GL_POLYGON_OFFSET_POINT`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_POLYGON_OFFSET_UNITS

    `constant GL.GL_POLYGON_OFFSET_UNITS`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_POLYGON_SMOOTH

    `constant GL.GL_POLYGON_SMOOTH`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_POLYGON_SMOOTH_HINT

    `constant GL.GL_POLYGON_SMOOTH_HINT`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glHint

  Constant GL_POLYGON_STIPPLE

    `constant GL.GL_POLYGON_STIPPLE`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glPolygonMode , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glPolygonStipple

  Constant GL_POLYGON_STIPPLE_BIT

    `constant GL.GL_POLYGON_STIPPLE_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_POLYGON_TOKEN

    `constant GL.GL_POLYGON_TOKEN`

  Description

    Used in glFeedbackBuffer

  Constant GL_POSITION

    `constant GL.GL_POSITION`

  Description

    Used in glGetLight and glLight

  Constant GL_POST_CONVOLUTION_ALPHA_BIAS_EXT

    `constant GL.GL_POST_CONVOLUTION_ALPHA_BIAS_EXT`

  Constant GL_POST_CONVOLUTION_ALPHA_SCALE_EXT

    `constant GL.GL_POST_CONVOLUTION_ALPHA_SCALE_EXT`

  Constant GL_POST_CONVOLUTION_BLUE_BIAS_EXT

    `constant GL.GL_POST_CONVOLUTION_BLUE_BIAS_EXT`

  Constant GL_POST_CONVOLUTION_BLUE_SCALE_EXT

    `constant GL.GL_POST_CONVOLUTION_BLUE_SCALE_EXT`

  Constant GL_POST_CONVOLUTION_COLOR_TABLE_SGI

    `constant GL.GL_POST_CONVOLUTION_COLOR_TABLE_SGI`

  Constant GL_POST_CONVOLUTION_GREEN_BIAS_EXT

    `constant GL.GL_POST_CONVOLUTION_GREEN_BIAS_EXT`

  Constant GL_POST_CONVOLUTION_GREEN_SCALE_EXT

    `constant GL.GL_POST_CONVOLUTION_GREEN_SCALE_EXT`

  Constant GL_POST_CONVOLUTION_RED_BIAS_EXT

    `constant GL.GL_POST_CONVOLUTION_RED_BIAS_EXT`

  Constant GL_POST_CONVOLUTION_RED_SCALE_EXT

    `constant GL.GL_POST_CONVOLUTION_RED_SCALE_EXT`

  Constant GL_PROJECTION

    `constant GL.GL_PROJECTION`

  Description

    Used in glPushMatrix , glMatrixMode , glFrustum , glGetIntegerv , glGetBooleanv , glTranslate , glGetFloatv , glGetDoublev , glRotate , glScale , glOrtho and glPopMatrix

  Constant GL_PROJECTION_MATRIX

    `constant GL.GL_PROJECTION_MATRIX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PROJECTION_STACK_DEPTH

    `constant GL.GL_PROJECTION_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_PROXY_COLOR_TABLE_SGI

    `constant GL.GL_PROXY_COLOR_TABLE_SGI`

  Constant GL_PROXY_HISTOGRAM_EXT

    `constant GL.GL_PROXY_HISTOGRAM_EXT`

  Constant GL_PROXY_PIXEL_TRANSFORM_COLOR_TABLE_EXT

    `constant GL.GL_PROXY_PIXEL_TRANSFORM_COLOR_TABLE_EXT`

  Constant GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI

    `constant GL.GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI`

  Constant GL_PROXY_TEXTURE_1D

    `constant GL.GL_PROXY_TEXTURE_1D`

  Description

    Used in glGetTexLevelParameter , glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev , glNewList , glEndList and glTexImage1D

  Constant GL_PROXY_TEXTURE_2D

    `constant GL.GL_PROXY_TEXTURE_2D`

  Description

    Used in glGetTexLevelParameter , glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev , glNewList , glTexImage2D and glEndList

  Constant GL_PROXY_TEXTURE_3D_EXT

    `constant GL.GL_PROXY_TEXTURE_3D_EXT`

  Constant GL_PROXY_TEXTURE_COLOR_TABLE_SGI

    `constant GL.GL_PROXY_TEXTURE_COLOR_TABLE_SGI`

  Constant GL_Q

    `constant GL.GL_Q`

  Description

    Used in glGetTexGen , glEnd , glDrawElements , glDrawArrays , glGetLight , glBegin , glLight , glEvalMesh and glTexGen

  Constant GL_QUADRATIC_ATTENUATION

    `constant GL.GL_QUADRATIC_ATTENUATION`

  Description

    Used in glGetLight and glLight

  Constant GL_QUADS

    `constant GL.GL_QUADS`

  Description

    Used in glEnd , glDrawElements , glDrawArrays and glBegin

  Constant GL_QUAD_STRIP

    `constant GL.GL_QUAD_STRIP`

  Description

    Used in glEnd , glDrawElements , glDrawArrays , glBegin and glEvalMesh

  Constant GL_R

    `constant GL.GL_R`

  Description

    Used in glPixelStore , glTexEnv , glRenderMode , glGetTexGen , glGetIntegerv , glCopyTexSubImage2D , glDrawPixels , glCopyTexImage1D , glTexSubImage2D , glPopAttrib , glPixelTransfer , glGetTexParameter , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glAccum , glReadBuffer , glGetDoublev , glReadPixels , glCopyTexImage2D , glTexImage2D , glStencilOp , glGetString , glTexParameter , glTexSubImage1D , glDrawBuffer , glTexImage1D , glCopyTexSubImage1D and glTexGen

  Constant GL_R3_G3_B2

    `constant GL.GL_R3_G3_B2`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_READ_BUFFER

    `constant GL.GL_READ_BUFFER`

  Description

    Used in glGetIntegerv , glCopyTexSubImage2D , glCopyTexImage1D , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glCopyTexImage2D and glCopyTexSubImage1D

  Constant GL_RED

    `constant GL.GL_RED`

  Description

    Used in glGetIntegerv , glDrawPixels , glTexSubImage2D , glPopAttrib , glPixelTransfer , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_REDUCE_EXT

    `constant GL.GL_REDUCE_EXT`

  Constant GL_RED_BIAS

    `constant GL.GL_RED_BIAS`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_RED_BITS

    `constant GL.GL_RED_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_RED_SCALE

    `constant GL.GL_RED_SCALE`

  Description

    Used in glGetIntegerv , glPopAttrib , glPixelTransfer , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_RENDER

    `constant GL.GL_RENDER`

  Description

    Used in glRenderMode , glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glGetString

  Constant GL_RENDERER

    `constant GL.GL_RENDERER`

  Description

    Used in glGetString

  Constant GL_RENDER_MODE

    `constant GL.GL_RENDER_MODE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_REPEAT

    `constant GL.GL_REPEAT`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_REPLACE

    `constant GL.GL_REPLACE`

  Description

    Used in glTexEnv and glStencilOp

  Constant GL_REPLICATE_BORDER_HP

    `constant GL.GL_REPLICATE_BORDER_HP`

  Constant GL_RESCALE_NORMAL_EXT

    `constant GL.GL_RESCALE_NORMAL_EXT`

  Constant GL_RETURN

    `constant GL.GL_RETURN`

  Description

    Used in glAccum

  Constant GL_RGB

    `constant GL.GL_RGB`

  Description

    Used in glPixelStore , glTexEnv , glGetIntegerv , glDrawPixels , glCopyTexImage1D , glTexSubImage2D , glGetBooleanv , glGetTexImage , glGetFloatv , glGetDoublev , glReadPixels , glCopyTexImage2D , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_RGB10

    `constant GL.GL_RGB10`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB10_A2

    `constant GL.GL_RGB10_A2`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB12

    `constant GL.GL_RGB12`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB16

    `constant GL.GL_RGB16`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB4

    `constant GL.GL_RGB4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB5

    `constant GL.GL_RGB5`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB5_A1

    `constant GL.GL_RGB5_A1`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGB8

    `constant GL.GL_RGB8`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGBA

    `constant GL.GL_RGBA`

  Description

    Used in glTexEnv , glGetIntegerv , glDrawPixels , glCopyTexImage1D , glTexSubImage2D , glGetBooleanv , glGetTexImage , glGetFloatv , glGetDoublev , glReadPixels , glCopyTexImage2D , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_RGBA12

    `constant GL.GL_RGBA12`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGBA16

    `constant GL.GL_RGBA16`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGBA2

    `constant GL.GL_RGBA2`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGBA4

    `constant GL.GL_RGBA4`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGBA8

    `constant GL.GL_RGBA8`

  Description

    Used in glCopyTexImage1D , glCopyTexImage2D , glTexImage2D and glTexImage1D

  Constant GL_RGBA_MODE

    `constant GL.GL_RGBA_MODE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_RIGHT

    `constant GL.GL_RIGHT`

  Description

    Used in glReadBuffer and glDrawBuffer

  Constant GL_S

    `constant GL.GL_S`

  Description

    Used in glPushMatrix , glLoadName , glIsEnabled , glPushName , glRenderMode , glGetTexGen , glGetIntegerv , glColorMaterial , glGetError , glDrawPixels , glBlendFunc , glVertexPointer , glSelectBuffer , glGetLight , glInitNames , glDisable , glColorPointer , glTexSubImage2D , glNormalPointer , glPopAttrib , glEnable , glGetPointerv , glPopName , glLogicOp , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glMaterial , glGetDoublev , glCallLists , glShadeModel , glReadPixels , glTexImage2D , glLight , glPopClientAttrib , glStencilOp , glTexCoordPointer , glCopyPixels , glIndexPointer , glPushClientAttrib , glScissor , glTexSubImage1D , glTexImage1D , glStencilFunc , glGetMaterial , glClear , glPopMatrix and glTexGen

  Constant GL_SCISSOR_BIT

    `constant GL.GL_SCISSOR_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_SCISSOR_BOX

    `constant GL.GL_SCISSOR_BOX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_SCISSOR_TEST

    `constant GL.GL_SCISSOR_TEST`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glScissor

  Constant GL_SELECT

    `constant GL.GL_SELECT`

  Description

    Used in glLoadName , glPushName , glRenderMode , glSelectBuffer , glInitNames , glGetPointerv and glPopName

  Constant GL_SELECTION_BUFFER_POINTER

    `constant GL.GL_SELECTION_BUFFER_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_SELECTION_BUFFER_SIZE

    `constant GL.GL_SELECTION_BUFFER_SIZE`

  Constant GL_SEPARABLE_2D_EXT

    `constant GL.GL_SEPARABLE_2D_EXT`

  Constant GL_SET

    `constant GL.GL_SET`

  Description

    Used in glLogicOp

  Constant GL_SGI_color_table

    `constant GL.GL_SGI_color_table`

  Constant GL_SGI_texture_color_table

    `constant GL.GL_SGI_texture_color_table`

  Constant GL_SHADE_MODEL

    `constant GL.GL_SHADE_MODEL`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_SHININESS

    `constant GL.GL_SHININESS`

  Description

    Used in glMaterial and glGetMaterial

  Constant GL_SHORT

    `constant GL.GL_SHORT`

  Description

    Used in glDrawPixels , glVertexPointer , glColorPointer , glTexSubImage2D , glNormalPointer , glGetTexImage , glCallLists , glReadPixels , glTexImage2D , glTexCoordPointer , glIndexPointer , glTexSubImage1D and glTexImage1D

  Constant GL_SMOOTH

    `constant GL.GL_SMOOTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glShadeModel

  Constant GL_SPECULAR

    `constant GL.GL_SPECULAR`

  Description

    Used in glColorMaterial , glGetLight , glMaterial , glLight and glGetMaterial

  Constant GL_SPHERE_MAP

    `constant GL.GL_SPHERE_MAP`

  Description

    Used in glTexGen

  Constant GL_SPOT_CUTOFF

    `constant GL.GL_SPOT_CUTOFF`

  Description

    Used in glGetLight and glLight

  Constant GL_SPOT_DIRECTION

    `constant GL.GL_SPOT_DIRECTION`

  Description

    Used in glGetLight and glLight

  Constant GL_SPOT_EXPONENT

    `constant GL.GL_SPOT_EXPONENT`

  Description

    Used in glGetLight and glLight

  Constant GL_SRC_ALPHA

    `constant GL.GL_SRC_ALPHA`

  Description

    Used in glBlendFunc

  Constant GL_SRC_ALPHA_SATURATE

    `constant GL.GL_SRC_ALPHA_SATURATE`

  Description

    Used in glBlendFunc

  Constant GL_SRC_COLOR

    `constant GL.GL_SRC_COLOR`

  Description

    Used in glBlendFunc

  Constant GL_STACK_OVERFLOW

    `constant GL.GL_STACK_OVERFLOW`

  Description

    Used in glPushMatrix , glPushName , glGetError , glPopAttrib , glPopName , glPushAttrib , glPopClientAttrib , glPushClientAttrib and glPopMatrix

  Constant GL_STACK_UNDERFLOW

    `constant GL.GL_STACK_UNDERFLOW`

  Description

    Used in glPushMatrix , glPushName , glGetError , glPopAttrib , glPopName , glPushAttrib , glPopClientAttrib , glPushClientAttrib and glPopMatrix

  Constant GL_STENCIL

    `constant GL.GL_STENCIL`

  Description

    Used in glIsEnabled , glGetIntegerv , glDrawPixels , glDisable , glPopAttrib , glEnable , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glReadPixels , glTexImage2D , glStencilOp , glCopyPixels , glTexImage1D , glStencilFunc and glClear

  Constant GL_STENCIL_BITS

    `constant GL.GL_STENCIL_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glStencilOp

  Constant GL_STENCIL_BUFFER_BIT

    `constant GL.GL_STENCIL_BUFFER_BIT`

  Description

    Used in glPopAttrib , glPushAttrib and glClear

  Constant GL_STENCIL_CLEAR_VALUE

    `constant GL.GL_STENCIL_CLEAR_VALUE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_FAIL

    `constant GL.GL_STENCIL_FAIL`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_FUNC

    `constant GL.GL_STENCIL_FUNC`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_INDEX

    `constant GL.GL_STENCIL_INDEX`

  Description

    Used in glDrawPixels , glGetTexImage , glReadPixels , glTexImage2D and glTexImage1D

  Constant GL_STENCIL_PASS_DEPTH_FAIL

    `constant GL.GL_STENCIL_PASS_DEPTH_FAIL`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_PASS_DEPTH_PASS

    `constant GL.GL_STENCIL_PASS_DEPTH_PASS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_REF

    `constant GL.GL_STENCIL_REF`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_TEST

    `constant GL.GL_STENCIL_TEST`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glPopAttrib , glEnable , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev , glStencilOp and glStencilFunc

  Constant GL_STENCIL_VALUE_MASK

    `constant GL.GL_STENCIL_VALUE_MASK`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STENCIL_WRITEMASK

    `constant GL.GL_STENCIL_WRITEMASK`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_STEREO

    `constant GL.GL_STEREO`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_SUBPIXEL_BITS

    `constant GL.GL_SUBPIXEL_BITS`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_SUNX_geometry_compression

    `constant GL.GL_SUNX_geometry_compression`

  Constant GL_SUNX_surface_hint

    `constant GL.GL_SUNX_surface_hint`

  Constant GL_SUN_convolution_border_modes

    `constant GL.GL_SUN_convolution_border_modes`

  Constant GL_SUN_multi_draw_arrays

    `constant GL.GL_SUN_multi_draw_arrays`

  Constant GL_SURFACE_SIZE_HINT_SUNX

    `constant GL.GL_SURFACE_SIZE_HINT_SUNX`

  Constant GL_T

    `constant GL.GL_T`

  Description

    Used in glPushMatrix , glMatrixMode , glIsEnabled , glGetTexLevelParameter , glTexEnv , glIsList , glAreTexturesResident , glGetTexGen , glGetIntegerv , glEnd , glIsTexture , glDrawElements , glDrawArrays , glCopyTexSubImage2D , glBindTexture , glDisable , glCopyTexImage1D , glTexSubImage2D , glEdgeFlag , glPopAttrib , glEnable , glColorMask , glEnableClientState , glGetPointerv , glGetTexParameter , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glInterleavedArrays , glReadPixels , glCopyTexImage2D , glTexImage2D , glGetTexEnv , glBegin , glTexCoordPointer , glTexParameter , glDisableClientState , glTexSubImage1D , glEdgeFlagv , glTexImage1D , glCopyTexSubImage1D , glPopMatrix and glTexGen

  Constant GL_T2F_C3F_V3F

    `constant GL.GL_T2F_C3F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_T2F_C4F_N3F_V3F

    `constant GL.GL_T2F_C4F_N3F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_T2F_C4UB_V3F

    `constant GL.GL_T2F_C4UB_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_T2F_N3F_V3F

    `constant GL.GL_T2F_N3F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_T2F_V3F

    `constant GL.GL_T2F_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_T4F_C4F_N3F_V4F

    `constant GL.GL_T4F_C4F_N3F_V4F`

  Description

    Used in glInterleavedArrays

  Constant GL_T4F_V4F

    `constant GL.GL_T4F_V4F`

  Description

    Used in glInterleavedArrays

  Constant GL_TABLE_TOO_LARGE_EXT

    `constant GL.GL_TABLE_TOO_LARGE_EXT`

  Constant GL_TEXTURE

    `constant GL.GL_TEXTURE`

  Description

    Used in glPushMatrix , glMatrixMode , glIsEnabled , glGetTexLevelParameter , glTexEnv , glAreTexturesResident , glGetTexGen , glGetIntegerv , glCopyTexSubImage2D , glBindTexture , glDisable , glCopyTexImage1D , glTexSubImage2D , glPopAttrib , glEnable , glEnableClientState , glGetPointerv , glGetTexParameter , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glCopyTexImage2D , glTexImage2D , glGetTexEnv , glTexCoordPointer , glTexParameter , glDisableClientState , glTexSubImage1D , glTexImage1D , glCopyTexSubImage1D , glPopMatrix and glTexGen

  Constant GL_TEXTURE_1D

    `constant GL.GL_TEXTURE_1D`

  Description

    Used in glIsEnabled , glGetTexLevelParameter , glGetIntegerv , glBindTexture , glDisable , glCopyTexImage1D , glPopAttrib , glEnable , glGetTexParameter , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glTexParameter , glTexSubImage1D , glTexImage1D and glCopyTexSubImage1D

  Constant GL_TEXTURE_2D

    `constant GL.GL_TEXTURE_2D`

  Description

    Used in glIsEnabled , glGetTexLevelParameter , glGetIntegerv , glCopyTexSubImage2D , glBindTexture , glDisable , glTexSubImage2D , glPopAttrib , glEnable , glGetTexParameter , glGetBooleanv , glGetTexImage , glPushAttrib , glGetFloatv , glGetDoublev , glCopyTexImage2D , glTexImage2D and glTexParameter

  Constant GL_TEXTURE_3D_EXT

    `constant GL.GL_TEXTURE_3D_EXT`

  Constant GL_TEXTURE_ALPHA_SIZE

    `constant GL.GL_TEXTURE_ALPHA_SIZE`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_BINDING_1D

    `constant GL.GL_TEXTURE_BINDING_1D`

  Constant GL_TEXTURE_BINDING_2D

    `constant GL.GL_TEXTURE_BINDING_2D`

  Constant GL_TEXTURE_BIT

    `constant GL.GL_TEXTURE_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_TEXTURE_BLUE_SIZE

    `constant GL.GL_TEXTURE_BLUE_SIZE`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_BORDER

    `constant GL.GL_TEXTURE_BORDER`

  Description

    Used in glGetTexLevelParameter , glCopyTexSubImage2D , glGetTexParameter , glTexParameter , glTexSubImage1D and glCopyTexSubImage1D

  Constant GL_TEXTURE_BORDER_COLOR

    `constant GL.GL_TEXTURE_BORDER_COLOR`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_TEXTURE_COLOR_TABLE_SGI

    `constant GL.GL_TEXTURE_COLOR_TABLE_SGI`

  Constant GL_TEXTURE_COMPONENTS

    `constant GL.GL_TEXTURE_COMPONENTS`

  Constant GL_TEXTURE_COORD_ARRAY

    `constant GL.GL_TEXTURE_COORD_ARRAY`

  Description

    Used in glIsEnabled , glGetIntegerv , glEnableClientState , glGetPointerv , glGetBooleanv , glGetFloatv , glGetDoublev , glTexCoordPointer and glDisableClientState

  Constant GL_TEXTURE_COORD_ARRAY_POINTER

    `constant GL.GL_TEXTURE_COORD_ARRAY_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_TEXTURE_COORD_ARRAY_SIZE

    `constant GL.GL_TEXTURE_COORD_ARRAY_SIZE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_TEXTURE_COORD_ARRAY_STRIDE

    `constant GL.GL_TEXTURE_COORD_ARRAY_STRIDE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_TEXTURE_COORD_ARRAY_TYPE

    `constant GL.GL_TEXTURE_COORD_ARRAY_TYPE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_TEXTURE_DEPTH_EXT

    `constant GL.GL_TEXTURE_DEPTH_EXT`

  Constant GL_TEXTURE_ENV

    `constant GL.GL_TEXTURE_ENV`

  Description

    Used in glTexEnv and glGetTexEnv

  Constant GL_TEXTURE_ENV_COLOR

    `constant GL.GL_TEXTURE_ENV_COLOR`

  Description

    Used in glTexEnv and glGetTexEnv

  Constant GL_TEXTURE_ENV_MODE

    `constant GL.GL_TEXTURE_ENV_MODE`

  Description

    Used in glTexEnv and glGetTexEnv

  Constant GL_TEXTURE_GEN_MODE

    `constant GL.GL_TEXTURE_GEN_MODE`

  Description

    Used in glGetTexGen , glPopAttrib , glPushAttrib and glTexGen

  Constant GL_TEXTURE_GEN_Q

    `constant GL.GL_TEXTURE_GEN_Q`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetDoublev and glTexGen

  Constant GL_TEXTURE_GEN_R

    `constant GL.GL_TEXTURE_GEN_R`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetDoublev and glTexGen

  Constant GL_TEXTURE_GEN_S

    `constant GL.GL_TEXTURE_GEN_S`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetDoublev and glTexGen

  Constant GL_TEXTURE_GEN_T

    `constant GL.GL_TEXTURE_GEN_T`

  Description

    Used in glIsEnabled , glGetIntegerv , glDisable , glEnable , glGetBooleanv , glGetFloatv , glGetDoublev and glTexGen

  Constant GL_TEXTURE_GREEN_SIZE

    `constant GL.GL_TEXTURE_GREEN_SIZE`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_HEIGHT

    `constant GL.GL_TEXTURE_HEIGHT`

  Description

    Used in glGetTexLevelParameter , glCopyTexSubImage2D and glTexSubImage2D

  Constant GL_TEXTURE_INTENSITY_SIZE

    `constant GL.GL_TEXTURE_INTENSITY_SIZE`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_INTERNAL_FORMAT

    `constant GL.GL_TEXTURE_INTERNAL_FORMAT`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_LUMINANCE_SIZE

    `constant GL.GL_TEXTURE_LUMINANCE_SIZE`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_MAG_FILTER

    `constant GL.GL_TEXTURE_MAG_FILTER`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_TEXTURE_MATRIX

    `constant GL.GL_TEXTURE_MATRIX`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_TEXTURE_MIN_FILTER

    `constant GL.GL_TEXTURE_MIN_FILTER`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_TEXTURE_PRIORITY

    `constant GL.GL_TEXTURE_PRIORITY`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_TEXTURE_RED_SIZE

    `constant GL.GL_TEXTURE_RED_SIZE`

  Description

    Used in glGetTexLevelParameter

  Constant GL_TEXTURE_RESIDENT

    `constant GL.GL_TEXTURE_RESIDENT`

  Description

    Used in glAreTexturesResident and glGetTexParameter

  Constant GL_TEXTURE_STACK_DEPTH

    `constant GL.GL_TEXTURE_STACK_DEPTH`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_TEXTURE_WIDTH

    `constant GL.GL_TEXTURE_WIDTH`

  Description

    Used in glGetTexLevelParameter , glCopyTexSubImage2D , glTexSubImage2D , glTexSubImage1D and glCopyTexSubImage1D

  Constant GL_TEXTURE_WRAP_R_EXT

    `constant GL.GL_TEXTURE_WRAP_R_EXT`

  Constant GL_TEXTURE_WRAP_S

    `constant GL.GL_TEXTURE_WRAP_S`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_TEXTURE_WRAP_T

    `constant GL.GL_TEXTURE_WRAP_T`

  Description

    Used in glGetTexParameter and glTexParameter

  Constant GL_TRANSFORM_BIT

    `constant GL.GL_TRANSFORM_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_TRIANGLES

    `constant GL.GL_TRIANGLES`

  Description

    Used in glEnd , glDrawElements , glDrawArrays and glBegin

  Constant GL_TRIANGLE_FAN

    `constant GL.GL_TRIANGLE_FAN`

  Description

    Used in glEnd , glDrawElements , glDrawArrays and glBegin

  Constant GL_TRIANGLE_STRIP

    `constant GL.GL_TRIANGLE_STRIP`

  Description

    Used in glEnd , glDrawElements , glDrawArrays and glBegin

  Constant GL_TRUE

    `constant GL.GL_TRUE`

  Description

    Used in glIsEnabled , glIsList , glAreTexturesResident , glGetIntegerv , glIsTexture , glDisable , glEdgeFlag , glEnable , glColorMask , glGetTexParameter , glGetBooleanv , glGetFloatv , glGetDoublev , glReadPixels and glEdgeFlagv

  Constant GL_UNPACK_ALIGNMENT

    `constant GL.GL_UNPACK_ALIGNMENT`

  Description

    Used in glPixelStore , glGetIntegerv , glDrawPixels , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_UNPACK_IMAGE_HEIGHT_EXT

    `constant GL.GL_UNPACK_IMAGE_HEIGHT_EXT`

  Constant GL_UNPACK_LSB_FIRST

    `constant GL.GL_UNPACK_LSB_FIRST`

  Description

    Used in glPixelStore , glGetIntegerv , glDrawPixels , glGetBooleanv , glGetFloatv , glGetDoublev , glTexImage2D , glTexImage1D and glPolygonStipple

  Constant GL_UNPACK_ROW_LENGTH

    `constant GL.GL_UNPACK_ROW_LENGTH`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_UNPACK_SKIP_IMAGES_EXT

    `constant GL.GL_UNPACK_SKIP_IMAGES_EXT`

  Constant GL_UNPACK_SKIP_PIXELS

    `constant GL.GL_UNPACK_SKIP_PIXELS`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_UNPACK_SKIP_ROWS

    `constant GL.GL_UNPACK_SKIP_ROWS`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_UNPACK_SWAP_BYTES

    `constant GL.GL_UNPACK_SWAP_BYTES`

  Description

    Used in glPixelStore , glGetIntegerv , glGetBooleanv , glGetFloatv , glGetDoublev and glPolygonStipple

  Constant GL_UNSIGNED_BYTE

    `constant GL.GL_UNSIGNED_BYTE`

  Description

    Used in glDrawElements , glDrawPixels , glColorPointer , glTexSubImage2D , glGetTexImage , glCallLists , glReadPixels , glTexImage2D , glIndexPointer , glTexSubImage1D and glTexImage1D

  Constant GL_UNSIGNED_INT

    `constant GL.GL_UNSIGNED_INT`

  Description

    Used in glDrawElements , glDrawPixels , glColorPointer , glTexSubImage2D , glGetTexImage , glCallLists , glReadPixels , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_UNSIGNED_INT_8_8_8_8

    `constant GL.GL_UNSIGNED_INT_8_8_8_8`

  Constant GL_UNSIGNED_INT_8_8_8_8_REV

    `constant GL.GL_UNSIGNED_INT_8_8_8_8_REV`

  Constant GL_UNSIGNED_SHORT

    `constant GL.GL_UNSIGNED_SHORT`

  Description

    Used in glDrawElements , glDrawPixels , glColorPointer , glTexSubImage2D , glGetTexImage , glCallLists , glReadPixels , glTexImage2D , glTexSubImage1D and glTexImage1D

  Constant GL_V2F

    `constant GL.GL_V2F`

  Description

    Used in glInterleavedArrays

  Constant GL_V3F

    `constant GL.GL_V3F`

  Description

    Used in glInterleavedArrays

  Constant GL_VENDOR

    `constant GL.GL_VENDOR`

  Description

    Used in glGetString

  Constant GL_VERSION

    `constant GL.GL_VERSION`

  Description

    Used in glGetString

  Constant GL_VERSION_1_1

    `constant GL.GL_VERSION_1_1`

  Constant GL_VERTEX_ARRAY

    `constant GL.GL_VERTEX_ARRAY`

  Description

    Used in glIsEnabled , glArrayElement , glGetIntegerv , glDrawElements , glDrawArrays , glVertexPointer , glEnableClientState , glGetPointerv , glGetBooleanv , glGetFloatv , glGetDoublev and glDisableClientState

  Constant GL_VERTEX_ARRAY_POINTER

    `constant GL.GL_VERTEX_ARRAY_POINTER`

  Description

    Used in glGetPointerv

  Constant GL_VERTEX_ARRAY_SIZE

    `constant GL.GL_VERTEX_ARRAY_SIZE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_VERTEX_ARRAY_STRIDE

    `constant GL.GL_VERTEX_ARRAY_STRIDE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_VERTEX_ARRAY_TYPE

    `constant GL.GL_VERTEX_ARRAY_TYPE`

  Description

    Used in glGetIntegerv , glGetBooleanv , glGetFloatv and glGetDoublev

  Constant GL_VIEWPORT

    `constant GL.GL_VIEWPORT`

  Description

    Used in glGetIntegerv , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv and glGetDoublev

  Constant GL_VIEWPORT_BIT

    `constant GL.GL_VIEWPORT_BIT`

  Description

    Used in glPopAttrib and glPushAttrib

  Constant GL_WRAP_BORDER_SUN

    `constant GL.GL_WRAP_BORDER_SUN`

  Constant GL_XOR

    `constant GL.GL_XOR`

  Description

    Used in glLogicOp

  Constant GL_ZERO

    `constant GL.GL_ZERO`

  Description

    Used in glGetIntegerv , glBlendFunc , glGetBooleanv , glGetFloatv , glGetDoublev and glStencilOp

  Constant GL_ZOOM_X

    `constant GL.GL_ZOOM_X`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glCopyPixels

  Constant GL_ZOOM_Y

    `constant GL.GL_ZOOM_Y`

  Description

    Used in glGetIntegerv , glDrawPixels , glPopAttrib , glGetBooleanv , glPushAttrib , glGetFloatv , glGetDoublev and glCopyPixels

Module SDL

  Description

    SDL or Simple DirectMedia Layer is a cross-platform multimedia library designed to provide fast access to the graphics framebuffer, audio device, input and other devices. This module implements a wrapper for SDL and other relevant libraries like SDL_mixer. The interface is similar to the C one, but using generally accepted Pike syntax.

    This means that classes are used when appropriate and that method names use all lowercase letters with words separated by _. For example SDL_SetVideoMode is named SDL.set_video_mode. Also note that unless otherwise noted, errors result in an error being thrown rather than returning -1 or 0, as commonly done in SDL methods.

  Method init

    `void init(int flags)`

  Description

    Initializes SDL. This should be called before all other SDL functions.

  Parameter `flags`

    The flags parameter specifies what part(s) of SDL to initialize. It can be one of many of the following ORed together.

    SDL.INIT_TIMER

      Initializes the timer subsystem.

    SDL.INIT_AUDIO

      Initializes the audio subsystem.

    SDL.INIT_VIDEO

      Initializes the video subsystem.

    SDL.INIT_CDROM

      Initializes the cdrom subsystem.

    SDL.INIT_JOYSTICK

      Initializes the joystick subsystem.

    SDL.INIT_EVERYTHING

      Initialize all of the above.

    SDL.INIT_NOPARACHUTE

      Prevents SDL from catching fatal signals.

    SDL.INIT_EVENTTHREAD

      Run event polling in a separate thread. Not always supported.

  See also

    SDL.quit() , SDL.init_sub_system() , SDL.quit_sub_system()

  Method get_error

    `void|string get_error()`

  Description

    Get the last internal SDL error.

  Returns

    The error string, or zero if there was no error.

  Method init_sub_system

    `void init_sub_system(int flags)`

  Description

    After SDL has been initialized with init() you may initialize uninitialized subsystems with this method.

  Parameter `flags`

    The same as what is used in SDL.init() .

  Method init_sub_system

    `void init_sub_system(int flags)`

  Description

    After SDL has been initialized with SDL.init() you may initialize uninitialized subsystems with this method.

  Parameter `flags`

    a bitwise OR'd combination of the subsystems you wish to check (see SDL.init() for a list of subsystem flags).

  See also

    SDL.init() , SDL.quit() , SDL.quit_sub_system()

  Method was_init

    `int was_init(int flags)`

  Description

    This method allows you to see which SDL subsytems have been initialized.

  Parameter `flags`

    a bitwise OR'd combination of the subsystems you wish to check (see SDL.init() for a list of subsystem flags).

  Returns

    a bitwised OR'd combination of the initialized subsystems

  See also

    SDL.init() , SDL.init_sub_system()

  Method quit

    `void quit()`

  Description

    Shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit.

  Note

    You can use the atexit() method to ensure that this method is always called when Pike exits normally.

  See also

    SDL.init() , SDL.init_sub_system() , SDL.quit_sub_system()

  Method enable_unicode

    `int enable_unicode(int enable)`

  Description

    Enables/Disables UNICODE keyboard translation.

    If you wish to translate a keysym to it's printable representation, you need to enable UNICODE translation using this function and then look in the unicode member of the SDL.Keysym class. This value will be zero for keysyms that do not have a printable representation. UNICODE translation is disabled by default as the conversion can cause a slight overhead.

  Parameter `enable`

    A value of 1 enables Unicode translation, 0 disables it and -1 leaves it unchanged (useful for querying the current translation mode).

  Returns

    The previous translation mode (1 enabled, 0 disabled). If enable is -1, the return value is the current translation mode.

  See also

    SDL.Keysym

  Method get_mod_state

    `int get_mod_state()`

  Description

    Returns the current state of the modifier keys (CTRL, ALT, etc.).

  Returns

    The return value can be an OR'd combination of the following: SDL.KMOD_NONE, SDL.KMOD_LSHIFT, SDL.KMOD_RSHIFT, SDL.KMOD_LCTRL, SDL.KMOD_RCTRL, SDL.KMOD_LALT, SDL.KMOD_RALT, SDL.KMOD_LMETA, SDL.KMOD_RMETA, SDL.KMOD_NUM, SDL.KMOD_CAPS, and SDL.KMOD_MODE. For convenience the following are also defined: SDL.KMOD_CTRL, SDL.KMOD_SHIFT, SDL.KMOD_ALT and SDL.KMOD_META

  See also

    SDL.get_key_state()

  Method get_key_state

    `string get_key_state()`

  Description

    Gets a snapshot of the current keyboard state. The current state is return as a string. The string is indexed by the SDL.K_* symbols. A value of 1 means the key is pressed and a value of 0 means its not.

  Note

    SDL.pump_events() to update the state array.

  Method video_mode_ok

    `int video_mode_ok(int width, int height, int bpp, int flags)`

  FIXME

    Document this function

  Method flip

    `int flip(SDL.Surface|void screen)`

  Description

    On hardware that supports double-buffering, this function sets up a flip and returns. The hardware will wait for vertical retrace, and then swap video buffers before the next video surface blit or lock will return. On hardware that doesn't support double-buffering, this is equivalent to calling SDL.update_rect(screen, 0, 0, 0, 0)

    The SDL.DOUBLEBUF flag must have been passed to SDL_SetVideoMode, when setting the video mode for this function to perform hardware flipping.

  Parameter `screen`

    The screen object to flip. If missing, the default screen is used.

  Returns

    This function returns 1 if successful, or 0 if there was an error.

  See also

    SDL.update_rect()

  Method update_rect

    `void update_rect(int x, int y, int w, int h, SDL.Surface|void screen)`

  Description

    Makes sure the given area is updated on the given screen. The rectangle must be confined within the screen boundaries (no clipping is done).

    If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire screen.

    This function should not be called while 'screen' is locked.

  Parameter `x`
  Parameter `y`

    Top left corner of the rectangle to update.

  Parameter `w`
  Parameter `h`

    Width and height of the rectangle to update.

  Parameter `screen`

    The screen object to flip. If missing, the default screen is used.

  See also

    SDL.flip()

  Method set_gamma

    `int set_gamma(float red, float green, float blue)`

  FIXME

    Document this function

  Method get_video_surface

    `void|object get_video_surface()`

  FIXME

    Document this function

  Method get_video_info

    `void|object get_video_info()`

  FIXME

    Document this function

  Method gl_set_attribute

    `void gl_set_attribute(int attribute, int value)`

  FIXME

    Document this function

  Method gl_get_attribute

    `void gl_get_attribute(int attribute)`

  FIXME

    Document this function

  Method show_cursor

    `int show_cursor(int show)`

  FIXME

    Document this function

  Method warp_mouse

    `void warp_mouse(int xpos, int ypos)`

  FIXME

    Document this function

  Method gl_swap_buffers

    `void gl_swap_buffers()`

  FIXME

    Document this function

  Method set_video_mode

    `object set_video_mode(int width, int height, int bpp, int flags)`

  FIXME

    Document this function

  Method blit_surface

    `int blit_surface(SDL.Surface src, SDL.Surface dst, SDL.Rect srcrect, SDL.Rect dstrect)`

  FIXME

    Document this function

  Method video_driver_name

    `void|string video_driver_name()`

  FIXME

    Document this function

  Method set_caption

    `void set_caption(string title, string icon)`

  FIXME

    Document this function

  Method get_caption

    `array(string) get_caption()`

  FIXME

    Document this function

  Method iconify_window

    `int iconify_window()`

  FIXME

    Document this function

  Method toggle_fullscreen

    `int toggle_fullscreen(void|SDL.Surface screen)`

  FIXME

    Document this function

  Method grab_input

    `int grab_input(int mode)`

  FIXME

    Document this function

  Method num_joysticks

    `int num_joysticks()`

  FIXME

    Document this function

  Method joystick_name

    `string joystick_name(int device_index)`

  FIXME

    Document this function

  Method joystick_opened

    `int joystick_opened(int device_index)`

  FIXME

    Document this function

  Method joystick_update

    `void joystick_update()`

  FIXME

    Document this function

  Method joystick_event_state

    `int joystick_event_state(int state)`

  FIXME

    Document this function

  Method cd_num_drivers

    `int cd_num_drivers()`

  FIXME

    Document this function

  Method cd_name

    `string|void cd_name(int drive)`

  FIXME

    Document this function

  Method open_audio

    `void open_audio(int frequency, int format, int channels, int bufsize)`

  FIXME

    Document this function

  CLASS SDL.Rect

    Description

      Used in SDL to define a rectangular area. It is sometimes also used to specify only points or sizes (i.e only one of the position and dimension is used).

      `int SDL.Rect.x`
      `int SDL.Rect.y`

    Description

      Position of the upper-left corner of the rectangle.

      `int SDL.Rect.w`
      `int SDL.Rect.h`

    Description

      The width and height of the rectangle.

    Method cast

      `mixed cast(string type)`

    Description

      It is possible to cast a Rect object to an array or to a mapping. The array will have the values in the x, y, w, h order and the mapping will have the values associated with those names.

  CLASS SDL.Keysym

    Description

      The Keysym class is used to report key presses and releases. It's available from the SDL.Event class for keyboard events.

      The scancode field should generally be left alone - it is the hardware dependent scancode returned by the keyboard. The sym field is extremely useful. It is the SDL-defined value of the key. This field is very useful when you are checking for certain key presses.

      mod stores the current state of the keyboard modifiers as explained in SDL.get_mod_state() . The unicode field is only used when UNICODE translation is enabled with SDL.enable_unicode() . If unicode is non-zero then this a the UNICODE character corresponding to the keypress. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character.

    Note

      UNICODE translation does have a slight overhead so don't enable it unless its needed.

    Variable scancode

      `int SDL.Keysym.scancode`

    Description

      Hardware specific scancode

    Variable sym

      `int SDL.Keysym.sym`

    Description

      SDL virtual keysym

    Variable mod

      `int SDL.Keysym.mod`

    Description

      Current key modifiers

    Variable unicode

      `int SDL.Keysym.unicode`

    Description

      Translated character

  CLASS SDL.PixelFormat

    Description

      This describes the format of the pixel data stored at the pixels field of a SDL.Surface . Every surface stores a PixelFormat in the format field.

    Variable bits_per_pixel

      `int SDL.PixelFormat.bits_per_pixel`

    Description

      The number of bits used to represent each pixel in a surface. Usually 8, 16, 24 or 32.

    Variable bytes_per_pixel

      `int SDL.PixelFormat.bytes_per_pixel`

    Description

      The number of bytes used to represent each pixel in a surface. Usually one to four.

      `int SDL.PixelFormat.rmask`
      `int SDL.PixelFormat.gmask`
      `int SDL.PixelFormat.bmask`
      `int SDL.PixelFormat.amask`

    Description

      Binary mask used to retrieve individual color values.

      `int SDL.PixelFormat.rloss`
      `int SDL.PixelFormat.gloss`
      `int SDL.PixelFormat.bloss`
      `int SDL.PixelFormat.aloss`

    Description

      Precision loss of each color component.

      `int SDL.PixelFormat.rshift`
      `int SDL.PixelFormat.gshift`
      `int SDL.PixelFormat.bshift`
      `int SDL.PixelFormat.ashift`

    Description

      Binary left shift of each color component in the pixel value.

    Variable colorkey

      `int SDL.PixelFormat.colorkey`

    Description

      Pixel value of transparent pixels.

    Variable alpha

      `int SDL.PixelFormat.alpha`

    Description

      Overall surface alpha value.

    Method losses

      `array(int) losses()`

    Description

      Convenience method returning the RGBA precision loss as an array.

    Method masks

      `array(int) masks()`

    Description

      Convenience method returning the RGBA masks as an array.

    Method shifts

      `array(int) shifts()`

    Description

      Convenience method returning the RGBA shifts as an array.

    Method map_rgb

      `int map_rgb(int r, int g, int b)`
      `int map_rgb(Image.Color.Color color)`

    Description

      Maps the RGB color value to the specified pixel format and returns the pixel value as an integer.

      If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

      If the pixel format has an alpha component it will be returned as all 1 bits (fully opaque).

    Parameter `r`
    Parameter `g`
    Parameter `b`

      The red, green and blue components specified as an integer between 0 and 255.

    Parameter `color`

      The color as represented by an Image.Color.Color object.

    Returns

      A pixel value best approximating the given RGB color value for a given pixel format.

    See also

      map_rgba() , get_rgb() , get_rgba()

    Method map_rgba

      `int map_rgba(int r, int g, int b, int a)`
      `int map_rgba(Image.Color.Color color, int a)`

    Description

      Maps the RGBA color value to the specified pixel format and returns the pixel value as an integer.

      If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

      If the pixel format has an alpha component it will be returned as all 1 bits (fully opaque).

    Parameter `r`
    Parameter `g`
    Parameter `b`
    Parameter `a`

      The red, green and blue components specified as an integer between 0 and 255.

    Parameter `color`

      The color as represented by an Image.Color.Color object.

    Returns

      A pixel value best approximating the given RGB color value for a given pixel format.

    See also

      map_rgb() , get_rgb() , get_rgba()

    Method get_rgb

      `Image.Color.Color get_rgb(int pixel)`

    Description

      Get RGB component values from a pixel stored in this pixel format.

    Parameter `pixel`

      A pixel retrieved from a surface with this pixel format or a color previously mapped with map_rgb() or map_rgba() .

    Returns

      A Image.Color.Color object with the RGB components of the pixel.

    See also

      map_rgb() , map_rgba() , get_rgba()

    Method get_rgba

      `mapping(string:Image.Color.Color|int) get_rgba(int pixel)`

    Description

      Get RGB component values from a pixel stored in this pixel format.

    Parameter `pixel`

      A pixel retrieved from a surface with this pixel format or a color previously mapped with map_rgb() or map_rgba() .

    Returns

      A mapping containing with the RGBA components of the pixel as described below.

      `color : Image.Color.Color` | The RGB color value of the pixel.
      `alpha : int` | The alpha value of the pixel in the range 0-255.

    See also

      map_rgb() , map_rgba() , get_rgb()

  CLASS SDL.VideoInfo

    Description

      This (read-only) class is returned by SDL.get_video_info() . It contains information on either the 'best' available mode (if called before SDL.set_video_mode() ) or the current video mode.

    Variable blit_hw_cc

      `int SDL.VideoInfo.blit_hw_cc`

    Description

      Are hardware to hardware colorkey blits accelerated?

    Variable blit_hw_a

      `int SDL.VideoInfo.blit_hw_a`

    Description

      Are hardware to hardware alpha blits accelerated?

    Variable blit_sw

      `int SDL.VideoInfo.blit_sw`

    Description

      Are software to hardware blits accelerated?

    Variable blit_sw_cc

      `int SDL.VideoInfo.blit_sw_cc`

    Description

      Are software to hardware colorkey blits accelerated?

    Variable blit_sw_a

      `int SDL.VideoInfo.blit_sw_a`

    Description

      Are software to hardware alpha blits accelerated?

    Variable blit_fill

      `int SDL.VideoInfo.blit_fill`

    Description

      Are color fills accelerated?

    Variable video_mem

      `int SDL.VideoInfo.video_mem`

    Description

      Total amount of video memory in KB.

    Variable format

      `SDL.PixelFormat SDL.VideoInfo.format`

    Description

      Pixel format of the video device.

  CLASS SDL.Surface

    Description

      Surface's represent areas of "graphical" memory, memory that can be drawn to. The video framebuffer is returned as a SDL.Surface by SDL.set_video_mode() and SDL.get_video_surface() .

      `int SDL.Surface.w`
      `int SDL.Surface.h`

    Description

      The width and height of the surface in pixels.

    Variable clip_rect

      `SDL.Rect SDL.Surface.clip_rect`

    Description

      This is the clipping rectangle as set by set_clip_rect() .

    Variable flags

      `int SDL.Surface.flags`

    Description

      The following are supported in the flags field.

      SDL.SWSURFACE

        Surface is stored in system memory

      SDL.HWSURFACE

        Surface is stored in video memory

      SDL.ASYNCBLIT

        Surface uses asynchronous blits if possible.

      SDL.ANYFORMAT

        Allows any pixel-format (Display surface).

      SDL.HWPALETTE

        Surface has exclusive palette.

      SDL.DOUBLEBUF

        Surface is double buffered (Display surface).

      SDL.FULLSCREEN

        Surface is full screen (Display Sur face).

      SDL.OPENGL

        Surface has an OpenGL context (Display Surface).

      SDL.OPENGLBLIT

        Surface supports OpenGL blitting (Display Surface).

      SDL.RESIZABLE

        Surface is resizable (Display Surface).

      SDL.HWACCEL

        Surface blit uses hardware acceleration.

      SDL.SRCCOLORKEY

        Surface use colorkey blitting.

      SDL.RLEACCEL

        Colorkey blitting is accelerated with RLE.

      SDL.SRCALPHA

        Surface blit uses alpha blending.

      SDL.PREALLOC

        Surface uses preallocated memory.

    Variable format

      `SDL.PixelFormat SDL.Surface.format`

    Description

      The pixel format of this surface.

    Method get_pixel

      `int get_pixel(int x, int y)`

    Description

      Get the value of the specified pixel. The surface needs to be locked before this method can be used.

    Parameter `x`
    Parameter `y`

      Pixel coordinate to get.

    Returns

      The value of the specified pixel.

    See also

      set_pixel() , unlock() , lock()

    Method set_pixel

      `int set_pixel(int x, int y, int pixel)`

    Description

      Set the value of the specified pixel. The surface needs to be locked before this method can be used.

    Parameter `x`
    Parameter `y`

      Pixel coordinate to modify.

    Parameter `pixel`

      Pixel value to set to the specified pixel.

    Returns

      A reference to the surface itself.

    See also

      get_pixel() , unlock() , lock()

    Method lock

      `int lock()`

    Description

      This methods locks the surface to allow direct access to the pixels using the get_pixel() and set_pixel() methods. Note that although all surfaces in SDL don't require locking, you still need to call this method to enable the set/get pixel methods. You should unlock the surface when you're doing modifying it.

    Note

      Calling this method multiple times means that you need to call unlock an equal number of times for the surface to become unlocked.

    Returns

      1 for success or 0 if the surface couldn't be locked.

    See also

      unlock() , set_pixel() , get_pixel()

    Method unlock

      `void unlock()`

    Description

      Surfaces that were previously locked using lock() must be unlocked with unlock() . Surfaces should be unlocked as soon as possible.

    See also

      lock()

    Method init

      `SDL.Surface init(int flags, int width, int height, int depth, int Rmask, int Gmask, int Bmask, int Amask)`

    Description

      This (re)initializes this surface using the specified parameters. Any previously allocated data will be freed. If depth is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' SDL.PixelFormat is created using the [RGBA]mask's provided. width and height specifies the desired size of the image. The flags specifies the type of surface that should be created. It is an OR'd combination of the following possible values:

      SDL.SWSURFACE

        SDL will create the surface in system memory. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.

      SDL.HWSURFACE

        SDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video->Video blits (which are often accelerated).

      SDL.SRCCOLORKEY

        This flag turns on colourkeying for blits from this surface. If SDL.HWSURFACE is also specified and colourkeyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory. Use set_color_key() to set or clear this flag after surface creation.

      SDL.SRCALPHA

        This flag turns on alpha-blending for blits from this surface. If SDL.HWSURFACE is also specified and alpha blending blits are hardware-accelerated, then the surface will be placed in video memory if possible. Use set_alpha() to set or clear this flag after surface creation.

    Note

      If an alpha-channel is specified (that is, if Amask is nonzero), then the SDL.SRCALPHA flag is automatically set. You may remove this flag by calling set_alpha() after surface creation.

    Returns

      A reference to itself.

    Note

      If this method fails, the surface will become uninitialized.

    See also

      set_image()

    Method set_image

      `SDL.Surface set_image(Image.Image image, int|void flags)`
      `SDL.Surface set_image(Image.Image image, Image.Image alpha, int|void flags)`

    Description

      This (re)initializes this surface from the Image.Image in image. Any previously allocated data will be freed. If initialization is successful, this surface will use RGBA8888 format. For good blitting performance, it should be converted to the display format using display_format() .

    Parameter `image`

      The source image.

    Parameter `alpha`

      Optional alpha channel. In Pike, the alpha channel can have different alpha values for red, green and blue. Since SDL doesn't support this, only the alpha value of the red color is used in the conversion. When this calling convention is used, the surface alpha value of image is ignored.

    Parameter `flags`

      When present this specifies the type of surface that should be created. It is an OR'd combination of the following possible values:

      SDL.SWSURFACE

        SDL will create the surface in system memory. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.

      SDL.HWSURFACE

        SDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video->Video blits (which are often accelerated).

      SDL.SRCCOLORKEY

        This flag turns on colourkeying for blits from this surface. If SDL.HWSURFACE is also specified and colourkeyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory. Use set_color_key() to set or clear this flag after surface creation.

      SDL.SRCALPHA

        This flag turns on alpha-blending for blits from this surface. If SDL.HWSURFACE is also specified and alpha blending blits are hardware-accelerated, then the surface will be placed in video memory if possible. Note that if this surface has an alpha value specified, this flag is enabled automatically. Use set_alpha() to modify this flag at a later point.

    Note

      If this method fails, the surface will become uninitialized.

    Returns

      A reference to itself.

    See also

      init()

    Method display_format

      `SDL.Surface display_format()`

    Description

      This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer, suitable for fast blitting onto the display surface. It calls convert_surface() .

      If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and / or alpha value before calling this function.

      If you want an alpha channel, see display_format_alpha() .

    Returns

      The new surface. An error is thrown if the conversion fails.

    Method display_format_alpha

      `SDL.Surface display_format_alpha()`

    Description

      This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer, suitable for fast blitting onto the display surface. It calls convert_surface() .

      If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and / or alpha value before calling this function.

      This function can be used to convert a colourkey to an alpha channel, if the SDL.SRCCOLORKEY flag is set on the surface. The generated surface will then be transparent (alpha=0) where the pixels match the colourkey, and opaque (alpha=255) elsewhere.

    Returns

      The new surface. An error is thrown if the conversion fails.

    Method blit

      `object blit(SDL.Surface dst, SDL.Rect|void srcrect, SDL.Rect|void dstrect)`

    FIXME

      Document this function

    Method fill_rect

      `object fill_rect(int color, SDL.Rect dstrect)`

    FIXME

      Document this function

    Method fill

      `object fill(int color)`

    FIXME

      Document this function

    Method set_color_key

      `object set_color_key(int flag, int key)`

    FIXME

      Document this function

    Method set_alpha

      `object set_alpha(int flag, int alpha)`

    FIXME

      Document this function

    Method set_clip_rect

      `object set_clip_rect(SDL.Rect rect)`

    FIXME

      Document this function

    Method convert_surface

      `object convert_surface(SDL.PixelFormat fmt, int flags)`

    FIXME

      Document this function

  CLASS SDL.Joystick

    Method create

      `void SDL.Joystick(int device_index)`

    FIXME

      Document this function

    Method index

      `int index()`

    FIXME

      Document this function

    Method num_axes

      `int num_axes()`

    FIXME

      Document this function

    Method num_balls

      `int num_balls()`

    FIXME

      Document this function

    Method num_hats

      `int num_hats()`

    FIXME

      Document this function

    Method num_buttons

      `int num_buttons()`

    FIXME

      Document this function

    Method get_axis

      `float get_axis(int axis)`

    FIXME

      Document this function

    Method get_hat

      `int get_hat(int hat)`

    FIXME

      Document this function

    Method get_ball

      `array(int) get_ball(int ball)`

    FIXME

      Document this function

    Method get_button

      `int get_button(int button)`

    FIXME

      Document this function

    Method name

      `string name()`

    FIXME

      Document this function

  CLASS SDL.CDTrack

      `int SDL.CDTrack.id`
      `int SDL.CDTrack.length`
      `int SDL.CDTrack.offset`
      `int SDL.CDTrack.type`

    FIXME

      Document this variable

  CLASS SDL.CD

    Method create

      `void SDL.CD(int drive)`

    FIXME

      Document this function

      `int SDL.CD.current_frame`
      `int SDL.CD.current_track`
      `int SDL.CD.id`
      `int SDL.CD.numtracks`

    FIXME

      Document this variable

    Method track

      `CDTrack track(int track)`

    FIXME

      Document this function

    Method status

      `int status()`

    FIXME

      Document this function

    Method play

      `int play(int start, int length)`

    FIXME

      Document this function

    Method play_tracks

      `int play_tracks(int start_track, int start_frame, int ntracks, int nframes)`

    FIXME

      Document this function

    Method pause

      `int pause()`

    FIXME

      Document this function

    Method resume

      `int resume()`

    FIXME

      Document this function

    Method stop

      `int stop()`

    FIXME

      Document this function

    Method eject

      `int eject()`

    FIXME

      Document this function

  CLASS SDL.Music

    Method create

      `void SDL.Music(string fname)`

    FIXME

      Document this function

    Method pause

      `object pause()`

    FIXME

      Document this function

    Method halt

      `object halt()`

    FIXME

      Document this function

    Method resume

      `object resume()`

    FIXME

      Document this function

    Method rewind

      `object rewind()`

    FIXME

      Document this function

    Method paused

      `int paused()`

    FIXME

      Document this function

    Method playing

      `int playing()`

    FIXME

      Document this function

    Method fading

      `int fading()`

    FIXME

      Document this function

    Method play

      `object play(int|void loops)`

    FIXME

      Document this function

    Method fade_in

      `object fade_in(int ms, int|void loops)`

    FIXME

      Document this function

    Method fade_out

      `object fade_out(int ms)`

    FIXME

      Document this function

    Method set_volume

      `float set_volume(float vol)`

    FIXME

      Document this function

    Method volume

      `float volume()`

    FIXME

      Document this function

  CLASS SDL.Event

    Method get

      `int get()`

    FIXME

      Document this function

    Method wait

      `int wait()`

    FIXME

      Document this function

    Method poll

      `int poll()`

    FIXME

      Document this function

      `int SDL.Event.axis`
      `int SDL.Event.ball`
      `int SDL.Event.button`
      `int SDL.Event.code`
      `int SDL.Event.gain`
      `int SDL.Event.h`
      `int SDL.Event.hat`
      `Keysym SDL.Event.keysym`
      `int SDL.Event.state`
      `int SDL.Event.type`
      `int SDL.Event.value`
      `int SDL.Event.w`
      `int SDL.Event.which`
      `int SDL.Event.x`
      `int SDL.Event.xrel`
      `int SDL.Event.y`
      `int SDL.Event.yrel`

Module GTK2

  Constant FALSE

    `constant GTK2.FALSE`

  Constant GDK_2BUTTON_PRESS

    `constant GTK2.GDK_2BUTTON_PRESS`

  Constant GDK_3BUTTON_PRESS

    `constant GTK2.GDK_3BUTTON_PRESS`

  Constant GDK_ACTION_ASK

    `constant GTK2.GDK_ACTION_ASK`

  Constant GDK_ACTION_COPY

    `constant GTK2.GDK_ACTION_COPY`

  Constant GDK_ACTION_DEFAULT

    `constant GTK2.GDK_ACTION_DEFAULT`

  Constant GDK_ACTION_LINK

    `constant GTK2.GDK_ACTION_LINK`

  Constant GDK_ACTION_MOVE

    `constant GTK2.GDK_ACTION_MOVE`

  Constant GDK_ACTION_PRIVATE

    `constant GTK2.GDK_ACTION_PRIVATE`

  Constant GDK_ALL_EVENTS_MASK

    `constant GTK2.GDK_ALL_EVENTS_MASK`

  Constant GDK_AND

    `constant GTK2.GDK_AND`

  Constant GDK_AND_INVERT

    `constant GTK2.GDK_AND_INVERT`

  Constant GDK_AND_REVERSE

    `constant GTK2.GDK_AND_REVERSE`

  Constant GDK_ARROW

    `constant GTK2.GDK_ARROW`

  Constant GDK_AXIS_IGNORE

    `constant GTK2.GDK_AXIS_IGNORE`

  Constant GDK_AXIS_LAST

    `constant GTK2.GDK_AXIS_LAST`

  Constant GDK_AXIS_PRESSURE

    `constant GTK2.GDK_AXIS_PRESSURE`

  Constant GDK_AXIS_WHEEL

    `constant GTK2.GDK_AXIS_WHEEL`

  Constant GDK_AXIS_X

    `constant GTK2.GDK_AXIS_X`

  Constant GDK_AXIS_XTILT

    `constant GTK2.GDK_AXIS_XTILT`

  Constant GDK_AXIS_Y

    `constant GTK2.GDK_AXIS_Y`

  Constant GDK_AXIS_YTILT

    `constant GTK2.GDK_AXIS_YTILT`

  Constant GDK_BASED_ARROW_DOWN

    `constant GTK2.GDK_BASED_ARROW_DOWN`

  Constant GDK_BASED_ARROW_UP

    `constant GTK2.GDK_BASED_ARROW_UP`

  Constant GDK_BOAT

    `constant GTK2.GDK_BOAT`

  Constant GDK_BOGOSITY

    `constant GTK2.GDK_BOGOSITY`

  Constant GDK_BOTTOM_LEFT_CORNER

    `constant GTK2.GDK_BOTTOM_LEFT_CORNER`

  Constant GDK_BOTTOM_RIGHT_CORNER

    `constant GTK2.GDK_BOTTOM_RIGHT_CORNER`

  Constant GDK_BOTTOM_SIDE

    `constant GTK2.GDK_BOTTOM_SIDE`

  Constant GDK_BOTTOM_TEE

    `constant GTK2.GDK_BOTTOM_TEE`

  Constant GDK_BOX_SPIRAL

    `constant GTK2.GDK_BOX_SPIRAL`

  Constant GDK_BUTTON1_MASK

    `constant GTK2.GDK_BUTTON1_MASK`

  Constant GDK_BUTTON1_MOTION_MASK

    `constant GTK2.GDK_BUTTON1_MOTION_MASK`

  Constant GDK_BUTTON2_MASK

    `constant GTK2.GDK_BUTTON2_MASK`

  Constant GDK_BUTTON2_MOTION_MASK

    `constant GTK2.GDK_BUTTON2_MOTION_MASK`

  Constant GDK_BUTTON3_MASK

    `constant GTK2.GDK_BUTTON3_MASK`

  Constant GDK_BUTTON3_MOTION_MASK

    `constant GTK2.GDK_BUTTON3_MOTION_MASK`

  Constant GDK_BUTTON4_MASK

    `constant GTK2.GDK_BUTTON4_MASK`

  Constant GDK_BUTTON5_MASK

    `constant GTK2.GDK_BUTTON5_MASK`

  Constant GDK_BUTTON_MOTION_MASK

    `constant GTK2.GDK_BUTTON_MOTION_MASK`

  Constant GDK_BUTTON_PRESS

    `constant GTK2.GDK_BUTTON_PRESS`

  Constant GDK_BUTTON_PRESS_MASK

    `constant GTK2.GDK_BUTTON_PRESS_MASK`

  Constant GDK_BUTTON_RELEASE

    `constant GTK2.GDK_BUTTON_RELEASE`

  Constant GDK_BUTTON_RELEASE_MASK

    `constant GTK2.GDK_BUTTON_RELEASE_MASK`

  Constant GDK_CAP_BUTT

    `constant GTK2.GDK_CAP_BUTT`

  Constant GDK_CAP_NOT_LAST

    `constant GTK2.GDK_CAP_NOT_LAST`

  Constant GDK_CAP_PROJECTING

    `constant GTK2.GDK_CAP_PROJECTING`

  Constant GDK_CAP_ROUND

    `constant GTK2.GDK_CAP_ROUND`

  Constant GDK_CENTER_PTR

    `constant GTK2.GDK_CENTER_PTR`

  Constant GDK_CIRCLE

    `constant GTK2.GDK_CIRCLE`

  Constant GDK_CLEAR

    `constant GTK2.GDK_CLEAR`

  Constant GDK_CLIENT_EVENT

    `constant GTK2.GDK_CLIENT_EVENT`

  Constant GDK_CLIP_BY_CHILDREN

    `constant GTK2.GDK_CLIP_BY_CHILDREN`

  Constant GDK_CLOCK

    `constant GTK2.GDK_CLOCK`

  Constant GDK_COFFEE_MUG

    `constant GTK2.GDK_COFFEE_MUG`

  Constant GDK_COLORSPACE_RGB

    `constant GTK2.GDK_COLORSPACE_RGB`

  Constant GDK_CONFIGURE

    `constant GTK2.GDK_CONFIGURE`

  Constant GDK_CONTROL_MASK

    `constant GTK2.GDK_CONTROL_MASK`

  Constant GDK_COPY

    `constant GTK2.GDK_COPY`

  Constant GDK_COPY_INVERT

    `constant GTK2.GDK_COPY_INVERT`

  Constant GDK_CROSS

    `constant GTK2.GDK_CROSS`

  Constant GDK_CROSSHAIR

    `constant GTK2.GDK_CROSSHAIR`

  Constant GDK_CROSSING_GRAB

    `constant GTK2.GDK_CROSSING_GRAB`

  Constant GDK_CROSSING_NORMAL

    `constant GTK2.GDK_CROSSING_NORMAL`

  Constant GDK_CROSSING_UNGRAB

    `constant GTK2.GDK_CROSSING_UNGRAB`

  Constant GDK_CROSS_REVERSE

    `constant GTK2.GDK_CROSS_REVERSE`

  Constant GDK_CURSOR_IS_PIXMAP

    `constant GTK2.GDK_CURSOR_IS_PIXMAP`

  Constant GDK_DECOR_ALL

    `constant GTK2.GDK_DECOR_ALL`

  Constant GDK_DECOR_BORDER

    `constant GTK2.GDK_DECOR_BORDER`

  Constant GDK_DECOR_MAXIMIZE

    `constant GTK2.GDK_DECOR_MAXIMIZE`

  Constant GDK_DECOR_MENU

    `constant GTK2.GDK_DECOR_MENU`

  Constant GDK_DECOR_MINIMIZE

    `constant GTK2.GDK_DECOR_MINIMIZE`

  Constant GDK_DECOR_RESIZEH

    `constant GTK2.GDK_DECOR_RESIZEH`

  Constant GDK_DECOR_TITLE

    `constant GTK2.GDK_DECOR_TITLE`

  Constant GDK_DELETE

    `constant GTK2.GDK_DELETE`

  Constant GDK_DESTROY

    `constant GTK2.GDK_DESTROY`

  Constant GDK_DIAMOND_CROSS

    `constant GTK2.GDK_DIAMOND_CROSS`

  Constant GDK_DOT

    `constant GTK2.GDK_DOT`

  Constant GDK_DOTBOX

    `constant GTK2.GDK_DOTBOX`

  Constant GDK_DOUBLE_ARROW

    `constant GTK2.GDK_DOUBLE_ARROW`

  Constant GDK_DRAFT_LARGE

    `constant GTK2.GDK_DRAFT_LARGE`

  Constant GDK_DRAFT_SMALL

    `constant GTK2.GDK_DRAFT_SMALL`

  Constant GDK_DRAG_ENTER

    `constant GTK2.GDK_DRAG_ENTER`

  Constant GDK_DRAG_LEAVE

    `constant GTK2.GDK_DRAG_LEAVE`

  Constant GDK_DRAG_MOTION

    `constant GTK2.GDK_DRAG_MOTION`

  Constant GDK_DRAG_PROTO_LOCAL

    `constant GTK2.GDK_DRAG_PROTO_LOCAL`

  Constant GDK_DRAG_PROTO_MOTIF

    `constant GTK2.GDK_DRAG_PROTO_MOTIF`

  Constant GDK_DRAG_PROTO_NONE

    `constant GTK2.GDK_DRAG_PROTO_NONE`

  Constant GDK_DRAG_PROTO_OLE2

    `constant GTK2.GDK_DRAG_PROTO_OLE2`

  Constant GDK_DRAG_PROTO_ROOTWIN

    `constant GTK2.GDK_DRAG_PROTO_ROOTWIN`

  Constant GDK_DRAG_PROTO_WIN32_DROPFILES

    `constant GTK2.GDK_DRAG_PROTO_WIN32_DROPFILES`

  Constant GDK_DRAG_PROTO_XDND

    `constant GTK2.GDK_DRAG_PROTO_XDND`

  Constant GDK_DRAG_STATUS

    `constant GTK2.GDK_DRAG_STATUS`

  Constant GDK_DRAPED_BOX

    `constant GTK2.GDK_DRAPED_BOX`

  Constant GDK_DROP_FINISHED

    `constant GTK2.GDK_DROP_FINISHED`

  Constant GDK_DROP_START

    `constant GTK2.GDK_DROP_START`

  Constant GDK_ENTER_NOTIFY

    `constant GTK2.GDK_ENTER_NOTIFY`

  Constant GDK_ENTER_NOTIFY_MASK

    `constant GTK2.GDK_ENTER_NOTIFY_MASK`

  Constant GDK_EQUIV

    `constant GTK2.GDK_EQUIV`

  Constant GDK_EVEN_ODD_RULE

    `constant GTK2.GDK_EVEN_ODD_RULE`

  Constant GDK_EXCHANGE

    `constant GTK2.GDK_EXCHANGE`

  Constant GDK_EXPOSE

    `constant GTK2.GDK_EXPOSE`

  Constant GDK_EXPOSURE_MASK

    `constant GTK2.GDK_EXPOSURE_MASK`

  Constant GDK_EXTENSION_EVENTS_ALL

    `constant GTK2.GDK_EXTENSION_EVENTS_ALL`

  Constant GDK_EXTENSION_EVENTS_CURSOR

    `constant GTK2.GDK_EXTENSION_EVENTS_CURSOR`

  Constant GDK_EXTENSION_EVENTS_NONE

    `constant GTK2.GDK_EXTENSION_EVENTS_NONE`

  Constant GDK_FILTER_CONTINUE

    `constant GTK2.GDK_FILTER_CONTINUE`

  Constant GDK_FILTER_REMOVE

    `constant GTK2.GDK_FILTER_REMOVE`

  Constant GDK_FILTER_TRANSLATE

    `constant GTK2.GDK_FILTER_TRANSLATE`

  Constant GDK_FLEUR

    `constant GTK2.GDK_FLEUR`

  Constant GDK_FOCUS_CHANGE

    `constant GTK2.GDK_FOCUS_CHANGE`

  Constant GDK_FOCUS_CHANGE_MASK

    `constant GTK2.GDK_FOCUS_CHANGE_MASK`

  Constant GDK_FUNC_ALL

    `constant GTK2.GDK_FUNC_ALL`

  Constant GDK_FUNC_CLOSE

    `constant GTK2.GDK_FUNC_CLOSE`

  Constant GDK_FUNC_MAXIMIZE

    `constant GTK2.GDK_FUNC_MAXIMIZE`

  Constant GDK_FUNC_MINIMIZE

    `constant GTK2.GDK_FUNC_MINIMIZE`

  Constant GDK_FUNC_MOVE

    `constant GTK2.GDK_FUNC_MOVE`

  Constant GDK_FUNC_RESIZE

    `constant GTK2.GDK_FUNC_RESIZE`

  Constant GDK_GC_BACKGROUND

    `constant GTK2.GDK_GC_BACKGROUND`

  Constant GDK_GC_CAP_STYLE

    `constant GTK2.GDK_GC_CAP_STYLE`

  Constant GDK_GC_CLIP_MASK

    `constant GTK2.GDK_GC_CLIP_MASK`

  Constant GDK_GC_CLIP_X_ORIGIN

    `constant GTK2.GDK_GC_CLIP_X_ORIGIN`

  Constant GDK_GC_CLIP_Y_ORIGIN

    `constant GTK2.GDK_GC_CLIP_Y_ORIGIN`

  Constant GDK_GC_EXPOSURES

    `constant GTK2.GDK_GC_EXPOSURES`

  Constant GDK_GC_FILL

    `constant GTK2.GDK_GC_FILL`

  Constant GDK_GC_FONT

    `constant GTK2.GDK_GC_FONT`

  Constant GDK_GC_FOREGROUND

    `constant GTK2.GDK_GC_FOREGROUND`

  Constant GDK_GC_FUNCTION

    `constant GTK2.GDK_GC_FUNCTION`

  Constant GDK_GC_JOIN_STYLE

    `constant GTK2.GDK_GC_JOIN_STYLE`

  Constant GDK_GC_LINE_STYLE

    `constant GTK2.GDK_GC_LINE_STYLE`

  Constant GDK_GC_LINE_WIDTH

    `constant GTK2.GDK_GC_LINE_WIDTH`

  Constant GDK_GC_STIPPLE

    `constant GTK2.GDK_GC_STIPPLE`

  Constant GDK_GC_SUBWINDOW

    `constant GTK2.GDK_GC_SUBWINDOW`

  Constant GDK_GC_TILE

    `constant GTK2.GDK_GC_TILE`

  Constant GDK_GC_TS_X_ORIGIN

    `constant GTK2.GDK_GC_TS_X_ORIGIN`

  Constant GDK_GC_TS_Y_ORIGIN

    `constant GTK2.GDK_GC_TS_Y_ORIGIN`

  Constant GDK_GOBBLER

    `constant GTK2.GDK_GOBBLER`

  Constant GDK_GRAB_ALREADY_GRABBED

    `constant GTK2.GDK_GRAB_ALREADY_GRABBED`

  Constant GDK_GRAB_FROZEN

    `constant GTK2.GDK_GRAB_FROZEN`

  Constant GDK_GRAB_INVALID_TIME

    `constant GTK2.GDK_GRAB_INVALID_TIME`

  Constant GDK_GRAB_NOT_VIEWABLE

    `constant GTK2.GDK_GRAB_NOT_VIEWABLE`

  Constant GDK_GRAB_SUCCESS

    `constant GTK2.GDK_GRAB_SUCCESS`

  Constant GDK_GRAVITY_CENTER

    `constant GTK2.GDK_GRAVITY_CENTER`

  Constant GDK_GRAVITY_EAST

    `constant GTK2.GDK_GRAVITY_EAST`

  Constant GDK_GRAVITY_NORTH

    `constant GTK2.GDK_GRAVITY_NORTH`

  Constant GDK_GRAVITY_NORTH_EAST

    `constant GTK2.GDK_GRAVITY_NORTH_EAST`

  Constant GDK_GRAVITY_NORTH_WEST

    `constant GTK2.GDK_GRAVITY_NORTH_WEST`

  Constant GDK_GRAVITY_SOUTH

    `constant GTK2.GDK_GRAVITY_SOUTH`

  Constant GDK_GRAVITY_SOUTH_EAST

    `constant GTK2.GDK_GRAVITY_SOUTH_EAST`

  Constant GDK_GRAVITY_SOUTH_WEST

    `constant GTK2.GDK_GRAVITY_SOUTH_WEST`

  Constant GDK_GRAVITY_STATIC

    `constant GTK2.GDK_GRAVITY_STATIC`

  Constant GDK_GRAVITY_WEST

    `constant GTK2.GDK_GRAVITY_WEST`

  Constant GDK_GUMBY

    `constant GTK2.GDK_GUMBY`

  Constant GDK_HAND1

    `constant GTK2.GDK_HAND1`

  Constant GDK_HAND2

    `constant GTK2.GDK_HAND2`

  Constant GDK_HEART

    `constant GTK2.GDK_HEART`

  Constant GDK_HINT_ASPECT

    `constant GTK2.GDK_HINT_ASPECT`

  Constant GDK_HINT_BASE_SIZE

    `constant GTK2.GDK_HINT_BASE_SIZE`

  Constant GDK_HINT_MAX_SIZE

    `constant GTK2.GDK_HINT_MAX_SIZE`

  Constant GDK_HINT_MIN_SIZE

    `constant GTK2.GDK_HINT_MIN_SIZE`

  Constant GDK_HINT_POS

    `constant GTK2.GDK_HINT_POS`

  Constant GDK_HINT_RESIZE_INC

    `constant GTK2.GDK_HINT_RESIZE_INC`

  Constant GDK_HINT_USER_POS

    `constant GTK2.GDK_HINT_USER_POS`

  Constant GDK_HINT_USER_SIZE

    `constant GTK2.GDK_HINT_USER_SIZE`

  Constant GDK_ICON

    `constant GTK2.GDK_ICON`

  Constant GDK_IMAGE_FASTEST

    `constant GTK2.GDK_IMAGE_FASTEST`

  Constant GDK_IMAGE_NORMAL

    `constant GTK2.GDK_IMAGE_NORMAL`

  Constant GDK_IMAGE_SHARED

    `constant GTK2.GDK_IMAGE_SHARED`

  Constant GDK_INCLUDE_INFERIORS

    `constant GTK2.GDK_INCLUDE_INFERIORS`

  Constant GDK_INPUT_EXCEPTION

    `constant GTK2.GDK_INPUT_EXCEPTION`

  Constant GDK_INPUT_ONLY

    `constant GTK2.GDK_INPUT_ONLY`

  Constant GDK_INPUT_OUTPUT

    `constant GTK2.GDK_INPUT_OUTPUT`

  Constant GDK_INPUT_READ

    `constant GTK2.GDK_INPUT_READ`

  Constant GDK_INPUT_WRITE

    `constant GTK2.GDK_INPUT_WRITE`

  Constant GDK_INTERP_BILINEAR

    `constant GTK2.GDK_INTERP_BILINEAR`

  Constant GDK_INTERP_HYPER

    `constant GTK2.GDK_INTERP_HYPER`

  Constant GDK_INTERP_NEAREST

    `constant GTK2.GDK_INTERP_NEAREST`

  Constant GDK_INTERP_TILES

    `constant GTK2.GDK_INTERP_TILES`

  Constant GDK_INVERT

    `constant GTK2.GDK_INVERT`

  Constant GDK_IRON_CROSS

    `constant GTK2.GDK_IRON_CROSS`

  Constant GDK_JOIN_BEVEL

    `constant GTK2.GDK_JOIN_BEVEL`

  Constant GDK_JOIN_MITER

    `constant GTK2.GDK_JOIN_MITER`

  Constant GDK_JOIN_ROUND

    `constant GTK2.GDK_JOIN_ROUND`

  Constant GDK_KEY_PRESS

    `constant GTK2.GDK_KEY_PRESS`

  Constant GDK_KEY_PRESS_MASK

    `constant GTK2.GDK_KEY_PRESS_MASK`

  Constant GDK_KEY_RELEASE

    `constant GTK2.GDK_KEY_RELEASE`

  Constant GDK_KEY_RELEASE_MASK

    `constant GTK2.GDK_KEY_RELEASE_MASK`

  Constant GDK_LAST_CURSOR

    `constant GTK2.GDK_LAST_CURSOR`

  Constant GDK_LEAVE_NOTIFY

    `constant GTK2.GDK_LEAVE_NOTIFY`

  Constant GDK_LEAVE_NOTIFY_MASK

    `constant GTK2.GDK_LEAVE_NOTIFY_MASK`

  Constant GDK_LEFTBUTTON

    `constant GTK2.GDK_LEFTBUTTON`

  Constant GDK_LEFT_PTR

    `constant GTK2.GDK_LEFT_PTR`

  Constant GDK_LEFT_SIDE

    `constant GTK2.GDK_LEFT_SIDE`

  Constant GDK_LEFT_TEE

    `constant GTK2.GDK_LEFT_TEE`

  Constant GDK_LINE_DOUBLE_DASH

    `constant GTK2.GDK_LINE_DOUBLE_DASH`

  Constant GDK_LINE_ON_OFF_DASH

    `constant GTK2.GDK_LINE_ON_OFF_DASH`

  Constant GDK_LINE_SOLID

    `constant GTK2.GDK_LINE_SOLID`

  Constant GDK_LL_ANGLE

    `constant GTK2.GDK_LL_ANGLE`

  Constant GDK_LOCK_MASK

    `constant GTK2.GDK_LOCK_MASK`

  Constant GDK_LR_ANGLE

    `constant GTK2.GDK_LR_ANGLE`

  Constant GDK_LSB_FIRST

    `constant GTK2.GDK_LSB_FIRST`

  Constant GDK_MAN

    `constant GTK2.GDK_MAN`

  Constant GDK_MAP

    `constant GTK2.GDK_MAP`

  Constant GDK_MIDDLEBUTTON

    `constant GTK2.GDK_MIDDLEBUTTON`

  Constant GDK_MOD1_MASK

    `constant GTK2.GDK_MOD1_MASK`

  Constant GDK_MOD2_MASK

    `constant GTK2.GDK_MOD2_MASK`

  Constant GDK_MOD3_MASK

    `constant GTK2.GDK_MOD3_MASK`

  Constant GDK_MOD4_MASK

    `constant GTK2.GDK_MOD4_MASK`

  Constant GDK_MOD5_MASK

    `constant GTK2.GDK_MOD5_MASK`

  Constant GDK_MODE_DISABLED

    `constant GTK2.GDK_MODE_DISABLED`

  Constant GDK_MODE_SCREEN

    `constant GTK2.GDK_MODE_SCREEN`

  Constant GDK_MODE_WINDOW

    `constant GTK2.GDK_MODE_WINDOW`

  Constant GDK_MODIFIER_MASK

    `constant GTK2.GDK_MODIFIER_MASK`

  Constant GDK_MOTION_NOTIFY

    `constant GTK2.GDK_MOTION_NOTIFY`

  Constant GDK_MOUSE

    `constant GTK2.GDK_MOUSE`

  Constant GDK_MSB_FIRST

    `constant GTK2.GDK_MSB_FIRST`

  Constant GDK_NAND

    `constant GTK2.GDK_NAND`

  Constant GDK_NOOP

    `constant GTK2.GDK_NOOP`

  Constant GDK_NOR

    `constant GTK2.GDK_NOR`

  Constant GDK_NOTHING

    `constant GTK2.GDK_NOTHING`

  Constant GDK_NOTIFY_ANCESTOR

    `constant GTK2.GDK_NOTIFY_ANCESTOR`

  Constant GDK_NOTIFY_INFERIOR

    `constant GTK2.GDK_NOTIFY_INFERIOR`

  Constant GDK_NOTIFY_NONLINEAR

    `constant GTK2.GDK_NOTIFY_NONLINEAR`

  Constant GDK_NOTIFY_NONLINEAR_VIRTUAL

    `constant GTK2.GDK_NOTIFY_NONLINEAR_VIRTUAL`

  Constant GDK_NOTIFY_UNKNOWN

    `constant GTK2.GDK_NOTIFY_UNKNOWN`

  Constant GDK_NOTIFY_VIRTUAL

    `constant GTK2.GDK_NOTIFY_VIRTUAL`

  Constant GDK_NO_EXPOSE

    `constant GTK2.GDK_NO_EXPOSE`

  Constant GDK_OPAQUE_STIPPLED

    `constant GTK2.GDK_OPAQUE_STIPPLED`

  Constant GDK_OR

    `constant GTK2.GDK_OR`

  Constant GDK_OR_INVERT

    `constant GTK2.GDK_OR_INVERT`

  Constant GDK_OR_REVERSE

    `constant GTK2.GDK_OR_REVERSE`

  Constant GDK_OVERLAP_RECTANGLE_IN

    `constant GTK2.GDK_OVERLAP_RECTANGLE_IN`

  Constant GDK_OVERLAP_RECTANGLE_OUT

    `constant GTK2.GDK_OVERLAP_RECTANGLE_OUT`

  Constant GDK_OVERLAP_RECTANGLE_PART

    `constant GTK2.GDK_OVERLAP_RECTANGLE_PART`

  Constant GDK_OWNER_CHANGE

    `constant GTK2.GDK_OWNER_CHANGE`

  Constant GDK_OWNER_CHANGE_CLOSE

    `constant GTK2.GDK_OWNER_CHANGE_CLOSE`

  Constant GDK_OWNER_CHANGE_DESTROY

    `constant GTK2.GDK_OWNER_CHANGE_DESTROY`

  Constant GDK_OWNER_CHANGE_NEW_OWNER

    `constant GTK2.GDK_OWNER_CHANGE_NEW_OWNER`

  Constant GDK_PENCIL

    `constant GTK2.GDK_PENCIL`

  Constant GDK_PIRATE

    `constant GTK2.GDK_PIRATE`

  Constant GDK_PIXBUF_ALPHA_BILEVEL

    `constant GTK2.GDK_PIXBUF_ALPHA_BILEVEL`

  Constant GDK_PIXBUF_ALPHA_FULL

    `constant GTK2.GDK_PIXBUF_ALPHA_FULL`

  Constant GDK_PIXBUF_ERROR_BAD_OPTION

    `constant GTK2.GDK_PIXBUF_ERROR_BAD_OPTION`

  Constant GDK_PIXBUF_ERROR_CORRUPT_IMAGE

    `constant GTK2.GDK_PIXBUF_ERROR_CORRUPT_IMAGE`

  Constant GDK_PIXBUF_ERROR_FAILED

    `constant GTK2.GDK_PIXBUF_ERROR_FAILED`

  Constant GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY

    `constant GTK2.GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY`

  Constant GDK_PIXBUF_ERROR_UNKNOWN_TYPE

    `constant GTK2.GDK_PIXBUF_ERROR_UNKNOWN_TYPE`

  Constant GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION

    `constant GTK2.GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION`

  Constant GDK_PIXBUF_ROTATE_CLOCKWISE

    `constant GTK2.GDK_PIXBUF_ROTATE_CLOCKWISE`

  Constant GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE

    `constant GTK2.GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE`

  Constant GDK_PIXBUF_ROTATE_NONE

    `constant GTK2.GDK_PIXBUF_ROTATE_NONE`

  Constant GDK_PIXBUF_ROTATE_UPSIDEDOWN

    `constant GTK2.GDK_PIXBUF_ROTATE_UPSIDEDOWN`

  Constant GDK_PLUS

    `constant GTK2.GDK_PLUS`

  Constant GDK_POINTER_MOTION_HINT_MASK

    `constant GTK2.GDK_POINTER_MOTION_HINT_MASK`

  Constant GDK_POINTER_MOTION_MASK

    `constant GTK2.GDK_POINTER_MOTION_MASK`

  Constant GDK_PROPERTY_CHANGE_MASK

    `constant GTK2.GDK_PROPERTY_CHANGE_MASK`

  Constant GDK_PROPERTY_DELETE

    `constant GTK2.GDK_PROPERTY_DELETE`

  Constant GDK_PROPERTY_NEW_VALUE

    `constant GTK2.GDK_PROPERTY_NEW_VALUE`

  Constant GDK_PROPERTY_NOTIFY

    `constant GTK2.GDK_PROPERTY_NOTIFY`

  Constant GDK_PROP_MODE_APPEND

    `constant GTK2.GDK_PROP_MODE_APPEND`

  Constant GDK_PROP_MODE_PREPEND

    `constant GTK2.GDK_PROP_MODE_PREPEND`

  Constant GDK_PROP_MODE_REPLACE

    `constant GTK2.GDK_PROP_MODE_REPLACE`

  Constant GDK_PROXIMITY_IN

    `constant GTK2.GDK_PROXIMITY_IN`

  Constant GDK_PROXIMITY_IN_MASK

    `constant GTK2.GDK_PROXIMITY_IN_MASK`

  Constant GDK_PROXIMITY_OUT

    `constant GTK2.GDK_PROXIMITY_OUT`

  Constant GDK_PROXIMITY_OUT_MASK

    `constant GTK2.GDK_PROXIMITY_OUT_MASK`

  Constant GDK_QUESTION_ARROW

    `constant GTK2.GDK_QUESTION_ARROW`

  Constant GDK_RELEASE_MASK

    `constant GTK2.GDK_RELEASE_MASK`

  Constant GDK_RGB_DITHER_MAX

    `constant GTK2.GDK_RGB_DITHER_MAX`

  Constant GDK_RGB_DITHER_NONE

    `constant GTK2.GDK_RGB_DITHER_NONE`

  Constant GDK_RGB_DITHER_NORMAL

    `constant GTK2.GDK_RGB_DITHER_NORMAL`

  Constant GDK_RIGHTBUTTON

    `constant GTK2.GDK_RIGHTBUTTON`

  Constant GDK_RIGHT_PTR

    `constant GTK2.GDK_RIGHT_PTR`

  Constant GDK_RIGHT_SIDE

    `constant GTK2.GDK_RIGHT_SIDE`

  Constant GDK_RIGHT_TEE

    `constant GTK2.GDK_RIGHT_TEE`

  Constant GDK_RTL_LOGO

    `constant GTK2.GDK_RTL_LOGO`

  Constant GDK_SAILBOAT

    `constant GTK2.GDK_SAILBOAT`

  Constant GDK_SB_DOWN_ARROW

    `constant GTK2.GDK_SB_DOWN_ARROW`

  Constant GDK_SB_H_DOUBLE_ARROW

    `constant GTK2.GDK_SB_H_DOUBLE_ARROW`

  Constant GDK_SB_LEFT_ARROW

    `constant GTK2.GDK_SB_LEFT_ARROW`

  Constant GDK_SB_RIGHT_ARROW

    `constant GTK2.GDK_SB_RIGHT_ARROW`

  Constant GDK_SB_UP_ARROW

    `constant GTK2.GDK_SB_UP_ARROW`

  Constant GDK_SB_V_DOUBLE_ARROW

    `constant GTK2.GDK_SB_V_DOUBLE_ARROW`

  Constant GDK_SCROLL

    `constant GTK2.GDK_SCROLL`

  Constant GDK_SCROLL_DOWN

    `constant GTK2.GDK_SCROLL_DOWN`

  Constant GDK_SCROLL_LEFT

    `constant GTK2.GDK_SCROLL_LEFT`

  Constant GDK_SCROLL_MASK

    `constant GTK2.GDK_SCROLL_MASK`

  Constant GDK_SCROLL_RIGHT

    `constant GTK2.GDK_SCROLL_RIGHT`

  Constant GDK_SCROLL_UP

    `constant GTK2.GDK_SCROLL_UP`

  Constant GDK_SELECTION_CLEAR

    `constant GTK2.GDK_SELECTION_CLEAR`

  Constant GDK_SELECTION_NOTIFY

    `constant GTK2.GDK_SELECTION_NOTIFY`

  Constant GDK_SELECTION_REQUEST

    `constant GTK2.GDK_SELECTION_REQUEST`

  Constant GDK_SET

    `constant GTK2.GDK_SET`

  Constant GDK_SETTING

    `constant GTK2.GDK_SETTING`

  Constant GDK_SETTING_ACTION_CHANGED

    `constant GTK2.GDK_SETTING_ACTION_CHANGED`

  Constant GDK_SETTING_ACTION_DELETED

    `constant GTK2.GDK_SETTING_ACTION_DELETED`

  Constant GDK_SETTING_ACTION_NEW

    `constant GTK2.GDK_SETTING_ACTION_NEW`

  Constant GDK_SHIFT_MASK

    `constant GTK2.GDK_SHIFT_MASK`

  Constant GDK_SHUTTLE

    `constant GTK2.GDK_SHUTTLE`

  Constant GDK_SIZING

    `constant GTK2.GDK_SIZING`

  Constant GDK_SOLID

    `constant GTK2.GDK_SOLID`

  Constant GDK_SOURCE_CURSOR

    `constant GTK2.GDK_SOURCE_CURSOR`

  Constant GDK_SOURCE_ERASER

    `constant GTK2.GDK_SOURCE_ERASER`

  Constant GDK_SOURCE_MOUSE

    `constant GTK2.GDK_SOURCE_MOUSE`

  Constant GDK_SOURCE_PEN

    `constant GTK2.GDK_SOURCE_PEN`

  Constant GDK_SPIDER

    `constant GTK2.GDK_SPIDER`

  Constant GDK_SPRAYCAN

    `constant GTK2.GDK_SPRAYCAN`

  Constant GDK_STAR

    `constant GTK2.GDK_STAR`

  Constant GDK_STIPPLED

    `constant GTK2.GDK_STIPPLED`

  Constant GDK_STRUCTURE_MASK

    `constant GTK2.GDK_STRUCTURE_MASK`

  Constant GDK_SUBSTRUCTURE_MASK

    `constant GTK2.GDK_SUBSTRUCTURE_MASK`

  Constant GDK_TARGET

    `constant GTK2.GDK_TARGET`

  Constant GDK_TCROSS

    `constant GTK2.GDK_TCROSS`

  Constant GDK_TILED

    `constant GTK2.GDK_TILED`

  Constant GDK_TOP_LEFT_ARROW

    `constant GTK2.GDK_TOP_LEFT_ARROW`

  Constant GDK_TOP_LEFT_CORNER

    `constant GTK2.GDK_TOP_LEFT_CORNER`

  Constant GDK_TOP_RIGHT_CORNER

    `constant GTK2.GDK_TOP_RIGHT_CORNER`

  Constant GDK_TOP_SIDE

    `constant GTK2.GDK_TOP_SIDE`

  Constant GDK_TOP_TEE

    `constant GTK2.GDK_TOP_TEE`

  Constant GDK_TREK

    `constant GTK2.GDK_TREK`

  Constant GDK_UL_ANGLE

    `constant GTK2.GDK_UL_ANGLE`

  Constant GDK_UMBRELLA

    `constant GTK2.GDK_UMBRELLA`

  Constant GDK_UNMAP

    `constant GTK2.GDK_UNMAP`

  Constant GDK_UR_ANGLE

    `constant GTK2.GDK_UR_ANGLE`

  Constant GDK_VISIBILITY_FULLY_OBSCURED

    `constant GTK2.GDK_VISIBILITY_FULLY_OBSCURED`

  Constant GDK_VISIBILITY_NOTIFY

    `constant GTK2.GDK_VISIBILITY_NOTIFY`

  Constant GDK_VISIBILITY_NOTIFY_MASK

    `constant GTK2.GDK_VISIBILITY_NOTIFY_MASK`

  Constant GDK_VISIBILITY_PARTIAL

    `constant GTK2.GDK_VISIBILITY_PARTIAL`

  Constant GDK_VISIBILITY_UNOBSCURED

    `constant GTK2.GDK_VISIBILITY_UNOBSCURED`

  Constant GDK_VISUAL_DIRECT_COLOR

    `constant GTK2.GDK_VISUAL_DIRECT_COLOR`

  Constant GDK_VISUAL_GRAYSCALE

    `constant GTK2.GDK_VISUAL_GRAYSCALE`

  Constant GDK_VISUAL_PSEUDO_COLOR

    `constant GTK2.GDK_VISUAL_PSEUDO_COLOR`

  Constant GDK_VISUAL_STATIC_COLOR

    `constant GTK2.GDK_VISUAL_STATIC_COLOR`

  Constant GDK_VISUAL_STATIC_GRAY

    `constant GTK2.GDK_VISUAL_STATIC_GRAY`

  Constant GDK_VISUAL_TRUE_COLOR

    `constant GTK2.GDK_VISUAL_TRUE_COLOR`

  Constant GDK_WATCH

    `constant GTK2.GDK_WATCH`

  Constant GDK_WA_COLORMAP

    `constant GTK2.GDK_WA_COLORMAP`

  Constant GDK_WA_CURSOR

    `constant GTK2.GDK_WA_CURSOR`

  Constant GDK_WA_NOREDIR

    `constant GTK2.GDK_WA_NOREDIR`

  Constant GDK_WA_TITLE

    `constant GTK2.GDK_WA_TITLE`

  Constant GDK_WA_VISUAL

    `constant GTK2.GDK_WA_VISUAL`

  Constant GDK_WA_WMCLASS

    `constant GTK2.GDK_WA_WMCLASS`

  Constant GDK_WA_X

    `constant GTK2.GDK_WA_X`

  Constant GDK_WA_Y

    `constant GTK2.GDK_WA_Y`

  Constant GDK_WINDING_RULE

    `constant GTK2.GDK_WINDING_RULE`

  Constant GDK_WINDOW_CHILD

    `constant GTK2.GDK_WINDOW_CHILD`

  Constant GDK_WINDOW_DIALOG

    `constant GTK2.GDK_WINDOW_DIALOG`

  Constant GDK_WINDOW_EDGE_EAST

    `constant GTK2.GDK_WINDOW_EDGE_EAST`

  Constant GDK_WINDOW_EDGE_NORTH

    `constant GTK2.GDK_WINDOW_EDGE_NORTH`

  Constant GDK_WINDOW_EDGE_NORTH_EAST

    `constant GTK2.GDK_WINDOW_EDGE_NORTH_EAST`

  Constant GDK_WINDOW_EDGE_NORTH_WEST

    `constant GTK2.GDK_WINDOW_EDGE_NORTH_WEST`

  Constant GDK_WINDOW_EDGE_SOUTH

    `constant GTK2.GDK_WINDOW_EDGE_SOUTH`

  Constant GDK_WINDOW_EDGE_SOUTH_EAST

    `constant GTK2.GDK_WINDOW_EDGE_SOUTH_EAST`

  Constant GDK_WINDOW_EDGE_SOUTH_WEST

    `constant GTK2.GDK_WINDOW_EDGE_SOUTH_WEST`

  Constant GDK_WINDOW_EDGE_WEST

    `constant GTK2.GDK_WINDOW_EDGE_WEST`

  Constant GDK_WINDOW_FOREIGN

    `constant GTK2.GDK_WINDOW_FOREIGN`

  Constant GDK_WINDOW_ROOT

    `constant GTK2.GDK_WINDOW_ROOT`

  Constant GDK_WINDOW_STATE

    `constant GTK2.GDK_WINDOW_STATE`

  Constant GDK_WINDOW_STATE_ABOVE

    `constant GTK2.GDK_WINDOW_STATE_ABOVE`

  Constant GDK_WINDOW_STATE_BELOW

    `constant GTK2.GDK_WINDOW_STATE_BELOW`

  Constant GDK_WINDOW_STATE_FULLSCREEN

    `constant GTK2.GDK_WINDOW_STATE_FULLSCREEN`

  Constant GDK_WINDOW_STATE_ICONIFIED

    `constant GTK2.GDK_WINDOW_STATE_ICONIFIED`

  Constant GDK_WINDOW_STATE_MAXIMIZED

    `constant GTK2.GDK_WINDOW_STATE_MAXIMIZED`

  Constant GDK_WINDOW_STATE_STICKY

    `constant GTK2.GDK_WINDOW_STATE_STICKY`

  Constant GDK_WINDOW_STATE_WITHDRAWN

    `constant GTK2.GDK_WINDOW_STATE_WITHDRAWN`

  Constant GDK_WINDOW_TEMP

    `constant GTK2.GDK_WINDOW_TEMP`

  Constant GDK_WINDOW_TOPLEVEL

    `constant GTK2.GDK_WINDOW_TOPLEVEL`

  Constant GDK_WINDOW_TYPE_HINT_DESKTOP

    `constant GTK2.GDK_WINDOW_TYPE_HINT_DESKTOP`

  Constant GDK_WINDOW_TYPE_HINT_DIALOG

    `constant GTK2.GDK_WINDOW_TYPE_HINT_DIALOG`

  Constant GDK_WINDOW_TYPE_HINT_DOCK

    `constant GTK2.GDK_WINDOW_TYPE_HINT_DOCK`

  Constant GDK_WINDOW_TYPE_HINT_MENU

    `constant GTK2.GDK_WINDOW_TYPE_HINT_MENU`

  Constant GDK_WINDOW_TYPE_HINT_NORMAL

    `constant GTK2.GDK_WINDOW_TYPE_HINT_NORMAL`

  Constant GDK_WINDOW_TYPE_HINT_SPLASHSCREEN

    `constant GTK2.GDK_WINDOW_TYPE_HINT_SPLASHSCREEN`

  Constant GDK_WINDOW_TYPE_HINT_TOOLBAR

    `constant GTK2.GDK_WINDOW_TYPE_HINT_TOOLBAR`

  Constant GDK_WINDOW_TYPE_HINT_UTILITY

    `constant GTK2.GDK_WINDOW_TYPE_HINT_UTILITY`

  Constant GDK_XOR

    `constant GTK2.GDK_XOR`

  Constant GDK_XTERM

    `constant GTK2.GDK_XTERM`

  Constant GDK_X_CURSOR

    `constant GTK2.GDK_X_CURSOR`

  Constant GNOME_CLIENT_IS_CONNECTED

    `constant GTK2.GNOME_CLIENT_IS_CONNECTED`

  Constant GNOME_CLIENT_RESTARTED

    `constant GTK2.GNOME_CLIENT_RESTARTED`

  Constant GNOME_CLIENT_RESTORED

    `constant GTK2.GNOME_CLIENT_RESTORED`

  Constant GNOME_DATE_EDIT_24_HR

    `constant GTK2.GNOME_DATE_EDIT_24_HR`

  Constant GNOME_DATE_EDIT_SHOW_TIME

    `constant GTK2.GNOME_DATE_EDIT_SHOW_TIME`

  Constant GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY

    `constant GTK2.GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY`

  Constant GNOME_DIALOG_ERROR

    `constant GTK2.GNOME_DIALOG_ERROR`

  Constant GNOME_DIALOG_NORMAL

    `constant GTK2.GNOME_DIALOG_NORMAL`

  Constant GNOME_EDGE_FINISH

    `constant GTK2.GNOME_EDGE_FINISH`

  Constant GNOME_EDGE_LAST

    `constant GTK2.GNOME_EDGE_LAST`

  Constant GNOME_EDGE_OTHER

    `constant GTK2.GNOME_EDGE_OTHER`

  Constant GNOME_EDGE_START

    `constant GTK2.GNOME_EDGE_START`

  Constant GNOME_INTERACT_ANY

    `constant GTK2.GNOME_INTERACT_ANY`

  Constant GNOME_INTERACT_ERRORS

    `constant GTK2.GNOME_INTERACT_ERRORS`

  Constant GNOME_INTERACT_NONE

    `constant GTK2.GNOME_INTERACT_NONE`

  Constant GNOME_PREFERENCES_ALWAYS

    `constant GTK2.GNOME_PREFERENCES_ALWAYS`

  Constant GNOME_PREFERENCES_NEVER

    `constant GTK2.GNOME_PREFERENCES_NEVER`

  Constant GNOME_PREFERENCES_USER

    `constant GTK2.GNOME_PREFERENCES_USER`

  Constant GNOME_RESTART_ANYWAY

    `constant GTK2.GNOME_RESTART_ANYWAY`

  Constant GNOME_RESTART_IF_RUNNING

    `constant GTK2.GNOME_RESTART_IF_RUNNING`

  Constant GNOME_RESTART_IMMEDIATELY

    `constant GTK2.GNOME_RESTART_IMMEDIATELY`

  Constant GNOME_RESTART_NEVER

    `constant GTK2.GNOME_RESTART_NEVER`

  Constant GNOME_SAVE_BOTH

    `constant GTK2.GNOME_SAVE_BOTH`

  Constant GNOME_SAVE_GLOBAL

    `constant GTK2.GNOME_SAVE_GLOBAL`

  Constant GNOME_SAVE_LOCAL

    `constant GTK2.GNOME_SAVE_LOCAL`

  Constant ACCEL_LOCKED

    `constant GTK2.ACCEL_LOCKED`

  Constant ACCEL_MASK

    `constant GTK2.ACCEL_MASK`

  Constant ACCEL_VISIBLE

    `constant GTK2.ACCEL_VISIBLE`

  Constant ANCHOR_CENTER

    `constant GTK2.ANCHOR_CENTER`

  Constant ANCHOR_E

    `constant GTK2.ANCHOR_E`

  Constant ANCHOR_EAST

    `constant GTK2.ANCHOR_EAST`

  Constant ANCHOR_N

    `constant GTK2.ANCHOR_N`

  Constant ANCHOR_NE

    `constant GTK2.ANCHOR_NE`

  Constant ANCHOR_NORTH

    `constant GTK2.ANCHOR_NORTH`

  Constant ANCHOR_NORTH_EAST

    `constant GTK2.ANCHOR_NORTH_EAST`

  Constant ANCHOR_NORTH_WEST

    `constant GTK2.ANCHOR_NORTH_WEST`

  Constant ANCHOR_NW

    `constant GTK2.ANCHOR_NW`

  Constant ANCHOR_S

    `constant GTK2.ANCHOR_S`

  Constant ANCHOR_SE

    `constant GTK2.ANCHOR_SE`

  Constant ANCHOR_SOUTH

    `constant GTK2.ANCHOR_SOUTH`

  Constant ANCHOR_SOUTH_EAST

    `constant GTK2.ANCHOR_SOUTH_EAST`

  Constant ANCHOR_SOUTH_WEST

    `constant GTK2.ANCHOR_SOUTH_WEST`

  Constant ANCHOR_SW

    `constant GTK2.ANCHOR_SW`

  Constant ANCHOR_W

    `constant GTK2.ANCHOR_W`

  Constant ANCHOR_WEST

    `constant GTK2.ANCHOR_WEST`

  Constant APP_PAINTABLE

    `constant GTK2.APP_PAINTABLE`

  Constant ARROW_DOWN

    `constant GTK2.ARROW_DOWN`

  Constant ARROW_LEFT

    `constant GTK2.ARROW_LEFT`

  Constant ARROW_RIGHT

    `constant GTK2.ARROW_RIGHT`

  Constant ARROW_UP

    `constant GTK2.ARROW_UP`

  Constant BUTTONBOX_DEFAULT_STYLE

    `constant GTK2.BUTTONBOX_DEFAULT_STYLE`

  Constant BUTTONBOX_EDGE

    `constant GTK2.BUTTONBOX_EDGE`

  Constant BUTTONBOX_END

    `constant GTK2.BUTTONBOX_END`

  Constant BUTTONBOX_SPREAD

    `constant GTK2.BUTTONBOX_SPREAD`

  Constant BUTTONBOX_START

    `constant GTK2.BUTTONBOX_START`

  Constant BUTTONS_CANCEL

    `constant GTK2.BUTTONS_CANCEL`

  Constant BUTTONS_CLOSE

    `constant GTK2.BUTTONS_CLOSE`

  Constant BUTTONS_NONE

    `constant GTK2.BUTTONS_NONE`

  Constant BUTTONS_OK

    `constant GTK2.BUTTONS_OK`

  Constant BUTTONS_OK_CANCEL

    `constant GTK2.BUTTONS_OK_CANCEL`

  Constant BUTTONS_YES_NO

    `constant GTK2.BUTTONS_YES_NO`

  Constant CALENDAR_NO_MONTH_CHANGE

    `constant GTK2.CALENDAR_NO_MONTH_CHANGE`

  Constant CALENDAR_SHOW_DAY_NAMES

    `constant GTK2.CALENDAR_SHOW_DAY_NAMES`

  Constant CALENDAR_SHOW_HEADING

    `constant GTK2.CALENDAR_SHOW_HEADING`

  Constant CALENDAR_SHOW_WEEK_NUMBERS

    `constant GTK2.CALENDAR_SHOW_WEEK_NUMBERS`

  Constant CALENDAR_WEEK_START_MONDAY

    `constant GTK2.CALENDAR_WEEK_START_MONDAY`

  Constant CAN_DEFAULT

    `constant GTK2.CAN_DEFAULT`

  Constant CAN_FOCUS

    `constant GTK2.CAN_FOCUS`

  Constant CELL_RENDERER_FOCUSED

    `constant GTK2.CELL_RENDERER_FOCUSED`

  Constant CELL_RENDERER_INSENSITIVE

    `constant GTK2.CELL_RENDERER_INSENSITIVE`

  Constant CELL_RENDERER_MODE_ACTIVATABLE

    `constant GTK2.CELL_RENDERER_MODE_ACTIVATABLE`

  Constant CELL_RENDERER_MODE_EDITABLE

    `constant GTK2.CELL_RENDERER_MODE_EDITABLE`

  Constant CELL_RENDERER_MODE_INERT

    `constant GTK2.CELL_RENDERER_MODE_INERT`

  Constant CELL_RENDERER_PRELIT

    `constant GTK2.CELL_RENDERER_PRELIT`

  Constant CELL_RENDERER_SELECTED

    `constant GTK2.CELL_RENDERER_SELECTED`

  Constant CELL_RENDERER_SORTED

    `constant GTK2.CELL_RENDERER_SORTED`

  Constant CENTIMETERS

    `constant GTK2.CENTIMETERS`

  Constant COMPOSITE_CHILD

    `constant GTK2.COMPOSITE_CHILD`

  Constant CORNER_BOTTOM_LEFT

    `constant GTK2.CORNER_BOTTOM_LEFT`

  Constant CORNER_BOTTOM_RIGHT

    `constant GTK2.CORNER_BOTTOM_RIGHT`

  Constant CORNER_TOP_LEFT

    `constant GTK2.CORNER_TOP_LEFT`

  Constant CORNER_TOP_RIGHT

    `constant GTK2.CORNER_TOP_RIGHT`

  Constant CURVE_TYPE_FREE

    `constant GTK2.CURVE_TYPE_FREE`

  Constant CURVE_TYPE_LINEAR

    `constant GTK2.CURVE_TYPE_LINEAR`

  Constant CURVE_TYPE_SPLINE

    `constant GTK2.CURVE_TYPE_SPLINE`

  Constant DATABOX_BARS

    `constant GTK2.DATABOX_BARS`

  Constant DATABOX_CROSS_SIMPLE

    `constant GTK2.DATABOX_CROSS_SIMPLE`

  Constant DATABOX_GRID

    `constant GTK2.DATABOX_GRID`

  Constant DATABOX_LINES

    `constant GTK2.DATABOX_LINES`

  Constant DATABOX_NOT_DISPLAYED

    `constant GTK2.DATABOX_NOT_DISPLAYED`

  Constant DATABOX_POINTS

    `constant GTK2.DATABOX_POINTS`

  Constant DELETE_CHARS

    `constant GTK2.DELETE_CHARS`

  Constant DELETE_DISPLAY_LINES

    `constant GTK2.DELETE_DISPLAY_LINES`

  Constant DELETE_DISPLAY_LINE_ENDS

    `constant GTK2.DELETE_DISPLAY_LINE_ENDS`

  Constant DELETE_PARAGRAPHS

    `constant GTK2.DELETE_PARAGRAPHS`

  Constant DELETE_PARAGRAPH_ENDS

    `constant GTK2.DELETE_PARAGRAPH_ENDS`

  Constant DELETE_WHITESPACE

    `constant GTK2.DELETE_WHITESPACE`

  Constant DELETE_WORDS

    `constant GTK2.DELETE_WORDS`

  Constant DELETE_WORD_ENDS

    `constant GTK2.DELETE_WORD_ENDS`

  Constant DEST_DEFAULT_ALL

    `constant GTK2.DEST_DEFAULT_ALL`

  Constant DEST_DEFAULT_DROP

    `constant GTK2.DEST_DEFAULT_DROP`

  Constant DEST_DEFAULT_HIGHLIGHT

    `constant GTK2.DEST_DEFAULT_HIGHLIGHT`

  Constant DEST_DEFAULT_MOTION

    `constant GTK2.DEST_DEFAULT_MOTION`

  Constant DIALOG_DESTROY_WITH_PARENT

    `constant GTK2.DIALOG_DESTROY_WITH_PARENT`

  Constant DIALOG_MODAL

    `constant GTK2.DIALOG_MODAL`

  Constant DIALOG_NO_SEPARATOR

    `constant GTK2.DIALOG_NO_SEPARATOR`

  Constant DIR_DOWN

    `constant GTK2.DIR_DOWN`

  Constant DIR_LEFT

    `constant GTK2.DIR_LEFT`

  Constant DIR_RIGHT

    `constant GTK2.DIR_RIGHT`

  Constant DIR_TAB_BACKWARD

    `constant GTK2.DIR_TAB_BACKWARD`

  Constant DIR_TAB_FORWARD

    `constant GTK2.DIR_TAB_FORWARD`

  Constant DIR_UP

    `constant GTK2.DIR_UP`

  Constant DOUBLE_BUFFERED

    `constant GTK2.DOUBLE_BUFFERED`

  Constant EXPAND

    `constant GTK2.EXPAND`

  Constant EXPANDER_COLLAPSED

    `constant GTK2.EXPANDER_COLLAPSED`

  Constant EXPANDER_EXPANDED

    `constant GTK2.EXPANDER_EXPANDED`

  Constant EXPANDER_SEMI_COLLAPSED

    `constant GTK2.EXPANDER_SEMI_COLLAPSED`

  Constant EXPANDER_SEMI_EXPANDED

    `constant GTK2.EXPANDER_SEMI_EXPANDED`

  Constant FILE_CHOOSER_ACTION_CREATE_FOLDER

    `constant GTK2.FILE_CHOOSER_ACTION_CREATE_FOLDER`

  Constant FILE_CHOOSER_ACTION_OPEN

    `constant GTK2.FILE_CHOOSER_ACTION_OPEN`

  Constant FILE_CHOOSER_ACTION_SAVE

    `constant GTK2.FILE_CHOOSER_ACTION_SAVE`

  Constant FILE_CHOOSER_ACTION_SELECT_FOLDER

    `constant GTK2.FILE_CHOOSER_ACTION_SELECT_FOLDER`

  Constant FILE_CHOOSER_ERROR_BAD_FILENAME

    `constant GTK2.FILE_CHOOSER_ERROR_BAD_FILENAME`

  Constant FILE_CHOOSER_ERROR_NONEXISTENT

    `constant GTK2.FILE_CHOOSER_ERROR_NONEXISTENT`

  Constant FILE_FILTER_DISPLAY_NAME

    `constant GTK2.FILE_FILTER_DISPLAY_NAME`

  Constant FILE_FILTER_FILENAME

    `constant GTK2.FILE_FILTER_FILENAME`

  Constant FILE_FILTER_MIME_TYPE

    `constant GTK2.FILE_FILTER_MIME_TYPE`

  Constant FILE_FILTER_URI

    `constant GTK2.FILE_FILTER_URI`

  Constant FILL

    `constant GTK2.FILL`

  Constant FLOATING

    `constant GTK2.FLOATING`

  Constant HAS_DEFAULT

    `constant GTK2.HAS_DEFAULT`

  Constant HAS_FOCUS

    `constant GTK2.HAS_FOCUS`

  Constant HAS_GRAB

    `constant GTK2.HAS_GRAB`

  Constant ICON_LOOKUP_FORCE_SVG

    `constant GTK2.ICON_LOOKUP_FORCE_SVG`

  Constant ICON_LOOKUP_NO_SVG

    `constant GTK2.ICON_LOOKUP_NO_SVG`

  Constant ICON_LOOKUP_USE_BUILTIN

    `constant GTK2.ICON_LOOKUP_USE_BUILTIN`

  Constant ICON_SIZE_BUTTON

    `constant GTK2.ICON_SIZE_BUTTON`

  Constant ICON_SIZE_DIALOG

    `constant GTK2.ICON_SIZE_DIALOG`

  Constant ICON_SIZE_DND

    `constant GTK2.ICON_SIZE_DND`

  Constant ICON_SIZE_INVALID

    `constant GTK2.ICON_SIZE_INVALID`

  Constant ICON_SIZE_LARGE_TOOLBAR

    `constant GTK2.ICON_SIZE_LARGE_TOOLBAR`

  Constant ICON_SIZE_MENU

    `constant GTK2.ICON_SIZE_MENU`

  Constant ICON_SIZE_SMALL_TOOLBAR

    `constant GTK2.ICON_SIZE_SMALL_TOOLBAR`

  Constant ICON_THEME_FAILED

    `constant GTK2.ICON_THEME_FAILED`

  Constant ICON_THEME_NOT_FOUND

    `constant GTK2.ICON_THEME_NOT_FOUND`

  Constant IMAGE_ANIMATION

    `constant GTK2.IMAGE_ANIMATION`

  Constant IMAGE_EMPTY

    `constant GTK2.IMAGE_EMPTY`

  Constant IMAGE_ICON_NAME

    `constant GTK2.IMAGE_ICON_NAME`

  Constant IMAGE_ICON_SET

    `constant GTK2.IMAGE_ICON_SET`

  Constant IMAGE_IMAGE

    `constant GTK2.IMAGE_IMAGE`

  Constant IMAGE_PIXBUF

    `constant GTK2.IMAGE_PIXBUF`

  Constant IMAGE_PIXMAP

    `constant GTK2.IMAGE_PIXMAP`

  Constant IMAGE_STOCK

    `constant GTK2.IMAGE_STOCK`

  Constant IM_PREEDIT_CALLBACK

    `constant GTK2.IM_PREEDIT_CALLBACK`

  Constant IM_PREEDIT_NONE

    `constant GTK2.IM_PREEDIT_NONE`

  Constant IM_PREEDIT_NOTHING

    `constant GTK2.IM_PREEDIT_NOTHING`

  Constant IM_STATUS_CALLBACK

    `constant GTK2.IM_STATUS_CALLBACK`

  Constant IM_STATUS_NONE

    `constant GTK2.IM_STATUS_NONE`

  Constant IM_STATUS_NOTHING

    `constant GTK2.IM_STATUS_NOTHING`

  Constant INCHES

    `constant GTK2.INCHES`

  Constant IN_DESTRUCTION

    `constant GTK2.IN_DESTRUCTION`

  Constant JUSTIFY_CENTER

    `constant GTK2.JUSTIFY_CENTER`

  Constant JUSTIFY_FILL

    `constant GTK2.JUSTIFY_FILL`

  Constant JUSTIFY_LEFT

    `constant GTK2.JUSTIFY_LEFT`

  Constant JUSTIFY_RIGHT

    `constant GTK2.JUSTIFY_RIGHT`

  Constant MAPPED

    `constant GTK2.MAPPED`

  Constant MENU_DIR_CHILD

    `constant GTK2.MENU_DIR_CHILD`

  Constant MENU_DIR_NEXT

    `constant GTK2.MENU_DIR_NEXT`

  Constant MENU_DIR_PARENT

    `constant GTK2.MENU_DIR_PARENT`

  Constant MENU_DIR_PREV

    `constant GTK2.MENU_DIR_PREV`

  Constant MESSAGE_ERROR

    `constant GTK2.MESSAGE_ERROR`

  Constant MESSAGE_INFO

    `constant GTK2.MESSAGE_INFO`

  Constant MESSAGE_QUESTION

    `constant GTK2.MESSAGE_QUESTION`

  Constant MESSAGE_WARNING

    `constant GTK2.MESSAGE_WARNING`

  Constant MOVEMENT_BUFFER_ENDS

    `constant GTK2.MOVEMENT_BUFFER_ENDS`

  Constant MOVEMENT_DISPLAY_LINES

    `constant GTK2.MOVEMENT_DISPLAY_LINES`

  Constant MOVEMENT_DISPLAY_LINE_ENDS

    `constant GTK2.MOVEMENT_DISPLAY_LINE_ENDS`

  Constant MOVEMENT_HORIZONTAL_PAGES

    `constant GTK2.MOVEMENT_HORIZONTAL_PAGES`

  Constant MOVEMENT_LOGICAL_POSITIONS

    `constant GTK2.MOVEMENT_LOGICAL_POSITIONS`

  Constant MOVEMENT_PAGES

    `constant GTK2.MOVEMENT_PAGES`

  Constant MOVEMENT_PARAGRAPHS

    `constant GTK2.MOVEMENT_PARAGRAPHS`

  Constant MOVEMENT_PARAGRAPH_ENDS

    `constant GTK2.MOVEMENT_PARAGRAPH_ENDS`

  Constant MOVEMENT_VISUAL_POSITIONS

    `constant GTK2.MOVEMENT_VISUAL_POSITIONS`

  Constant MOVEMENT_WORDS

    `constant GTK2.MOVEMENT_WORDS`

  Constant NO_REPARENT

    `constant GTK2.NO_REPARENT`

  Constant NO_SHOW_ALL

    `constant GTK2.NO_SHOW_ALL`

  Constant NO_WINDOW

    `constant GTK2.NO_WINDOW`

  Constant ORIENTATION_HORIZONTAL

    `constant GTK2.ORIENTATION_HORIZONTAL`

  Constant ORIENTATION_VERTICAL

    `constant GTK2.ORIENTATION_VERTICAL`

  Constant PACK_END

    `constant GTK2.PACK_END`

  Constant PACK_START

    `constant GTK2.PACK_START`

  Constant PARENT_SENSITIVE

    `constant GTK2.PARENT_SENSITIVE`

  Constant PATH_CLASS

    `constant GTK2.PATH_CLASS`

  Constant PATH_PRIO_APPLICATION

    `constant GTK2.PATH_PRIO_APPLICATION`

  Constant PATH_PRIO_GTK

    `constant GTK2.PATH_PRIO_GTK`

  Constant PATH_PRIO_HIGHEST

    `constant GTK2.PATH_PRIO_HIGHEST`

  Constant PATH_PRIO_LOWEST

    `constant GTK2.PATH_PRIO_LOWEST`

  Constant PATH_PRIO_RC

    `constant GTK2.PATH_PRIO_RC`

  Constant PATH_PRIO_THEME

    `constant GTK2.PATH_PRIO_THEME`

  Constant PATH_WIDGET

    `constant GTK2.PATH_WIDGET`

  Constant PATH_WIDGET_CLASS

    `constant GTK2.PATH_WIDGET_CLASS`

  Constant PIXELS

    `constant GTK2.PIXELS`

  Constant POLICY_ALWAYS

    `constant GTK2.POLICY_ALWAYS`

  Constant POLICY_AUTOMATIC

    `constant GTK2.POLICY_AUTOMATIC`

  Constant POLICY_NEVER

    `constant GTK2.POLICY_NEVER`

  Constant POS_BOTTOM

    `constant GTK2.POS_BOTTOM`

  Constant POS_LEFT

    `constant GTK2.POS_LEFT`

  Constant POS_RIGHT

    `constant GTK2.POS_RIGHT`

  Constant POS_TOP

    `constant GTK2.POS_TOP`

  Constant PROGRESS_BOTTOM_TO_TOP

    `constant GTK2.PROGRESS_BOTTOM_TO_TOP`

  Constant PROGRESS_CONTINUOUS

    `constant GTK2.PROGRESS_CONTINUOUS`

  Constant PROGRESS_DISCRETE

    `constant GTK2.PROGRESS_DISCRETE`

  Constant PROGRESS_LEFT_TO_RIGHT

    `constant GTK2.PROGRESS_LEFT_TO_RIGHT`

  Constant PROGRESS_RIGHT_TO_LEFT

    `constant GTK2.PROGRESS_RIGHT_TO_LEFT`

  Constant PROGRESS_TOP_TO_BOTTOM

    `constant GTK2.PROGRESS_TOP_TO_BOTTOM`

  Constant RC_BASE

    `constant GTK2.RC_BASE`

  Constant RC_BG

    `constant GTK2.RC_BG`

  Constant RC_FG

    `constant GTK2.RC_FG`

  Constant RC_STYLE

    `constant GTK2.RC_STYLE`

  Constant RC_TEXT

    `constant GTK2.RC_TEXT`

  Constant RC_TOKEN_ACTIVE

    `constant GTK2.RC_TOKEN_ACTIVE`

  Constant RC_TOKEN_APPLICATION

    `constant GTK2.RC_TOKEN_APPLICATION`

  Constant RC_TOKEN_BASE

    `constant GTK2.RC_TOKEN_BASE`

  Constant RC_TOKEN_BG

    `constant GTK2.RC_TOKEN_BG`

  Constant RC_TOKEN_BG_PIXMAP

    `constant GTK2.RC_TOKEN_BG_PIXMAP`

  Constant RC_TOKEN_BIND

    `constant GTK2.RC_TOKEN_BIND`

  Constant RC_TOKEN_BINDING

    `constant GTK2.RC_TOKEN_BINDING`

  Constant RC_TOKEN_CLASS

    `constant GTK2.RC_TOKEN_CLASS`

  Constant RC_TOKEN_ENGINE

    `constant GTK2.RC_TOKEN_ENGINE`

  Constant RC_TOKEN_FG

    `constant GTK2.RC_TOKEN_FG`

  Constant RC_TOKEN_FONT

    `constant GTK2.RC_TOKEN_FONT`

  Constant RC_TOKEN_FONTSET

    `constant GTK2.RC_TOKEN_FONTSET`

  Constant RC_TOKEN_FONT_NAME

    `constant GTK2.RC_TOKEN_FONT_NAME`

  Constant RC_TOKEN_GTK

    `constant GTK2.RC_TOKEN_GTK`

  Constant RC_TOKEN_HIGHEST

    `constant GTK2.RC_TOKEN_HIGHEST`

  Constant RC_TOKEN_IM_MODULE_FILE

    `constant GTK2.RC_TOKEN_IM_MODULE_FILE`

  Constant RC_TOKEN_IM_MODULE_PATH

    `constant GTK2.RC_TOKEN_IM_MODULE_PATH`

  Constant RC_TOKEN_INCLUDE

    `constant GTK2.RC_TOKEN_INCLUDE`

  Constant RC_TOKEN_INSENSITIVE

    `constant GTK2.RC_TOKEN_INSENSITIVE`

  Constant RC_TOKEN_INVALID

    `constant GTK2.RC_TOKEN_INVALID`

  Constant RC_TOKEN_LAST

    `constant GTK2.RC_TOKEN_LAST`

  Constant RC_TOKEN_LOWEST

    `constant GTK2.RC_TOKEN_LOWEST`

  Constant RC_TOKEN_LTR

    `constant GTK2.RC_TOKEN_LTR`

  Constant RC_TOKEN_MODULE_PATH

    `constant GTK2.RC_TOKEN_MODULE_PATH`

  Constant RC_TOKEN_NORMAL

    `constant GTK2.RC_TOKEN_NORMAL`

  Constant RC_TOKEN_PIXMAP_PATH

    `constant GTK2.RC_TOKEN_PIXMAP_PATH`

  Constant RC_TOKEN_PRELIGHT

    `constant GTK2.RC_TOKEN_PRELIGHT`

  Constant RC_TOKEN_RC

    `constant GTK2.RC_TOKEN_RC`

  Constant RC_TOKEN_RTL

    `constant GTK2.RC_TOKEN_RTL`

  Constant RC_TOKEN_SELECTED

    `constant GTK2.RC_TOKEN_SELECTED`

  Constant RC_TOKEN_STOCK

    `constant GTK2.RC_TOKEN_STOCK`

  Constant RC_TOKEN_STYLE

    `constant GTK2.RC_TOKEN_STYLE`

  Constant RC_TOKEN_TEXT

    `constant GTK2.RC_TOKEN_TEXT`

  Constant RC_TOKEN_THEME

    `constant GTK2.RC_TOKEN_THEME`

  Constant RC_TOKEN_WIDGET

    `constant GTK2.RC_TOKEN_WIDGET`

  Constant RC_TOKEN_WIDGET_CLASS

    `constant GTK2.RC_TOKEN_WIDGET_CLASS`

  Constant RC_TOKEN_XTHICKNESS

    `constant GTK2.RC_TOKEN_XTHICKNESS`

  Constant RC_TOKEN_YTHICKNESS

    `constant GTK2.RC_TOKEN_YTHICKNESS`

  Constant REALIZED

    `constant GTK2.REALIZED`

  Constant RECEIVES_DEFAULT

    `constant GTK2.RECEIVES_DEFAULT`

  Constant RELIEF_HALF

    `constant GTK2.RELIEF_HALF`

  Constant RELIEF_NONE

    `constant GTK2.RELIEF_NONE`

  Constant RELIEF_NORMAL

    `constant GTK2.RELIEF_NORMAL`

  Constant RESERVED_1

    `constant GTK2.RESERVED_1`

  Constant RESERVED_2

    `constant GTK2.RESERVED_2`

  Constant RESIZE_IMMEDIATE

    `constant GTK2.RESIZE_IMMEDIATE`

  Constant RESIZE_PARENT

    `constant GTK2.RESIZE_PARENT`

  Constant RESIZE_QUEUE

    `constant GTK2.RESIZE_QUEUE`

  Constant RESPONSE_ACCEPT

    `constant GTK2.RESPONSE_ACCEPT`

  Constant RESPONSE_APPLY

    `constant GTK2.RESPONSE_APPLY`

  Constant RESPONSE_CANCEL

    `constant GTK2.RESPONSE_CANCEL`

  Constant RESPONSE_CLOSE

    `constant GTK2.RESPONSE_CLOSE`

  Constant RESPONSE_DELETE_EVENT

    `constant GTK2.RESPONSE_DELETE_EVENT`

  Constant RESPONSE_HELP

    `constant GTK2.RESPONSE_HELP`

  Constant RESPONSE_NO

    `constant GTK2.RESPONSE_NO`

  Constant RESPONSE_NONE

    `constant GTK2.RESPONSE_NONE`

  Constant RESPONSE_OK

    `constant GTK2.RESPONSE_OK`

  Constant RESPONSE_REJECT

    `constant GTK2.RESPONSE_REJECT`

  Constant RESPONSE_YES

    `constant GTK2.RESPONSE_YES`

  Constant SCROLL_END

    `constant GTK2.SCROLL_END`

  Constant SCROLL_ENDS

    `constant GTK2.SCROLL_ENDS`

  Constant SCROLL_HORIZONTAL_ENDS

    `constant GTK2.SCROLL_HORIZONTAL_ENDS`

  Constant SCROLL_HORIZONTAL_PAGES

    `constant GTK2.SCROLL_HORIZONTAL_PAGES`

  Constant SCROLL_HORIZONTAL_STEPS

    `constant GTK2.SCROLL_HORIZONTAL_STEPS`

  Constant SCROLL_JUMP

    `constant GTK2.SCROLL_JUMP`

  Constant SCROLL_NONE

    `constant GTK2.SCROLL_NONE`

  Constant SCROLL_PAGES

    `constant GTK2.SCROLL_PAGES`

  Constant SCROLL_PAGE_BACKWARD

    `constant GTK2.SCROLL_PAGE_BACKWARD`

  Constant SCROLL_PAGE_DOWN

    `constant GTK2.SCROLL_PAGE_DOWN`

  Constant SCROLL_PAGE_FORWARD

    `constant GTK2.SCROLL_PAGE_FORWARD`

  Constant SCROLL_PAGE_LEFT

    `constant GTK2.SCROLL_PAGE_LEFT`

  Constant SCROLL_PAGE_RIGHT

    `constant GTK2.SCROLL_PAGE_RIGHT`

  Constant SCROLL_PAGE_UP

    `constant GTK2.SCROLL_PAGE_UP`

  Constant SCROLL_START

    `constant GTK2.SCROLL_START`

  Constant SCROLL_STEPS

    `constant GTK2.SCROLL_STEPS`

  Constant SCROLL_STEP_BACKWARD

    `constant GTK2.SCROLL_STEP_BACKWARD`

  Constant SCROLL_STEP_DOWN

    `constant GTK2.SCROLL_STEP_DOWN`

  Constant SCROLL_STEP_FORWARD

    `constant GTK2.SCROLL_STEP_FORWARD`

  Constant SCROLL_STEP_LEFT

    `constant GTK2.SCROLL_STEP_LEFT`

  Constant SCROLL_STEP_RIGHT

    `constant GTK2.SCROLL_STEP_RIGHT`

  Constant SCROLL_STEP_UP

    `constant GTK2.SCROLL_STEP_UP`

  Constant SELECTION_BROWSE

    `constant GTK2.SELECTION_BROWSE`

  Constant SELECTION_MULTIPLE

    `constant GTK2.SELECTION_MULTIPLE`

  Constant SELECTION_NONE

    `constant GTK2.SELECTION_NONE`

  Constant SELECTION_SINGLE

    `constant GTK2.SELECTION_SINGLE`

  Constant SENSITIVE

    `constant GTK2.SENSITIVE`

  Constant SHADOW_ETCHED_IN

    `constant GTK2.SHADOW_ETCHED_IN`

  Constant SHADOW_ETCHED_OUT

    `constant GTK2.SHADOW_ETCHED_OUT`

  Constant SHADOW_IN

    `constant GTK2.SHADOW_IN`

  Constant SHADOW_NONE

    `constant GTK2.SHADOW_NONE`

  Constant SHADOW_OUT

    `constant GTK2.SHADOW_OUT`

  Constant SHRINK

    `constant GTK2.SHRINK`

  Constant SIZE_GROUP_BOTH

    `constant GTK2.SIZE_GROUP_BOTH`

  Constant SIZE_GROUP_HORIZONTAL

    `constant GTK2.SIZE_GROUP_HORIZONTAL`

  Constant SIZE_GROUP_NONE

    `constant GTK2.SIZE_GROUP_NONE`

  Constant SIZE_GROUP_VERTICAL

    `constant GTK2.SIZE_GROUP_VERTICAL`

  Constant SORT_ASCENDING

    `constant GTK2.SORT_ASCENDING`

  Constant SORT_DESCENDING

    `constant GTK2.SORT_DESCENDING`

  Constant SOURCE_SEARCH_CASE_INSENSITIVE

    `constant GTK2.SOURCE_SEARCH_CASE_INSENSITIVE`

  Constant SOURCE_SEARCH_TEXT_ONLY

    `constant GTK2.SOURCE_SEARCH_TEXT_ONLY`

  Constant SOURCE_SEARCH_VISIBLE_ONLY

    `constant GTK2.SOURCE_SEARCH_VISIBLE_ONLY`

  Constant SPIN_END

    `constant GTK2.SPIN_END`

  Constant SPIN_HOME

    `constant GTK2.SPIN_HOME`

  Constant SPIN_PAGE_BACKWARD

    `constant GTK2.SPIN_PAGE_BACKWARD`

  Constant SPIN_PAGE_FORWARD

    `constant GTK2.SPIN_PAGE_FORWARD`

  Constant SPIN_STEP_BACKWARD

    `constant GTK2.SPIN_STEP_BACKWARD`

  Constant SPIN_STEP_FORWARD

    `constant GTK2.SPIN_STEP_FORWARD`

  Constant SPIN_USER_DEFINED

    `constant GTK2.SPIN_USER_DEFINED`

  Constant STATE_ACTIVE

    `constant GTK2.STATE_ACTIVE`

  Constant STATE_INSENSITIVE

    `constant GTK2.STATE_INSENSITIVE`

  Constant STATE_NORMAL

    `constant GTK2.STATE_NORMAL`

  Constant STATE_PRELIGHT

    `constant GTK2.STATE_PRELIGHT`

  Constant STATE_SELECTED

    `constant GTK2.STATE_SELECTED`

  Constant STOCK_ABOUT

    `constant GTK2.STOCK_ABOUT`

  Constant STOCK_ADD

    `constant GTK2.STOCK_ADD`

  Constant STOCK_APPLY

    `constant GTK2.STOCK_APPLY`

  Constant STOCK_BOLD

    `constant GTK2.STOCK_BOLD`

  Constant STOCK_CANCEL

    `constant GTK2.STOCK_CANCEL`

  Constant STOCK_CDROM

    `constant GTK2.STOCK_CDROM`

  Constant STOCK_CLEAR

    `constant GTK2.STOCK_CLEAR`

  Constant STOCK_CLOSE

    `constant GTK2.STOCK_CLOSE`

  Constant STOCK_COLOR_PICKER

    `constant GTK2.STOCK_COLOR_PICKER`

  Constant STOCK_CONNECT

    `constant GTK2.STOCK_CONNECT`

  Constant STOCK_CONVERT

    `constant GTK2.STOCK_CONVERT`

  Constant STOCK_COPY

    `constant GTK2.STOCK_COPY`

  Constant STOCK_CUT

    `constant GTK2.STOCK_CUT`

  Constant STOCK_DELETE

    `constant GTK2.STOCK_DELETE`

  Constant STOCK_DIALOG_AUTHENTICATION

    `constant GTK2.STOCK_DIALOG_AUTHENTICATION`

  Constant STOCK_DIALOG_ERROR

    `constant GTK2.STOCK_DIALOG_ERROR`

  Constant STOCK_DIALOG_INFO

    `constant GTK2.STOCK_DIALOG_INFO`

  Constant STOCK_DIALOG_QUESTION

    `constant GTK2.STOCK_DIALOG_QUESTION`

  Constant STOCK_DIALOG_WARNING

    `constant GTK2.STOCK_DIALOG_WARNING`

  Constant STOCK_DIRECTORY

    `constant GTK2.STOCK_DIRECTORY`

  Constant STOCK_DISCONNECT

    `constant GTK2.STOCK_DISCONNECT`

  Constant STOCK_DND

    `constant GTK2.STOCK_DND`

  Constant STOCK_DND_MULTIPLE

    `constant GTK2.STOCK_DND_MULTIPLE`

  Constant STOCK_EDIT

    `constant GTK2.STOCK_EDIT`

  Constant STOCK_EXECUTE

    `constant GTK2.STOCK_EXECUTE`

  Constant STOCK_FILE

    `constant GTK2.STOCK_FILE`

  Constant STOCK_FIND

    `constant GTK2.STOCK_FIND`

  Constant STOCK_FIND_AND_REPLACE

    `constant GTK2.STOCK_FIND_AND_REPLACE`

  Constant STOCK_FLOPPY

    `constant GTK2.STOCK_FLOPPY`

  Constant STOCK_FULLSCREEN

    `constant GTK2.STOCK_FULLSCREEN`

  Constant STOCK_GOTO_BOTTOM

    `constant GTK2.STOCK_GOTO_BOTTOM`

  Constant STOCK_GOTO_FIRST

    `constant GTK2.STOCK_GOTO_FIRST`

  Constant STOCK_GOTO_LAST

    `constant GTK2.STOCK_GOTO_LAST`

  Constant STOCK_GOTO_TOP

    `constant GTK2.STOCK_GOTO_TOP`

  Constant STOCK_GO_BACK

    `constant GTK2.STOCK_GO_BACK`

  Constant STOCK_GO_DOWN

    `constant GTK2.STOCK_GO_DOWN`

  Constant STOCK_GO_FORWARD

    `constant GTK2.STOCK_GO_FORWARD`

  Constant STOCK_GO_UP

    `constant GTK2.STOCK_GO_UP`

  Constant STOCK_HARDDISK

    `constant GTK2.STOCK_HARDDISK`

  Constant STOCK_HELP

    `constant GTK2.STOCK_HELP`

  Constant STOCK_HOME

    `constant GTK2.STOCK_HOME`

  Constant STOCK_INDENT

    `constant GTK2.STOCK_INDENT`

  Constant STOCK_INDEX

    `constant GTK2.STOCK_INDEX`

  Constant STOCK_INFO

    `constant GTK2.STOCK_INFO`

  Constant STOCK_ITALIC

    `constant GTK2.STOCK_ITALIC`

  Constant STOCK_JUMP_TO

    `constant GTK2.STOCK_JUMP_TO`

  Constant STOCK_JUSTIFY_CENTER

    `constant GTK2.STOCK_JUSTIFY_CENTER`

  Constant STOCK_JUSTIFY_FILL

    `constant GTK2.STOCK_JUSTIFY_FILL`

  Constant STOCK_JUSTIFY_LEFT

    `constant GTK2.STOCK_JUSTIFY_LEFT`

  Constant STOCK_JUSTIFY_RIGHT

    `constant GTK2.STOCK_JUSTIFY_RIGHT`

  Constant STOCK_LEAVE_FULLSCREEN

    `constant GTK2.STOCK_LEAVE_FULLSCREEN`

  Constant STOCK_MEDIA_FORWARD

    `constant GTK2.STOCK_MEDIA_FORWARD`

  Constant STOCK_MEDIA_NEXT

    `constant GTK2.STOCK_MEDIA_NEXT`

  Constant STOCK_MEDIA_PAUSE

    `constant GTK2.STOCK_MEDIA_PAUSE`

  Constant STOCK_MEDIA_PLAY

    `constant GTK2.STOCK_MEDIA_PLAY`

  Constant STOCK_MEDIA_PREVIOUS

    `constant GTK2.STOCK_MEDIA_PREVIOUS`

  Constant STOCK_MEDIA_RECORD

    `constant GTK2.STOCK_MEDIA_RECORD`

  Constant STOCK_MEDIA_REWIND

    `constant GTK2.STOCK_MEDIA_REWIND`

  Constant STOCK_MEDIA_STOP

    `constant GTK2.STOCK_MEDIA_STOP`

  Constant STOCK_MISSING_IMAGE

    `constant GTK2.STOCK_MISSING_IMAGE`

  Constant STOCK_NETWORK

    `constant GTK2.STOCK_NETWORK`

  Constant STOCK_NEW

    `constant GTK2.STOCK_NEW`

  Constant STOCK_NO

    `constant GTK2.STOCK_NO`

  Constant STOCK_OK

    `constant GTK2.STOCK_OK`

  Constant STOCK_OPEN

    `constant GTK2.STOCK_OPEN`

  Constant STOCK_PASTE

    `constant GTK2.STOCK_PASTE`

  Constant STOCK_PREFERENCES

    `constant GTK2.STOCK_PREFERENCES`

  Constant STOCK_PRINT

    `constant GTK2.STOCK_PRINT`

  Constant STOCK_PRINT_PREVIEW

    `constant GTK2.STOCK_PRINT_PREVIEW`

  Constant STOCK_PROPERTIES

    `constant GTK2.STOCK_PROPERTIES`

  Constant STOCK_QUIT

    `constant GTK2.STOCK_QUIT`

  Constant STOCK_REDO

    `constant GTK2.STOCK_REDO`

  Constant STOCK_REFRESH

    `constant GTK2.STOCK_REFRESH`

  Constant STOCK_REMOVE

    `constant GTK2.STOCK_REMOVE`

  Constant STOCK_REVERT_TO_SAVED

    `constant GTK2.STOCK_REVERT_TO_SAVED`

  Constant STOCK_SAVE

    `constant GTK2.STOCK_SAVE`

  Constant STOCK_SAVE_AS

    `constant GTK2.STOCK_SAVE_AS`

  Constant STOCK_SELECT_COLOR

    `constant GTK2.STOCK_SELECT_COLOR`

  Constant STOCK_SELECT_FONT

    `constant GTK2.STOCK_SELECT_FONT`

  Constant STOCK_SORT_ASCENDING

    `constant GTK2.STOCK_SORT_ASCENDING`

  Constant STOCK_SORT_DESCENDING

    `constant GTK2.STOCK_SORT_DESCENDING`

  Constant STOCK_SPELL_CHECK

    `constant GTK2.STOCK_SPELL_CHECK`

  Constant STOCK_STOP

    `constant GTK2.STOCK_STOP`

  Constant STOCK_STRIKETHROUGH

    `constant GTK2.STOCK_STRIKETHROUGH`

  Constant STOCK_UNDELETE

    `constant GTK2.STOCK_UNDELETE`

  Constant STOCK_UNDERLINE

    `constant GTK2.STOCK_UNDERLINE`

  Constant STOCK_UNDO

    `constant GTK2.STOCK_UNDO`

  Constant STOCK_UNINDENT

    `constant GTK2.STOCK_UNINDENT`

  Constant STOCK_YES

    `constant GTK2.STOCK_YES`

  Constant STOCK_ZOOM_100

    `constant GTK2.STOCK_ZOOM_100`

  Constant STOCK_ZOOM_FIT

    `constant GTK2.STOCK_ZOOM_FIT`

  Constant STOCK_ZOOM_IN

    `constant GTK2.STOCK_ZOOM_IN`

  Constant STOCK_ZOOM_OUT

    `constant GTK2.STOCK_ZOOM_OUT`

  Constant TARGET_SAME_APP

    `constant GTK2.TARGET_SAME_APP`

  Constant TARGET_SAME_WIDGET

    `constant GTK2.TARGET_SAME_WIDGET`

  Constant TEXT_DIR_LTR

    `constant GTK2.TEXT_DIR_LTR`

  Constant TEXT_DIR_NONE

    `constant GTK2.TEXT_DIR_NONE`

  Constant TEXT_DIR_RTL

    `constant GTK2.TEXT_DIR_RTL`

  Constant TEXT_SEARCH_TEXT_ONLY

    `constant GTK2.TEXT_SEARCH_TEXT_ONLY`

  Constant TEXT_SEARCH_VISIBLE_ONLY

    `constant GTK2.TEXT_SEARCH_VISIBLE_ONLY`

  Constant TEXT_WINDOW_BOTTOM

    `constant GTK2.TEXT_WINDOW_BOTTOM`

  Constant TEXT_WINDOW_LEFT

    `constant GTK2.TEXT_WINDOW_LEFT`

  Constant TEXT_WINDOW_PRIVATE

    `constant GTK2.TEXT_WINDOW_PRIVATE`

  Constant TEXT_WINDOW_RIGHT

    `constant GTK2.TEXT_WINDOW_RIGHT`

  Constant TEXT_WINDOW_TEXT

    `constant GTK2.TEXT_WINDOW_TEXT`

  Constant TEXT_WINDOW_TOP

    `constant GTK2.TEXT_WINDOW_TOP`

  Constant TEXT_WINDOW_WIDGET

    `constant GTK2.TEXT_WINDOW_WIDGET`

  Constant TOOLBAR_BOTH

    `constant GTK2.TOOLBAR_BOTH`

  Constant TOOLBAR_BOTH_HORIZ

    `constant GTK2.TOOLBAR_BOTH_HORIZ`

  Constant TOOLBAR_ICONS

    `constant GTK2.TOOLBAR_ICONS`

  Constant TOOLBAR_SPACE_EMPTY

    `constant GTK2.TOOLBAR_SPACE_EMPTY`

  Constant TOOLBAR_SPACE_LINE

    `constant GTK2.TOOLBAR_SPACE_LINE`

  Constant TOOLBAR_TEXT

    `constant GTK2.TOOLBAR_TEXT`

  Constant TOPLEVEL

    `constant GTK2.TOPLEVEL`

  Constant TREE_MODEL_ITERS_PERSIST

    `constant GTK2.TREE_MODEL_ITERS_PERSIST`

  Constant TREE_MODEL_LIST_ONLY

    `constant GTK2.TREE_MODEL_LIST_ONLY`

  Constant TREE_VIEW_COLUMN_AUTOSIZE

    `constant GTK2.TREE_VIEW_COLUMN_AUTOSIZE`

  Constant TREE_VIEW_COLUMN_FIXED

    `constant GTK2.TREE_VIEW_COLUMN_FIXED`

  Constant TREE_VIEW_COLUMN_GROW_ONLY

    `constant GTK2.TREE_VIEW_COLUMN_GROW_ONLY`

  Constant TREE_VIEW_DROP_AFTER

    `constant GTK2.TREE_VIEW_DROP_AFTER`

  Constant TREE_VIEW_DROP_BEFORE

    `constant GTK2.TREE_VIEW_DROP_BEFORE`

  Constant TREE_VIEW_DROP_INTO_OR_AFTER

    `constant GTK2.TREE_VIEW_DROP_INTO_OR_AFTER`

  Constant TREE_VIEW_DROP_INTO_OR_BEFORE

    `constant GTK2.TREE_VIEW_DROP_INTO_OR_BEFORE`

  Constant UI_MANAGER_ACCELERATOR

    `constant GTK2.UI_MANAGER_ACCELERATOR`

  Constant UI_MANAGER_AUTO

    `constant GTK2.UI_MANAGER_AUTO`

  Constant UI_MANAGER_MENU

    `constant GTK2.UI_MANAGER_MENU`

  Constant UI_MANAGER_MENUBAR

    `constant GTK2.UI_MANAGER_MENUBAR`

  Constant UI_MANAGER_MENUITEM

    `constant GTK2.UI_MANAGER_MENUITEM`

  Constant UI_MANAGER_PLACEHOLDER

    `constant GTK2.UI_MANAGER_PLACEHOLDER`

  Constant UI_MANAGER_POPUP

    `constant GTK2.UI_MANAGER_POPUP`

  Constant UI_MANAGER_SEPARATOR

    `constant GTK2.UI_MANAGER_SEPARATOR`

  Constant UI_MANAGER_TOOLBAR

    `constant GTK2.UI_MANAGER_TOOLBAR`

  Constant UI_MANAGER_TOOLITEM

    `constant GTK2.UI_MANAGER_TOOLITEM`

  Constant UPDATE_ALWAYS

    `constant GTK2.UPDATE_ALWAYS`

  Constant UPDATE_CONTINUOUS

    `constant GTK2.UPDATE_CONTINUOUS`

  Constant UPDATE_DELAYED

    `constant GTK2.UPDATE_DELAYED`

  Constant UPDATE_DISCONTINUOUS

    `constant GTK2.UPDATE_DISCONTINUOUS`

  Constant UPDATE_IF_VALID

    `constant GTK2.UPDATE_IF_VALID`

  Constant VISIBILITY_FULL

    `constant GTK2.VISIBILITY_FULL`

  Constant VISIBILITY_NONE

    `constant GTK2.VISIBILITY_NONE`

  Constant VISIBILITY_PARTIAL

    `constant GTK2.VISIBILITY_PARTIAL`

  Constant VISIBLE

    `constant GTK2.VISIBLE`

  Constant WIDGET_HELP_TOOLTIP

    `constant GTK2.WIDGET_HELP_TOOLTIP`

  Constant WIDGET_HELP_WHATS_THIS

    `constant GTK2.WIDGET_HELP_WHATS_THIS`

  Constant WINDOW_POPUP

    `constant GTK2.WINDOW_POPUP`

  Constant WINDOW_TOPLEVEL

    `constant GTK2.WINDOW_TOPLEVEL`

  Constant WIN_POS_CENTER

    `constant GTK2.WIN_POS_CENTER`

  Constant WIN_POS_CENTER_ALWAYS

    `constant GTK2.WIN_POS_CENTER_ALWAYS`

  Constant WIN_POS_CENTER_ON_PARENT

    `constant GTK2.WIN_POS_CENTER_ON_PARENT`

  Constant WIN_POS_MOUSE

    `constant GTK2.WIN_POS_MOUSE`

  Constant WIN_POS_NONE

    `constant GTK2.WIN_POS_NONE`

  Constant WRAP_CHAR

    `constant GTK2.WRAP_CHAR`

  Constant WRAP_NONE

    `constant GTK2.WRAP_NONE`

  Constant WRAP_WORD

    `constant GTK2.WRAP_WORD`

  Constant WRAP_WORD_CHAR

    `constant GTK2.WRAP_WORD_CHAR`

  Constant PANGO_ATTR_BACKGROUND

    `constant GTK2.PANGO_ATTR_BACKGROUND`

  Constant PANGO_ATTR_FALLBACK

    `constant GTK2.PANGO_ATTR_FALLBACK`

  Constant PANGO_ATTR_FAMILY

    `constant GTK2.PANGO_ATTR_FAMILY`

  Constant PANGO_ATTR_FONT_DESC

    `constant GTK2.PANGO_ATTR_FONT_DESC`

  Constant PANGO_ATTR_FOREGROUND

    `constant GTK2.PANGO_ATTR_FOREGROUND`

  Constant PANGO_ATTR_INVALID

    `constant GTK2.PANGO_ATTR_INVALID`

  Constant PANGO_ATTR_LANGUAGE

    `constant GTK2.PANGO_ATTR_LANGUAGE`

  Constant PANGO_ATTR_LETTER_SPACING

    `constant GTK2.PANGO_ATTR_LETTER_SPACING`

  Constant PANGO_ATTR_RISE

    `constant GTK2.PANGO_ATTR_RISE`

  Constant PANGO_ATTR_SCALE

    `constant GTK2.PANGO_ATTR_SCALE`

  Constant PANGO_ATTR_SHAPE

    `constant GTK2.PANGO_ATTR_SHAPE`

  Constant PANGO_ATTR_SIZE

    `constant GTK2.PANGO_ATTR_SIZE`

  Constant PANGO_ATTR_STRETCH

    `constant GTK2.PANGO_ATTR_STRETCH`

  Constant PANGO_ATTR_STRIKETHROUGH

    `constant GTK2.PANGO_ATTR_STRIKETHROUGH`

  Constant PANGO_ATTR_STYLE

    `constant GTK2.PANGO_ATTR_STYLE`

  Constant PANGO_ATTR_UNDERLINE

    `constant GTK2.PANGO_ATTR_UNDERLINE`

  Constant PANGO_ATTR_VARIANT

    `constant GTK2.PANGO_ATTR_VARIANT`

  Constant PANGO_ATTR_WEIGHT

    `constant GTK2.PANGO_ATTR_WEIGHT`

  Constant PANGO_FONT_MASK_FAMILY

    `constant GTK2.PANGO_FONT_MASK_FAMILY`

  Constant PANGO_FONT_MASK_SIZE

    `constant GTK2.PANGO_FONT_MASK_SIZE`

  Constant PANGO_FONT_MASK_STRETCH

    `constant GTK2.PANGO_FONT_MASK_STRETCH`

  Constant PANGO_FONT_MASK_STYLE

    `constant GTK2.PANGO_FONT_MASK_STYLE`

  Constant PANGO_FONT_MASK_VARIANT

    `constant GTK2.PANGO_FONT_MASK_VARIANT`

  Constant PANGO_FONT_MASK_WEIGHT

    `constant GTK2.PANGO_FONT_MASK_WEIGHT`

  Constant PANGO_SCALE

    `constant GTK2.PANGO_SCALE`

  Constant PANGO_SCALE_LARGE

    `constant GTK2.PANGO_SCALE_LARGE`

  Constant PANGO_SCALE_MEDIUM

    `constant GTK2.PANGO_SCALE_MEDIUM`

  Constant PANGO_SCALE_SMALL

    `constant GTK2.PANGO_SCALE_SMALL`

  Constant PANGO_SCALE_XX_LARGE

    `constant GTK2.PANGO_SCALE_XX_LARGE`

  Constant PANGO_SCALE_XX_SMALL

    `constant GTK2.PANGO_SCALE_XX_SMALL`

  Constant PANGO_SCALE_X_LARGE

    `constant GTK2.PANGO_SCALE_X_LARGE`

  Constant PANGO_SCALE_X_SMALL

    `constant GTK2.PANGO_SCALE_X_SMALL`

  Constant PANGO_STRETCH_CONDENSED

    `constant GTK2.PANGO_STRETCH_CONDENSED`

  Constant PANGO_STRETCH_EXPANDED

    `constant GTK2.PANGO_STRETCH_EXPANDED`

  Constant PANGO_STRETCH_EXTRA_CONDENSED

    `constant GTK2.PANGO_STRETCH_EXTRA_CONDENSED`

  Constant PANGO_STRETCH_EXTRA_EXPANDED

    `constant GTK2.PANGO_STRETCH_EXTRA_EXPANDED`

  Constant PANGO_STRETCH_NORMAL

    `constant GTK2.PANGO_STRETCH_NORMAL`

  Constant PANGO_STRETCH_SEMI_CONDENSED

    `constant GTK2.PANGO_STRETCH_SEMI_CONDENSED`

  Constant PANGO_STRETCH_SEMI_EXPANDED

    `constant GTK2.PANGO_STRETCH_SEMI_EXPANDED`

  Constant PANGO_STRETCH_ULTRA_CONDENSED

    `constant GTK2.PANGO_STRETCH_ULTRA_CONDENSED`

  Constant PANGO_STRETCH_ULTRA_EXPANDED

    `constant GTK2.PANGO_STRETCH_ULTRA_EXPANDED`

  Constant PANGO_STYLE_ITALIC

    `constant GTK2.PANGO_STYLE_ITALIC`

  Constant PANGO_STYLE_NORMAL

    `constant GTK2.PANGO_STYLE_NORMAL`

  Constant PANGO_STYLE_OBLIQUE

    `constant GTK2.PANGO_STYLE_OBLIQUE`

  Constant PANGO_TAB_LEFT

    `constant GTK2.PANGO_TAB_LEFT`

  Constant PANGO_UNDERLINE_DOUBLE

    `constant GTK2.PANGO_UNDERLINE_DOUBLE`

  Constant PANGO_UNDERLINE_ERROR

    `constant GTK2.PANGO_UNDERLINE_ERROR`

  Constant PANGO_UNDERLINE_LOW

    `constant GTK2.PANGO_UNDERLINE_LOW`

  Constant PANGO_UNDERLINE_NONE

    `constant GTK2.PANGO_UNDERLINE_NONE`

  Constant PANGO_UNDERLINE_SINGLE

    `constant GTK2.PANGO_UNDERLINE_SINGLE`

  Constant PANGO_VARIANT_NORMAL

    `constant GTK2.PANGO_VARIANT_NORMAL`

  Constant PANGO_VARIANT_SMALL_CAPS

    `constant GTK2.PANGO_VARIANT_SMALL_CAPS`

  Constant PANGO_WEIGHT_BOLD

    `constant GTK2.PANGO_WEIGHT_BOLD`

  Constant PANGO_WEIGHT_HEAVY

    `constant GTK2.PANGO_WEIGHT_HEAVY`

  Constant PANGO_WEIGHT_LIGHT

    `constant GTK2.PANGO_WEIGHT_LIGHT`

  Constant PANGO_WEIGHT_NORMAL

    `constant GTK2.PANGO_WEIGHT_NORMAL`

  Constant PANGO_WEIGHT_ULTRABOLD

    `constant GTK2.PANGO_WEIGHT_ULTRABOLD`

  Constant PANGO_WEIGHT_ULTRALIGHT

    `constant GTK2.PANGO_WEIGHT_ULTRALIGHT`

  Constant TRUE

    `constant GTK2.TRUE`

  Method add_builtin_icon

    `void add_builtin_icon(string name, int size, GTK2.GdkPixbuf pixbuf)`

  Description

    Registers a built-in icon for icon theme lookups. The idea of build-in icons is to allow an application or library that uses themed icons to function requiring files to be present in the file system. For instance, the default images for all of GTK2+'s stock icons are registered as built-in icons.

    In general, if you use add_builtin_icon() you should also install the icon in the icon theme, so that the icon is generally available.

  Method false

    `int false()`

  Description

    Always returns false.

  Method flush

    `void flush()`

  Description

    Flush GDK. Not normally needed, can be useful while doing calculations.

  Method get_default_icon_list

    `array get_default_icon_list()`

  Description

    Gets the value set by set_default_icon_list().

  Method get_default_icon_theme

    `GTK2.IconTheme get_default_icon_theme()`

  Description

    Gets the icon theme.

  Method get_file_info

    `mapping get_file_info(string filename)`

  Description

    Parses an image file far enough to determine its format and size.

  Method get_formats

    `array get_formats()`

  Description

    Get information about the image formats supported.

  Method gnome_init

    `array gnome_init(string app_id, string app_version, array argv)`

  Description

    Initializes the application. This sets up all of the GNOME internals and prepares them (gdk/gtk, session-management, triggers, sound, user preferences). If corba init flags are specified, corba initialization is done as well as gnome initialization. corba_init_flags is 0 or more of GNORBA_INIT_SERVER_FUNC (1), GNORBA_INIT_DISABLE_COOKIES (2) and GNORBA_INIT_CORBA_PRIO_HIGH (4)

  Method grab_add

    `void grab_add(GTK2.Widget widget)`

  Description

    Grab a widget.

  Method grab_remove

    `void grab_remove(GTK2.Widget widget)`

  Description

    Remove the grab.

  Method gtk_init

    `array gtk_init(array|void argc, int|void no_pgtkrc)`

  Description

    Low level GTK init function (used by setup_gtk). This function is more or less equivalent to the C-GTK+ function gtk_init. setup_gtk does some extra things (such as parsing ~/.pgtkrc).

  Method list_toplevels

    `array list_toplevels()`

  Description

    Returns a list of all existing toplevel windows.

  Method low_flush

    `void low_flush()`

  Description

    Flush, but do not process events. Not normally needed.

  Method main

    `void main()`

  Description

    Start GTK in blocking mode. Doing this disables asynchronous I/O in pike. You can return -1 from main in pike to run GTK (and the rest of pike) in asynchronous mode.

  Method main_iteration_do

    `int main_iteration_do(int block)`

  Description

    Run one iteration in the mainloop. If block is true, wait for an event before returning.

  Method main_level

    `int main_level()`

  Description

    Return the current recursion depth.

  Method main_quit

    `void main_quit()`

  Description

    Exit from the gtk_main function on the next iteration.

  Method parse_rc

    `void parse_rc(string rc)`

  Description

    Takes a string and reads it as a gtkrc file.

  Method root_window

    `GTK2.GdkWindow root_window()`

  Description

    Returns the root window of the current display

  Method set_auto_startup_notification

    `void set_auto_startup_notification(int setting)`

  Description

    By default, after showing the first GTK2.Window for each GDK2.Screen, GTK+ calls GDK2.Screen->notify_startup_complete(). Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main window has been shown, for example.

    In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification.

  Method set_default_icon

    `void set_default_icon(GTK2.GdkPixbuf pix)`

  Description

    Sets an icon to be used as fallback for windows that haven't had set_icon() called on them.

  Method set_default_icon_from_file

    `void set_default_icon_from_file(string filename)`

  Description

    Sets an icon to be used as fallback from a file on disk.

  Method set_default_icon_list

    `void set_default_icon_list(array list)`

  Description

    Sets an icon list to be used as fallback for windows that haven't had set_icon_list() called on them to set up a window-specific icon list. This function allows you to set up the icon for all windows in your app at once.

  Method set_default_icon_name

    `void set_default_icon_name(string name)`

  Description

    Sets an icon to be used as fallback for windows that haven't had set_icon_list() called on them from a named themed icon.

  Method setup_gtk

    `array setup_gtk(array|void argv, int|void do_not_parse_rc)`

  Description

    Initialize GTK, and all that comes with it. Also parses $HOME/.pgtkrc and $HOME/.gtkrc if they exists. The single argument, if supplied, is the argument array passed to the program. This is used to set default window titles etc. The second argument, if supplied, indicates that pike specific *rc files should not be parsed.

    The most common usage is GTK2.setup_gtk(argv);

  Method true

    `int true()`

  Description

    Always returns true.

  Method version

    `array version()`

  Description

    Returns the version of the GTK library.

  CLASS GTK2.Hbox

    Description

      Most packing is done by creating boxes. These are invisible widget containers that we can pack our widgets into which come in two forms, a horizontal box, and a vertical box. This is the horizontal one. When packing widgets into a horizontal box, the objects are inserted horizontally from left to right or right to left depending on the call used.

      `GTK2.Hbox(0,0)->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->pack_end_defaults(GTK2.Button("From right"))->pack_start_defaults(GTK2.Button("From left"))`

      `GTK2.Hbox(1,0)->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->pack_end_defaults(GTK2.Button("From right"))->pack_start_defaults(GTK2.Button("From left"))`

      `GTK2.Hbox(1,40)->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->pack_end_defaults(GTK2.Button("From right"))->pack_start_defaults(GTK2.Button("From left"))`

    Inherit Box

      inherit GTK2.Box : Box

    Method create

      `GTK2.Hbox GTK2.Hbox(int|mapping uniformp_or_props, int hpadding)`

    Description

      Create a new horizontal box widget. If all_same_size is true, all widgets will have exactly the same size. hpadding is added to the left and right of the children.

  CLASS GTK2.Pango.LayoutIter

    Description

      PangoLayoutIter.

    Method at_last_line

      `int at_last_line()`

    Description

      Determines whether this iter is on the last line of the layout.

    Method get_baseline

      `int get_baseline()`

    Description

      Gets the y position of the current line's baseline, in layout coordinates (origin at top left of the entire layout).

    Method get_char_extents

      `mapping get_char_extents()`

    Description

      Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).

    Method get_cluster_extents

      `array get_cluster_extents()`

    Description

      Gets the extents of the current cluster, in layout coordinates.

    Method get_index

      `int get_index()`

    Description

      Gets the current byte index. Note that iterating forward by char moves in visual order, not logical order, so indexes may not be sequential. Also, the index may be equal to the length of the text in the layout.

    Method get_layout_extents

      `array get_layout_extents()`

    Description

      Obtains the extents of the layout.

    Method get_line

      `GTK2.Pango.LayoutLine get_line()`

    Description

      Gets the current line.

    Method get_line_extents

      `array get_line_extents()`

    Description

      Obtains the extents of the current line.

    Method get_line_yrange

      `array get_line_yrange()`

    Description

      Divides the vertical space being iterated over between the lines in the layout, and returns the space belonging to the current line. A line's range includes the line's logical extents, plus half of the spacing above and below the line, if Pango.Layout->set_spacing() has been called to set layout spacing. The y positions are in layout coordinates.

    Method get_run_extents

      `array get_run_extents()`

    Description

      Gets the extents of the current run in layout coordinates.

    Method next_char

      `int next_char()`

    Description

      Moves forward to the next character in visual order. If it was already at the end of the layout, returns false.

    Method next_cluster

      `int next_cluster()`

    Description

      Moves forward to the next cluster in visual order. If it was already at the end of the layout, returns false.

    Method next_line

      `int next_line()`

    Description

      Moves forward to the start of the next line. If it is already on the last line, returns false.

    Method next_run

      `int next_run()`

    Description

      Moves forward to the next run in visual order. If it was already at the end of the layout, returns false.

  CLASS GTK2.ToolButton

    Description

      Properties that can be notified: icon-widget label label-widget stock-id use-underline

      Signals: clicked

    Inherit ToolItem

      inherit GTK2.ToolItem : ToolItem

    Method create

      `GTK2.ToolButton GTK2.ToolButton(GTK2.Widget icon, string|void label)`

    Description

      Create a new GTK2.ToolButton. If icon is a string, label should be omitted. If it isn't, it will be ignored. The result will be a button from a stock item, one of STOCK_ABOUT , STOCK_ADD , STOCK_APPLY , STOCK_BOLD , STOCK_CANCEL , STOCK_CDROM , STOCK_CLEAR , STOCK_CLOSE , STOCK_COLOR_PICKER , STOCK_CONNECT , STOCK_CONVERT , STOCK_COPY , STOCK_CUT , STOCK_DELETE , STOCK_DIALOG_AUTHENTICATION , STOCK_DIALOG_ERROR , STOCK_DIALOG_INFO , STOCK_DIALOG_QUESTION , STOCK_DIALOG_WARNING , STOCK_DIRECTORY , STOCK_DISCONNECT , STOCK_DND , STOCK_DND_MULTIPLE , STOCK_EDIT , STOCK_EXECUTE , STOCK_FILE , STOCK_FIND , STOCK_FIND_AND_REPLACE , STOCK_FLOPPY , STOCK_FULLSCREEN , STOCK_GOTO_BOTTOM , STOCK_GOTO_FIRST , STOCK_GOTO_LAST , STOCK_GOTO_TOP , STOCK_GO_BACK , STOCK_GO_DOWN , STOCK_GO_FORWARD , STOCK_GO_UP , STOCK_HARDDISK , STOCK_HELP , STOCK_HOME , STOCK_INDENT , STOCK_INDEX , STOCK_INFO , STOCK_ITALIC , STOCK_JUMP_TO , STOCK_JUSTIFY_CENTER , STOCK_JUSTIFY_FILL , STOCK_JUSTIFY_LEFT , STOCK_JUSTIFY_RIGHT , STOCK_LEAVE_FULLSCREEN , STOCK_MEDIA_FORWARD , STOCK_MEDIA_NEXT , STOCK_MEDIA_PAUSE , STOCK_MEDIA_PLAY , STOCK_MEDIA_PREVIOUS , STOCK_MEDIA_RECORD , STOCK_MEDIA_REWIND , STOCK_MEDIA_STOP , STOCK_MISSING_IMAGE , STOCK_NETWORK , STOCK_NEW , STOCK_NO , STOCK_OK , STOCK_OPEN , STOCK_PASTE , STOCK_PREFERENCES , STOCK_PRINT , STOCK_PRINT_PREVIEW , STOCK_PROPERTIES , STOCK_QUIT , STOCK_REDO , STOCK_REFRESH , STOCK_REMOVE , STOCK_REVERT_TO_SAVED , STOCK_SAVE , STOCK_SAVE_AS , STOCK_SELECT_COLOR , STOCK_SELECT_FONT , STOCK_SORT_ASCENDING , STOCK_SORT_DESCENDING , STOCK_SPELL_CHECK , STOCK_STOP , STOCK_STRIKETHROUGH , STOCK_UNDELETE , STOCK_UNDERLINE , STOCK_UNDO , STOCK_UNINDENT , STOCK_YES , STOCK_ZOOM_100 , STOCK_ZOOM_FIT , STOCK_ZOOM_IN and STOCK_ZOOM_OUT . If icon is a GTK2.Widget, it will be used as the icon, and label will be the label. The label must exists if that is the case.

    Method get_icon_name

      `string get_icon_name()`

    Description

      Returns the name of the themed icon for the tool button.

    Method get_icon_widget

      `GTK2.Widget get_icon_widget()`

    Description

      Returns the widget used as the icon widget.

    Method get_label

      `string get_label()`

    Description

      Returns the label used by the tool button, or empty if the tool button doesn't have a label.

    Method get_label_widget

      `GTK2.Widget get_label_widget()`

    Description

      Returns the widget used as the label.

    Method get_stock_id

      `string get_stock_id()`

    Description

      Returns the name of the stock item.

    Method get_use_underline

      `int get_use_underline()`

    Description

      Returns whether underscores in the label property are used as mnemonics on menu items on the overflow menu.

    Method set_icon_name

      `GTK2.ToolButton set_icon_name(string name)`

    Description

      Sets the icon for the tool button from a named themed icon. The "icon-name" property only has an effect if not overridden by non-NULL "label", "icon-widget", and "stock-id" properties.

    Method set_icon_widget

      `GTK2.ToolButton set_icon_widget(GTK2.Widget icon_widget)`

    Description

      Sets icon_widget as the widget used as the icon on the button.

    Method set_label

      `GTK2.ToolButton set_label(string label)`

    Description

      Sets label as the label used for the tool button.

    Method set_label_widget

      `GTK2.ToolButton set_label_widget(GTK2.Widget label_widget)`

    Description

      Sets label_widget as the widget used as the label.

    Method set_stock_id

      `GTK2.ToolButton set_stock_id(string stock_id)`

    Description

      Sets the name of the stock item.

    Method set_use_underline

      `GTK2.ToolButton set_use_underline(int use_underline)`

    Description

      If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu.

  CLASS GTK2.CellEditable

    Method editing_done

      `GTK2.CellEditable editing_done()`

    Description

      Emits the "editing-done" signal. This signal is a sign for the cell renderer to update its value from the cell.

    Method remove_widget

      `GTK2.CellEditable remove_widget()`

    Description

      Emits the "remove-widget" signal. This signal is meant to indicate that the cell is finished editing, and the widget may now be destroyed.

    Method start_editing

      `GTK2.CellEditable start_editing(GTK2.GdkEvent event)`

    Description

      Begins editing. event is the GDK2.Event that began the editing process. It may be empty, in the instance that editing was initiated through programmatic means.

  CLASS GTK2.Pango.FontDescription

    Description

      Pango Font Description.

    Method better_match

      `int better_match(GTK2.Pango.FontDescription new, GTK2.Pango.FontDescription old)`

    Description

      Determines if the style attributes of new are a closer match than old, or if old is omitted, determines if new is a match at all. Approximate matching is done for weight and style; other attributes must match exactly.

    Method copy

      `GTK2.Pango.FontDescription copy()`

    Description

      Copy a font description.

    Method create

      `Pango.FontDescription GTK2.Pango.FontDescription(string|void desc)`

    Description

      Create a new font description. If desc is present, creates a new font description from a string representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE-OPTIONS is a whitespace separated list of words where each word describes one of style, variant, weight, or stretch, and size is a decimal number (size in points). Any one of the options may be absent. If FAMILY-LIST is absent, then the family name will be blank. If STYLE-OPTIONS is missing, then all style options will be set to the default values. If SIZE is missing, the size in the resulting font description will be set to 0.

    Method equal

      `int equal(GTK2.Pango.FontDescription desc)`

    Description

      Compares two font descriptions for equality.

    Method get_family

      `string get_family()`

    Description

      Gets the family name.

    Method get_size

      `int get_size()`

    Description

      Gets the size.

    Method get_stretch

      `int get_stretch()`

    Description

      Get the stretch.

    Method get_style

      `int get_style()`

    Description

      Gets the style.

    Method get_variant

      `int get_variant()`

    Description

      Gets the variant.

    Method get_weight

      `int get_weight()`

    Description

      Gets the weight.

    Method merge

      `Pango.FontDescription merge(GTK2.Pango.FontDescription desc, int replace)`

    Description

      Merges the fields that are set int desc to the fields in this description. If replace is false, only fields in this description that are not already set are affected. If true, then fields that are already set will be replaced as well.

    Method set_family

      `Pango.FontDescription set_family(string family)`

    Description

      Sets the family name. The family name represents a family of related fonts styles, and will resolve to a particular PangoFontFamily.

    Method set_size

      `Pango.FontDescription set_size(int size)`

    Description

      Sets the size in fractional points. This is the size of the font in points, scaled by PANGO_SCALE. (That is, a size value of 10*PANGO_SCALE) is a 10 point font. The conversion factor between points and device units depends on system configuration and the output device. For screen display, a logical DPI of 96 is common, in which case a 10 point font corresponds to a 1o*(96.72) = 13.3 pixel font. Use set_absolute_size() if you need a particular size in device units.

    Method set_stretch

      `Pango.FontDescription set_stretch(int stretch)`

    Description

      Sets the stretch. This specifies how narrow or wide the font should be. One of PANGO_STRETCH_CONDENSED , PANGO_STRETCH_EXPANDED , PANGO_STRETCH_EXTRA_CONDENSED , PANGO_STRETCH_EXTRA_EXPANDED , PANGO_STRETCH_NORMAL , PANGO_STRETCH_SEMI_CONDENSED , PANGO_STRETCH_SEMI_EXPANDED , PANGO_STRETCH_ULTRA_CONDENSED and PANGO_STRETCH_ULTRA_EXPANDED .

    Method set_style

      `Pango.FontDescription set_style(int style)`

    Description

      Sets the style. This describes whether the font is slanted and the manner in which is is slanted. One of PANGO_STYLE_ITALIC , PANGO_STYLE_NORMAL and PANGO_STYLE_OBLIQUE . Most fonts will either have an italic style or an oblique style, but not both, and font matching in Pango will match italic specifications with oblique fonts and vice-versa if an exact match is not found.

    Method set_variant

      `Pango.FontDescription set_variant(int variant)`

    Description

      Sets the variant. One of PANGO_VARIANT_NORMAL and PANGO_VARIANT_SMALL_CAPS .

    Method set_weight

      `Pango.FontDescription set_weight(int weight)`

    Description

      Sets the weight. The weight specifies how bold or light the font should be. In addition to the values of PANGO_WEIGHT_BOLD , PANGO_WEIGHT_HEAVY , PANGO_WEIGHT_LIGHT , PANGO_WEIGHT_NORMAL , PANGO_WEIGHT_ULTRABOLD and PANGO_WEIGHT_ULTRALIGHT , other intermediate numeric values are possible.

    Method to_filename

      `string to_filename()`

    Description

      Creates a filename representation. The filename is identical to the result from calling to_string(), but with underscores instead of characters that are untypical in filenames, and in lower case only.

    Method to_string

      `string to_string()`

    Description

      Creates a string representation. The family list in the string description will only have a terminating comm if the last word of the list is a valid style option.

  CLASS GTK2.Fixed

    Description

      A fixed container is a container that keeps it's children at fixed locations and give them fixed sizes, both given in pixels.

      Example: `GTK2.Fixed()->put(GTK2.Label("100,100"), 100, 100)->put(GTK2.Label("0,0"), 0, 0)->set_size_request(150,115)`

      Child properties: int x int y

    Inherit Container

      inherit GTK2.Container : Container

    Method create

      `GTK2.Fixed GTK2.Fixed(mapping|void props)`

    Description

      Create a new fixed widget

    Method get_children

      `array get_children()`

    Description

      Get a list of the children and their x,y positions.

    Method get_has_window

      `int get_has_window()`

    Description

      Gets whether GTK2.Fixed has its own GDK2.Window.

    Method move

      `GTK2.Fixed move(GTK2.Widget widget, int new_xpos, int new_ypos)`

    Description

      Move the widget to new_xpos,new_ypos from it's old location.

    Method put

      `GTK2.Fixed put(GTK2.Widget widget, int x, int y)`

    Description

      Place the widget at xpos,ypos.

    Method set_has_window

      `GTK2.Fixed set_has_window(int has_window)`

    Description

      Sets wither a GTK2.Fixed widget is created with a separate GDK2.Window for the window or now.

  CLASS GTK2.TreeModelSort

    Description

      Properties: GTK2.TreeModel model

    Inherit Object

      inherit G.Object : Object

    Inherit TreeModel

      inherit GTK2.TreeModel : TreeModel

    Inherit TreeDragSource

      inherit GTK2.TreeDragSource : TreeDragSource

    Inherit TreeSortable

      inherit GTK2.TreeSortable : TreeSortable

    Method convert_child_iter_to_iter

      `GTK2.TreeIter convert_child_iter_to_iter(GTK2.TreeIter child_iter)`

    Description

      Returns an iter pointing to the row in this model that corresponds to the row pointed at by child_iter.

    Method convert_child_path_to_path

      `GTK2.TreePath convert_child_path_to_path(GTK2.TreePath child_path)`

    Description

      Converts child_path to a path relative to this model. That is, child_path points to a path in the child mode. The returned path will point to the same row in the sorted model.

    Method convert_iter_to_child_iter

      `GTK2.TreeIter convert_iter_to_child_iter(GTK2.TreeIter sorted_iter)`

    Description

      Returns an iter pointing to the row in this model that corresponds to the row pointed at by sorted_iter.

    Method convert_path_to_child_path

      `GTK2.TreePath convert_path_to_child_path(GTK2.TreePath sorted_path)`

    Description

      Converts sorted_path to a path on the child model.

    Method create

      `GTK2.TreeModelSort GTK2.TreeModelSort(GTK2.TreeModel model)`

    Description

      Create a new GTK2.TreeModel, with model as the child model.

    Method get_model

      `GTK2.TreeModel get_model()`

    Description

      Return the model this ModelSort is sorting.

    Method reset_default_sort_func

      `GTK2.TreeModelSort reset_default_sort_func()`

    Description

      This resets the default sort function to be in the 'unsorted' state. That is, it is in the same order as the child model. It will re-sort the model to be in the same order as the child model only if this model is in 'unsorted' state.

  CLASS GTK2.Alignment

    Description

      The W(Alignment) widget controls the alignment and size of its child widget. It has four settings: xscale, yscale, xalign, and yalign.

      The scale settings are used to specify how much the child widget should expand to fill the space allocated to the W(Alignment). The values can range from 0 (meaning the child doesn't expand at all) to 1 (meaning the child expands to fill all of the available space).

      The align settings are used to place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect.

      NOIMG Properties: int bottom-padding int left-padding int right-padding int top-padding float xalign float xscale float yalign float yscale

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.Alignment GTK2.Alignment(float|mapping xalign_or_props, float|void yalign, float|void xscale, float|void yscale)`

    Description

      xalign : | the horizontal alignment of the child widget, from 0 (left) to 1 (right).
      yalign : | the vertical alignment of the child widget, from 0 (top) to 1 (bottom).
      xscale : | the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the GTK2.Alignment.
      yscale : | the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

    Method set

      `GTK2.Alignment set(float xalign, float yalign, float xscale, float yscale)`

    Description

      xalign : | the horizontal alignment of the child widget, from 0 (left) to 1 (right).
      yalign : | the vertical alignment of the child widget, from 0 (top) to 1 (bottom).
      xscale : | the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the GTK2.Alignment.
      yscale : | the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

    Method set_padding

      `GTK2.Alignment set_padding(int padding_top, int padding_bottom, int padding_left, int padding_right)`

    Description

      Sets the padding on the different sides.

  CLASS GTK2.Scrollbar

    Description

      These are your standard, run-of-the-mill scrollbars. These should be used only for scrolling some other widget, such as a list, a text box, or a viewport (and it's generally easier to use the scrolled window widget in most cases). For other purposes, you should use scale widgets, as they are friendlier and more featureful. Style properties: int fixed-slider-length int has-backward-stepper int has-forward-stepper int has-secondary-backward-stepper int has-secondary-forward-stepper int min-slider-length

    Inherit Range

      inherit GTK2.Range : Range

  CLASS GTK2.FontSelection

    Description

      The W(FontSelection) widget lists the available fonts, styles and sizes, allowing the user to select a font. It is used in W(FontSelectionDialog). `GTK2.FontSelection();`

      Properties: string font-name string preview-text

    Inherit Vbox

      inherit GTK2.Vbox : Vbox

    Method create

      `GTK2.FontSelection GTK2.FontSelection(mapping|void props)`

    Description

      Create a new GTK2.FontSelection widget.

    Method get_font_name

      `string get_font_name()`

    Description

      Gets the currently-selected font name.

    Method get_preview_text

      `string get_preview_text()`

    Description

      Gets the text displayed in the preview area.

    Method set_font_name

      `GTK2.FontSelection set_font_name(string fontname)`

    Description

      This sets the currently displayed font.

    Method set_preview_text

      `GTK2.FontSelection set_preview_text(string text)`

    Description

      Sets the text displayed in the preview area.

  CLASS GTK2.CellRendererToggle

    Description

      Properties: int activatable The toggle button can be activated. int active The toggle state of the button. int inconsistent The inconsistent state of the button. int indicator-size int radio Draw the toggle butotn as a radio button.

      Signals: toggled

    Inherit CellRenderer

      inherit GTK2.CellRenderer : CellRenderer

    Method create

      `GTK2.CellRendererToggle GTK2.CellRendererToggle(mapping|void props)`

    Description

      Creates a new W(CellRendererToggle). Adjust rendering parameters using object properties. Object properties can be set globally with set().

    Method get_active

      `int get_active()`

    Description

      Returns whether the cell renderer is active.

    Method get_radio

      `int get_radio()`

    Description

      Returns whether we're rendering radio toggles rather than checkboxes.

    Method set_active

      `GTK2.CellRendererToggle set_active(int setting)`

    Description

      Activates or deactivates a cell renderer.

    Method set_radio

      `GTK2.CellRendererToggle set_radio(int radio)`

    Description

      If radio is true, the cell renderer renders a radio toggle (i.e a toggle in a group of mutually-exclusive toggles). If false, it renders a check toggle (a standalone boolean option). This can be set globally for the cell renderer, or changed just before rendering each cell in the model (for W(TreeView), you set up a per-row setting using W(TreeViewColumn) to associate model columns with cell renderer properties).

  CLASS GTK2.Paned

    Description

      GTK2.Paned is the base class for widgets with two panes, arranged either horizontally (W(HPaned)) or vertically (W(VPaned)). Child widgets are added to the panes of the widget with pack1() and pack2(). The division beween the two children is set by default from the size requests of the children, but it can be adjusted by the user.

      A paned widget draws a separator between the two child widgets and a small handle that the user can drag to adjust the division. It does not draw any relief around the children or around the separator. (The space in which the separator is called the gutter). Often, it is useful to put each child inside a W(Frame) with the shadow type set to GTK2.ShadowIn so that the gutter appears as a ridge.

      Each child has two options that can be set, resize and shrink. If resize is true, then when the GTK2.Paned is resized, that child will expand or shrink along with the paned widget. If shrink is true, then when that child can be made smaller than it's requisition by the user. Setting shrink to 0 allows the application to set a minimum size. If resize is false for both children, then this is treated as if resize is true for both children.

      The application can set the position of the slider as if it were set by the user, by calling set_position().

      Properties: int max-position int min-position int position int position-set

      Child properties: int resize int shrink

      Style properties: int handle-size

      Signals: accept_position

      cancel_position

      cycle_child_focus

      cycle_handle_focus

      move_handle

      toggle_handle_focus

    Inherit Container

      inherit GTK2.Container : Container

    Method add1

      `GTK2.Paned add1(GTK2.Widget left_or_top)`

    Description

      Set the left or topmost item. This is equivalent to pack1(left_or_top,0,1)

    Method add2

      `GTK2.Paned add2(GTK2.Widget right_or_bottom)`

    Description

      Set the right or bottommost item This is equivalent to pack2(left_or_top,0,1)

    Method get_child1

      `GTK2.Widget get_child1()`

    Description

      Obtains the first child of the paned widget.

    Method get_child2

      `GTK2.Widget get_child2()`

    Description

      Obtains the second child of the paned widget.

    Method get_position

      `int get_position()`

    Description

      Obtains the position of the divider between the two panes.

    Method pack1

      `GTK2.Paned pack1(GTK2.Widget widget, int resize, int shrink)`

    Description

      Add a child to the top or left pane.

    Method pack2

      `GTK2.Paned pack2(GTK2.Widget widget, int resize, int shrink)`

    Description

      Add a child to the bottom or right pane.

    Method set_position

      `GTK2.Paned set_position(int position)`

    Description

      Set the position of the separator, as if set by the user. If position is negative, the remembered position is forgotten, and the division is recomputed from the the requisitions of the children.

  CLASS GTK2.Gnome2CanvasItem

    Description

      This is the base class for all canvas items. Canvas items are the drawing elements of a Gnome2.Canvas. Example items include lines, ellipses, polygons, images, text, curves, and even arbitary GTK+ widgets.

      Properties: Gnome2.CanvasItem parent

      Signals: event

    Inherit Object

      inherit GTK2.Object : Object

  CLASS GTK2.Viewport

    Description

      This is a container that can be scrolled around, but it has no scrollbars. You can connect scrollbars to it using the adjustment objects. `GTK2.Viewport(GTK2.Adjustment(),GTK2.Adjustment())->set_size_request(100,100)`

      `GTK2.Viewport(GTK2.Adjustment(),GTK2.Adjustment())->set_size_request(100,100)->set_shadow_type(GTK2.SHADOW_ETCHED_IN)`

      `GTK2.Viewport(GTK2.Adjustment(),GTK2.Adjustment())->set_size_request(100,100)->add(GTK2.Label("A label with a very long text on it, it will not fit"))->set_shadow_type(GTK2.SHADOW_ETCHED_IN)`

      `lambda(){ object a1;object v = GTK2.Viewport(a1=GTK2.Adjustment(),GTK2.Adjustment())->set_size_request(100,100)->add(GTK2.Label("A label with a very long text on it, it will not fit"))->set_shadow_type(GTK2.SHADOW_ETCHED_IN);call_out(a1->set_value,0,100.0);return v;}()`

      Properties: GTK2.Adjustment hadjustment int shadow-type GTK2.Adjustment vadjustment

      Signals: set_scroll_adjustments

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.Viewport GTK2.Viewport(GTK2.Adjustment xscroll_or_props, GTK2.Adjustment yscroll)`

    Description

      Create a new viewport. The adjustments are used to select what part of the viewport to view to the user. They are normally connected to a scrollbar or something similar.

    Method get_hadjustment

      `GTK2.Adjustment get_hadjustment()`

    Description

      Return the current horizontal adjustment object

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      Get the shadow type. One Of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method get_vadjustment

      `GTK2.Adjustment get_vadjustment()`

    Description

      Return the current vertical adjustment object

    Method set_hadjustment

      `GTK2.Viewport set_hadjustment(GTK2.Adjustment xscroll)`

    Description

      Set a new horizontal adjustment object.

    Method set_shadow_type

      `GTK2.Viewport set_shadow_type(int type)`

    Description

      Set the shadow style. One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_vadjustment

      `GTK2.Viewport set_vadjustment(GTK2.Adjustment yscroll)`

    Description

      Set a new vertical adjustment object.

  CLASS GTK2.Gdk_Atom

    Description

      An X-atom. You most likely want to use GDK2.Atom.atom_name instead of GDK2._Atom(name).

    Method create

      `GDK2._Atom GTK2.Gdk_Atom(string atom_name, int|void only_if_exists)`

    Description

      Create a new low-level atom. You should normally not call this function directly. Use GDK2.Atom[name] instead of GDK2._Atom(name,0).

    Method get_name

      `string get_name()`

    Description

      Returns the name of the atom.

  CLASS GTK2.Pango.LayoutLine

    Description

      PangoLayoutLine.

    Method get_extents

      `array get_extents()`

    Description

      Computes the logical and ink extents of a layout line.

    Method get_pixel_extents

      `array get_pixel_extents()`

    Description

      Computes the logical and ink extents of a layout line, in device units.

    Method index_to_x

      `int index_to_x(int index, int trailing)`

    Description

      Converts an index within a line to an x position.

    Method x_to_index

      `mapping x_to_index(int x_pos)`

    Description

      Converts from x offset to the byte index of the corresponding character within the text of the layout. If x_pos is outside the line, index and trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in index and trailing. An X position to the left of the line results in index pointing to the (logical) last grapheme in the line and trailing set to the number of characters in that grapheme. The reverse is true for a left-to-right line.

  CLASS GTK2.SeparatorToolItem

    Description

      Properties: int draw

    Inherit ToolItem

      inherit GTK2.ToolItem : ToolItem

    Method create

      `GTK2.SeparatorToolItem GTK2.SeparatorToolItem(mapping|void props)`

    Description

      Create a new GTK2.SeparatorToolItem.

    Method get_draw

      `int get_draw()`

    Description

      Returns whether SeparatorToolItem is drawn as a line, or just a blank

    Method set_draw

      `GTK2.SeparatorToolItem set_draw(int draw)`

    Description

      When a SeparatorToolItem is drawn as a line, or just a blank.

  CLASS GTK2.CellLayout

    Description

      An interface for packing cells.

    Method add_attribute

      `GTK2.CellLayout add_attribute(GTK2.CellRenderer cell, string attribute, int column)`

    Description

      Adds an attribute mapping.

    Method clear

      `GTK2.CellLayout clear()`

    Description

      Unsets all the mappings on all renderers and removes all renderers.

    Method clear_attributes

      `GTK2.CellLayout clear_attributes(GTK2.CellRenderer cell)`

    Description

      Clears all existing attributes.

    Method pack_end

      `GTK2.CellLayout pack_end(GTK2.CellRenderer cell, int expand)`

    Description

      See pack_start().

    Method pack_start

      `GTK2.CellLayout pack_start(GTK2.CellRenderer cell, int expand)`

    Description

      Packs the cell into the beginning. If expand is false, then the cell is allocated no more space than it needs. Any unused space is divied evenly between the cells for which expand is true.

    Method reorder

      `GTK2.CellLayout reorder(GTK2.CellRenderer cell, int position)`

    Description

      Re-inserts cell at position.

    Method set_cell_data_func

      `GTK2.CellLayout set_cell_data_func(GTK2.CellRenderer cell, function f, mixed user_data)`

    Description

      Sets the callback to use for this cell layout. This function is used instead of the standard attributes mapping for setting the column value, and should set the value of the cell layout's cell renderer(s) as appropriate. f may be 0 to remove an older one.

  CLASS GTK2.Editable

    Description

      Interface for text-editing widgets.

      Signals: changed

      delete_text

      insert_text

    Method copy_clipboard

      `GTK2.Editable copy_clipboard()`

    Description

      Causes the characters in the current selection to be copied to the clipboard.

    Method cut_clipboard

      `GTK2.Editable cut_clipboard()`

    Description

      Causes the characters in the current selection to be copied to the clipboard and then deleted.

    Method delete_selection

      `GTK2.Editable delete_selection()`

    Description

      Deletes the current contents of the selection.

    Method delete_text

      `GTK2.Editable delete_text(int start, int end)`

    Description

      Deletes a sequence of characters.

    Method get_chars

      `string get_chars(int start, int end)`

    Description

      Retrieves a sequence of characters.

    Method get_editable

      `int get_editable()`

    Description

      Retrieves whether this widget is editable.

    Method get_position

      `int get_position()`

    Description

      Retrieves the current cursor position.

    Method get_selection_bounds

      `array get_selection_bounds()`

    Description

      Returns the selection bounds.

    Method insert_text

      `int insert_text(string text, int length, int pos)`

    Description

      Inserts text at a given position. Returns the position after the new text.

    Method paste_clipboard

      `GTK2.Editable paste_clipboard()`

    Description

      Causes the contents of the clipboard to be pasted into the given widget at the current cursor position.

    Method select_region

      `GTK2.Editable select_region(int start, int end)`

    Description

      Selects a region of text.

    Method set_editable

      `GTK2.Editable set_editable(int setting)`

    Description

      Determines if the user can edit the text or not.

    Method set_position

      `GTK2.Editable set_position(int pos)`

    Description

      Sets the cursor position.

  CLASS GTK2.Gnome2DateEdit

    Description

      The GnomeDateEdit widget provides a way to enter dates and times with a helper calendar to let the user select the date. `GTK2.Gnome2DateEdit(time(),1,1);`

      `GTK2.Gnome2DateEdit(time(),0,1);`

      Properties: int dateedit-flags int initial-time int lower-hour int time int upper-hour

      Signals: date_changed

      time_changed

    Inherit Hbox

      inherit GTK2.Hbox : Hbox

    Method create

      `Gnome2.DateEdit GTK2.Gnome2DateEdit(int the_time, int show_time, int use_24_format)`

    Description

      Creates a new GnomeDateEdit widget which can be used to provide an easy to use way for entering dates and times.

    Method get_flags

      `int get_flags()`

    Description

      Get the flags.

    Method get_initial_time

      `int get_initial_time()`

    Description

      Queries the initial time that was set using set_time() or during creation.

    Method get_time

      `int get_time()`

    Description

      Return the time entered in the widget.

    Method set_flags

      `Gnome2.DateEdit set_flags(int flags)`

    Description

      Bitwise or of GNOME_DATE_EDIT_24_HR , GNOME_DATE_EDIT_SHOW_TIME and GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY .

    Method set_popup_range

      `Gnome2.DateEdit set_popup_range(int low_hour, int up_hour)`

    Description

      Sets the range of times that will be provide by the time popup selectors.

    Method set_time

      `Gnome2.DateEdit set_time(int the_time)`

    Description

      Changes the displayed date and time in the GnomeDateEdit widget to be the one represented by the_time.

  CLASS GTK2.Pango.Context

    Description

      PangoContext.

    Inherit Object

      inherit G.Object : Object

  CLASS GTK2.Gnome2DruidPageStandard

    Description

      Properties: string background GDK2.Color background-gdk int background-set string contents-background GDK2.Color contents-background-gdk int contents-background-set GDK2.Pixbuf logo string logo-background GDK2.Color logo-background-gdk int logo-background-set string title string title-foreground GDK2.Color title-foreground-gdk int title-foreground-set GDK2.Pixbuf top-watermark

    Inherit DruidPage

      inherit Gnome2.DruidPage : DruidPage

    Method append_item

      `Gnome2.DruidPageStandard append_item(string question, GTK2.Widget item, string additional_info)`

    Description

      Convenience function to add a GTK2.Widget to the vbox. This function creates a new contents section that has the question text followed by the item widget and then the additional_info text, all stacked vertically from top to bottom.

      The item widget could be something like a set of radio checkbuttons requesting a choice from the user.

    Method create

      `Gnome2.DruidPageStandard GTK2.Gnome2DruidPageStandard(string|void title, GTK2.GdkPixbuf logo, GTK2.GdkPixbuf top_watermark)`

    Description

      Construct a new Gnome2.DruidPageStandard.

    Method set_background

      `Gnome2.DruidPageStandard set_background(GTK2.GdkColor color)`

    Description

      Sets the background color of the top section.

    Method set_contents_background

      `Gnome2.DruidPageStandard set_contents_background(GTK2.GdkColor color)`

    Description

      Sets the color of the main contents section's background.

    Method set_logo

      `Gnome2.DruidPageStandard set_logo(GTK2.GdkPixbuf logo)`

    Description

      Sets a GDK2.Pixbuf as the logo in the top right corner. If omitted, then no logo will be displayed.

    Method set_logo_background

      `Gnome2.DruidPageStandard set_logo_background(GTK2.GdkColor color)`

    Description

      Sets the background color of the logo.

    Method set_title

      `Gnome2.DruidPageStandard set_title(string title)`

    Description

      Sets the title.

    Method set_title_foreground

      `Gnome2.DruidPageStandard set_title_foreground(GTK2.GdkColor color)`

    Description

      Sets the title text to the specified color.

    Method set_top_watermark

      `Gnome2.DruidPageStandard set_top_watermark(GTK2.GdkPixbuf watermark)`

    Description

      Sets a GDK2.Pixbuf as the watermark on top of the top strip on the druid. If watermark is omitted, it is reset to the normal color.

  CLASS GTK2.Allocation

    Inherit Rectangle

      inherit GDK2.Rectangle : Rectangle

  CLASS GTK2.Gnome2CanvasBpath

    Inherit CanvasShape

      inherit Gnome2.CanvasShape : CanvasShape

  CLASS GTK2.Gnome2CanvasLine

    Description

      Properties: float arrow-shape-a float arrow-shape-b float arrow-shape-c int cap-style string fill-color GDK2.Color fill-color-gdk int fill-color-rgba GDK2.Drawable fill-stipple int first-arrowhead int join-style int last-arrowhead int line-style Gnome2.CanvasPoints points int smooth int spline-steps int width-pixels float width-units

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

  CLASS GTK2.Widget

    Description

      The basic widget, inherited (directly or indirectly) by all widgets. Thus, all functions and signals defined in this widget work on all widgets.

      One of the most important functions in this class is 'show', it lets GTK2 know that we are done setting the attributes of the widget, and it is ready to be displayed. You may also use hide to make it disappear again. The order in which you show the widgets is not important, but I suggest showing the toplevel window last so the whole window pops up at once rather than seeing the individual widgets come up on the screen as they're formed. The children of a widget (a window is a widget too) will not be displayed until the window itself is shown using the show() function.

      Properties: int app-paintable int can-default int can-focus int composite-child int events (GDK2.EventMask) int extension-events (GDK_EXTENSION_EVENTS_ALL , GDK_EXTENSION_EVENTS_CURSOR and GDK_EXTENSION_EVENTS_NONE ) int has-default int has-focus int height-request int is-focus string name int no-show-all GTK2.Container parent int receives-default int sensitive GTK2.Style style int visible int width-request

      Style properties: float cursor-aspect-ratio GDK2.Color cursor-color int draw-border string focus-line-pattern int focus-line-width int focus-padding int interior-focus GDK2.Color link-color int scroll-arrow-hlength int scroll-arrow-vlength int separator-height int separator-width GDK2.Color visited-link-color int wide-separators

      Signals: accel_closures_changed

      button_press_event Called when a mouse button is pressed

      button_release_event Called when a mouse button is released

      can_activate_accel

      child_notify

      client_event An event sent by another client application

      composited_changed

      configure_event The size, position or stacking order of the widget has changed

      delete_event Called when the user has requested that the widget should be closed

      destroy_event Called when the widget is destroyed

      direction_changed

      drag_begin Called when the drag is initiated, on the sending side

      drag_data_delete Called when the data can be safely deleted (there is no need to use this function in pigtk, it's all handled automatically)

      drag_data_get Called on the sending side when the drop is initiated

      drag_data_received Called on the receiving side when the drop is finished

      drag_drop Called on the receiving side when the drop is initiated

      drag_end Called when the drag is finished, on the sending side

      drag_leave Called when the mouse leaves the widget while the user is dragging something

      drag_motion Called on the receiving side when the cursor is moved over the widget while dragging something

      enter_notify_event Calls when the mouse enters the widget

      event Called for all events

      event_after

      expose_event Called when the widget, or a part of the widget, gets an expose event

      focus

      focus_in_event The keyboard focus has entered the widget

      focus_out_event The keyboard focus has left the widget

      grab_broken_event

      grab_focus

      grab_notify

      heirarchy_changed

      hide Called when the widget is hidden

      key_press_event Called when a keyboard key is pressed

      key_release_event Called when a keyboard key is released

      leave_notify_event Called when the mouse leaves the widget

      map Called when the window associated with the widget is mapped

      map_event Called just before the 'map' signal

      mnemonic_activate

      motion_notify_event Called when the mouse is moved inside the widget

      no_expose_event

      parent_set Called when the parent widget is changed

      popup_menu

      property_notify_event Called when a property of the GDK window associated with the widget is changed

      proximity_in_event

      proximity_out_event

      realize Called when the widget is realized. Some methods cannot be used until the widget has been realized; if you get assertion errors related to 'w->window' or similar, this is probably the cause.

      screen_changed

      scroll_event

      selection_clear_event

      selection_get

      selection_notify_event

      selection_received

      selection_request_event

      show Called when the widget is shown

      show_help

      size_allocate Called when the widget gets the size it should be

      size_request Called when the widget should calculate how big it wants to be

      state_changed

      style_set Called when the style is changed

      unmap Called when the window associated with the widget is unmapped

      unmap_event Called just before the 'unmap' signal

      unrealize Called when the widget is unrealized;

      visibility_notify_event The widget has been mapped, unmapped, hidden, or otherwise had it's visibility modified

      window_state_event

    Inherit Object

      inherit GTK2.Object : Object

    Method APP_PAINTABLE

      `GTK2.Widget APP_PAINTABLE()`

    Description

      Returns if the GTK2.APP_PAINTABLE flag has been set on this widget.

    Method CAN_DEFAULT

      `GTK2.Widget CAN_DEFAULT()`

    Description

      Returns if this widget is allowed to receive the default action.

    Method CAN_FOCUS

      `GTK2.Widget CAN_FOCUS()`

    Description

      Returns if this widget is able to handle focus grabs.

    Method COMPOSITE_CHILD

      `GTK2.Widget COMPOSITE_CHILD()`

    Description

      Returns if this widget is a composite child of its parent.

    Method DOUBLE_BUFFERED

      `GTK2.Widget DOUBLE_BUFFERED()`

    Description

      Returns if the GTK2.DOUBLE_BUFFERED flag has been set on this widget.

    Method DRAWABLE

      `GTK2.Widget DRAWABLE()`

    Description

      Returns if this widget is mapped and visible.

    Method FLAGS

      `GTK2.Widget FLAGS()`

    Description

      Returns flags.

    Method HAS_DEFAULT

      `GTK2.Widget HAS_DEFAULT()`

    Description

      Returns if this widget is currently receiving the default action.

    Method HAS_FOCUS

      `GTK2.Widget HAS_FOCUS()`

    Description

      Returns if this widget has grabbed the focus and no other widget has done so more recently.

    Method HAS_GRAB

      `GTK2.Widget HAS_GRAB()`

    Description

      Returns if this widget is in the grab_widgets stack, and will be the preferred one for receiving events other than ones of cosmetic value.

    Method IS_SENSITIVE

      `GTK2.Widget IS_SENSITIVE()`

    Description

      Returns if this widget is effectively sensitive.

    Method MAPPED

      `GTK2.Widget MAPPED()`

    Description

      Returns if this widget is mapped.

    Method NO_WINDOW

      `GTK2.Widget NO_WINDOW()`

    Description

      Returns if this widget doesn't have its own GDK2.Window.

    Method PARENT_SENSITIVE

      `GTK2.Widget PARENT_SENSITIVE()`

    Description

      Returns if the GTK2.PARENT_SENSITIVE flag is set.

    Method RC_STYLE

      `GTK2.Widget RC_STYLE()`

    Description

      Returns if the widget's style has been looked up through the rc mechanism.

    Method REALIZED

      `GTK2.Widget REALIZED()`

    Description

      Returns if this widget is realized.

    Method RECEIVES_DEFAULT

      `GTK2.Widget RECEIVES_DEFAULT()`

    Description

      Returns if this widget when focused will receive the default action even if there is a different widget set as default.

    Method SAVED_STATE

      `GTK2.Widget SAVED_STATE()`

    Description

      Get the saved state.

    Method SENSITIVE

      `GTK2.Widget SENSITIVE()`

    Description

      Returns if this widget is sensitive.

    Method STATE

      `GTK2.Widget STATE()`

    Description

      Get the state.

    Method TOPLEVEL

      `GTK2.Widget TOPLEVEL()`

    Description

      Returns if this is a toplevel widget.

    Method VISIBLE

      `GTK2.Widget VISIBLE()`

    Description

      Returns if this widget is visible.

    Method activate

      `int activate()`

    Description

      For widgets that can be "activated" (buttons, menu items, etc.) this functions activates them. Activation is what happens when you press Enter on a widget during key navigation.

    Method add_accelerator

      `GTK2.Widget add_accelerator(string accel_signal, GTK2.AccelGroup accel_group, int accel_key, int accel_mods, int accel_flags)`

    Description

      Installs an accelerator in accel_group that causes accel_signal to be emitted if the accelerator is activated. The signal must be of type G_RUN_ACTION.

    Method add_events

      `GTK2.Widget add_events(int events)`

    Description

      Adds the events in the bitfield events to the event mask.

    Method add_mnemonic_label

      `GTK2.Widget add_mnemonic_label(GTK2.Widget label)`

    Description

      Adds a widget to the list of mnemonic lables for this widget. Note the list of mnemonic labels for the widget is cleared when the widget is destroyed, so the caller must make sure to update it's internal state at this point as well, by using a connection to the destroy signal.

    Method allocation

      `mapping allocation()`

    Description

      Returns ([ "x": xoffset, "y":yoffset, "width":xsize, "height":ysize ])

    Method can_activate_accel

      `int can_activate_accel(int signal_id)`

    Description

      Determines whether an accelerator that activates the signal signal_id can currently be activated.

    Method child_notify

      `GTK2.Widget child_notify(string prop)`

    Description

      Emits a "child-notify" signal for the child property prop.

    Method class_path

      `string class_path()`

    Description

      Same as path() but uses type rather than name.

    Method create_pango_context

      `GTK2.Pango.Context create_pango_context()`

    Description

      Creates a new Pango.Context with the appropriate colormap, font description, and base direction for drawing text for this widget.

    Method create_pango_layout

      `GTK2.Pango.Layout create_pango_layout(string text)`

    Description

      Creates a new Pango.Layout with the appropriate colormap, font description, and base direction for drawing text.

    Method freeze_child_notify

      `GTK2.Widget freeze_child_notify()`

    Description

      Stops emission of "child-notify" signals. The signals are queued until thaw_child_notify() is called on the widget.

    Method get_clipboard

      `GTK2.Clipboard get_clipboard(GDK2.Atom selection)`

    Description

      Returns the clipboard object for the given selection.

    Method get_composite_name

      `string get_composite_name()`

    Description

      Get the composite name.

    Method get_direction

      `int get_direction()`

    Description

      Gets the reading direction.

    Method get_display

      `GTK2.GdkDisplay get_display()`

    Description

      Get the GDK2.Display for the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a GTK2.Window at the top.

    Method get_events

      `int get_events()`

    Description

      Returns the event mask for the widget.

    Method get_extension_events

      `int get_extension_events()`

    Description

      Retrieves the extension events the widget will receive.

    Method get_modifier_style

      `GTK2.RcStyle get_modifier_style()`

    Description

      Returns the current modifier style.

    Method get_name

      `string get_name()`

    Description

      Retrieves the name.

    Method get_no_show_all

      `int get_no_show_all()`

    Description

      Returns the current value of the "no-show-all" property.

    Method get_pango_context

      `GTK2.Pango.Context get_pango_context()`

    Description

      Gets a Pango.Context with the appropriate colormap, font description, and base direction for this widget.

    Method get_parent

      `GTK2.Widget get_parent()`

    Description

      Returns the parent container.

    Method get_parent_window

      `GTK2.GdkWindow get_parent_window()`

    Description

      Get the parent window.

    Method get_pointer

      `mapping get_pointer()`

    Description

      Obtains the location of the mouse pointer in widget coordinates.

    Method get_root_window

      `GTK2.GdkWindow get_root_window()`

    Description

      Get the root window.

    Method get_screen

      `GTK2.GdkScreen get_screen()`

    Description

      Get the GDK2.Screen from the toplevel window associated with this widget.

    Method get_settings

      `GTK2.Settings get_settings()`

    Description

      Gets the settings object holding the settings (global property settings, RC file information, etc) used for this widget.

    Method get_size_request

      `mapping get_size_request()`

    Description

      Gets the size request that was explicityly set for the widget using set_size_request(). A value of -1 for width or height indices that that dimension has not been set explicityly and the natural requisition of the widget will be used instead. To get the size a widget will actually use, call size_request() instead.

    Method get_style

      `GTK2.Style get_style()`

    Description

      Returns the style.

    Method get_toplevel

      `GTK2.Widget get_toplevel()`

    Description

      This function returns the topmost widget in the container hierarchy this widget is a part of. If this widget has no parent widgets, it will be returned as the topmost widget.

    Method grab_default

      `GTK2.Widget grab_default()`

    Description

      Causes this widget to become the default widget.

    Method grab_focus

      `GTK2.Widget grab_focus()`

    Description

      Causes this widget to have the keyboard focus. This widget must be a focusable widget, such as a GTK2.Entry; something like GTK2.Frame won't work.

    Method has_screen

      `int has_screen()`

    Description

      Checks whether there is a GDK2.Screen associated with this widget.

    Method hide

      `GTK2.Widget hide()`

    Description

      Hide the widget.

    Method hide_all

      `GTK2.Widget hide_all()`

    Description

      Hide this widget, and all child widgets.

    Method hide_on_delete

      `int hide_on_delete()`

    Description

      Utility function

    Method is_ancestor

      `int is_ancestor(GTK2.Widget ancestor)`

    Description

      Determines whether this widget is somewhere inside ancestor.

    Method is_focus

      `int is_focus()`

    Description

      Determines if the widget is the focus widget within its toplevel. (This does not mean that the HAS_FOCUS flag is necessarily set; HAS_FOCUS will only be set if the toplevel widget additionally has the input focus.

    Method list_mnemonic_lables

      `array list_mnemonic_lables()`

    Description

      Returns a list of the widgets, normally labels, for which this widget is the target of a mnemonic.

    Method map

      `GTK2.Widget map()`

    Description

      Causes this widget to be mapped.

    Method mnemonic_activate

      `int mnemonic_activate(int group_cycling)`

    Description

      Not documented.

    Method modify_base

      `GTK2.Widget modify_base(int state, GTK2.GdkColor color)`

    Description

      Sets the base color of the widget in a particular state. See modify_fg().

    Method modify_bg

      `GTK2.Widget modify_bg(int state, GTK2.GdkColor color)`

    Description

      Sets the background color of the widget in a particular state. See modify_fg().

    Method modify_fg

      `GTK2.Widget modify_fg(int state, GTK2.GdkColor color)`

    Description

      Sets the foreground color of the widget in a particular state. state is one of STATE_ACTIVE , STATE_INSENSITIVE , STATE_NORMAL , STATE_PRELIGHT and STATE_SELECTED . color can be omitted to undo the effect of a previous call.

    Method modify_font

      `GTK2.Widget modify_font(GTK2.Pango.FontDescription font)`

    Description

      Sets the font.

    Method modify_style

      `GTK2.Widget modify_style(GTK2.RcStyle style)`

    Description

      Modifies style values.

    Method modify_text

      `GTK2.Widget modify_text(int state, GTK2.GdkColor color)`

    Description

      Sets the text color of the widget in a particular state. See modify_fg().

    Method path

      `string path()`

    Description

      Obtains the full path. The path is simply the name of a widget and all its parents in the container hierarchy, separated by periods.

    Method queue_draw

      `GTK2.Widget queue_draw()`

    Description

      Equivalent to calling queue_draw_area() for the entire area of the widget.

    Method queue_draw_area

      `GTK2.Widget queue_draw_area(int x, int y, int width, int height)`

    Description

      Invalidates the rectangular area defined by x,y,width,height by calling GDK2.Window->invalidate_rect() on the widget's window and all its child windows. Once the main loop becomse idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.

    Method queue_resize

      `GTK2.Widget queue_resize()`

    Description

      This function is only for use in widget implementations. Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a W(Label), GTK2.Label queues a resize to ensure there's enough space for the new text.

    Method queue_resize_no_redraw

      `GTK2.Widget queue_resize_no_redraw()`

    Description

      This function works like queue_resize(), except that the widget is not invalidated.

    Method remove_accelerator

      `int remove_accelerator(GTK2.AccelGroup accel_group, int accel_key, int accel_mods)`

    Description

      Removes an accelerator.

    Method remove_mnemonic_label

      `GTK2.Widget remove_mnemonic_label(GTK2.Widget label)`

    Description

      Removes a widget from the list of mnemonic labels for this widget.

    Method render_icon

      `GTK2.GdkPixbuf render_icon(string stock_id, int size, string detail)`

    Description

      A convenience function that uses the theme engine and rc file settings to look up stock_id and render it to a pixbuf. stock_id should be a stock icon ID such as GTK2.STOCK_OPEN or GTK2.STOCK_OK. size should be a size such as GTK2.ICON_SIZE_MENU. detail should be a string that identifies//! the widget or code doing the rendering, so that theme engines can special-case rendering for that widget or code.

      The pixels in the returned GDK2.Pixbuf are shared with the rest of the application and should not be modified.

    Method reparent

      `GTK2.Widget reparent(GTK2.Widget new_parent)`

    Description

      Moves a widget from one W(Container) to another.

    Method reset_shapes

      `GTK2.Widget reset_shapes()`

    Description

      Recursively resets the shape on this widget and its descendants.

    Method set_accel_path

      `GTK2.Widget set_accel_path(string accel_path, GTK2.AccelGroup accel_group)`

    Description

      Sets up an accelerator in accel_group so whenever the key binding that is defined for accel_path is pressed, this widget will be activated.

    Method set_composite_name

      `GTK2.Widget set_composite_name(string name)`

    Description

      Sets a widget's composite name.

    Method set_direction

      `GTK2.Widget set_direction(int dir)`

    Description

      Sets the reading direction. This direction controls the primary direction for widgets containing text, and also the direction in which the children of the container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left reading directions can be done. Generally, applications will let the default reading direction present, except for containers where the containers are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification).

    Method set_events

      `GTK2.Widget set_events(int events)`

    Description

      Sets the event mask for a widget. The event mask determines which events a widget will receive. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget's functionality, so be careful. This function must be called while a widget is unrealized. Consider add_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can't be used with GTK2.NO_WINDOW widgets; to get events on those widgets, place them inside a GTK2.EventBox and receive events on the event box.

    Method set_extension_events

      `GTK2.Widget set_extension_events(int mode)`

    Description

      Sets the extension events mask to mode. One of GDK_EXTENSION_EVENTS_ALL , GDK_EXTENSION_EVENTS_CURSOR and GDK_EXTENSION_EVENTS_NONE

    Method set_flags

      `GTK2.Widget set_flags(int flags)`

    Description

      Set certain flags, such as GTK2.CAN_DEFAULT.

    Method set_name

      `GTK2.Widget set_name(string name)`

    Description

      Widgets can be named, which allows you to refer to them from a gtkrc file. You can apply a style to widgets with a particular name in the gtkrc file.

    Method set_no_show_all

      `GTK2.Widget set_no_show_all(int no_show_all)`

    Description

      Sets the "no-show-all" property, which determines whether calls to show_all() and hide_all() will affect this widget.

    Method set_parent

      `GTK2.Widget set_parent(GTK2.Widget parent)`

    Description

      Sets the container as the parent of this widget.

    Method set_parent_window

      `GTK2.Widget set_parent_window(GTK2.GdkWindow parent)`

    Description

      Sets a non default parent window for this widget.

    Method set_scroll_adjustments

      `GTK2.Widget set_scroll_adjustments(GTK2.Adjustment hadj, GTK2.Adjustment vadj)`

    Description

      For widgets that support scrolling, sets the scroll adjustments. For widgets that don't support scrolling, does nothing. Widgets that don't support scrolling can be scrolled by placing them in a W(Viewport), which does support scrolling.

    Method set_sensitive

      `GTK2.Widget set_sensitive(int sensitive)`

    Description

      Sets the sensitivity. A widget is sensitive is the user can interact with it. Insensitive widgets are "grayed out" and the user can't interact with them. Insensitive widgets are known as "inactive", "disabled", or "ghosted" in some other toolkits.

    Method set_size_request

      `GTK2.Widget set_size_request(int width, int height)`

    Description

      Sets the minimum size of a widget; that is, the widget's size request will be width by height. You can use this function to force a widget to be either larger or smaller than it normally would be.

      In most cases, set_default_size() is a better choice for toplevel windows than this function; setting the default size will still allow users to shrink the window. Setting the size request will force them to leave the window at least as large as the size request. When dealing with window sizes, set_geometry_hints() can be a useful function as well.

      Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct.

      The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it request.

      If the size request in a given direction is -1 (unset), then the "natural" size request of the widget will be used instead.

      Widgets can't actually be allocated a size less than 1x1, but you can pass 0,0 to this function to mean "as small as possible".

    Method set_style

      `GTK2.Widget set_style(GTK2.Style style)`

    Description

      Sets the style.

    Method shape_combine_mask

      `GTK2.Widget shape_combine_mask(GTK2.GdkBitmap shape_mask, int offset_x, int offset_y)`

    Description

      Sets a shape for a widget's GDK2.Window. This allows for transparent window, etc.

    Method show

      `GTK2.Widget show()`

    Description

      Show the widget. Most (almost all) widgets must be shown to be visible on the screen.

    Method show_all

      `GTK2.Widget show_all()`

    Description

      Show this widget, and all child widgets.

    Method show_now

      `GTK2.Widget show_now()`

    Description

      Shows a widget. If the widget is an unmapped toplevel widget (i.e. a GTK2.Window that has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.

    Method size_request

      `mapping size_request()`

    Description

      Get the size allocated to a widget.

    Method style_get_property

      `mixed style_get_property(string name)`

    Description

      Gets the value of the style property called name.

    Method thaw_child_notify

      `GTK2.Widget thaw_child_notify()`

    Description

      Reverts the effect of a previous call to freeze_child_notify().

    Method unmap

      `GTK2.Widget unmap()`

    Description

      Causes this widget to be unmapped.

    Method unset_flags

      `GTK2.Widget unset_flags(int flags)`

    Description

      Unset flags.

  CLASS GTK2.Gnome2DruidPageEdge

    Inherit DruidPage

      inherit Gnome2.DruidPage : DruidPage

    Method create

      `Gnome2.DruidPageEdge GTK2.Gnome2DruidPageEdge(int position, int|void anti_alias)`

    Description

      Create a new Gnome2.DruidPageEdge, with optional anti-aliasing.

    Method set_bg_color

      `Gnome2.DruidPageEdge set_bg_color(GTK2.GdkColor color)`

    Description

      This will set the background color.

    Method set_logo

      `Gnome2.DruidPageEdge set_logo(GTK2.GdkPixbuf logo)`

    Description

      Sets a GDK2.Pixbuf as the logo in the top right corner. If omitted, then no logo will be displayed.

    Method set_logo_bg_color

      `Gnome2.DruidPageEdge set_logo_bg_color(GTK2.GdkColor color)`

    Description

      Sets the color behind the druid page's logo.

    Method set_text

      `Gnome2.DruidPageEdge set_text(string text)`

    Description

      Sets the contents of the text portion.

    Method set_text_color

      `Gnome2.DruidPageEdge set_text_color(GTK2.GdkColor color)`

    Description

      Sets the color of the text in the body of the page.

    Method set_textbox_color

      `Gnome2.DruidPageEdge set_textbox_color(GTK2.GdkColor color)`

    Description

      Sets the color of the background in the main text area of the page.

    Method set_title

      `Gnome2.DruidPageEdge set_title(string title)`

    Description

      Sets the contents of the page's title text.

    Method set_title_color

      `Gnome2.DruidPageEdge set_title_color(GTK2.GdkColor color)`

    Description

      Sets the color of the title text.

    Method set_top_watermark

      `Gnome2.DruidPageEdge set_top_watermark(GTK2.GdkPixbuf watermark)`

    Description

      Sets a GDK2.Pixbuf as the watermark on top of the top strip on the druid. If watermark is omitted, it is reset to the normal color.

    Method set_watermark

      `Gnome2.DruidPageEdge set_watermark(GTK2.GdkPixbuf watermark)`

    Description

      Sets a GDK2.Pixbuf as the watermark on the left strip on the druid. If watermark is omitted, it is reset to the normal color.

  CLASS GTK2.GdkWindow

    Description

      a GDK2.Window object.

      NOIMG

    Inherit Drawable

      inherit GDK2.Drawable : Drawable

    Method change_property

      `GDK2.Window change_property(GDK2.Atom property, GDK2.Atom type, int mode, string data)`

    Description

      mode is one of GDK_PROP_MODE_APPEND , GDK_PROP_MODE_PREPEND and GDK_PROP_MODE_REPLACE

    Method children

      `array children()`

    Description

      Returns an array of GDK2.Window objects.

    Method create

      `GDK2.Window GTK2.GdkWindow(GTK2.GdkWindow parent, mapping|void attributes)`

    Description

      Not for non-experts. I promise.

    Method delete_property

      `GDK2.Window delete_property(GDK2.Atom a)`

    Description

      Delete a property.

    Method get_geometry

      `mapping get_geometry()`

    Description

      Returns ([ "x":xpos, "y":ypos, "width":width, "height":height, "depth":bits_per_pixel ])

    Method get_property

      `mapping get_property(GDK2.Atom atom, int|void offset, int|void delete_when_done)`

    Description

      Returns the value (as a string) of the specified property. The arguments are:

      property: The property atom, as an example GDK2.Atom.__SWM_VROOT offset (optional): The starting offset, in elements delete_when_done (optional): If set, the property will be deleted when it has been fetched.

      Example usage: Find the 'virtual' root window (many window managers put large windows over the screen)

             GDK2.Window root = GTK.root_window();
             array maybe=root->children()->
                         get_property(GDK2.Atom.__SWM_VROOT)-({0});
             if(sizeof(maybe))
               root=GDK2.Window( maybe[0]->data[0] );

    Method is_viewable

      `int is_viewable()`

    Description

      Return 1 if the window is mapped.

    Method is_visible

      `int is_visible()`

    Description

      Return 1 if the window, or a part of the window, is visible right now.

    Method lower

      `GDK2.Window lower()`

    Description

      Lower this window if the window manager allows that.

    Method move_resize

      `GDK2.Window move_resize(int x, int y, int w, int h)`

    Description

      Move and resize the window in one call.

    Method raise

      `GDK2.Window raise()`

    Description

      Raise this window if the window manager allows that.

    Method set_background

      `GDK2.Window set_background(GTK2.GdkColor to)`

    Description

      Set the background color or image. The argument is either a GDK2.Pixmap or a GDK2.Color object.

    Method set_bitmap_cursor

      `GDK2.Window set_bitmap_cursor(GTK2.GdkBitmap image, GTK2.GdkBitmap mask, GTK2.GdkColor fg, GTK2.GdkColor bg, int xhot, int yhot)`

    Description

      xhot,yhot are the locations of the x and y hotspot relative to the upper left corner of the cursor image.

    Method set_cursor

      `GDK2.Window set_cursor(int new_cursor)`

    Description

      Change the window cursor.<table border="0" cellpadding="3" cellspacing="0"> CURS(GDK2.Arrow) CURS(GDK2.BasedArrowDown) CURS(GDK2.BasedArrowUp) CURS(GDK2.Boat) CURS(GDK2.Bogosity) CURS(GDK2.BottomLeftCorner) CURS(GDK2.BottomRightCorner) CURS(GDK2.BottomSide) CURS(GDK2.BottomTee) CURS(GDK2.BoxSpiral) CURS(GDK2.CenterPtr) CURS(GDK2.Circle) CURS(GDK2.Clock) CURS(GDK2.CoffeeMug) CURS(GDK2.Cross) CURS(GDK2.CrossReverse) CURS(GDK2.Crosshair) CURS(GDK2.DiamondCross) CURS(GDK2.Dot) CURS(GDK2.Dotbox) CURS(GDK2.DoubleArrow) CURS(GDK2.DraftLarge) CURS(GDK2.DraftSmall) CURS(GDK2.DrapedBox) CURS(GDK2.Exchange) CURS(GDK2.Fleur) CURS(GDK2.Gobbler) CURS(GDK2.Gumby) CURS(GDK2.Hand1) CURS(GDK2.Hand2) CURS(GDK2.Heart) CURS(GDK2.Icon) CURS(GDK2.IronCross) CURS(GDK2.LeftPtr) CURS(GDK2.LeftSide) CURS(GDK2.LeftTee) CURS(GDK2.Leftbutton) CURS(GDK2.LlAngle) CURS(GDK2.LrAngle) CURS(GDK2.Man) CURS(GDK2.Middlebutton) CURS(GDK2.Mouse) CURS(GDK2.Pencil) CURS(GDK2.Pirate) CURS(GDK2.Plus) CURS(GDK2.QuestionArrow) CURS(GDK2.RightPtr) CURS(GDK2.RightSide) CURS(GDK2.RightTee) CURS(GDK2.Rightbutton) CURS(GDK2.RtlLogo) CURS(GDK2.Sailboat) CURS(GDK2.SbDownArrow) CURS(GDK2.SbHDoubleArrow) CURS(GDK2.SbLeftArrow) CURS(GDK2.SbRightArrow) CURS(GDK2.SbUpArrow) CURS(GDK2.SbVDoubleArrow) CURS(GDK2.Shuttle) CURS(GDK2.Sizing) CURS(GDK2.Spider) CURS(GDK2.Spraycan) CURS(GDK2.Star) CURS(GDK2.Target) CURS(GDK2.Tcross) CURS(GDK2.TopLeftArrow) CURS(GDK2.TopLeftCorner) CURS(GDK2.TopRightCorner) CURS(GDK2.TopSide) CURS(GDK2.TopTee) CURS(GDK2.Trek) CURS(GDK2.UlAngle) CURS(GDK2.Umbrella) CURS(GDK2.UrAngle) CURS(GDK2.Watch) CURS(GDK2.Xterm) </table>

    Method set_events

      `GDK2.Window set_events(int events)`

    Description

      events is a bitwise or of one or more of the following constants: GDK2.ExposureMask, GDK2.PointerMotionMask, GDK2.PointerMotion_HINTMask, GDK2.ButtonMotionMask, GDK2.Button1MotionMask, GDK2.Button2MotionMask, GDK2.Button3MotionMask, GDK2.ButtonPressMask, GDK2.ButtonReleaseMask, GDK2.KeyPressMask, GDK2.KeyReleaseMask, GDK2.EnterNotifyMask, GDK2.LeaveNotifyMask, GDK2.FocusChangeMask, GDK2.StructureMask, GDK2.PropertyChangeMask, GDK2.VisibilityNotifyMask, GDK2.ProximityInMask, GDK2.ProximityOutMask and GDK2.AllEventsMask

    Method set_icon

      `GDK2.Window set_icon(GTK2.GdkPixmap pixmap, GTK2.GdkBitmap mask, GTK2.GdkWindow window)`

    Description

      Set the icon to the specified image (with mask) or the specified GDK2.Window. It is up to the window manager to display the icon. Most window manager handles window and pixmap icons, but only a few can handle the mask argument. If you want a shaped icon, the only safe bet is a shaped window.

    Method set_icon_name

      `GDK2.Window set_icon_name(string name)`

    Description

      Set the icon name to the specified string.

    Method shape_combine_mask

      `GDK2.Window shape_combine_mask(GTK2.GdkBitmap mask, int xoffset, int yoffset)`

    Description

      Set the shape of the widget, or, rather, it's window, to that of the supplied bitmap.

  CLASS GTK2.MessageDialog

    Description

      A dialog with an image representing the type of message (Error, Question). alongside some message text. It's simply a convenience widget; you could construct the equivalent of GTK2.MessageDialog from GTK2.Dialog without too much effort, but GTK2.MessageDialog saves typing. Properties: int buttons int message-type

      Style properties: int message-border int use-separator

    Inherit Dialog

      inherit GTK2.Dialog : Dialog

    Method create

      `GTK2.MessageDialog GTK2.MessageDialog(mapping|int flags, int|void type, int|void buttons, string|void message, GTK2.Window parent)`

    Description

      Creates a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc) and some text the user may want to see. When the user clicks a button a "response" signal is emitted with response IDs from . See GTK2.Dialog for more details.

    Method format_secondary_markup

      `GTK2.MessageDialog format_secondary_markup(string text)`

    Description

      Sets the secondary text of the message dialog to be text, which is marked up with the Pango text markup language.

      Note tha tsetting a secondary text makes the primary text become bold, unless you have provided explicit markup.

    Method format_secondary_text

      `GTK2.MessageDialog format_secondary_text(string text)`

    Description

      Sets the secondary text of the message dialog to be text.

      Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup.

    Method set_markup

      `GTK2.MessageDialog set_markup(string text)`

    Description

      Sets the text of the message dialog to be text, which is marked up with the Pango text markup language.

  CLASS GTK2.SpinButton

    Description

      The Spin Button widget is generally used to allow the user to select a value from a range of numeric values. It consists of a text entry box with up and down arrow buttons attached to the side. Selecting one of the buttons causes the value to "spin" up and down the range of possible values. The entry box may also be edited directly to enter a specific value.

      The Spin Button allows the value to have zero or a number of decimal places and to be incremented/decremented in configurable steps. The action of holding down one of the buttons optionally results in an acceleration of change in the value according to how long it is depressed.

      The Spin Button uses an W(Adjustment) object to hold information about the range of values that the spin button can take.

      The attributes of an W(Adjustment) are used by the Spin Button in the following way: <ul><li>value: initial value for the Spin Button</li> <li>lower: lower range value</li> <li>upper: upper range value</li> <li>step_increment: value to increment/decrement when pressing mouse button 1 on a button</li> <li>page_increment: value to increment/decrement when pressing mouse button 2 on a button</li> <li>page_size: unused</li> </ul>

      The argument order for the W(Adjustment) constructor is: value, lower, upper, step_increment, page_increment, page_size

      `GTK2.SpinButton(GTK2.Adjustment(),0.1, 1 )->set_size_request(60,20)`

      Properties: GTK2.Adjustment adjustment float climb-rate int digits int numeric int snap-to-ticks int update-policy float value int wrap

      Style properties: int shadow-type

      Signals: change_value

      input

      output

      value_changed

    Inherit Entry

      inherit GTK2.Entry : Entry

    Inherit CellEditable

      inherit GTK2.CellEditable : CellEditable

    Inherit Editable

      inherit GTK2.Editable : Editable

    Method configure

      `GTK2.SpinButton configure(GTK2.Adjustment range, float climb_rate, int precision)`

    Description

      Adjustment (with the lower/upper/increse values), climb_rate and digits

    Method create

      `GTK2.SpinButton GTK2.SpinButton(GTK2.Adjustment range_or_min_or_props, float climb_rate_or_max, int|float precision_or_step)`

    Description

      The climb_rate argument take a value between 0.0 and 1.0 and indicates the amount of acceleration that the Spin Button has. The digits argument specifies the number of decimal places to which the value will be displayed.

    Method get_adjustment

      `GTK2.Adjustment get_adjustment()`

    Description

      Get the adjustment associated with this spinbutton.

    Method get_digits

      `int get_digits()`

    Description

      Fetches the precision.

    Method get_entry

      `int get_entry()`

    Description

      Returns W(Entry) of this widget.

    Method get_increments

      `mapping get_increments()`

    Description

      Gets the current step and page increments.

    Method get_numeric

      `int get_numeric()`

    Description

      Returns whether non-numeric text can be typed in.

    Method get_range

      `mapping get_range()`

    Description

      Gets the range allowed.

    Method get_snap_to_ticks

      `int get_snap_to_ticks()`

    Description

      Returns whether the value are corrected to the nearest step.

    Method get_update_policy

      `int get_update_policy()`

    Description

      Gets the update behavior.

    Method get_value

      `float get_value()`

    Description

      Get the value.

    Method get_value_as_int

      `int get_value_as_int()`

    Description

      The current value of a Spin Button can be retrieved as a int.

    Method get_wrap

      `int get_wrap()`

    Description

      Returns whether the value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.

    Method set_adjustment

      `GTK2.SpinButton set_adjustment(GTK2.Adjustment range)`

    Description

      Set a new adjustment.

    Method set_digits

      `GTK2.SpinButton set_digits(int precision)`

    Description

      Set the number of digits to show to the user.

    Method set_increments

      `GTK2.SpinButton set_increments(float step, float page)`

    Description

      Sets the step and page increments. This affects how quickly the value changes when the arrows are activated.

    Method set_numeric

      `GTK2.SpinButton set_numeric(int numericp)`

    Description

      If true, it is a numeric value. This prevents a user from typing anything other than numeric values into the text box of a Spin Button

    Method set_range

      `GTK2.SpinButton set_range(float min, float max)`

    Description

      Sets the minimum and maximum allowable values.

    Method set_snap_to_ticks

      `GTK2.SpinButton set_snap_to_ticks(int snapp)`

    Description

      Set the Spin Button to round the value to the nearest step_increment, which is set within the Adjustment object used with the Spin Button

    Method set_update_policy

      `GTK2.SpinButton set_update_policy(int policy)`

    Description

      The possible values of policy are either GTK2.UpdateAlways or GTK2.UpdateIfValid.

      These policies affect the behavior of a Spin Button when parsing inserted text and syncing its value with the values of the Adjustment.

      In the case of GTK2.UpdateIfValid the Spin Button value only gets changed if the text input is a numeric value that is within the range specified by the Adjustment. Otherwise the text is reset to the current value.

      In case of GTK2.UpdateAlways errors are ignored while converting text into a numeric value.

    Method set_value

      `GTK2.SpinButton set_value(float to)`

    Description

      Set the value.

    Method set_wrap

      `GTK2.SpinButton set_wrap(int wrapp)`

    Description

      If true, the spin button will wrap from the lowest to the highest value, and the highest to the lowest.

    Method spin

      `GTK2.SpinButton spin(int direction, float increment)`

    Description

      If you want to alter the value of a Spin Value relative to its current value, then this function can be used.

      The direction paramenter is one of SPIN_END , SPIN_HOME , SPIN_PAGE_BACKWARD , SPIN_PAGE_FORWARD , SPIN_STEP_BACKWARD , SPIN_STEP_FORWARD and SPIN_USER_DEFINED

      GTK2.SpinStepForward and GTK2.SpinStepBackward change the value of the Spin Button by the amount specified by increment, unless increment is equal to 0, in which case the value is changed by the value of step_increment in theAdjustment.

      GTK2.SpinPageForward and GTK2.SpinPageBackward simply alter the value of the Spin Button by increment.

      GTK2.SpinHome sets the value of the Spin Button to the bottom of the Adjustments range.

      GTK2.SpinEnd sets the value of the Spin Button to the top of the Adjustments range.

      GTK2.SpinUserDefined simply alters the value of the Spin Button by the specified amount.

    Method update

      `GTK2.SpinButton update()`

    Description

      Explicitly request that the Spin Button updates itself

  CLASS GTK2.Gnome2DruidPage

    Description

      This widget is a virtual widget to define the interface to a druid page. It's descendants are placed in a W(Gnome2.Druid) widget.

      Signals: back

      cancel

      finish

      next

      prepare

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method back

      `int back()`

    Description

      This will emit the "back" signal for that particular page.

    Method cancel

      `int cancel()`

    Description

      This will emit the "cancel" signal for that particular page.

    Method create

      `Gnome2.DruidPage GTK2.Gnome2DruidPage()`

    Description

      Creates a new Gnome2.DruidPage.

    Method finish

      `Gnome2.DruidPage finish()`

    Description

      This emits the "finish" signal for the page.

    Method next

      `int next()`

    Description

      This will emit the "next" signal for that particular page. It is called by gnome-druid exclusviely. It is expected that non-linear Druid's will override this signal and return true if it handles changing pages.

    Method prepare

      `Gnome2.DruidPage prepare()`

    Description

      This emits the "prepare" signal for the page. It is called by gnome-druid exclusively. This function is called immediately prior to a druid page being show so that it can "prepare" for display.

  CLASS GTK2.GdkColor

    Description

      The GDK2.Color object is used to represent a color. When you call GDK2.Color(r,g,b) the color will be allocated from the X-server. The constructor can return an exception if there are no more colors to allocate. NOIMG

    Method blue

      `int blue()`

    Description

      Returns the blue color component.

    Method create

      `GDK2.Color GTK2.GdkColor(object|int color_or_r, int|void g, int|void b)`

    Description

      r g and b are in the range 0 to 255, inclusive. If color is specified, it should be an Image.Color object, and the only argument.

    Method destroy

      `GDK2.Color destroy()`

    Description

      Destroys the color object. Please note that this function does not free the color from the X-colormap (in case of pseudocolor) right now.

    Method green

      `int green()`

    Description

      Returns the green color component.

    Method image_color_object

      `Image.Color.Color image_color_object()`

    Description

      Return a Image.Color.Color instance. This gives better precision than the rgb function.

    Method pixel

      `int pixel()`

    Description

      Returns the pixel value of the color. See GDK2.Image->set_pixel.

    Method red

      `int red()`

    Description

      Returns the red color component.

    Method rgb

      `array rgb()`

    Description

      Returns the red green and blue color components as an array.

  CLASS GTK2.G.Object

    Description

      The base object. All GDK and GTK classes inherit from this. The Pango classes also inherit from this class.

      Signals: notify

    Method accel_groups_activate

      `G.Object accel_groups_activate(int accel_key, int accel_mods)`

    Description

      Finds the first accelerator in an GTK.AccelGroup attached to this object that matches accel_key and accel_mods, and activates that accelerator.

    Method get_property

      `mixed get_property(string property)`

    Description

      Get a property.

    Method new_signal

      `int new_signal(string name, array types, string return_type)`

    Description

      Create a new signal.

    Method notify

      `G.Object notify(string property)`

    Description

      Emits a "notify" signal for the named property on the object.

    Method set_property

      `G.Object set_property(string property, mixed value)`

    Description

      Set a property on a G.Object (and any derived types) to value.

    Method signal_block

      `G.Object signal_block(int signal_id)`

    Description

      Temporarily block a signal handler. No signals will be received while the handler is blocked. See signal_connect() for more info.

    Method signal_connect

      `int signal_connect(string signal, function callback, mixed|void callback_arg, string|void detail)`

    Description

      int signal_connect(string signal, function callback, mixed ... args) Connect a signal to a pike function. The function will be called with the last argument to this function as it's first argument (defaults to 0), the second argument is always the widget, and any other arguments are the ones supplied by GTK.

      The return value of this function can be used to remove a signal with signal_disconnect(), and block and unblock the signal with signal_block() and signal_unblock().

    Method signal_disconnect

      `G.Object signal_disconnect(int signal_id)`

    Description

      Remove a signal formerly added by signal_connect. The argument is the return value of signal_connect(). See signal_connect() for more info.

    Method signal_emit

      `G.Object signal_emit(string signal_name, string|void detail)`

    Description

      Send the current named signal.

    Method signal_unblock

      `G.Object signal_unblock(int signal_id)`

    Description

      Unblock a formerly blocked signal handler. See signal_block() and signal_connect() for more info.

  CLASS GTK2.AccelGroup

    Description

      An AccelGroup stores keybindings. A group is automatically created by W(MenuFactory)

      NOIMG

      Signals: accel_activate

      accel_changed

    Inherit Object

      inherit G.Object : Object

    Method connect

      `GTK2.AccelGroup connect(int accel_key, int accel_mods, int accel_flags, function cb, mixed user_data)`

    Description

      Installs an accelerator in this group.

    Method connect_by_path

      `GTK2.AccelGroup connect_by_path(string accel_path, function cb, mixed user_data)`

    Description

      Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers.

    Method create

      `GTK2.AccelGroup GTK2.AccelGroup()`

    Description

      Create a new accelerator group

    Method disconnect

      `GTK2.AccelGroup disconnect(int accel_key, int accel_mods)`

    Description

      Removes an accelerator previously installed.

    Method lock

      `GTK2.AccelGroup lock()`

    Description

      Locks the group.

    Method unlock

      `GTK2.AccelGroup unlock()`

    Description

      Undoes the last call to lock().

  CLASS GTK2.SourceTagTable

    Description

      Derived from GTK2.TextTagTable

      Signals: changed

    Inherit TextTagTable

      inherit GTK2.TextTagTable : TextTagTable

    Method add_tags

      `GTK2.SourceTagTable add_tags(array tags)`

    Description

      Adds a list of tags to the table. The added tags are assigned the highest priority in the table.

      If a tag is already present in the table or has the same name as an already added tag, then it is not added to the table.

    Method create

      `GTK2.SourceTagTable GTK2.SourceTagTable()`

    Description

      Creates a new table. The table contains no tags be default.

    Method remove_source_tags

      `GTK2.SourceTagTable remove_source_tags()`

    Description

      Removes all source tags from the table. This will remove the table's reference to the tags, so be careful - tags will end up destroyed if you don't have a reference to them.

  CLASS GTK2.Arrow

    Description

      An arrow pointing in one of four directions. The 'etched' shadow types does not work. `GTK2.Arrow(GTK2.ARROW_UP, GTK2.SHADOW_OUT)`

      `GTK2.Arrow(GTK2.ARROW_LEFT, GTK2.SHADOW_IN)`

      `GTK2.Arrow(GTK2.ARROW_RIGHT, GTK2.SHADOW_IN)`

      `GTK2.Arrow(GTK2.ARROW_DOWN, GTK2.SHADOW_OUT)`

      Properties: int arrow-type ARROW_DOWN , ARROW_LEFT , ARROW_RIGHT and ARROW_UP int shadow-type SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Inherit Misc

      inherit GTK2.Misc : Misc

    Method create

      `GTK2.Arrow GTK2.Arrow(int|mapping arrow_type_or_props, int|void shadow_type)`

    Description

      First argument is one of ARROW_DOWN , ARROW_LEFT , ARROW_RIGHT and ARROW_UP , second one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT .

    Method set

      `GTK2.Arrow set(int arrow_type, int shadow_type)`

    Description

      First argument is one of ARROW_DOWN , ARROW_LEFT , ARROW_RIGHT and ARROW_UP , second one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT .

  CLASS GTK2.TreePath

    Description

      TreePath.

    Method append_index

      `GTK2.TreePath append_index(int index)`

    Description

      Appends a new index to path. As a result, the depth of the path is increased.

    Method compare

      `int compare(GTK2.TreePath b)`

    Description

      Compares two paths. If this path appears before b, -1 is returned. If b before this path, 1 is return. If they are equal, 0 is returned.

    Method copy

      `GTK2.TreePath copy()`

    Description

      Creates a new GTK2.TreePath as a copy.

    Method create

      `GTK2.TreePath GTK2.TreePath(string|void path)`

    Description

      Creates a new GTK2.TreePath.

    Method down

      `GTK2.TreePath down()`

    Description

      Moves path to point to the first child of the current path.

    Method get_depth

      `int get_depth()`

    Description

      Returns the current depth of path.

    Method get_indices

      `array get_indices()`

    Description

      Returns the current indices of path as an array of integers, each representing a node in a tree.

    Method is_ancestor

      `int is_ancestor(GTK2.TreePath descendant)`

    Description

      Returns TRUE if descendant is a descendant of this path.

    Method is_descendant

      `int is_descendant(GTK2.TreePath ancestor)`

    Description

      Returns TRUE if this path is a descendant of ancestor.

    Method next

      `GTK2.TreePath next()`

    Description

      Moves the path to point to the next node at the current depth.

    Method prepend_index

      `GTK2.TreePath prepend_index(int index)`

    Description

      Prepends a new index to a path. As a result, the depth of the path is increased.

    Method prev

      `GTK2.TreePath prev()`

    Description

      Moves the path to point to the previous node at the current depth, if it exists. Returns TRUE if the move was made.

    Method to_string

      `string to_string()`

    Description

      Generates a string representation of the path. This string is a ':' separated list of numbers. For example, "4:10:0:3" would be an acceptable return value for this string.

    Method up

      `GTK2.TreePath up()`

    Description

      Moves the path to point to its parent node, if it has a parent.

  CLASS GTK2.FileChooserWidget

    Description

      File chooser widget that can be embedded in other widgets. `GTK2.FileChooserWidget(GTK2.FILE_CHOOSER_ACTION_OPEN);`

    Inherit Vbox

      inherit GTK2.Vbox : Vbox

    Inherit FileChooser

      inherit GTK2.FileChooser : FileChooser

    Method create

      `GTK2.FileChooserWidget GTK2.FileChooserWidget(int|mapping action_or_props)`

    Description

      Create a new file chooser widget. action is one of FILE_CHOOSER_ACTION_CREATE_FOLDER , FILE_CHOOSER_ACTION_OPEN , FILE_CHOOSER_ACTION_SAVE and FILE_CHOOSER_ACTION_SELECT_FOLDER

  CLASS GTK2.Separator

    Description

      A generic separator. Basicaly a line, like &lt;hr&gt; in HTML.

    Inherit Widget

      inherit GTK2.Widget : Widget

  CLASS GTK2.RadioAction

    Description

      Properties GTK2.RadioAction group int value

      Signals: changed

    Inherit ToggleAction

      inherit GTK2.ToggleAction : ToggleAction

    Method create

      `GTK2.RadioAction GTK2.RadioAction(string|mapping name_or_props, string|void label, string|void tooltip, string|void stock_id, int|void value)`

    Description

      Creates a new GTK2.ToggleAction object.

    Method get_current_value

      `int get_current_value()`

    Description

      Obtains the value property of the currently active member.

    Method get_group

      `array get_group()`

    Description

      Returns the list representing the radio group.

    Method set_group

      `GTK2.RadioAction set_group(GTK2.RadioAction member)`

    Description

      Sets the radio group.

  CLASS GTK2.EntryCompletion

    Description

      Properties: int inline-completion int minimum-key-length GTK2.TreeModel model int popup-completion int popup-single-match int text-column

      Signals: action_activated

      insert_prefix

      match_selected

    Inherit Object

      inherit G.Object : Object

    Inherit CellLayout

      inherit GTK2.CellLayout : CellLayout

    Method complete

      `GTK2.EntryCompletion complete()`

    Description

      Requests a completion operation, or in other words a refiltering of the current list with completions, using the current key. The completion list view will be updated accordingly.

    Method create

      `GTK2.EntryCompletion GTK2.EntryCompletion(mapping|void props)`

    Description

      Creates a new widget.

    Method delete_action

      `GTK2.EntryCompletion delete_action(int index)`

    Description

      Deletes the action at index.

    Method get_entry

      `GTK2.Widget get_entry()`

    Description

      Gets the entry this widget has been attached to.

    Method get_inline_completion

      `int get_inline_completion()`

    Description

      Returns whether the common prefix of the possible completions should be automatically inserted in the entry.

    Method get_minimum_key_length

      `int get_minimum_key_length()`

    Description

      Returns the minimum key length.

    Method get_model

      `GTK2.TreeModel get_model()`

    Description

      Returns the model being used as the data source.

    Method get_popup_completion

      `int get_popup_completion()`

    Description

      Returns whether completions should be presented in a popup window.

    Method get_popup_set_width

      `int get_popup_set_width()`

    Description

      Returns whether the completion popup window will be resized to the width of the entry.

    Method get_popup_single_match

      `int get_popup_single_match()`

    Description

      Returns whether the completion popup window will appear even if there is only a single match.

    Method get_text_column

      `int get_text_column()`

    Description

      Returns the column in the model to get strings from.

    Method insert_action_markup

      `GTK2.EntryCompletion insert_action_markup(int index, string markup)`

    Description

      Inserts an action in the action item list at position index with the specified markup.

    Method insert_action_text

      `GTK2.EntryCompletion insert_action_text(int index, string text)`

    Description

      Inserts an action in the action item list at position index with the specified text. If you want the action item to have markup, use insert_action_markup().

    Method insert_prefix

      `GTK2.EntryCompletion insert_prefix()`

    Description

      Requests a prefix insertion.

    Method set_inline_completion

      `GTK2.EntryCompletion set_inline_completion(int inline_completion)`

    Description

      Sets whether the common prefix of the possible completions should be automatically inserted in the entry.

    Method set_minimum_key_length

      `GTK2.EntryCompletion set_minimum_key_length(int length)`

    Description

      Requires the length of the search key to be at least length long. This is useful for long lists, where completing using a small key takes a lot of time and will come up with meaningless results anyway (i.e. a too large dataset).

    Method set_model

      `GTK2.EntryCompletion set_model(GTK2.TreeModel model)`

    Description

      Sets the model. If this completion already has a model set, it will remove it before setting the new model. If omitted it will unset the model.

    Method set_popup_completion

      `GTK2.EntryCompletion set_popup_completion(int setting)`

    Description

      Sets whether the completions should be presented in a popup window.

    Method set_popup_set_width

      `GTK2.EntryCompletion set_popup_set_width(int setting)`

    Description

      Sets whether the completion popup window will be resized to be the same width as the entry.

    Method set_popup_single_match

      `GTK2.EntryCompletion set_popup_single_match(int setting)`

    Description

      Sets whether the completion popup window will appear even if there is only a single match. You may want to set this to 0 if you are using inline completion.

    Method set_text_column

      `GTK2.EntryCompletion set_text_column(int column)`

    Description

      Convenience function for setting up the most used case of this code: a completion list with just strings. This function will set up the completion to have a list displaying all (and just) strings in the list, and to get those strings from column column in the model.

  CLASS GTK2.SourceIter

    Inherit TextIter

      inherit GTK2.TextIter : TextIter

    Method backward_search

      `array backward_search(string str, int flags, GTK2.TextIter limit)`

    Description

      Same as GTK2.TextIter->backward_search(), but supports case insensitive searching.

    Method find_matching_bracket

      `int find_matching_bracket()`

    Description

      Tries to match the bracket character currently at this iter with its opening/closing counterpart, and if found moves iter to the position where it was found.

    Method forward_search

      `array forward_search(string str, int flags, GTK2.TextIter limit)`

    Description

      Same as GTK2.TextIter->backward_search(), but supports case insensitive searching.

  CLASS GTK2.CellRendererCombo

    Description

      Properties: int has-entry GTK2.TreeModel model int text-column

    Inherit CellRendererText

      inherit GTK2.CellRendererText : CellRendererText

    Method create

      `GTK2.CellRendererCombo GTK2.CellRendererCombo(mapping|void props)`

    Description

      Creates a new W(CellRendererCombo).

  CLASS GTK2.ToggleToolButton

    Description

      A ToolItem containing a toggle button.

      Signals: toggled

    Inherit ToolButton

      inherit GTK2.ToolButton : ToolButton

    Method create

      `GTK2.ToggleToolButton GTK2.ToggleToolButton(string|mapping stock_id)`

    Description

      Creates a new toggle tool button, with or without a stock id.

    Method get_active

      `int get_active()`

    Description

      Returns the status of the toggle tool button, true if it is pressed in and false if it isn't.

    Method set_active

      `GTK2.ToggleToolButton set_active(int is_active)`

    Description

      Sets the status of the toggle tool button. Set to true if you want the button to be pressed in, and false to raise it. This causes the toggled signal to be emitted.

  CLASS GTK2.HbuttonBox

    Description

      A HbuttonBox is very similar to a Hbox. The major diffference is that the button box is made to pack buttons in, and has a few convenience function for normal button layouts.

      `GTK2.HbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_size_request(400,30)`

      `GTK2.HbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_SPREAD)->set_size_request(400,30)`

      `GTK2.HbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_EDGE)->set_size_request(400,30)`

      `GTK2.HbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_START)->set_size_request(400,30)`

      `GTK2.HbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_END)->set_size_request(400,30)`

    Inherit ButtonBox

      inherit GTK2.ButtonBox : ButtonBox

    Method create

      `GTK2.HbuttonBox GTK2.HbuttonBox(mapping|void props)`

    Description

      Create a new horizontal button box

  CLASS GTK2.ComboBox

    Description

      Properties: int active int add-tearoffs int column-span-column int focus-on-click int has-frame GTK2.TreeModel model int row-span-column int wrap-width

      Style properties: int appears-as-list

      Signals: changed

    Inherit Bin

      inherit GTK2.Bin : Bin

    Inherit CellLayout

      inherit GTK2.CellLayout : CellLayout

    Inherit CellEditable

      inherit GTK2.CellEditable : CellEditable

    Method append_text

      `GTK2.ComboBox append_text(string text)`

    Description

      Appends text to the list of strings stored in this combo box. Note that you can only use this function with combo boxes constructed with GTK2.ComboBox("a string").

    Method create

      `GTK2.ComboBox GTK2.ComboBox(GTK2.TreeModel model_or_props)`

    Description

      Create a new ComboBox, either empty or with a model. If a string is passed int instead, it will create a new W(ComboBox) with only text strings. If you do so, you should only manipulate it with the following functions: append_text(), insert_text(), prepend_text(), and remove_text().

    Method get_active

      `int get_active()`

    Description

      Returns the index of the currently active item, or -1 if none. If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this function returns path_get_indices(path)[0], where path is the GTK2.TreePath of the active item.

    Method get_active_iter

      `GTK2.TreeIter get_active_iter()`

    Description

      Get the current active item.

    Method get_active_text

      `string get_active_text()`

    Description

      Returns the currently active string. Note that you can only use this function with combo boxes constructed with GTK2.ComboBox("a string").

    Method get_add_tearoffs

      `int get_add_tearoffs()`

    Description

      Gets whether the popup menu has tearoff items.

    Method get_column_span_column

      `int get_column_span_column()`

    Description

      Returns the column with column span information.

    Method get_focus_on_click

      `int get_focus_on_click()`

    Description

      Returns whether the combo box grabs focus when it is clicked with the mouse.

    Method get_model

      `GTK2.TreeModel get_model()`

    Description

      Get the GTK2.TreeModel which is acting as a data source.

    Method get_row_span_column

      `int get_row_span_column()`

    Description

      Returns the column with row span information.

    Method get_wrap_width

      `int get_wrap_width()`

    Description

      Returns the wrap width which is used to determine the number of columns for the popup menu. If the wrap width is larger than 1, the combo box is in table mode.

    Method insert_text

      `GTK2.ComboBox insert_text(int position, string text)`

    Description

      Inserts string at position in the list of strings stored. Note that you can only use this function with combo boxes constructed with GTK2.ComboBox("a string").

    Method popdown

      `GTK2.ComboBox popdown()`

    Description

      Hides the menu or dropdown list.

    Method popup

      `GTK2.ComboBox popup()`

    Description

      Pops up the menu or dropdown list.

    Method prepend_text

      `GTK2.ComboBox prepend_text(string text)`

    Description

      Prepends string to the list of strings stored in this combo box. Note that you can only use this function with combo boxes constructed with GTK2.ComboBox("a string").

    Method remove_text

      `GTK2.ComboBox remove_text(int position)`

    Description

      Removes the string at position from this combo box. Note that you can only use this function with combo boxes constructed with GTK2.ComboBox("a string").

    Method set_active

      `GTK2.ComboBox set_active(int index_)`

    Description

      Sets the active item.

    Method set_active_iter

      `GTK2.ComboBox set_active_iter(GTK2.TreeIter iter)`

    Description

      Sets the current active item to be the one referenced by iter. iter must correspond to a path of depth one.

    Method set_add_tearoffs

      `GTK2.ComboBox set_add_tearoffs(int setting)`

    Description

      Sets whether the popup menu should have a tearoff menu item.

    Method set_column_span_column

      `GTK2.ComboBox set_column_span_column(int column_span)`

    Description

      Sets the column span information. The column span column contains integers which indicate how many columns an item should span.

    Method set_focus_on_click

      `GTK2.ComboBox set_focus_on_click(int setting)`

    Description

      Sets whether the combo box will grab focus when it is clicked with the mouse.

    Method set_model

      `GTK2.ComboBox set_model(GTK2.TreeModel model)`

    Description

      Sets the model used by this widget. Will unset a previously set model. If no arguments are passed, then it will unset the model.

    Method set_row_separator_func

      `GTK2.ComboBox set_row_separator_func(function f, mixed user_data)`

    Description

      Sets the row separator function, which is used to determine whether a row should be drawn as a separator. If the row separator function is 0 no separators are drawn. This is the default value.

    Method set_row_span_column

      `GTK2.ComboBox set_row_span_column(int row_span)`

    Description

      Sets the column with row span information. The row span column contains integers which indicate how many rows an item should span.

    Method set_wrap_width

      `GTK2.ComboBox set_wrap_width(int width)`

    Description

      Sets the wrap width. The wrap width is basically the preferred number of columns when you want the popup to be layed out in a table.

  CLASS GTK2.GdkImage

    Description

      A gdk (low level) image. Mainly used for W(Image) objects.

      NOIMG

    Inherit Object

      inherit G.Object : Object

    Method create

      `GDK2.Image GTK2.GdkImage(int|void fast_mode, Image.Image|void image)`

    Description

      Create a new GDK2.Image object. The first argument is either 0, which indicates that you want a 'slow' image. If you use '1', you indicate that you want a 'fast' image. Fast images are stored in shared memory, and thus are not sent over any network. But please limit your usage of fast images, they use up a possibly limited system resource set. See the man page for shmget(2) for more information on the limits on shared segments on your system.

      A 'fast' image will automatically revert back to 'slow' mode if no shared memory is available.

      If the second argument is specified, it is the actual image data.

    Method get_pixel

      `int get_pixel(int x, int y)`

    Description

      Get the pixel value of a pixel as a X-pixel value. It is usualy not very easy to convert this value to a rgb triple. See get_pnm.

    Method get_pnm

      `string get_pnm()`

    Description

      Returns the data in the image as a pnm object. Currently, this is always a P6 (true color raw) image. This could change in the future. To get a pike image object do 'Image.PNM.decode( gdkimage->get_pnm() )'

    Method grab

      `GDK2.Image grab(GTK2.Widget widget, int xoffset, int yoffset, int width, int height)`

    Description

      Call this function to grab a portion of a widget (argument 1) to the image. Grabbing non-toplevel widgets may produce unexpected results. To get the size of a widget use -&gt;xsize() and -&gt;ysize(). To get the offset of the upper left corner of the widget, relative to it's X-window (this is what you want for the offset arguments), use -&gt;xoffset() and -&gt;yoffset().

    Method set

      `GDK2.Image set(Image.Image|int image_or_xsize, int|void ysize)`

    Description

      Call this to set this image to either the contents of a pike image or a blank image of a specified size.

    Method set_pixel

      `GDK2.Image set_pixel(int x, int y, int pixel)`

    Description

      Set the pixel value of a pixel. Please note that the pixel argument is a X-pixel value, which is not easily gotten from a RGB color. See get_pixel and set.

  CLASS GTK2.ColorButton

    Description

      Properties: int alpha GDK2.Color color string title int use-alpha

      Signals: color_set When a user selects a color.

    Inherit Button

      inherit GTK2.Button : Button

    Method create

      `GTK2.ColorButton GTK2.ColorButton(GTK2.GdkColor red_or_props, int|void green, int|void blue)`

    Description

      Create a new W(ColorButton).

    Method get_alpha

      `int get_alpha()`

    Description

      Get the current alpha value.

    Method get_color

      `GTK2.GdkColor get_color()`

    Description

      Returns the current color.

    Method get_title

      `string get_title()`

    Description

      Get the title.

    Method get_use_alpha

      `int get_use_alpha()`

    Description

      Gets whether the color button uses the alpha channel.

    Method set_alpha

      `GTK2.ColorButton set_alpha(int alpha)`

    Description

      Sets the current opacity to alpha.

    Method set_color

      `GTK2.ColorButton set_color(int|GdkColor red, int|void green, int|void blue)`

    Description

      Sets the current color.

    Method set_title

      `GTK2.ColorButton set_title(string title)`

    Description

      Sets the title for the color selection dialog.

    Method set_use_alpha

      `GTK2.ColorButton set_use_alpha(int use_alpha)`

    Description

      Sets whether or not the color button should use the alpha channel.

  CLASS GTK2.Image

    Description

      An image is a image object stored in client, not X server, memory. A pixmap, on the other hand, is a image object stored in the X-server. See GDK2.Image and GDK2.Pixmap.

      `GTK2.Image("tornado_nguyen_big.jpg");`

      Properties: string file string icon-name icon-set int icon-size GDK2.Image image GDK2.Pixmap mask GDK2.Pixbuf pixbuf GDK2.PixbufAnimation pixbuf-animation int pixel-size GDK2.Pixmap pixmap string stock int storage-type IMAGE_ANIMATION , IMAGE_EMPTY , IMAGE_ICON_NAME , IMAGE_ICON_SET , IMAGE_IMAGE , IMAGE_PIXBUF , IMAGE_PIXMAP and IMAGE_STOCK

    Inherit Misc

      inherit GTK2.Misc : Misc

    Method clear

      `GTK2.Image clear()`

    Description

      Resets the image to be empty.

    Method create

      `GTK2.Image GTK2.Image(string|GdkPixbuf|GdkPixbufAnimation|GdkImage|GdkPixmap|mapping file_or_props, GTK2.GdkBitmap mask_or_size)`

    Description

      Create a new W(Image) from either a file or a GDK2.Pixbuf.

    Method get_animation

      `GTK2.GdkPixbufAnimation get_animation()`

    Description

      Gets the GDK2.PixbufAnimation being displayed.

    Method get_icon_name

      `mapping get_icon_name()`

    Description

      Gets the icon name and size.

    Method get_image

      `mapping get_image()`

    Description

      Returns ([ "image":GDK2.Image img, "mask":GDK2.Bitmap mask ])

    Method get_pixbuf

      `GTK2.GdkPixbuf get_pixbuf()`

    Description

      Gets the GDK2.Pixbuf being displayed. The storage type of the image must be GTK2.IMAGE_EMPTY or GTK2.IMAGE_PIXBUF).

    Method get_pixel_size

      `int get_pixel_size()`

    Description

      Gets the pixel size used for named icons.

    Method get_pixmap

      `mapping get_pixmap()`

    Description

      Gets the pixmap and mask.

    Method get_stock

      `mapping get_stock()`

    Description

      Gets the stock icon name and size.

    Method get_storage_type

      `int get_storage_type()`

    Description

      Gets the type of representation being used to store data. If it has no image data, the return value will be GTK2.IMAGE_EMPTY. One of IMAGE_ANIMATION , IMAGE_EMPTY , IMAGE_ICON_NAME , IMAGE_ICON_SET , IMAGE_IMAGE , IMAGE_PIXBUF , IMAGE_PIXMAP and IMAGE_STOCK

    Method set_from_animation

      `GTK2.Image set_from_animation(GTK2.GdkPixbufAnimation anim)`

    Description

      Causes the W(Image) to display the given animation.

    Method set_from_file

      `GTK2.Image set_from_file(string filename)`

    Description

      Set the image from a file.

    Method set_from_icon_name

      `GTK2.Image set_from_icon_name(string icon_name, int size)`

    Description

      Sets from an icon name.

    Method set_from_icon_set

      `GTK2.Image set_from_icon_set(GTK2.IconSet icon_set, int size)`

    Description

      Set this image from an icon set.

    Method set_from_image

      `GTK2.Image set_from_image(GTK2.GdkImage gdk_image, GTK2.GdkBitmap mask)`

    Description

      Set this image from a GDK2.Image plus optional mask.

    Method set_from_pixbuf

      `GTK2.Image set_from_pixbuf(GTK2.GdkPixbuf pixbuf)`

    Description

      Set image from a pixbuf

    Method set_from_pixmap

      `GTK2.Image set_from_pixmap(GTK2.GdkPixmap pixmap, GTK2.GdkBitmap mask)`

    Description

      Set this image from a GDK2.Pixmap plus optional mask.

    Method set_from_stock

      `GTK2.Image set_from_stock(string stock_id, int size)`

    Description

      Sets from a stock icon. Sample icon names are GTK2.STOCK_OPEN, GTK2.STOCK_EXIT. Sample stock sizes are GTK2.ICON_SIZE_MENU, GTK2.ICON_SIZE_SMALL_TOOLBAR. If the stock name isn't known, the image will be empty.

    Method set_pixel_size

      `GTK2.Image set_pixel_size(int pixel_size)`

    Description

      Sets the pixel size to use for named icons. If the pixel size is set to a value != -1, it is used instead of the icon size set by set_from_icon_name().

  CLASS GTK2.TextAttributes

    Description

      Holds text attributes.

    Method copy

      `GTK2.TextAttributes copy()`

    Description

      Copies src and returns it.

    Method copy_values

      `GTK2.TextAttributes copy_values(GTK2.TextAttributes dest)`

    Description

      Copies src onto dest

    Method create

      `GTK2.TextAttributes GTK2.TextAttributes()`

    Description

      Create a W(TextAttributes) widget.

  CLASS GTK2.AspectFrame

    Description

      A W(Frame) widget that always maintain a specified ratio between width and height. width/height == ratio

      `GTK2.AspectFrame("Title",0.5,0.5,0.4,0)->add( GTK2.Label("Wrong aspect"))->set_size_request(200,200)`

      Properties: int obey-child float ratio float xalign float yalign

    Inherit Frame

      inherit GTK2.Frame : Frame

    Method create

      `GTK2.AspectFrame GTK2.AspectFrame(mapping|string label, float|void xalign, float|void yalign, float|void ratio, int|void obey_child)`

    Description

      Create a new frame. Arguments are label, xalign, yalign, ratio, obey_child xalign is floats between 0 and 1, 0.0 is upper (or leftmost), 1.0 is lower (or rightmost). If 'obey_child' is true, the frame will use the aspect ratio of it's (one and only) child widget instead of 'ratio'.

    Method set

      `GTK2.AspectFrame set(float xalign, float yalign, float ratio, int obey_child)`

    Description

      Set the aspec values. Arguments are xalign, yalign, ratio, obey_child xalign is floats between 0 and 1, 0.0 is upper (or leftmost), 1.0 is lower (or rightmost). If 'obey_child' is true, the frame will use the aspect ratio of it's (one and only) child widget instead of 'ratio'.

  CLASS GTK2.GdkColormap

    Description

      A colormap is an object that contains the mapping between the color values stored in memory and the RGB values that are used to display color values. In general, colormaps only contain significant information for pseudo-color visuals, but even for other visual types, a colormap object is required in some circumstances.

    Method alloc_color

      `int alloc_color(GTK2.GdkColor color, int writeable, int best_match)`

    Description

      Alocates a single color from a colormap.

    Method alloc_colors

      `int alloc_colors(array colors, int writeable, int best_match)`

    Description

      Allocates colors from a colormap.

    Method create

      `GDK2.Colormap GTK2.GdkColormap(GTK2.GdkVisual visual, int|void allocate, int|void system)`

    Description

      Creates a new colormap.

    Method free_colors

      `GDK2.Colormap free_colors(array colors)`

    Description

      Free colors.

    Method get_screen

      `GTK2.GdkScreen get_screen()`

    Description

      Returns the screen.

    Method get_visual

      `GTK2.GdkVisual get_visual()`

    Description

      Returns the visual.

    Method query_color

      `GTK2.GdkColor query_color(int pixel)`

    Description

      Locates the RGB color corresponding to the given hardware pixel. pixel must be a valid pixel in the colormap; it's a programmer error to call this function with a pixel which is not in the colormap. Hardware pixels are normally obtained from alloc_colors(), or from a GDK2.Image.

  CLASS GTK2.Notebook

    Description

      The NoteBook Widget is a collection of 'pages' that overlap each other, each page contains different information. This widget has become more common lately in GUI programming, and it is a good way to show blocks similar information that warrant separation in their display.

      `GTK2.Notebook()->set_tab_pos(GTK2.POS_LEFT)->append_page(GTK2.Label("Page 1\nContents"),GTK2.Label("Page 1"))->append_page(GTK2.Label(""),GTK2.Label("Page 2"))->append_page(GTK2.Label("Page 3 contents\nare here!"),GTK2.Label("Page 3"))`

      `GTK2.Notebook()->set_tab_pos(GTK2.POS_TOP)->append_page(GTK2.Label("Page 1\nContents"),GTK2.Label("Page 1"))->append_page(GTK2.Label(""),GTK2.Label("Page 2"))->append_page(GTK2.Label("Page 3 contents\nare here!"),GTK2.Label("Page 3"))`

      `GTK2.Notebook()->set_tab_pos(GTK2.POS_RIGHT)->append_page(GTK2.Label("Page 1\nContents"),GTK2.Label("Page 1"))->append_page(GTK2.Label(""),GTK2.Label("Page 2"))->append_page(GTK2.Label("Page 3 contents\nare here!"),GTK2.Label("Page 3"))->next_page()->next_page()`

      Properties: int enable-popup int homogeneous int page int scrollable int show-border int show-tabs int tab-border int tab-hborder int tab-pos int tab-vborder

      Child properties: string menu-label int position int tab-expand int tab-fill string tab-label int tab-pack

      Style properties: int has-backward-stepper int has-forward-stepper int has-secondary-backward-stepper int has-secondary-forward-stepper

      Signals: change_current_page

      focus_tab

      move_focus_out

      select_page

      switch_page Called when a different page is selected

    Inherit Container

      inherit GTK2.Container : Container

    Method append_page

      `GTK2.Notebook append_page(GTK2.Widget contents, GTK2.Widget label)`

    Description

      Add a new 'page' to the notebook. The first argument is the contents of the page, the second argument is the label.

    Method append_page_menu

      `GTK2.Notebook append_page_menu(GTK2.Widget contents, GTK2.Widget label, GTK2.Widget menu)`

    Description

      Add a new 'page' to the notebook. The first argument is the contents of the page, the second argument is the label, the third argument is a menu label widget.

    Method create

      `GTK2.Notebook GTK2.Notebook(mapping|void props)`

    Description

      Create a W(Notebook) widget with no pages.

    Method get_current_page

      `int get_current_page()`

    Description

      Returns the index of the currently selected page

    Method get_menu_label

      `GTK2.Widget get_menu_label(GTK2.Widget page)`

    Description

      Return the menu label widget.

    Method get_menu_label_text

      `string get_menu_label_text(GTK2.Widget child)`

    Description

      Retrieves the text of the menu label for the page containing child.

    Method get_n_pages

      `int get_n_pages()`

    Description

      Get the number of pages.

    Method get_nth_page

      `GTK2.Widget get_nth_page(int index)`

    Description

      Returns the page for the specified index

    Method get_scrollable

      `int get_scrollable()`

    Description

      Returns whether the tab label area has arrows for scrolling.

    Method get_show_border

      `int get_show_border()`

    Description

      Returns whether a bevel will be drawn around the pages.

    Method get_show_tabs

      `int get_show_tabs()`

    Description

      Returns whether the tabs of the notebook are shown.

    Method get_tab_label

      `GTK2.Widget get_tab_label(GTK2.Widget page)`

    Description

      Returns the tab label widget.

    Method get_tab_label_text

      `string get_tab_label_text(GTK2.Widget child)`

    Description

      Retrieves the text of the tab label for the page containing child.

    Method get_tab_pos

      `int get_tab_pos()`

    Description

      Gets the edge at which the tabs are located.

    Method insert_page

      `GTK2.Notebook insert_page(GTK2.Widget contents, GTK2.Widget label, int pos)`

    Description

      Insert a page at the specified location, arguments as for append_page, but an aditional integer specifies the location.

    Method insert_page_menu

      `GTK2.Notebook insert_page_menu(GTK2.Widget contents, GTK2.Widget label, GTK2.Widget menu, int pos)`

    Description

      Insert a page at the specified location, arguments as for append_page_menu, but an additional integer specifies the location.

    Method next_page

      `GTK2.Notebook next_page()`

    Description

      Go to the next page

    Method page_num

      `int page_num(GTK2.Widget widget)`

    Description

      Returns the index for the specified page.

    Method popup_disable

      `GTK2.Notebook popup_disable()`

    Description

      Disable the popup menu (set with insert_page_menu).

    Method popup_enable

      `GTK2.Notebook popup_enable()`

    Description

      Enable the popup menu (set with insert_page_menu).

    Method prepend_page

      `GTK2.Notebook prepend_page(GTK2.Widget contents, GTK2.Widget label)`

    Description

      Add a page at the end of the list of pages. The first argument is the contents of the page, the second argument is the label.

    Method prepend_page_menu

      `GTK2.Notebook prepend_page_menu(GTK2.Widget contents, GTK2.Widget label, GTK2.Widget menu)`

    Description

      Add a new 'page' at the end of the list of pages. The first argument is the contents of the page, the second argument is the label, the third argument is a menu label widget.

    Method prev_page

      `GTK2.Notebook prev_page()`

    Description

      Go to the previous page

    Method query_tab_label_packing

      `mapping query_tab_label_packing(GTK2.Widget page)`

    Description

      Returns ([ "expand":expandp, "fill":fillp, "pack_type":type ])

    Method remove_page

      `GTK2.Notebook remove_page(int pos)`

    Description

      Remove a page.

    Method reorder_child

      `GTK2.Notebook reorder_child(GTK2.Widget child, int position)`

    Description

      Reorders the page containing child, so that it appears at position.

    Method set_current_page

      `GTK2.Notebook set_current_page(int pos)`

    Description

      Go to the specified page

    Method set_menu_label

      `GTK2.Notebook set_menu_label(GTK2.Widget child, GTK2.Widget label)`

    Description

      Changes the menu label for the page containing child.

    Method set_menu_label_text

      `GTK2.Notebook set_menu_label_text(GTK2.Widget child, string label_text)`

    Description

      Creates a new label with label_text sets it as the menu label.

    Method set_scrollable

      `GTK2.Notebook set_scrollable(int scrollablep)`

    Description

      If true, add scrollbars if necessary.

    Method set_show_border

      `GTK2.Notebook set_show_border(int showborderp)`

    Description

      If true, show the borders around the contents and tabs.

    Method set_show_tabs

      `GTK2.Notebook set_show_tabs(int showtabsp)`

    Description

      If supplied with a true value, the tabs will be shown. Otherwise they will not be shown. The user will not be able to select the pages without them, but you can add 'next' and 'previous' buttons to create a wizard-line interface.

    Method set_tab_label

      `GTK2.Notebook set_tab_label(GTK2.Widget child, GTK2.Widget label)`

    Description

      Changes the tab label for child.

    Method set_tab_label_packing

      `GTK2.Notebook set_tab_label_packing(GTK2.Widget child, int expand, int fill, int type)`

    Description

      Sets the packing parameters for the tab label of the page child.

    Method set_tab_label_text

      `GTK2.Notebook set_tab_label_text(GTK2.Widget child, string title)`

    Description

      Creates a new label and sets it as the tab label for the page containing child.

    Method set_tab_pos

      `GTK2.Notebook set_tab_pos(int pos)`

    Description

      Sets the edge at which the tabs for switching pages in the notebook are drawn. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

  CLASS GTK2.Layout

    Description

      Properties: GTK2.Adjustment hadjustment int height GTK2.Adjustment vadjustment int width

      Child properties: int x int y

      Signals: set_scroll_adjustments

    Inherit Container

      inherit GTK2.Container : Container

    Method create

      `GTK2.Layout GTK2.Layout(GTK2.Adjustment hadjustment_or_props, GTK2.Adjustment vadjustment)`

    Description

      Creates a new GTK2.Layout.

    Method get_hadjustment

      `GTK2.Adjustment get_hadjustment()`

    Description

      Gets the GTK2.Adjustment used for communicaiton between the horizontal scrollbar and this layout. This should only be called after the layout has been placed in a GTK2.ScrolledWindow or otherwise configured for scrolling.

    Method get_vadjustment

      `GTK2.Adjustment get_vadjustment()`

    Description

      Gets the vertical GTK2.Adjustment.

    Method move

      `GTK2.Layout move(GTK2.Widget widget, int x, int y)`

    Description

      Moves a current child to a new position.

    Method put

      `GTK2.Layout put(GTK2.Widget widget, int x, int y)`

    Description

      Adds widget to the layout at position (x,y). The layout becomes the new parent.

    Method set_hadjustment

      `GTK2.Layout set_hadjustment(GTK2.Adjustment adj)`

    Description

      Sets the horizontal scroll adjustment for the layout.

    Method set_size

      `GTK2.Layout set_size(int xsize, int ysize)`

    Description

      Sets the size of the scrollable area of the layout.

    Method set_vadjustment

      `GTK2.Layout set_vadjustment(GTK2.Adjustment adj)`

    Description

      Sets the vertical scroll adjustment for the layout.

  CLASS GTK2.ColorSelection

    Description

      The color selection widget is, not surprisingly, a widget for interactive selection of colors. This composite widget lets the user select a color by manipulating RGB (Red, Green, Blue) and HSV (Hue, Saturation, Value) triples. This is done either by adjusting single values with sliders or entries, or by picking the desired color from a hue-saturation wheel/value bar. Optionally, the opacity of the color can also be set.

      The color selection widget currently emits only one signal, "color_changed", which is emitted whenever the current color in the widget changes, either when the user changes it or if it's set explicitly through set_color().

      `GTK2.ColorSelection()`

      Properties: int current-alpha GDK2.Color current-color int has-opacity-control int has-palette

      Signals: color_changed

    Inherit Vbox

      inherit GTK2.Vbox : Vbox

    Method create

      `GTK2.ColorSelection GTK2.ColorSelection(mapping|void props)`

    Description

      Create a new color selection.

    Method get_current_alpha

      `int get_current_alpha()`

    Description

      Returns the current alpha value.

    Method get_current_color

      `mapping get_current_color()`

    Description

      When you need to query the current color, typically when you've received a "color_changed" signal, you use this function. The return value is an array of floats, See the set_color() function for the description of this array.

    Method get_has_opacity_control

      `int get_has_opacity_control()`

    Description

      Determines whether the colorsel has an opacity control.

    Method get_has_palette

      `int get_has_palette()`

    Description

      Determines whether the color selector has a color palette.

    Method get_previous_alpha

      `int get_previous_alpha()`

    Description

      Returns the previous alpha value.

    Method get_previous_color

      `mapping get_previous_color()`

    Description

      Returns the original color value.

    Method is_adjusting

      `int is_adjusting()`

    Description

      Gets the current state of the colorsel.

    Method set_current_alpha

      `GTK2.ColorSelection set_current_alpha(int alpha)`

    Description

      Sets the current opacity to be alpha. The first time this is called, it will also set the original opacity to be alpha too.

    Method set_current_color

      `GTK2.ColorSelection set_current_color(mapping color)`

    Description

      You can set the current color explicitly by calling this function with an array of colors (floats). The length of the array depends on whether opacity is enabled or not. Position 0 contains the red component, 1 is green, 2 is blue and opacity is at position 3 (only if opacity is enabled, see set_opacity()) All values are between 0 and 65535

    Method set_has_opacity_control

      `GTK2.ColorSelection set_has_opacity_control(int setting)`

    Description

      Sets whether or not to use opacity.

    Method set_has_palette

      `GTK2.ColorSelection set_has_palette(int has_palette)`

    Description

      Shows and hides the palette based upon the value of has_palette

    Method set_previous_alpha

      `GTK2.ColorSelection set_previous_alpha(int alpha)`

    Description

      Sets the 'previous' alpha to be alpha. This function should be called with some hesitation, as it might seem confusing to have that alpha change.

    Method set_previous_color

      `GTK2.ColorSelection set_previous_color(mapping colors)`

    Description

      Sets the 'previous' color to be color.

  CLASS GTK2.FontSelectionDialog

    Description

      The GtkFontSelectionDialog widget is a dialog box for selecting a font.

      To set the font which is initially selected, use set_font_name().

      To get the selected font use get_font_name().

      To change the text which is shown in the preview area, use set_preview_text().

      `GTK2.FontSelectionDialog("Select a font")`

    Inherit Dialog

      inherit GTK2.Dialog : Dialog

    Method create

      `GTK2.FontSelectionDialog GTK2.FontSelectionDialog(string title)`

    Description

      Create a new font selection dialog with the specified window title

    Method get_apply_button

      `GTK2.Button get_apply_button()`

    Description

      The apply button

    Method get_cancel_button

      `GTK2.Button get_cancel_button()`

    Description

      The cancel button

    Method get_font_name

      `string get_font_name()`

    Description

      Gets the currently-selected font name.

    Method get_ok_button

      `GTK2.Button get_ok_button()`

    Description

      The ok button

    Method get_preview_text

      `string get_preview_text()`

    Description

      Gets the text displayed in the preview area.

    Method set_font_name

      `int set_font_name(string font)`

    Description

      Sets the currently-selected font.

    Method set_preview_text

      `GTK2.FontSelectionDialog set_preview_text(string text)`

    Description

      Sets the text displayed in the preview area.

  CLASS GTK2.Style

    Description

      Style settings.

      Signals: realize

      unrealize

    Inherit Object

      inherit G.Object : Object

    Method attach

      `GTK2.Style attach(GTK2.Widget window)`

    Description

      Attaches a style to a window; this process allocates the colors and creates the GC's for the style - it specializes it to a particular visual and colormap. The process may involve the creation of a new style if the style has already been attached to a window with a different style and colormap.

    Method copy

      `GTK2.Style copy()`

    Description

      Copy a style.

    Method create

      `GTK2.Style GTK2.Style()`

    Description

      Creates a new style.

    Method detach

      `GTK2.Style detach()`

    Description

      Detach a style.

    Method lookup_icon_set

      `GTK2.IconSet lookup_icon_set(string stock_id)`

    Description

      Lookup the icon set.

    Method paint_arrow

      `GTK2.Style paint_arrow(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int arrow, int fill, int x, int y, int width, int height)`

    Description

      Draws an arrow in the given rectangle on window using the given parameters. arrow determines the direction of the arrow.

    Method paint_box

      `GTK2.Style paint_box(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a box on window with the given parameters.

    Method paint_box_gap

      `GTK2.Style paint_box_gap(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height, int gap_side, int gap_x, int gap_width)`

    Description

      Draws a box in window using the given style and state and shadow type, leaving a gap in one side.

    Method paint_check

      `GTK2.Style paint_check(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a check button indicator in the given rectangle on window.

    Method paint_diamond

      `GTK2.Style paint_diamond(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a diamond in the given rectangle on window.

    Method paint_expander

      `GTK2.Style paint_expander(GTK2.Widget window, int state, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int style)`

    Description

      Draws an expander as used in GTK2.TreeView. x and y specify the center of the expander. The size of the expander is determined by the "expander-size" style property of widget. (If widget is 0 or doesn't have an "expander-size" property, an unspecified default size will be used, since the caller doesn't have sufficient information to position the expander, this is likely not useful.) The expander is expander_size pixels tall in the collapsed position and expander_size pixels wide in the expanded position.

    Method paint_extension

      `GTK2.Style paint_extension(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height, int gap_side)`

    Description

      Draws an extension, i.e. a notebook tab.

    Method paint_flat_box

      `GTK2.Style paint_flat_box(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a flat box on window.

    Method paint_focus

      `GTK2.Style paint_focus(GTK2.Widget window, int state, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a focus indicator around the given rectangle.

    Method paint_handle

      `GTK2.Style paint_handle(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height, int orientation)`

    Description

      Draws a handle as used in GTK2.HandleBox and GTK2.Paned.

    Method paint_hline

      `GTK2.Style paint_hline(GTK2.Widget window, int state, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x1, int x2, int y)`

    Description

      Draws a horizontal line from (x1,y) to (x2,y).

    Method paint_layout

      `GTK2.Style paint_layout(GTK2.Widget window, int state, int use_text, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, GTK2.Pango.Layout layout)`

    Description

      Draw a pango layout. Use widget->create_pango_layout() to get a Pango.Layout.

    Method paint_option

      `GTK2.Style paint_option(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a radio button indicator in the given rectangle.

    Method paint_resize_grip

      `GTK2.Style paint_resize_grip(GTK2.Widget window, int state, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int edge, int x, int y, int width, int height)`

    Description

      Draws a resize grip in the given rectangle.

    Method paint_shadow

      `GTK2.Style paint_shadow(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws a shadow around the given rectangle.

    Method paint_shadow_gap

      `GTK2.Style paint_shadow_gap(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height, int gap_side, int gap_x, int gap_width)`

    Description

      Draws a shadow around the given rectangle in window, leaving a gap in one side.

    Method paint_slider

      `GTK2.Style paint_slider(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height, int orientation)`

    Description

      Paint a slider.

    Method paint_tab

      `GTK2.Style paint_tab(GTK2.Widget window, int state, int shadow, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int x, int y, int width, int height)`

    Description

      Draws an option menu tab (i.e. the up and down pointing arrows).

    Method paint_vline

      `GTK2.Style paint_vline(GTK2.Widget window, int state, GTK2.GdkRectangle rect, GTK2.Widget widget, string detail, int y1, int y2, int x)`

    Description

      Draws a vertical line from (x,y1) to (x,y2).

    Method render_icon

      `GTK2.GdkPixbuf render_icon(GTK2.IconSource source, int direction, int state, int size, GTK2.Widget widget, string detail)`

    Description

      Renders the icon specified by source at the given size according to the given parameters and returns the result in a pixbuf.

    Method set_background

      `GTK2.Style set_background(GTK2.Widget window, int state)`

    Description

      Sets the background of window to the background color or pixmap specified by style for the given state.

  CLASS GTK2.Hpaned

    Description

      The paned window widgets are useful when you want to divide an area into two parts, with the relative size of the two parts controlled by the user. A groove is drawn between the two portions with a handle that the user can drag to change the ratio. This widgets makes a horizontal division

      See W(Paned) for details.

      `GTK2.Hpaned()->add1(GTK2.Label("Left\nSide\nOf\nPane"))->add2(GTK2.Label("Right\nSide\nOf\nPane"))->set_size_request(100,100)`

    Inherit Paned

      inherit GTK2.Paned : Paned

    Method create

      `GTK2.Hpaned GTK2.Hpaned(mapping|void props)`

    Description

      Create a new W(Hpaned) widget.

  CLASS GTK2.Progress

    Description

      Properties: int activity-mode int show-text float text-xalign float text-yalign

    Inherit Widget

      inherit GTK2.Widget : Widget

  CLASS GTK2.ColorSelectionDialog

    Description

      Color Selection Dialog

    Inherit Dialog

      inherit GTK2.Dialog : Dialog

    Method create

      `GTK2.ColorSelectionDialog GTK2.ColorSelectionDialog(string|mapping title_or_props)`

    Description

      Create a new Color Selection Dialog

    Method get_cancel_button

      `GTK2.Widget get_cancel_button()`

    Description

      The Cancel button.

    Method get_colorsel

      `GTK2.Widget get_colorsel()`

    Description

      The Color Selection widget contained within the dialog

    Method get_help_button

      `GTK2.Widget get_help_button()`

    Description

      The Help button.

    Method get_ok_button

      `GTK2.Widget get_ok_button()`

    Description

      The OK button.

  CLASS GTK2.TreeSortable

    Description

      The interface for sortable models used by TreeView.

      Signals: sort_column_changed

    Method get_sort_column_id

      `mapping get_sort_column_id()`

    Description

      Returns ([ "column": int, "order": int ])

    Method has_default_sort_func

      `int has_default_sort_func()`

    Description

      Returns true if the model has a default sort function.

    Method set_default_sort_func

      `GTK2.TreeSortable set_default_sort_func(function f, mixed user_data)`

    Description

      Sets the default comparison function used when sorting to be f. If the current sort column id of this sortable is GTK2.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function.

      if f is 0, then there will be no default comparison function. This means once the model has been sorted, it can't go back to the default state. In this case, when the current sort column id of this sortable is GTK2.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.

    Method set_sort_column_id

      `GTK2.TreeSortable set_sort_column_id(int column, int order)`

    Description

      Sets the current sort column to be column. The widget will resort itself to reflect this change, after emitting a "sort-column-changed" signal. If column is GTK2.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the default sort function will be used, if it is set.

    Method set_sort_func

      `GTK2.TreeSortable set_sort_func(int column, function f, mixed user_data)`

    Description

      Sets the comparison function used when sorting to be f. If the current sort column id of this sortable is the same as column, then the model will sort using this function.

    Method sort_column_changed

      `GTK2.TreeSortable sort_column_changed()`

    Description

      Emits a "sort-column-changed" signal

  CLASS GTK2.FontButton

    Description

      Properties: string font-name int show-size int show-style string title int use-font int use-size

      Signals: font_set

    Inherit Button

      inherit GTK2.Button : Button

    Method create

      `GTK2.FontButton GTK2.FontButton(string|mapping font_or_props)`

    Description

      Create a new font picker widget. If font is specified, it will be displayed in the font selection dialog.

    Method get_font_name

      `string get_font_name()`

    Description

      Retrieves the name of the currently selected font.

    Method get_show_size

      `int get_show_size()`

    Description

      Returns whether the font size will be shown in the label.

    Method get_show_style

      `int get_show_style()`

    Description

      Returns whether the name of the font style will be shown in the label.

    Method get_title

      `string get_title()`

    Description

      Retrieves the title of the font selection dialog.

    Method get_use_font

      `int get_use_font()`

    Description

      Returns whether the selected font is used in the label.

    Method get_use_size

      `int get_use_size()`

    Description

      Returns whether the selected size is used in the label.

    Method set_font_name

      `int set_font_name(string font)`

    Description

      Sets or updates the currently-displayed font.

    Method set_show_size

      `GTK2.FontButton set_show_size(int setting)`

    Description

      If setting is true, the font size will be displayed along with the name of the selected of the selected font.

    Method set_show_style

      `GTK2.FontButton set_show_style(int setting)`

    Description

      If setting is true, the font style will be displayed along with the name of the selected font.

    Method set_title

      `GTK2.FontButton set_title(string title)`

    Description

      Sets the title for the font selection dialog.

    Method set_use_font

      `GTK2.FontButton set_use_font(int setting)`

    Description

      If setting is true, the font name will be written using the selected font.

    Method set_use_size

      `GTK2.FontButton set_use_size(int setting)`

    Description

      If setting is true, the font name will be written using the selected size.

  CLASS GTK2.WindowGroup

    Description

      Limit the effect of grabs.

    Inherit Object

      inherit G.Object : Object

    Method add_window

      `GTK2.WindowGroup add_window(GTK2.Window window)`

    Description

      Add a window.

    Method create

      `GTK2.WindowGroup GTK2.WindowGroup()`

    Description

      Creates a new GTK2.WindowGroup object. Grabs added with GTK2.grab_add() only affect windows with the same GTK2.WindowGroup.

    Method remove_window

      `GTK2.WindowGroup remove_window(GTK2.Window window)`

    Description

      Remove a window.

  CLASS GTK2.Range

    Description

      The category of range widgets includes the ubiquitous scrollbar widget and the less common "scale" widget. Though these two types of widgets are generally used for different purposes, they are quite similar in function and implementation. All range widgets share a set of common graphic elements, each of which has its own X window and receives events. They all contain a "trough" and a "slider" (what is sometimes called a "thumbwheel" in other GUI environments). Dragging the slider with the pointer moves it back and forth within the trough, while clicking in the trough advances the slider towards the location of the click, either completely, or by a designated amount, depending on which mouse button is used.

      As mentioned in the W(Adjustment) page, all range widgets are associated with an adjustment object, from which they calculate the length of the slider and its position within the trough. When the user manipulates the slider, the range widget will change the value of the adjustment.

      All of the GTK range widgets react to mouse clicks in more or less the same way. Clicking button-1 in the trough will cause its adjustment's page_increment to be added or subtracted from its value, and the slider to be moved accordingly. Clicking mouse button-2 in the trough will jump the slider to the point at which the button was clicked. Clicking any button on a scrollbar's arrows will cause its adjustment's value to change step_increment at a time.

      It may take a little while to get used to, but by default, scrollbars as well as scale widgets can take the keyboard focus in GTK. If you think your users will find this too confusing, you can always disable this by unsetting the GTK2.CanFocus flag on the scrollbar, like this:

      `scrollbar->unset_flag(GTK2.CanFocus);`

      The key bindings (which are, of course, only active when the widget has focus) are slightly different between horizontal and vertical range widgets, for obvious reasons. They are also not quite the same for scale widgets as they are for scrollbars, for somewhat less obvious reasons (possibly to avoid confusion between the keys for horizontal and vertical scrollbars in scrolled windows, where both operate on the same area).

      Properties: GTK2.Adjustment adjustment int inverted int update-policy

      Style properties: int arrow-displacement-x int arrow-displacement-y int slider-width int stepper-size int stepper-spacing int trough-border

      Signals: adjust_bounds

      change_value

      move_slider

      value_changed

    Inherit Widget

      inherit GTK2.Widget : Widget

    Method get_adjustment

      `GTK2.Adjustment get_adjustment()`

    Description

      Gets the W(Adjustment) which is the "model" object for W(Range).

    Method get_inverted

      `int get_inverted()`

    Description

      Gets the value set by set_inverted().

    Method get_update_policy

      `int get_update_policy()`

    Description

      Gets the update policy.

    Method get_value

      `float get_value()`

    Description

      Gets the current value.

    Method set_adjustment

      `GTK2.Range set_adjustment(GTK2.Adjustment pos)`

    Description

      set_adjustment() does absolutely nothing if you pass it the adjustment that range is already using, regardless of whether you changed any of its fields or not. If you pass it a new Adjustment, it will unreference the old one if it exists (possibly destroying it), connect the appropriate signals to the new one, and call the private function gtk_range_adjustment_changed(), which will (or at least, is supposed to...) recalculate the size and/or position of the slider and redraw if necessary.

    Method set_increments

      `GTK2.Range set_increments(float step, float page)`

    Description

      Sets the step and page sizes. The step size is used when the user clicks the W(Scrollbar) arrows or moves W(Scale) via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

    Method set_inverted

      `GTK2.Range set_inverted(int setting)`

    Description

      Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right. Inverted ranges have higher values at the top or on the right rather than on the bottom or left.

    Method set_range

      `GTK2.Range set_range(float min, float max)`

    Description

      Sets the allowable values, and clamps the range value to be between min and max.

    Method set_update_policy

      `GTK2.Range set_update_policy(int when)`

    Description

      The "update policy" of a range widget defines at what points during user interaction it will change the value field of its Adjustment and emit the "value_changed" signal on this Adjustment. The update policies are:

      GTK2.UpdatePolicyContinuous

        This is the default. The "value_changed" signal is emitted continuously, i.e., whenever the slider is moved by even the tiniest amount.

      GTK2.UpdatePolicyDiscontinuous

        The "value_changed" signal is only emitted once the slider has stopped moving and the user has released the mouse button.

      GTK2.UpdatePolicyDelayed

        The "value_changed" signal is emitted when the user releases the mouse button, or if the slider stops moving for a short period of time.

    Method set_value

      `GTK2.Range set_value(float value)`

    Description

      Sets the current value; if the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The range emits the "value-changed" signal if the value changes.

  CLASS GTK2.TextIter

    Description

      A TextIter.

    Method backward_char

      `int backward_char()`

    Description

      Moves backward by one character offset. Returns true if the movement was possible; if it was the first in the buffer (character offset 0), backward_char() returns false for convenience when writing loops.

    Method backward_chars

      `int backward_chars(int count)`

    Description

      Moves count characters backward, if possible (if count would mmove past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the iterator moved onto a dereferenceable position; if it didn't move, or moved onto the end iterator, then false is returned. If count is 0, the function does nothing and returns false.

    Method backward_cursor_position

      `int backward_cursor_position()`

    Description

      Like forward_cursor_position(), but moves backward.

    Method backward_cursor_positions

      `int backward_cursor_positions(int count)`

    Description

      Moves up to count cursor positions.

    Method backward_line

      `int backward_line()`

    Description

      Moves to the start of the previous line. Returns true if this iter could be moved; i.e. if iter was at character offset 0, this function returns false. Therefore if it was already on line 0, but not at the start of the line, it is snapped to the start of the line and the function returns true. (Note that this implies that in a loop calling this function, the line number may not change on every iteration, if your first iteration is on line 0.)

    Method backward_lines

      `int backward_lines(int count)`

    Description

      Moves count lines backward.

    Method backward_search

      `array backward_search(string str, int flags, GTK2.TextIter limit)`

    Description

      Same as forward_search(), but searches backward.

    Method backward_sentence_start

      `int backward_sentence_start()`

    Description

      Moves backward to the previous sentence start.

    Method backward_sentence_starts

      `int backward_sentence_starts(int count)`

    Description

      Call backward_sentence_start() count times.

    Method backward_to_tag_toggle

      `int backward_to_tag_toggle(GTK2.TextTag tag)`

    Description

      Moves backward to the next toggle. See forward_to_tag_toggle().

    Method backward_visible_cursor_position

      `int backward_visible_cursor_position()`

    Description

      Moves backward to the previous visible cursor position.

    Method backward_visible_cursor_positions

      `int backward_visible_cursor_positions(int count)`

    Description

      Moves up to count visible cursor positions.

    Method backward_visible_line

      `int backward_visible_line()`

    Description

      Moves to the start of the previous visible line. Returns TRUE if iter could be moved; i.e. if iter was at character offset 0, this function returns FALSE. Therefore if iter was alreayd on line 0, but not at the start of the line, iter is snapped to the start of the line and the function returns TRUE. (Note that this implies that in a loop calling this function, the line number may not change on every iteration, if your first iteration is on line 0).

    Method backward_visible_lines

      `int backward_visible_lines(int count)`

    Description

      Moves count visible lines backward, if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the iterator moved onto a dereferenceable position; if the iterator didn't move, or moved onto the end iterator, then FALSE is returned. If count is 0, the function does nothing and returns FALSE. If count is negative, moves forward by 0 - count lines.

    Method backward_visible_word_start

      `int backward_visible_word_start()`

    Description

      Moves backward to the previous visible word start.

    Method backward_visible_word_starts

      `int backward_visible_word_starts(int count)`

    Description

      Call backward_visible_word_start() count times

    Method backward_word_start

      `int backward_word_start()`

    Description

      Moves backward to the previous word start.

    Method backward_word_starts

      `int backward_word_starts(int count)`

    Description

      Calls backward_word_start() up to count times.

    Method begins_tag

      `int begins_tag(GTK2.TextTag tag)`

    Description

      Returns true if tag is toggled on at exactly this point. If tag is omitted, returns true if any tag is toggled on at this point. Note that begins_tag() returns true if this iter is the start of the tagged range; has_tag() tells you whether an iterator is within a tagged range.

    Method can_insert

      `int can_insert(int default_editability)`

    Description

      Considering the default editability of the buffer, and tags that affect editability, determines whether text inserted here would be editabled. If text inserted here would be editabled then the user should be allowed to insert text here. insert_interactive() uses this function to decide whether insertions are allowed at a given position.

    Method compare

      `int compare(GTK2.TextIter rhs)`

    Description

      Returns -1 if this iterator is less than rhs, 1 if greater than, and 0 if they're equal. Ordering is in character offset order, i.e. the first character in the buffer is less than the second character in the buffer.

    Method editable

      `int editable(int default_setting)`

    Description

      Returns whether the character at this location is within an editable region of text. Non-editable text is "locked" and can't be changed by the user via W(TextView). This function is simply a convenience wrapper around get_attributes(). If no tags applied to this text editability, default_setting will be returned.

      You don't want to use this function to decide whether text can be inserted here, because for insertion you don't want to know whether the char at iter is inside an editable range, you want to know whether a new characer inserted here would be inside an editable range. Use can_insert() to handle this case.

    Method ends_line

      `int ends_line()`

    Description

      Returns true if iter points to the start of the paragraph delimiter characters for a line (delimiters will be either a newline, a carriage return, a carriage return followed by a newline, or a Unicode paragraph separator character). Note that an iterator pointing to the \n of a \r\n pair will not be counted as the end of a line, the line ends before the \r. The end iterator is considered to be at the end of a line, even though there are no paragraph delimiter chars there.

    Method ends_sentence

      `int ends_sentence()`

    Description

      Determines whether this iter ends a sentence.

    Method ends_tag

      `int ends_tag(GTK2.TextTag tag)`

    Description

      Returns true if tag is toggled off at exactly this point. If tag is omitted, returns true if any tag is toggled off at this point. Not that ends_tag() returns true if this iter it at the end of the tagged range; has_tag() tells you whether an iterator is within a tagged range.

    Method ends_word

      `int ends_word()`

    Description

      Determines whether this iter ends a natural-language word. Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).

    Method equal

      `int equal(GTK2.TextIter rhs)`

    Description

      Tests whether two iterators are equal, using the fastest possible mechanism. This function is very fast; you can expect it to perform better than e.g. getting the character offset for each iterator and comparing offsets yourself. Also, it's a bit faster than compare().

    Method forward_char

      `int forward_char()`

    Description

      Moves this iterator forward by one character offset. Note that images embedded in the buffer occopy 1 character slot, to forward_char() may actually move onto an image instead of a character, if you have images in your buffer. If this iterator is the end iterator or one character before it, it will now point at the end iterator, and forward_char() returns false for convenience when writing loops.

    Method forward_chars

      `int forward_chars(int count)`

    Description

      Moves count characters if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the new position is different from its original position, and dereferenceable (the last iterator in the buffer is not). If count is 0, the function does nothing and returns false.

    Method forward_cursor_position

      `int forward_cursor_position()`

    Description

      Moves this iterator forward by a single cursor position. Cursor positions are (unsurprisingly) positions where the cursor can appear. Perhaps surprisingly, there may not be a cursor position between all characters. The most common example for European languages would be a carriage return/newline sequence. For some Unicode characters, the equivalent of say the letter "a" with an accent mark will be represented as two characters, first the letter then a "combining mark" that causes the accent to be rendered; so the cursor can't go between those two characters. See also Pango.LogAttr and pango_break().

    Method forward_cursor_positions

      `int forward_cursor_positions(int count)`

    Description

      Moves up to count cursor positions.

    Method forward_line

      `int forward_line()`

    Description

      Moves to the start of the next line. Returns true if there was a next line to move to, and false if this iter was simply moved to the end of the buffer and is now not dereferenceable, or if it was already at the end of the buffer.

    Method forward_lines

      `int forward_lines(int count)`

    Description

      Moves count lines forward, if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the iterator moved onto a dereferenceable position; if the iterator didn't move, or moved onto the end iterator, then false is returned. If count is 0, the function does nothing and returns false. If count is negative, moves backward by 0 - count lines.

    Method forward_search

      `array forward_search(string str, int flags, GTK2.TextIter limit)`

    Description

      Searches forward for str. Returns two GTK2.TextIter objects, one pointing to the first character of the match, and the second pointing to the first character after the match. The search will not continue past limit. Note that a search is a linear or O(n) operation, so you may wish to use limit to avoid locking up your UI on large buffers.

      If the GTK2.TEXT_SEARCH_VISIBLE_ONLY flag is present, the match may have invisible text interspersed in str, i.e. str will be a possibly non-contiguous subsequence of the matched range. Similarly, if you specify GTK2.TEXT_SEARCH_TEXT_ONLY, the match may have pixbufs or child widgets mixed inside the matched range. If these flags are not given, the match must be exact; the special 0xFFFC character in str will match embedded pixbufs or child widgets.

    Method forward_sentence_end

      `int forward_sentence_end()`

    Description

      Moves forward to the next sentence end.

    Method forward_sentence_ends

      `int forward_sentence_ends(int count)`

    Description

      Call forward_sentence_ends() count times.

    Method forward_to_end

      `GTK2.TextIter forward_to_end()`

    Description

      Moves forward to the "end iterator", which points one past the last valid character in the buffer. get_char() called on the end iterator returns 0, which is convenient for writing loops.

    Method forward_to_line_end

      `int forward_to_line_end()`

    Description

      Moves the iterator to point to the paragraph delimiter characters, which will be either a newline, a carriage return, a carriage return/newline sequence, or the Unicode paragraph separator character. If the iterator is already at the paragraph delimiter characters, moves to the paragraph delimiter characters for the next line. If iter is on the last line in the buffer, which does not end in paragraph delimiters, moves to the end iterator (end of the last line), and returns false.

    Method forward_to_tag_toggle

      `int forward_to_tag_toggle(GTK2.TextTag tag)`

    Description

      Moves forward to the next toggle (on or off) of tag, or to the next toggle of any tag if tag is omitted. If no matching tag toggles are found, returns false, otherwise true. Does not return toggles located at this iter, only toggles after. Sets this iter to the location of the toggle, or to the end of the buffer if no toggle is found.

    Method forward_visible_cursor_position

      `int forward_visible_cursor_position()`

    Description

      Moves forward to the next visible cursor position.

    Method forward_visible_cursor_positions

      `int forward_visible_cursor_positions(int count)`

    Description

      Moves up to count visible cursor positions.

    Method forward_visible_line

      `int forward_visible_line()`

    Description

      Moves to the start of the next visible line. Returns TRUE if there was a next line to move to, and FALSE if iter was simply moved to the end of the buffer and is now not dereferenceable, or if iter was already at the end of the buffer.

    Method forward_visible_lines

      `int forward_visible_lines(int count)`

    Description

      Moves count visible lines forward, if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the iterator moved onto a dereferenceable position; if the iterator didn't move, or moved onto the end iterator, then FALSE is returned. If count is 0, the function does nothing and returns FALSE. If count is negative, moves backward by 0 - count lines.

    Method forward_visible_word_end

      `int forward_visible_word_end()`

    Description

      Moves forward to the next visible word end.

    Method forward_visible_word_ends

      `int forward_visible_word_ends(int count)`

    Description

      Call forward_visible_word_end() count times.

    Method forward_word_end

      `int forward_word_end()`

    Description

      Moves forward to the next word end.

    Method forward_word_ends

      `int forward_word_ends(int count)`

    Description

      Calls forward_word_end() up to count times.

    Method free

      `GTK2.TextIter free()`

    Description

      Free an iterator.

    Method get_buffer

      `GTK2.TextBuffer get_buffer()`

    Description

      Returns the W(TextBuffer) this iterator is associated with.

    Method get_bytes_in_line

      `int get_bytes_in_line()`

    Description

      Returns the number of bytes in the line, including the paragraph delimiters.

    Method get_char

      `int get_char()`

    Description

      Returns the Unicode character at this iterator. If the element at this iterator is a non-character element, such as an image embedded in the buffer, the Unicode "unknown" character 0xFFFc is returned.

    Method get_chars_in_line

      `int get_chars_in_line()`

    Description

      Returns the number of characters in the line, including the paragraph delimiters.

    Method get_child_anchor

      `GTK2.TextChildAnchor get_child_anchor()`

    Description

      If this location contains a child anchor, the anchor is returned.

    Method get_line

      `int get_line()`

    Description

      Returns the line number containing this iterator.

    Method get_line_index

      `int get_line_index()`

    Description

      Returns the byte index of the iterator, counting from the start of a newline-terminated line. Rember that W(TextBuffer) encodes text in UTF-8, and that characters can require a variable number of bytes to represent.

    Method get_line_offset

      `int get_line_offset()`

    Description

      Returns the character offset of the iterator, counting from the start of a newline-terminated line.

    Method get_marks

      `array get_marks()`

    Description

      Returns a list of W(TextMark) at this location. Because marks are not iterable (they don't take up any "space" in the buffer, they are just marks in between iterable locations), multiple marks can exist in the same place. The returned list is not in any meaningful order.

    Method get_offset

      `int get_offset()`

    Description

      Returns the character offset of an iterator.

    Method get_pixbuf

      `GTK2.GdkPixbuf get_pixbuf()`

    Description

      If the element at iter is a pixbuf, it is returned.

    Method get_slice

      `string get_slice(GTK2.TextIter end)`

    Description

      Returns the text in the given range. A "slice" is an array of characters encoded in UTF-8 foramt, including the Unicode "unknown" character 0xFFFC for iterable non-character elements in the buffer, such as images. Because images are encoded in the slice, byte and character offsets in the returned array will correspond to bytes offsets in the text buffer. Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer.

    Method get_tags

      `array get_tags()`

    Description

      Returns a list of tags that apply to iter, in ascending order of priority (highest-priority tags are last).

    Method get_text

      `string get_text(GTK2.TextIter end)`

    Description

      Returns text in the given range. If the range contains non-text elements such as images, the character and byte offsets in the returned string will not correspond to character and bytes offsets in the buffer.

    Method get_toggled_tags

      `array get_toggled_tags(int toggled_on)`

    Description

      Returns a list of W(TextTag) that are toggled on or off at this point. (If toggled_on is true, the list contains tags that are toggled on). If a tag is toggled on at this iterator, then some non-empty range of characters following this iter has that tag applied to it. If a tag is toggled off, then some non-empty range following this iter does not have the tag applied to it.

    Method get_visible_line_index

      `int get_visible_line_index()`

    Description

      Returns the number of bytes from the start of the line to this iter, not counting bytes that are invisible due to tags with the invisible flag toggled on.

    Method get_visible_line_offset

      `int get_visible_line_offset()`

    Description

      Returns the offset in characters from the start of the line, not not counting characters that are invisible due to tags with the invisible tag toggled on.

    Method get_visible_slice

      `string get_visible_slice(GTK2.TextIter end)`

    Description

      Like get_slice(), but invisible text is not included.

    Method get_visible_text

      `string get_visible_text(GTK2.TextIter end)`

    Description

      Like get_text(), but invisible text is not include.

    Method has_tag

      `int has_tag(GTK2.TextTag tag)`

    Description

      Returns true if this iterator is within a range tagged with tag.

    Method in_range

      `int in_range(GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Checks whether this iterator falls in the range [start,end). start and end must be in ascending order.

    Method inside_sentence

      `int inside_sentence()`

    Description

      Determines whether this is inside a sentence (as opposed to int between two sentences, e.g. after a period and before the first letter of the next sentence). Sentence boundaries are determined by Pango and should be correct for nearly language (if not, the correct fix would be to the Pango text boundary algorithms).

    Method inside_word

      `int inside_word()`

    Description

      Determines whether this iter is inside a natural-language word ass opposed to say inside some whitespace).

    Method is_cursor_position

      `int is_cursor_position()`

    Description

      See forward_cursor_position() or Pango.LangAttr or pango_break() for details on what a cursor position is.

    Method is_end

      `int is_end()`

    Description

      Returns true if this location is the end iterator, i.e. one past the last dereferenceable iterator in the buffer. is_end() is the most efficient way to check whether an iterator is the end iterator.

    Method is_start

      `int is_start()`

    Description

      Returns true if this is the first iterator in the buffer, that is if it has a character offset of 0.

    Method order

      `GTK2.TextIter order(GTK2.TextIter second)`

    Description

      Swaps this iter for second if second comes first in the buffer. That is, ensures that this iterator and second are in sequence. Most text buffer functions that take a range call this automatically on your behalf, so there's no real reason to call it yourself in those cases. There are some exceptions, such as in_range(), that expect a pre-sorted range.

    Method set_line

      `GTK2.TextIter set_line(int line_number)`

    Description

      Moves the iterator to the start of the line line_number. If line_number is negative or larger than the number of lines in the buffer, moves to the start of the last line in the buffer.

    Method set_line_index

      `GTK2.TextIter set_line_index(int index)`

    Description

      Same as set_line_offset(), but works with a byte index. The given byte index must be at the start of a character, it can't be in the middle of a UTF-8 encoded character.

    Method set_line_offset

      `GTK2.TextIter set_line_offset(int offset)`

    Description

      Moves iterator within a line, to a new character (not byte) offset. The given character offset must be less than or equal to the number of characters in the line; if equal, iterator moves to the start of the next line. See set_line_index() if you have a byte index rather than a character offset.

    Method set_offset

      `GTK2.TextIter set_offset(int char_offset)`

    Description

      Sets to point to char_offset. char_offset counts from the start of the entire text buffer, starting with 0.

    Method set_visible_line_index

      `GTK2.TextIter set_visible_line_index(int index)`

    Description

      Same as set_line_index(), but works with visible byte index. The given byte index must be at the start of a character, it can't be in the middle of a UTF-8 encoded character.

    Method set_visible_line_offset

      `GTK2.TextIter set_visible_line_offset(int offset)`

    Description

      Like set_line_offset(), but the offset is in visible characters, i.e. text with a tag making it invisible is not counted in the offset.

    Method starts_line

      `int starts_line()`

    Description

      Returns true if this iter begins a paragraph, i.e. if get_line_offset() would return 0. However this function is potentially more efficient than get_line_offset() because it doesn't have to computer the offset, it just has to see whether it's 0.

    Method starts_sentence

      `int starts_sentence()`

    Description

      Determines whether this iter begins a sentence.

    Method starts_word

      `int starts_word()`

    Description

      Determines whether this iter begins a natural-language word. Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).

    Method toggles_tag

      `int toggles_tag(GTK2.TextTag tag)`

    Description

      This is equivalent to begins_tag()||ends_tag(), i.e it tells you whether a range with tag applied to it beings or ends here.

  CLASS GTK2.Gnome2CanvasRichText

    Description

      Properties: int anchor int cursor-blink int cursor-visible int direction int editable int grow-height float height int indent int justification int left-margin int pixels-above-lines int pixels-below-lines int pixels-inside-wrap int right-margin string text int visible float width int wrap-mode float x float y

      Signals: tag_changed

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

    Method get_buffer

      `GTK2.TextBuffer get_buffer()`

    Description

      Get the text buffer.

    Method set_buffer

      `Gnome2.CanvasRichText set_buffer(GTK2.TextBuffer buffer)`

    Description

      Set the text buffer.

  CLASS GTK2.Gnome2App

    Description

      Toplevel GNOME applications would normally use one Gnome2.App widget as their toplevel window. You can create as many Gnome2.App widgets as you want, for example, some people use one GnomeApp per document their application loads.

      Once you have created one instance of this widget, you would add your main application view information to this window by using set_contents() routine.

      The GnomeApp has support for including a menubar, one or more toolbars and a statusbar for your application. It also takes care of intalling the accelerators for you when used in conjuction with the gnome-app-helper routines. The toolbars are inserted into Gnome2.Dock widgets.

      The gnome-app-helper module provides various helper routines to simplify the configuration of your menus and toolbars, but you can create those yourself and use the set_menus(), add_toolbar(), set_toolbar(), add_dock_item() and add_docked(). Properties: string app-id

    Inherit Window

      inherit GTK2.Window : Window

    Method add_docked

      `Gnome2.App add_docked(GTK2.Widget widget, string name, int behavior, int placement, int band_num, int band_position, int|void offset)`

    Description

      Create a new Gnome2.DockItem widget containing widget, and add it to app's dock with the specified layout information. Notice that, if automatic layout configuration is enabled, the layout is overridden by the saved configuration, if any.

      widget : Widget to be added to app's dock name : Name for the dock item that will contain toolbar behavior : Behavior for the new dock item. One of placement : Placement for the new dock item, one of Gnome2.DockTop, Gnome2.DockRight, Gnome2.DockBottom, Gnome2.DockLeft and Gnome2.DockFloating band_num : Number of the band where the dock item should be placed band_position : Position of the new dock item in band band_num offset : Offset from the previous dock item in the band; if there is no previous item, offset from the beginning of the band.

    Method add_toolbar

      `Gnome2.App add_toolbar(GTK2.Toolbar toolbar, string name, int behavior, int placement, int band_num, int band_position, int|void offset)`

    Description

      Create a new Gnome2.DockItem widget containing toolbar, and add it to app's dock with the specified layout information. Notice that, if automatic layout configuration is enabled, the layout is overridden by the saved configuration, if any.

      toolbar : Toolbar to be added to app's dock name : Name for the dock item that will contain toolbar behavior : Behavior for the new dock item. One or more of placement : Placement for the new dock item, one of Gnome2.DockTop, Gnome2.DockRight, Gnome2.DockBottom, Gnome2.DockLeft and Gnome2.DockFloating band_num : Number of the band where the dock item should be placed band_position : Position of the new dock item in band band_num offset : Offset from the previous dock item in the band; if there is no previous item, offset from the beginning of the band.

    Method create

      `Gnome2.App GTK2.Gnome2App(string appname, string|void title)`

    Description

      Create a new (empty) application window. You must specify the application's name (used internally as an identifier). title can be left as 0, in which case the window's title will not be set.

    Method enable_layout_config

      `Gnome2.App enable_layout_config(int enable)`

    Description

      Specify whether the the dock's layout configuration should be automatically saved via gnome-config whenever it changes, or not.

    Method set_contents

      `Gnome2.App set_contents(GTK2.Widget contents)`

    Description

      Sets the status bar of the application window.

    Method set_menus

      `Gnome2.App set_menus(GTK2.MenuBar menu_bar)`

    Description

      Sets the menu bar of the application window.

    Method set_statusbar

      `Gnome2.App set_statusbar(GTK2.Widget statusbar)`

    Description

      Sets the status bar of the application window.

    Method set_statusbar_custom

      `Gnome2.App set_statusbar_custom(GTK2.Widget container, GTK2.Widget statusbar)`

    Description

      Sets the status bar of the application window, but use container as its container.

    Method set_toolbar

      `Gnome2.App set_toolbar(GTK2.Toolbar toolbar)`

    Description

      Sets the main toolbar of the application window.

  CLASS GTK2.ToggleAction

    Description

      Properties int draw-as-radio

      Signals: toggled

    Inherit Action

      inherit GTK2.Action : Action

    Method create

      `GTK2.ToggleAction GTK2.ToggleAction(string|mapping name_or_props, string|void label, string|void tooltip, string|void stock_id)`

    Description

      Creates a new GTK2.ToggleAction object.

    Method get_active

      `int get_active()`

    Description

      Returns the checked state.

    Method get_draw_as_radio

      `int get_draw_as_radio()`

    Description

      Returns whether the action should have proxies like a radio action.

    Method set_active

      `GTK2.ToggleAction set_active(int setting)`

    Description

      Sets the checked state.

    Method set_draw_as_radio

      `GTK2.ToggleAction set_draw_as_radio(int setting)`

    Description

      Sets whether the action should have proxies like a radio action.

    Method toggled

      `GTK2.ToggleAction toggled()`

    Description

      Emits the "toggled" signal.

  CLASS GTK2.TearoffMenuItem

    Description

      A GTK2.TearoffMenuItem is a special W(MenuItem) which is used to tear off and reattach its menu.

      When its menu is shown normally, the GTK2.TearoffMenuItem is drawn as a dotted line indicating that the menu can be torn off. Activating it causes its menu to be torn off and displayed in its own window as a tearoff menu.

      When its menu is shown as a tearoff menu, the GTK2.TearoffMenuItem is drawn as a dotted line which has a left pointing arrow graphic indicating that the tearoff menu can be reattached. Activating it will erase the tearoff menu window. `GTK2.TearoffMenuItem()->set_size_request(100,0)`

    Inherit MenuItem

      inherit GTK2.MenuItem : MenuItem

    Method create

      `GTK2.TearoffMenuItem GTK2.TearoffMenuItem(mapping|void props)`

    Description

      Create a new tearoff menu item

  CLASS GTK2.GdkGC

    Description

      A GC, or Graphics Context, is used for most low-level drawing operations.

      As an example, the foreground color, background color, and drawing function is stored in the GC.

      NOIMG

    Inherit Object

      inherit G.Object : Object

    Method copy

      `GDK2.GC copy(GTK2.GdkGC source)`

    Description

      Copy all attributes from the source GC

    Method create

      `GDK2.GC GTK2.GdkGC(GTK2.Widget context, mapping|void attributes)`

    Description

      The argument is either a W(Widget) or a GDK2(Drawable) in which the gc will be valid.

    Method get_screen

      `GTK2.GdkScreen get_screen()`

    Description

      Gets the screen.

    Method get_values

      `mapping get_values()`

    Description

      Get all (or rather most) values from the GC. Even though GdkGCValues contains a GdkFont object, we won't return this value because GdkFont is deprecated. The Pango methods should be used instead.

    Method set_background

      `GDK2.GC set_background(GTK2.GdkColor color)`

    Description

      Set the background to the specified GDK2.Color.

    Method set_clip_mask

      `GDK2.GC set_clip_mask(GTK2.GdkBitmap mask)`

    Description

      Set the clip mask to the specified GDK2.Bitmap

    Method set_clip_origin

      `GDK2.GC set_clip_origin(int x, int y)`

    Description

      Set the clip mask origin to the specified point.

    Method set_clip_rectangle

      `GDK2.GC set_clip_rectangle(GTK2.GdkRectangle rect)`

    Description

      Sets the clip mask for a graphics context from a rectangle. The clip mask is interpreted relative to the clip origin.

    Method set_clip_region

      `GDK2.GC set_clip_region(GTK2.GdkRegion rect)`

    Description

      Sets the clip mask for a graphs context from a region. The clip mask is interpreted relative to the clip origin.

    Method set_dashes

      `GDK2.GC set_dashes(int offset, array dashes)`

    Description

      Sets the way dashed-lines are drawn. Lines will be drawn with alternating on and off segments of the lengths specified in dashes. The manner in which the on and off segments are drawn is determined by the line_style value of the GC.

    Method set_exposures

      `GDK2.GC set_exposures(int exp)`

    Description

      Sets whether copying non-visible portions of a drawable using this gc generates exposure events for the corresponding regions of the dest drawable.

    Method set_fill

      `GDK2.GC set_fill(int fill)`

    Description

      Set the fill method to fill.

    Method set_foreground

      `GDK2.GC set_foreground(GTK2.GdkColor color)`

    Description

      Set the foreground to the specified GDK2.Color.

    Method set_function

      `GDK2.GC set_function(int fun)`

    Description

      Set the function to the specified one. One of GDK2.Xor, GDK2.Invert and GDK2.Copy.

    Method set_line_attributes

      `GDK2.GC set_line_attributes(int line_width, int line_style, int cap_style, int join_style)`

    Description

      Control how lines are drawn. line_style is one of GDK2.LineSolid, GDK2,LineOnOffDash and GDK2.LineDoubleDash. cap_style is one of GDK2.CapNotLast, GDK2.CapButt, GDK2.CapRound and GDK2.CapProjecting. join_style is one of GDK2.JoinMiter, GDK2.JoinRound and GDK2.JoinBevel.

    Method set_stipple

      `GDK2.GC set_stipple(GTK2.GdkBitmap stipple)`

    Description

      Set the background type. Fill must be GDK_STIPPLED or GDK_OPAQUE_STIPPLED.

    Method set_subwindow

      `GDK2.GC set_subwindow(int draw_on_subwindows)`

    Description

      If set, anything drawn with this GC will draw on subwindows as well as the window in which the drawing is done.

    Method set_tile

      `GDK2.GC set_tile(GTK2.GdkPixmap tile)`

    Description

      Set the background type. Fill must be GDK_TILED

    Method set_ts_origin

      `GDK2.GC set_ts_origin(int x, int y)`

    Description

      Set the origin when using tiles or stipples with the GC. The tile or stipple will be aligned such that the upper left corner of the tile or stipple will coincide with this point.

  CLASS GTK2.ListStore

    Description

      A list-like data structure that can be used with W(TreeView).

    Inherit Object

      inherit G.Object : Object

    Inherit TreeModel

      inherit GTK2.TreeModel : TreeModel

    Inherit TreeSortable

      inherit GTK2.TreeSortable : TreeSortable

    Inherit TreeDragSource

      inherit GTK2.TreeDragSource : TreeDragSource

    Inherit TreeDragDest

      inherit GTK2.TreeDragDest : TreeDragDest

    Method append

      `GTK2.TreeIter append()`

    Description

      Append a new row.

    Method clear

      `GTK2.ListStore clear()`

    Description

      Removes all rows.

    Method create

      `GTK2.ListStore GTK2.ListStore(array types)`

    Description

      Create a new list store with as many columns as there are items in the array. A type is either a string representing a type name, such as "int" or "float", or an actual widget. If it is a widget, the column in question should be a widget of the same type that you would like this column to represent.

    Method insert

      `GTK2.TreeIter insert(int position)`

    Description

      Insert a row at position. If parent is valid, will create as child, otherwise at top level. If position is larger than then number of rows at that level, it will be added to the end of the list. iter will be changed to point to the new row.

    Method insert_after

      `GTK2.TreeIter insert_after(GTK2.TreeIter sibling)`

    Description

      Insert a new row after sibling. If sibling is 0, then the row will be prepended to parent's children. If parent and sibling are both 0, then the row will be prepended to the toplevel.

    Method insert_before

      `GTK2.TreeIter insert_before(GTK2.TreeIter sibling)`

    Description

      Insert a row before sibling. If sibling is 0, then the row will be appended to parent's children. If parent and sibling are 0, then the row will be appended to the toplevel.

    Method move_after

      `GTK2.ListStore move_after(GTK2.TreeIter iter, GTK2.TreeIter position)`

    Description

      Moves iter to after position. These should be at the same level. This only works if the store is unsorted. If position is omitted, iter will be moved to the start of the level.

    Method move_before

      `GTK2.ListStore move_before(GTK2.TreeIter iter, GTK2.TreeIter position)`

    Description

      Moves iter to before position. These should be at the same level. This only works if the store is unsorted. If position is omitted, iter will be moved to the end of the level.

    Method prepend

      `GTK2.TreeIter prepend()`

    Description

      Prepend a new row.

    Method remove

      `GTK2.ListStore remove(GTK2.TreeIter iter)`

    Description

      Remove iter. iter is set to the next valid row at that level, or invalidated if it was the last one.

    Method set_row

      `GTK2.ListStore set_row(GTK2.TreeIter iter, array values)`

    Description

      Set the data in an entire row.

    Method set_value

      `GTK2.ListStore set_value(GTK2.TreeIter iter, int column, mixed value)`

    Description

      Set the data in the cell specified by iter and column.

    Method swap

      `GTK2.ListStore swap(GTK2.TreeIter a, GTK2.TreeIter b)`

    Description

      Swap 2 rows. Only works if this store is unsorted.

  CLASS GTK2.Adjustment

    Description

      The GTK2.Adjustment object represents a value which has an associated lower and upper bound, together with step and page increments, and a page size. It is used within several GTK2+ widgets, including GtkSpinButton, GtkViewport, and GtkRange (which is a base class for GtkHScrollbar, GtkVScrollbar, GtkHScale, and GtkVScale).

      The GtkAdjustment object does not update the value itself. Instead it is left up to the owner of the GtkAdjustment to control the value.

      The owner of the GtkAdjustment typically calls the value_changed() and changed() functions after changing the value or its bounds. This results in the emission of the "value_changed" or "changed" signal respectively.

      Properties: float lower float page-increment float page-size float step-increment float upper float value

      Signals: changed The adjustment changed in some way

      value_changed The value changed

    Inherit Data

      inherit GTK2.Data : Data

    Method changed

      `GTK2.Adjustment changed()`

    Description

      Emites a "changed" signal.

    Method clamp_page

      `GTK2.Adjustment clamp_page(float lower, float upper)`

    Description

      Updates the W(Adjustment) value to ensure that the range between lower and upper is in the current page (i.e. between value and value+page_size). If the range is larger than the page size, then only the start of it will be in the current page. A "changed" signal will be emitted if the value is changed.

    Method create

      `GTK2.Adjustment GTK2.Adjustment(float|mapping value_or_props, float|void lower, float|void upper, float|void step_increment, float|void page_increment, float|void page_size)`

    Description

      The value argument is the initial value you want to give to the adjustment, usually corresponding to the topmost or leftmost position of an adjustable widget. The lower argument specifies the lowest value which the adjustment can hold. The step_increment argument specifies the "smaller" of the two increments by which the user can change the value, while the page_increment is the "larger" one. The page_size argument usually corresponds somehow to the visible area of a panning widget. The upper argument is used to represent the bottom most or right most coordinate in a panning widget's child. Therefore it is not always the largest number that value can take, since the page_size of such widgets is usually non-zero.

      All values are optional, they default to 0.0. For most widgets the unit is pixels.

    Method get_value

      `float get_value()`

    Description

      Gets the current value.

    Method set_value

      `GTK2.Adjustment set_value(float to)`

    Description

      Sets the value. The value is clamped to lie between lower and upper.

      Note that for adjustments which are used in a W(Scrollbar), the effective range of allowed values goes from lower to upper-page_size.

    Method value_changed

      `GTK2.Adjustment value_changed()`

    Description

      Emits a "value-changed" signal.

  CLASS GTK2.VbuttonBox

    Description

      A Vbutton_box is very similar to a Vbox. The major diffference is that the button box is made to pack buttons in, and has a few convenience function for normal button layouts.

      `GTK2.VbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_size_request(100,300)`

      `GTK2.VbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_SPREAD)->set_size_request(100,300)`

      `GTK2.VbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_EDGE)->set_size_request(100,300)`

      `GTK2.VbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_START)->set_size_request(100,300)`

      `GTK2.VbuttonBox()->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->set_layout(GTK2.BUTTONBOX_END)->set_size_request(100,300)`

    Inherit ButtonBox

      inherit GTK2.ButtonBox : ButtonBox

    Method create

      `GTK2.VbuttonBox GTK2.VbuttonBox(mapping|void props)`

    Description

      Create a new vertical button box

  CLASS GTK2.PatternTag

    Inherit SourceTag

      inherit GTK2.SourceTag : SourceTag

    Method create

      `GTK2.PatternTag GTK2.PatternTag(string id, string name, string pattern)`

    Description

      Creates a new pattern tag object with the provided arguments.

  CLASS GTK2.GdkDragContext

    Description

      The drag context contains all information about the drag'n'drop connected to the signal to which it is an argument.

      NOIMG

    Method drag_abort

      `GDK2.DragContext drag_abort(int time)`

    Description

      Abort the drag

    Method drag_drop

      `GDK2.DragContext drag_drop(int time)`

    Description

      Drag drop.

    Method drag_finish

      `GDK2.DragContext drag_finish(int success, int del)`

    Description

      If success is true, the drag succeded. If del is true, the source should be deleted. time is the current time.

    Method drag_set_icon_default

      `GDK2.DragContext drag_set_icon_default()`

    Description

      Use the default drag icon associated with the source widget.

    Method drag_set_icon_pixmap

      `GDK2.DragContext drag_set_icon_pixmap(GTK2.GdkPixmap p, GTK2.GdkBitmap b, int hot_x, int hot_y)`

    Description

      Set the drag pixmap, and optionally mask. The hot_x and hot_y coordinates will be the location of the mouse pointer, relative to the upper left corner of the pixmap.

    Method drag_set_icon_widget

      `GDK2.DragContext drag_set_icon_widget(GTK2.Widget widget, int hot_x, int hot_y)`

    Description

      Set the drag widget. This is a widget that will be shown, and then dragged around by the user during this drag.

    Method drag_status

      `GDK2.DragContext drag_status(int action)`

    Description

      Setting action to -1 means use the suggested action

    Method drop_reply

      `GDK2.DragContext drop_reply(int ok)`

    Description

      Drop reply.

    Method get_action

      `int get_action()`

    Description

      One of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE ;

    Method get_actions

      `int get_actions()`

    Description

      A bitwise or of one or more of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE ;

    Method get_is_source

      `int get_is_source()`

    Description

      Is this application the source?

    Method get_protocol

      `int get_protocol()`

    Description

      One of GDK_DRAG_PROTO_LOCAL , GDK_DRAG_PROTO_MOTIF , GDK_DRAG_PROTO_NONE , GDK_DRAG_PROTO_OLE2 , GDK_DRAG_PROTO_ROOTWIN , GDK_DRAG_PROTO_WIN32_DROPFILES and GDK_DRAG_PROTO_XDND

    Method get_source_widget

      `GTK2.Widget get_source_widget()`

    Description

      Return the drag source widget.

    Method get_start_time

      `int get_start_time()`

    Description

      The start time of this drag, as a unix time_t (seconds since 0:00 1/1 1970)

    Method get_suggested_action

      `int get_suggested_action()`

    Description

      One of GDK_ACTION_ASK , GDK_ACTION_COPY , GDK_ACTION_DEFAULT , GDK_ACTION_LINK , GDK_ACTION_MOVE and GDK_ACTION_PRIVATE ;

  CLASS GTK2.SourceBuffer

    Description

      Text buffer object for GTK2.SourceView

      Properties: int check-brackets int escape-char int highlight GTK2.SourceLanguage language int max-undo-levels

      Signals: can_redo

      can_undo

      highlight_updated

      marker_updated

    Inherit TextBuffer

      inherit GTK2.TextBuffer : TextBuffer

    Method begin_not_undoable_action

      `GTK2.SourceBuffer begin_not_undoable_action()`

    Description

      Marks the beginning of a not undoable action on the buffer, disabling the undo manager. Typically you would call this function before initially setting the contents of the buffer (e.g. when loading a file in a text editor).

      You may nest begin_no_undoable_action()/end_not_undoable_action() blocks.

    Method can_redo

      `int can_redo()`

    Description

      Determines whether a source buffer can redo the last action.

    Method can_undo

      `int can_undo()`

    Description

      Determines whether a source buffer can undo the last action.

    Method create

      `GTK2.SourceBuffer GTK2.SourceBuffer(GTK2.SourceTagTable table_or_lang)`

    Description

      Creates a new source buffer. If table_or_lang is a GTK2.SourceLanguage, it will create a buffer using the highlighting patterns of that language. If it is a GTK2.SourceTagTable, it will use that table, otherwise it will be a new source buffer with a new tag table.

    Method create_marker

      `GTK2.SourceMarker create_marker(string name, string type, GTK2.TextIter where)`

    Description

      Creates a marker in the buffer of type type. A marker is semantically very similar to a GTK2.TextMark, except it has a type which is used by the GTK2.SourceView displaying the buffer to show a pixmap on the left margin, at the line the marker is in. Becuase of this, a marker is generally associated to a line and not a character position. Markers are also accessible through a position or range in the buffer.

      Markers are implemented using GTK2.TextMark, so all characteristics and restrictions to marks apply to markers too. These include life cycle issues and "mark-set" and "mark-deleted" signal emissions.

      Like a GTK2.TextMark, a GTK2.SourceMarker can be anonymous if the passed name is 0.

      Markers always have left gravity and are moved to the beginning of the line when the users deletes the line they were in. Also, if the user deletes a region of text which contained lines with markers, those are deleted.

      Typical uses for a marker are bookmarks, breakpoints, current executing instruction indication in a source file, etc.

    Method delete_marker

      `GTK2.SourceBuffer delete_marker(GTK2.SourceMarker marker)`

    Description

      Deletes marker from the source buffer. The same conditions as for GTK2.TextMark apply here.

    Method end_not_undoable_action

      `GTK2.SourceBuffer end_not_undoable_action()`

    Description

      Marks the end of a not undoable action on the buffer. When the last not undoable block is closed through a call to this function, the list of undo actions is cleared and the undo manager is re-enabled.

    Method get_check_brackets

      `int get_check_brackets()`

    Description

      Determines whether bracket match highlighting is activated.

    Method get_escape_char

      `int get_escape_char()`

    Description

      Determines the escaping character used by the source buffer highlighting engine.

    Method get_first_marker

      `GTK2.SourceMarker get_first_marker()`

    Description

      Returns the first (nearest to the top of the buffer) marker.

    Method get_highlight

      `int get_highlight()`

    Description

      Determines whether text highlighting is activated in the source buffer.

    Method get_iter_at_marker

      `GTK2.TextIter get_iter_at_marker(GTK2.SourceMarker marker)`

    Description

      Returns a GTK2.TextIter at marker.

    Method get_language

      `GTK2.SourceLanguage get_language()`

    Description

      Determines the GTK2.SourceLanguage used by the buffer.

    Method get_last_marker

      `GTK2.SourceMarker get_last_marker()`

    Description

      Returns the last (nearest to the bottom of the buffer) marker.

    Method get_marker

      `GTK2.SourceMarker get_marker(string name)`

    Description

      Looks up the GTK2.SourceMarker named name, or returns 0 if it doesn't exist.

    Method get_markers_in_region

      `array get_markers_in_region(GTK2.TextIter begin, GTK2.TextIter end)`

    Description

      Returns an ordered (by position) list of GTK2.SourceMarker objects inside the region delimited by the GTK2.TextIters begin and end. The iters may be in any order.

    Method get_max_undo_levels

      `int get_max_undo_levels()`

    Description

      Determines the number of undo levels the buffer will track for buffer edits.

    Method get_next_marker

      `GTK2.SourceMarker get_next_marker(GTK2.TextIter iter)`

    Description

      Returns the nearest marker to the right of iter. If there are multiple markers at the same position, this function will always return the first one (from the internal linked list), even if starting the search exactly at its location. You can get the others using next().

    Method get_prev_marker

      `GTK2.SourceMarker get_prev_marker(GTK2.TextIter iter)`

    Description

      Returns the nearest marker to the left of iter. If there are multiple markers at the same position, this function will always return the last one (from the internal linked list), even if starting the search exactly at its location. You can get the others using prev().

    Method move_marker

      `GTK2.SourceBuffer move_marker(GTK2.SourceMarker marker, GTK2.TextIter where)`

    Description

      Moves marker to the new location.

    Method redo

      `GTK2.SourceBuffer redo()`

    Description

      Redoes the last undo operation. Use can_redo() to check whether a call to this function will have any effect.

    Method set_bracket_match_style

      `GTK2.SourceBuffer set_bracket_match_style(mapping style)`

    Description

      Sets the style used for highlighting matching brackets. <code> ([ "default": boolean, "mask": int, "foreground": GDK2.Color, "background": GDK2.Color, "italic": boolean, "bold": boolean, "underline": boolean, "strikethrough": boolean ]); </code>

    Method set_check_brackets

      `GTK2.SourceBuffer set_check_brackets(int setting)`

    Description

      Controls the bracket match highlighting function in the buffer. If activated, when you position your cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or closing bracket character will be highlighted. You can specify the style with the set_bracket_match_style() function.

    Method set_escape_char

      `GTK2.SourceBuffer set_escape_char(int escape_char)`

    Description

      Sets the escape character to be used by the highlighting engine.

      When performing the initial analysis, the engine will discard a matching syntax pattern if it's prefixed with an odd number of escape characters. This allows for example to correctly highlight strings with escaped quotes embedded.

      This setting affects only syntax patterns.

    Method set_highlight

      `GTK2.SourceBuffer set_highlight(int setting)`

    Description

      Controls whether text is highlighted in the buffer. If setting is true, the text will be highlighted according to the patterns installed in the buffer (either set with set_language() or by adding individual GTK2.SourceTag tags to the buffer's tag table). Otherwise, any current highlighted text will be restored to the default buffer style.

      Tags not of GTK2.SourceTag type will not be removed by this option, and normal GTK2.TextTag priority settings apply when highlighting is enabled.

      If not using a GTK2.SourceLanguage for setting the highlighting patterns in the buffer, it is recommended for performance reasons that you add all the GTK2.SourceTag tags with highlighting disabled and enable it when finished.

    Method set_language

      `GTK2.SourceBuffer set_language(GTK2.SourceLanguage lang)`

    Description

      Sets the source language the source buffer will use, adding GTK2.SourceTag tags with the language's patterns and setting the escape character with set_escape_char(). Note that this will remove any GTK2.SourceTag tags currently in the buffer's tag table.

    Method set_max_undo_levels

      `GTK2.SourceBuffer set_max_undo_levels(int setting)`

    Description

      Sets the number of undo levels for user actions the buffer will track. If the number of user actions exceeds the limit set by this funcction, older actions will be discarded.

      A new action is started whenever the function begin_user_action() is called. In general, this happens whenever the user presses any key which modifies the buffer, but the undo manager will try to merge similar consecutive actions, such as multiple character insertions into one action. But, inserting a newline does start a new action.

    Method undo

      `GTK2.SourceBuffer undo()`

    Description

      Undoes the last user action which modified the buffer. Use can_undo() to check whether a call to this function will have any effect.

      Actions are defined as groups of operations between a call to GTK2.TextBuffer->begin_user_action() and GTK2.TextBuffer->end_user_action(), or sequences of similar edits (inserts or deletes) on the same line.

  CLASS GTK2.RcStyle

    Description

      RC settings.

    Inherit Object

      inherit G.Object : Object

    Method copy

      `GTK2.RcStyle copy()`

    Description

      Makes a copy.

    Method create

      `GTK2.RcStyle GTK2.RcStyle()`

    Description

      Creates a new W(Rc).

    Method set_base

      `GTK2.RcStyle set_base(array colors)`

    Description

      Set base.

    Method set_bg

      `GTK2.RcStyle set_bg(array colors)`

    Description

      Set bg.

    Method set_bg_pixmap_name

      `GTK2.RcStyle set_bg_pixmap_name(array names)`

    Description

      Set bg_pixmap_name.

    Method set_color_flags

      `GTK2.RcStyle set_color_flags(array flags)`

    Description

      Set color_flags.

    Method set_fg

      `GTK2.RcStyle set_fg(array colors)`

    Description

      Set fg.

    Method set_name

      `GTK2.RcStyle set_name(string name)`

    Description

      Set the name.

    Method set_text

      `GTK2.RcStyle set_text(array colors)`

    Description

      Set text.

    Method set_xthickness

      `GTK2.RcStyle set_xthickness(int value)`

    Description

      Set xthickness.

    Method set_ythickness

      `GTK2.RcStyle set_ythickness(int value)`

    Description

      Set ythickness.

  CLASS GTK2.DrawingArea

    Description

      The drawing area is a window you can draw in. Please note that you must handle refresh and resize events on your own. Use W(pDrawingArea) for a drawingarea with automatic refresh/resize handling. `GTK2.DrawingArea()->set_size_request(100,100)`

    Inherit Widget

      inherit GTK2.Widget : Widget

    Method clear

      `GTK2.DrawingArea clear(int|void x, int|void y, int|void width, int|void height)`

    Description

      Either clears the rectangle defined by the arguments, of if no arguments are specified, the whole drawable.

    Method copy_area

      `GTK2.DrawingArea copy_area(GTK2.GdkGC gc, int xdest, int ydest, GTK2.Widget source, int xsource, int ysource, int width, int height)`

    Description

      Copies the rectangle defined by xsource,ysource and width,height from the source drawable, and places the results at xdest,ydest in the drawable in which this function is called.

    Method create

      `GTK2.DrawingArea GTK2.DrawingArea(mapping|void props)`

    Description

      Create a new drawing area.

    Method draw_arc

      `GTK2.DrawingArea draw_arc(GTK2.GdkGC gc, int filledp, int x1, int y1, int x2, int y2, int angle1, int angle2)`

    Description

      Draws a single circular or elliptical arc. Each arc is specified by a rectangle and two angles. The center of the circle or ellipse is the center of the rectangle, and the major and minor axes are specified by the width and height. Positive angles indicate counterclockwise motion, and negative angles indicate clockwise motion. If the magnitude of angle2 is greater than 360 degrees, it is truncated to 360 degrees.

    Method draw_bitmap

      `GTK2.DrawingArea draw_bitmap(GTK2.GdkGC gc, GTK2.GdkBitmap bitmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw a GDK2(Bitmap) in this drawable. NOTE: This drawable must be a bitmap as well. This will be fixed in GTK 1.3

    Method draw_image

      `GTK2.DrawingArea draw_image(GTK2.GdkGC gc, GTK2.GdkImage image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK2(Image) at xdest,ydest in the destination drawable

    Method draw_line

      `GTK2.DrawingArea draw_line(GTK2.GdkGC gc, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK2.DrawingArea()->set_size_request(100,100); delay: g = GDK2.GC(w)->set_foreground( GDK2.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_line(g,x*10,0,100-x*10,99); img_end

    Method draw_pixbuf

      `GTK2.DrawingArea draw_pixbuf(GTK2.GdkGC gc, GTK2.GdkPixbuf pixbuf, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw a GDK2(Pixbuf) in this drawable.

    Method draw_pixmap

      `GTK2.DrawingArea draw_pixmap(GTK2.GdkGC gc, GTK2.GdkPixmap pixmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK2(Pixmap) at xdest,ydest in the destination drawable

    Method draw_point

      `GTK2.DrawingArea draw_point(GTK2.GdkGC gc, int x, int y)`

    Description

      img_begin w = GTK2.DrawingArea()->set_size_request(10,10); delay: g = GDK2.GC(w)->set_foreground( GDK2.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_point(g, x, x); img_end

    Method draw_rectangle

      `GTK2.DrawingArea draw_rectangle(GTK2.GdkGC gc, int filledp, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK2.DrawingArea()->set_size_request(100,100); delay: g = GDK2.GC(w)->set_foreground( GDK2.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_rectangle(g,0,x*10,0,100-x*10,99); img_end img_begin w = GTK2.DrawingArea()->set_size_request(100,100); delay: g = GDK2.GC(w); delay: for(int x = 0; x<30; x++) { delay: g->set_foreground(GDK2.Color(random(255),random(255),random(255)) ); delay: w->draw_rectangle(g,1,x*10,0,100-x*10,99); delay: } img_end

    Method draw_text

      `GTK2.DrawingArea draw_text(GTK2.GdkGC gc, int x, int y, string text)`

    Description

      y is used as the baseline for the text.

    Method set_background

      `GTK2.DrawingArea set_background(GTK2.GdkColor to)`

    Description

      Set the background color or image. The argument is either a GDK2.Pixmap or a GDK2.Color object.

  CLASS GTK2.Gnome2Canvas

    Description

      Gnome2.Canvas is an engine for structured graphics that offers a rich imaging model, high performance rendering, and a powerful, high level API. It offers a choice of two rendering back-ends, one based on Xlib for extremely fast display, and another based on Libart, a sophisticated, antialiased, alpha-compositing engine. This widget can be used for flexible display of graphics and for creating interactive user interface elements.

      A Gnome2.Canvas widget contains one or more Gnome2.CanvasItem objects. Items consist of graphing elements like lines, ellipses, polygons, images, text, and curves. These items are organized using Gnome2.CanvasGroup objects, which are themselves derived from Gnome2.CanvasItem. Since a group is an item it can be contained within other groups, forming a tree of canvas items. Certain operations, like translating and scaling, can be performed on all items in a group. See http://developer.gnome.org/doc/API/2.0/libgnomecanvas/GnomeCanvas.html for more information. Properties: int aa

      Signals: draw_background

      render_background

    Inherit Layout

      inherit GTK2.Layout : Layout

    Method c2w

      `array c2w(int cx, int cy)`

    Description

      Converts canvas pixel coordinates to world coordinates.

    Method create

      `Gnome2.Canvas GTK2.Gnome2Canvas(int|void anti_alias)`

    Description

      Create a new Gnome2.Canvas widget. Set anti_alias to true to create a canvas in antialias mode.

    Method get_center_scroll_region

      `int get_center_scroll_region()`

    Description

      Returns whether the canvas is set to center the scrolling region in the window if the former is smaller than the canvas' allocation.

    Method get_color

      `GTK2.GdkColor get_color(string|void spec)`

    Description

      Allocates a color based on the specified X color specification. An omitted or empty string is considered transparent.

    Method get_color_pixel

      `int get_color_pixel(int rgba)`

    Description

      Allocates a color from the RGBA value passed into this function. The alpha opacity value is discarded, since normal X colors do not support it.

    Method get_dither

      `int get_dither()`

    Description

      Returns the type of dithering used to render an antialiased canvas.

    Method get_item_at

      `GTK2.Gnome2CanvasItem get_item_at(float x, float y)`

    Description

      Looks for the item that is under the specified position, which must be specified in world coordinates.

    Method get_scroll_offsets

      `array get_scroll_offsets()`

    Description

      Queries the scrolling offsets of a canvas. The values are returned in canvas pixel units.

    Method get_scroll_region

      `mapping get_scroll_region()`

    Description

      Queries the scrolling region of a canvas.

    Method root

      `GTK2.Gnome2CanvasGroup root()`

    Description

      Queries the root group.

    Method scroll_to

      `Gnome2.Canvas scroll_to(int cx, int cy)`

    Description

      Makes a canvas scroll to the specified offsets, given in canvas pixel units. The canvas will adjust the view so that it is not outside the scrolling region. This function is typically not used, as it is better to hook scrollbars to the canvas layout's scrolling adjustments.

    Method set_center_scroll_region

      `Gnome2.Canvas set_center_scroll_region(int setting)`

    Description

      When the scrolling region of the canvas is smaller than the canvas window, e.g. the allocation of the canvas, it can be either centered on the window or simply made to be on the upper-left corner on the window.

    Method set_dither

      `Gnome2.Canvas set_dither(int dither)`

    Description

      Controls the dithered rendering for antialiased canvases. The value of dither should be GDK2.RgbDitherNone, GDK2.RgbDitherNormal, or GDK2.RgbDitherMax. The default canvas setting is GDK2.RgbDitherNormal.

    Method set_pixels_per_unit

      `Gnome2.Canvas set_pixels_per_unit(float n)`

    Description

      Sets the zooming factor of a canvas by specifying the number of pixels that correspond to one canvas unit.

      The anchor point for zooming, i.e. the point that stays fixed and all others zoom inwards or outwards from it, depends on whether the canvas is set to center the scrolling region or not. You can contorl this using the set_center_scroll_region() function. If the canvas is set to center the scroll region, then the center of the canvas window is used as the anchor point for zooming. Otherwise, the upper-left corner of the canvas window is used as the anchor point.

    Method set_scroll_region

      `Gnome2.Canvas set_scroll_region(float x1, float y1, float x2, float y2)`

    Description

      Sets the scrolling region of a canvas to the specified rectangle. The canvas will then be able to scroll only within this region. The view of the canvas is adjusted as appropriate to display as much of the new region as possible.

    Method w2c

      `array w2c(float wx, float wy)`

    Description

      Converts world coordinates into canvas pixel coordinates.

    Method w2c_affine

      `array w2c_affine()`

    Description

      Gets the affine transform that converts from world coordinates to canvas pixel coordinates.

    Method w2c_d

      `array w2c_d(float wx, float wy)`

    Description

      Converts world coordinates into canvas pixel coordinates. This version returns coordinates in floating point coordinates, for greater precision.

    Method window_to_world

      `array window_to_world(float winx, float winy)`

    Description

      Converts window-relative coordinates into world coordinates. You can use this when you need to convert mouse coordinates into world coordinates, for example.

    Method world_to_window

      `array world_to_window(float worldx, float worldy)`

    Description

      Converts world coordinates into window-relative coordinates.

  CLASS GTK2.SourceView

    Description

      Properties: int auto-indent int highlight-current-line int insert-spaces-instead-of-tabs int margin int show-line-markers int show-line-numbers int show-margin int smart-home-end int tabs-width

      Signals: redo

      undo

    Inherit TextView

      inherit GTK2.TextView : TextView

    Method create

      `GTK2.SourceView GTK2.SourceView(GTK2.SourceBuffer buffer)`

    Description

      Create a new W(SourceView). If a buffer isn't specified, an empty default buffer will be created.

    Method get_auto_indent

      `int get_auto_indent()`

    Description

      Returns whether auto indentation of text is enabled.

    Method get_default

      `GTK2.SourceStyleScheme get_default()`

    Description

      Gets the default style scheme.

    Method get_insert_spaces_instead_of_tabs

      `int get_insert_spaces_instead_of_tabs()`

    Description

      Returns whether when inserting a tabulator character it should be replaced by a group of space characters.

    Method get_margin

      `int get_margin()`

    Description

      Gets the position of the right margin.

    Method get_marker_pixbuf

      `GTK2.GdkPixbuf get_marker_pixbuf(string type)`

    Description

      Gets the pixbuf which is associated with the given type.

    Method get_show_line_numbers

      `int get_show_line_numbers()`

    Description

      Returns whether line markers are displayed beside the text.

    Method get_show_margin

      `int get_show_margin()`

    Description

      Returns whether a margin is displayed.

    Method get_smart_home_end

      `int get_smart_home_end()`

    Description

      Returns whether HOME and END keys will move to the first/last non-space character of the line before moving to the start/end.

    Method get_tabs_width

      `int get_tabs_width()`

    Description

      Returns the width of tabulation in characters.

    Method set_auto_indent

      `GTK2.SourceView set_auto_indent(int setting)`

    Description

      If true, auto indentation of text is enabled.

    Method set_insert_spaces_instead_of_tabs

      `GTK2.SourceView set_insert_spaces_instead_of_tabs(int setting)`

    Description

      If true, any tabulator character inserted is replaced by a group of space characters.

    Method set_margin

      `GTK2.SourceView set_margin(int setting)`

    Description

      Sets the position of the right margin in the given view.

    Method set_marker_pixbuf

      `GTK2.SourceView set_marker_pixbuf(string type, GTK2.GdkPixbuf pixbuf)`

    Description

      Associates a given pixbuf with a given marker type.

    Method set_show_line_markers

      `GTK2.SourceView set_show_line_markers(int setting)`

    Description

      If true, line makers will be displayed beside the text.

    Method set_show_line_numbers

      `GTK2.SourceView set_show_line_numbers(int setting)`

    Description

      If true, line numbers will be displayed beside the text.

    Method set_show_margin

      `GTK2.SourceView set_show_margin(int setting)`

    Description

      If true, a margin is displayed.

    Method set_smart_home_end

      `GTK2.SourceView set_smart_home_end(int setting)`

    Description

      If true, HOME and END keys will move to the first/last non-space character of the line before moving to the start/end.

    Method set_tabs_width

      `GTK2.SourceView set_tabs_width(int width)`

    Description

      Sets the width of tabulation in characters.

  CLASS GTK2.Gnome2CanvasGroup

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

  CLASS GTK2.Gnome2CanvasShape

    Description

      Properties: int cap-style string dash string fill-color GDK2.Color fill-color-gdk int fill-color-rgba GDK2.Drawable fill-stipple int join-style float miterlimit string outline-color GDK2.Color outline-color-gdk int outline-color-rgba GDK2.Drawable outline-stipple int width-pixels float width-units int wind

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

  CLASS GTK2.HandleBox

    Description

      The contents of a handle box can be 'dragged' out of the box by the user. The contents will then be placed in a separate window. `GTK2.HandleBox()->add(GTK2.Label("The contents"))`

      Properties: int handle-position int shadow int shadow-type int snap-edge int snap-edge-set

      Signals: child_attached Called when a new child is added to the box

      child_detached Called when a child is removed from the box

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.HandleBox GTK2.HandleBox(mapping|void props)`

    Description

      Create a new handle box widget.

    Method get_handle_position

      `int get_handle_position()`

    Description

      Get the handle position.

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      Get the shadow type.

    Method get_snap_edge

      `int get_snap_edge()`

    Description

      Get the snap edge.

    Method set_handle_position

      `GTK2.HandleBox set_handle_position(int pos)`

    Description

      The position of the handle. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

    Method set_shadow_type

      `GTK2.HandleBox set_shadow_type(int shadow_type)`

    Description

      One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_snap_edge

      `GTK2.HandleBox set_snap_edge(int pos)`

    Description

      The edge to snap to. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP , or -1 for unset.

  CLASS GTK2.Statusbar

    Description

      Statusbars are simple widgets used to display a text message. They keep a stack of the messages pushed onto them, so that popping the current message will re-display the previous text message.

      In order to allow different parts of an application to use the same statusbar to display messages, the statusbar widget issues Context Identifiers which are used to identify different 'users'. The message on top of the stack is the one displayed, no matter what context it is in. Messages are stacked in last-in-first-out order, not context identifier order.

      `lambda() {object sb = GTK2.Statusbar();int id = sb->get_context_id("test");sb->push(id,"A message");sb->push(id,"Another message");return sb;}()`

      `lambda() {object sb = GTK2.Statusbar();int id = sb->get_context_id("test");sb->push(id,"A message");sb->push(id,"Another message");sb->pop(id);return sb;}()`

      Properties: int has-resize-grip

      Style properties: int shadow-type

      Signals: text_popped

      text_pushed

    Inherit Hbox

      inherit GTK2.Hbox : Hbox

    Method create

      `GTK2.Statusbar GTK2.Statusbar(mapping|void props)`

    Description

      Create a new statusbar widget

    Method get_context_id

      `int get_context_id(string context)`

    Description

      Create a new context id (or get the id of an old one). The argument is any string. The return value can be used for -&gt;push() -&gt;pop() and -&gt;remove later on.

    Method get_has_resize_grip

      `int get_has_resize_grip()`

    Description

      Returns whether the statusbar has a resize grip.

    Method pop

      `GTK2.Statusbar pop(int context)`

    Description

      Remove the topmost message.

    Method push

      `int push(int context, string data)`

    Description

      Push a message onto the statusbar. The return value is an id that can be passed to remove later on.

    Method remove

      `GTK2.Statusbar remove(int context, int id)`

    Description

      Remove the specified message (the message id is the second argument).

    Method set_has_resize_grip

      `GTK2.Statusbar set_has_resize_grip(int setting)`

    Description

      Sets whether the statusbar has a resize grip. TRUE by default.

  CLASS GTK2.GdkPixbufAnimation

    Description

      The GdkPixbufAnimation object. Holds animations, like gifs.

    Inherit Object

      inherit G.Object : Object

    Method create

      `GDK2.PixbufAnimation GTK2.GdkPixbufAnimation(string filename)`

    Description

      Create a new PixbufAnimation.

    Method get_height

      `int get_height()`

    Description

      Returns the height of the bounding box.

    Method get_iter

      `GTK2.GdkPixbufAnimationIter get_iter()`

    Description

      Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time.

      Returns the beginning of the animation. Afterwards you should probably immediately display the pixbuf return by GDK2.PixbufAnimationIter->get_pixbuf(). Then, you should install a timeout or by some other mechanism ensure that you'll update the image after GDK2.PixbufAnimationIter->get_delay_time() milliseconds. Each time the image is updated, you should reinstall the timeout with the new, possibly changed delay time.

      To update the image, call GDK2.PixbufAnimationIter->advance().

    Method get_static_image

      `GTK2.GdkPixbuf get_static_image()`

    Description

      If an animation is really just a plain image (has only one frame), this function returns that image. If the animation is an animation, this function returns reasonable thing to display as a static unanimated image, which might be the first frame, or something more sophisticated. If an animation hasn't loaded any frames yet, this function will return 0.

    Method get_width

      `int get_width()`

    Description

      Returns the width of the bounding box.

    Method is_static_image

      `int is_static_image()`

    Description

      If the file turns out to be a plain, unanimated image, this function will return true. Use get_static_image() to retrieve the image.

  CLASS GTK2.Vscale

    Description

      The GTK2.HScale widget is used to allow the user to select a value using a horizontal slider. A GTK2.Adjustment is used to set the initial value, the lower and upper bounds, and the step and page increments.

      See W(Scale) for details

      The position to show the current value, and the number of decimal places shown can be set using the parent W(Scale) class's functions.

      `GTK2.Vscale(GTK2.Adjustment())->set_size_request(300,30)`

    Inherit Scale

      inherit GTK2.Scale : Scale

    Method create

      `GTK2.Vscale GTK2.Vscale(GTK2.Adjustment settings_or_min_props, float|void max, float|void step)`

    Description

      Used to create a new hscale widget. Either pass an W(Adjustment), or three floats representing min, max, and step values.

  CLASS GTK2.Gnome2Appbar

    Description

      A bar that GNOME applications put on the bottom of the windows to display status, progress, hints for menu items or a minibuffer for getting some sort of response. It has a stack for status messages `GTK2.Gnome2Appbar( 1, 1, GTK2.GNOME_PREFERENCES_USER )->set_progress_percentage( 0.4 );`

      Properties: int has-progress int has-status int interactivity

      Signals: clear_prompt Emitted when the prompt is cleared. mixed user_data

      user_response Emitted when the user hits enter after a prompt. mixed user_data

    Inherit Hbox

      inherit GTK2.Hbox : Hbox

    Method clear_prompt

      `Gnome2.Appbar clear_prompt()`

    Description

      Remove any prompt.

    Method clear_stack

      `Gnome2.Appbar clear_stack()`

    Description

      Remove all status messages from appbar, and display default status message (if present).

    Method create

      `Gnome2.Appbar GTK2.Gnome2Appbar(int has_progress, int has_status, int interactivity)`

    Description

      Create a new GNOME application status bar. If has_progress is TRUE, a small progress bar widget will be created, and placed on the left side of the appbar. If has_status is TRUE, a status bar, possibly an editable one, is created.

      interactivity determines whether the appbar is an interactive "minibuffer" or just a status bar. If it is set to Gnome2.PREFERENCES_NEVER, it is never interactive. If it is set to Gnome2.PREFERENCES_USER we respect user preferences from ui-properties. If it's Gnome2.PREFERENCES_ALWAYS we are interactive whether the user likes it or not. Basically, if your app supports both interactive and not (for example, if you use the gnome-app-util interfaces), you should use Gnome2.PREFERENCES_USER. Otherwise, use the setting you support. Please note that "interactive" mode is not functional now; GtkEntry is inadequate and so a custom widget will be written eventually.

    Method get_progress

      `GTK2.ProgressBar get_progress()`

    Description

      Returns GTK2.ProgressBar widget pointer, so that the progress bar may be manipulated further.

    Method get_response

      `string get_response()`

    Description

      Get the response to the prompt, if any.

    Method get_status

      `GTK2.Widget get_status()`

    Description

      Retrieves the statusbar widget.

    Method pop

      `Gnome2.Appbar pop()`

    Description

      Remove current status message, and display previous status message, if any. It is OK to call this with an empty stack.

    Method push

      `Gnome2.Appbar push(string what)`

    Description

      Push a new status message onto the status bar stack, and display it.

    Method refresh

      `Gnome2.Appbar refresh()`

    Description

      Reflect the current state of stack/default. Useful to force a set_status to disappear.

    Method set_default

      `Gnome2.Appbar set_default(string default_status)`

    Description

      What to show when showing nothing else; defaults to "".

    Method set_progress_percentage

      `Gnome2.Appbar set_progress_percentage(float percentage)`

    Description

      Sets progress bar to the given percentage.

    Method set_prompt

      `Gnome2.Appbar set_prompt(string prompt, int modal)`

    Description

      Put a prompt in the appbar and wait for a response. When the user responds or cancels, a "user-response" signal is emitted.

    Method set_status

      `Gnome2.Appbar set_status(string status)`

    Description

      Sets the status label without changing widget state; next set or push will destroy this permanently.

  CLASS GTK2.TreeDragSource

    Method drag_data_delete

      `int drag_data_delete(GTK2.TreePath path)`

    Description

      Asks to delete the row at path, because it was moved somewhere else via drag-and-drop. Returns false if the deletion fails because path no longer exists, or for some model-specific reason.

    Method drag_data_get

      `GTK2.SelectionData drag_data_get(GTK2.TreePath path)`

    Description

      Asks to return a representation of the row at path.

    Method row_draggable

      `int row_draggable(GTK2.TreePath path)`

    Description

      Asks the source whether a particular row can be used as the source of a DND operation. If the source doesn't implement this interface, the row is assumed draggable.

  CLASS GTK2.SourceTag

    Description

      Properties: string id GTK2.SourceTagStyle tag-style

    Inherit TextTag

      inherit GTK2.TextTag : TextTag

    Method get_style

      `mapping get_style()`

    Description

      Gets the style associated with this tag.

    Method set_style

      `GTK2.SourceTag set_style(mapping style)`

    Description

      Associates a style with this tag. See GTK2.SourceBuffer->set_bracket_match_style() for format.

  CLASS GTK2.ButtonBox

    Description

      More or less equivalent to a normal box, but you can set a few layout schemes that are not available for normal boxes. See the hbox and vbox documentation for examples. Properties: int layout-style

      Child properties: int secondary

      Style properties: int child-internal-pad-x int child-internal-pad-y int child-min-height int child-min-width

    Inherit Box

      inherit GTK2.Box : Box

    Method get_child_secondary

      `int get_child_secondary(GTK2.Widget child)`

    Description

      Returns whether child should appear in a secondary group of children.

    Method get_layout

      `int get_layout()`

    Description

      Returns the currently configured layout. One of BUTTONBOX_DEFAULT_STYLE , BUTTONBOX_EDGE , BUTTONBOX_END , BUTTONBOX_SPREAD and BUTTONBOX_START

    Method set_child_secondary

      `GTK2.ButtonBox set_child_secondary(GTK2.Widget child, int is_secondary)`

    Description

      Sets whether child should appear in a secondary group of children.

    Method set_layout

      `GTK2.ButtonBox set_layout(int layout)`

    Description

      layout is one of BUTTONBOX_DEFAULT_STYLE , BUTTONBOX_EDGE , BUTTONBOX_END , BUTTONBOX_SPREAD and BUTTONBOX_START

  CLASS GTK2.Vbox

    Description

      Most packing is done by creating boxes. These are invisible widget containers that we can pack our widgets into which come in two forms, a horizontal box, and a vertical box. This is the vertical one. When packing widgets into a vertical box, the objects are inserted horizontally from top to bottom or bottom to top depending on the call used.

      `GTK2.Vbox(0,0)->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->pack_end_defaults(GTK2.Button("From right"))->pack_start_defaults(GTK2.Button("From left"))`

      `GTK2.Vbox(1,0)->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->pack_end_defaults(GTK2.Button("From right"))->pack_start_defaults(GTK2.Button("From left"))`

      `GTK2.Vbox(1,40)->add(GTK2.Button("Hello"))->add(GTK2.Button("World"))->pack_end_defaults(GTK2.Button("From right"))->pack_start_defaults(GTK2.Button("From left"))`

    Inherit Box

      inherit GTK2.Box : Box

    Method create

      `GTK2.Vbox GTK2.Vbox(int|mapping uniformp_or_props, int|void padding)`

    Description

      Create a new vertical box widget. If all_same_size is true, all widgets will have exactly the same size. padding is added to the top and bottom of the children.

  CLASS GTK2.SourceMarker

    Method get_buffer

      `GTK2.SourceBuffer get_buffer()`

    Description

      Gets the buffer associated with this marker.

    Method get_line

      `int get_line()`

    Description

      Gets the line number of this marker.

    Method get_marker_type

      `string get_marker_type()`

    Description

      Gets the marker type of this marker.

    Method get_name

      `string get_name()`

    Description

      Gets the name of this marker.

    Method next

      `GTK2.SourceMarker next()`

    Description

      Gets the next marker after this.

    Method prev

      `GTK2.SourceMarker prev()`

    Description

      Gets the previous marker before this.

    Method set_marker_type

      `GTK2.SourceMarker set_marker_type(string type)`

    Description

      Not documented.

  CLASS GTK2.FileFilter

    Description

      A filter for selecting a file subset.

    Inherit Data

      inherit GTK2.Data : Data

    Method add_mime_type

      `GTK2.FileFilter add_mime_type(string mime_type)`

    Description

      Adds a rule allowing a given mime type.

    Method add_pattern

      `GTK2.FileFilter add_pattern(string pattern)`

    Description

      Adds a rule allowing a shell style glob.

    Method add_pixbuf_formats

      `GTK2.FileFilter add_pixbuf_formats()`

    Description

      Adds a rule allowing image files in the formats support by W(Pixbuf).

    Method create

      `GTK2.FileFilter GTK2.FileFilter()`

    Description

      Creates a new W(FileFilter) with no rules added to it. Such a filter doesn't accept any files, so is not particularly useful until you add rules with add_mime_type(), add_pattern(), or add_custom(). To create a filter accepts any file, use add_pattern("*").

    Method get_name

      `string get_name()`

    Description

      Gets the human-readable name for the filter.

    Method set_name

      `GTK2.FileFilter set_name(string name)`

    Description

      Sets the human-readable name of the filter; this is the string that will be displayed in the file selector user interface if there is a selectable list of filters.

  CLASS GTK2.MenuToolButton

    Description

      Properties to be notified. GTK2.Menu menu

      Signals: show_menu

    Inherit ToolButton

      inherit GTK2.ToolButton : ToolButton

    Method create

      `GTK2.MenuToolButton GTK2.MenuToolButton(GTK2.Widget icon, string|void label)`

    Description

      Create a new GTK2.MenuToolButton. If icon is a string, label should be omitted. If it isn't, it will be igrnored. The result will be a button from a stock item, one of STOCK_ABOUT , STOCK_ADD , STOCK_APPLY , STOCK_BOLD , STOCK_CANCEL , STOCK_CDROM , STOCK_CLEAR , STOCK_CLOSE , STOCK_COLOR_PICKER , STOCK_CONNECT , STOCK_CONVERT , STOCK_COPY , STOCK_CUT , STOCK_DELETE , STOCK_DIALOG_AUTHENTICATION , STOCK_DIALOG_ERROR , STOCK_DIALOG_INFO , STOCK_DIALOG_QUESTION , STOCK_DIALOG_WARNING , STOCK_DIRECTORY , STOCK_DISCONNECT , STOCK_DND , STOCK_DND_MULTIPLE , STOCK_EDIT , STOCK_EXECUTE , STOCK_FILE , STOCK_FIND , STOCK_FIND_AND_REPLACE , STOCK_FLOPPY , STOCK_FULLSCREEN , STOCK_GOTO_BOTTOM , STOCK_GOTO_FIRST , STOCK_GOTO_LAST , STOCK_GOTO_TOP , STOCK_GO_BACK , STOCK_GO_DOWN , STOCK_GO_FORWARD , STOCK_GO_UP , STOCK_HARDDISK , STOCK_HELP , STOCK_HOME , STOCK_INDENT , STOCK_INDEX , STOCK_INFO , STOCK_ITALIC , STOCK_JUMP_TO , STOCK_JUSTIFY_CENTER , STOCK_JUSTIFY_FILL , STOCK_JUSTIFY_LEFT , STOCK_JUSTIFY_RIGHT , STOCK_LEAVE_FULLSCREEN , STOCK_MEDIA_FORWARD , STOCK_MEDIA_NEXT , STOCK_MEDIA_PAUSE , STOCK_MEDIA_PLAY , STOCK_MEDIA_PREVIOUS , STOCK_MEDIA_RECORD , STOCK_MEDIA_REWIND , STOCK_MEDIA_STOP , STOCK_MISSING_IMAGE , STOCK_NETWORK , STOCK_NEW , STOCK_NO , STOCK_OK , STOCK_OPEN , STOCK_PASTE , STOCK_PREFERENCES , STOCK_PRINT , STOCK_PRINT_PREVIEW , STOCK_PROPERTIES , STOCK_QUIT , STOCK_REDO , STOCK_REFRESH , STOCK_REMOVE , STOCK_REVERT_TO_SAVED , STOCK_SAVE , STOCK_SAVE_AS , STOCK_SELECT_COLOR , STOCK_SELECT_FONT , STOCK_SORT_ASCENDING , STOCK_SORT_DESCENDING , STOCK_SPELL_CHECK , STOCK_STOP , STOCK_STRIKETHROUGH , STOCK_UNDELETE , STOCK_UNDERLINE , STOCK_UNDO , STOCK_UNINDENT , STOCK_YES , STOCK_ZOOM_100 , STOCK_ZOOM_FIT , STOCK_ZOOM_IN and STOCK_ZOOM_OUT . If icon is a GTK2.Widget, it will be used as the icon, and label will be the label. The label must exist if that is the case.

    Method get_menu

      `GTK2.Widget get_menu()`

    Description

      Returns the GTK2.Menu.

    Method set_arrow_tooltip

      `GTK2.MenuToolButton set_arrow_tooltip(GTK2.Tooltips tooltips, string tip_text, string tip_private)`

    Description

      Sets the GTK2.Tooltips object to be used for the arrow button which pops up the menu.

    Method set_menu

      `GTK2.MenuToolButton set_menu(GTK2.Widget menu)`

    Description

      Sets the GTK2.Menu that is popped up when the user clicks on the arrow.

  CLASS GTK2.KeywordListTag

    Inherit SourceTag

      inherit GTK2.SourceTag : SourceTag

    Method create

      `GTK2.KeywordListTag GTK2.KeywordListTag(string id, string name, array keywords, int case_sensitive, int match_empty_string_at_beginning, int match_empty_string_at_end, string beginning_regex, string end_regex)`

    Description

      Creates a new keyword list tag object with the provided arguments.

  CLASS GTK2.Bin

    Description

      A container that can only contain one child.

    Inherit Container

      inherit GTK2.Container : Container

    Method get_child

      `GTK2.Widget get_child()`

    Description

      Return the child.

  CLASS GTK2.TreeModel

    Description

      The tree interface used by TreeView.

      Signals: row_changed

      row_deleted

      row_has_child_toggled

      row_inserted

      rows_reordered

    Method get_column_type

      `int get_column_type(int index)`

    Description

      Returns the type of the column.

    Method get_flags

      `int get_flags()`

    Description

      Returns a set of flags supported by this interface.

    Method get_iter

      `GTK2.TreeIter get_iter(GTK2.TreePath path)`

    Description

      Returns a valid iterator pointer to path

    Method get_iter_first

      `GTK2.TreeIter get_iter_first()`

    Description

      Get GTK2.TreeIter with the first iterator in the tree ("0").

    Method get_iter_from_string

      `GTK2.TreeIter get_iter_from_string(string path)`

    Description

      Returns a valid iterator from a path string.

    Method get_n_columns

      `int get_n_columns()`

    Description

      Returns the number of columns suppported by this model.

    Method get_path

      `GTK2.TreePath get_path(GTK2.TreeIter iter)`

    Description

      Returns a GTK2.TreePath from iter.

    Method get_row

      `array get_row(GTK2.TreeIter iter)`

    Description

      Get the row at this iter.

    Method get_string_from_iter

      `string get_string_from_iter(GTK2.TreeIter iter)`

    Description

      Get string representation of iter.

    Method get_value

      `mixed get_value(GTK2.TreeIter iter, int column)`

    Description

      Get value at column of iter.

    Method iter_children

      `GTK2.TreeIter iter_children(GTK2.TreeIter parent)`

    Description

      Get first child of parent.

    Method iter_has_child

      `int iter_has_child(GTK2.TreeIter iter)`

    Description

      Check if iter has children.

    Method iter_n_children

      `int iter_n_children(GTK2.TreeIter iter)`

    Description

      Returns the number of children this iter has.

    Method iter_next

      `GTK2.TreeIter iter_next(GTK2.TreeIter iter)`

    Description

      Go to next node.

    Method iter_nth_child

      `GTK2.TreeIter iter_nth_child(GTK2.TreeIter parent, int index)`

    Description

      Get the child of parent using the given index. Returns valid GTK2.TreeIter if it exists, or 0. If the index is too big, or parent is invalid, then it returns the index from the root node.

    Method iter_parent

      `GTK2.TreeIter iter_parent(GTK2.TreeIter child)`

    Description

      Get parent of child, or 0 if none.

    Method row_changed

      `GTK2.TreeModel row_changed(GTK2.TreePath path, GTK2.TreeIter iter)`

    Description

      Emit "row-changed" signal.

    Method row_deleted

      `GTK2.TreeModel row_deleted(GTK2.TreePath path)`

    Description

      Emit "row-deleted" signal.

    Method row_has_child_toggled

      `GTK2.TreeModel row_has_child_toggled(GTK2.TreePath path, GTK2.TreeIter iter)`

    Description

      Emit "row-has-child-toggled" signal.

    Method row_inserted

      `GTK2.TreeModel row_inserted(GTK2.TreePath path, GTK2.TreeIter iter)`

    Description

      Emit "row-inserted" signal.

  CLASS GTK2.Invisible

    Description

      An invisible container, useful, eh? :) Properties: GDK2.Screen screen

    Inherit Widget

      inherit GTK2.Widget : Widget

    Method create

      `GTK2.Invisible GTK2.Invisible(mapping|void props)`

    Description

      Create a new invisible widget

    Method get_screen

      `GTK2.GdkScreen get_screen()`

    Description

      Gets the screen associated with this object.

    Method set_screen

      `GTK2.Invisible set_screen(GTK2.GdkScreen screen)`

    Description

      Sets the screen where this object will be displayed.

  CLASS GTK2.GdkRectangle

    Description

      Rectangle class.

    Method cast

      `mixed cast(string type)`

    Description

      Normally used like (mapping)rectangle or (array)rectangle.

    Method create

      `GDK2.Rectangle GTK2.GdkRectangle(int x, int y, int width, int height)`

    Description

      Create a new rectangle

      NOIMG

    Method set

      `GDK2.Rectangle set(int x, int y, int width, int height)`

    Description

      Set the upper left corner and the size of the rectangle.

  CLASS GTK2.Gnome2CanvasText

    Description

      Properties: int anchor Pango.AttrList attributes int clip float clip-height float clip-width string family int family-set string fill-color GDK2.Color fill-color-gdk int fill-color-rgba GDK2.Drawable fill-stipple string font Pango.FontDescription font-dest int justification string markup int rise int rise-set float scale int scale-set int size float size-points int size-set Pango.Stretch stretch int stretch-set int strikethrough int strikethrough-set Pango.Style style int style-set string text float text-height float text-width Pango.Underline underline int underline-set Pango.Variant variant int variant-set int weight float x float x-offset float y float y-offset

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

  CLASS GTK2.TreeSelection

    Description

      Selections on a treestore.

      Signals: changed

    Inherit Object

      inherit G.Object : Object

    Method count_selected_rows

      `int count_selected_rows()`

    Description

      Returns the number of rows that have been selected.

    Method get_mode

      `int get_mode()`

    Description

      Gets the selectiom mode.

    Method get_selected

      `array get_selected()`

    Description

      Returns a W(TreeITer) with the currently selected node if this selection is set to GTK2.SELECTION_SINGLE or GTK2.SELECTION_BROWSE. Also returns W(TreeModel) as a convenience. This function will not work if you this selection is set to GTK2.SELECTION_MULTIPLE.

    Method get_selected_rows

      `array get_selected_rows(GTK2.TreeModel model)`

    Description

      Creates a list of W(TreePath)'s for all selected rows. Additionally, if you are planning on modified the model after calling this function, you may want to convert the returned list into a list of W(TreeRowReference)s. To do this, you can use GTK2.TreeRowReference->create().

    Method get_tree_view

      `GTK2.TreeView get_tree_view()`

    Description

      Returns the tree view associated with this selection.

    Method get_user_data

      `object get_user_data()`

    Description

      Returns the user data for the selection function.

    Method iter_is_selected

      `int iter_is_selected(GTK2.TreeIter iter)`

    Description

      Returns true if the row at iter is currently selected.

    Method path_is_selected

      `int path_is_selected(GTK2.TreePath path)`

    Description

      Returns true if the row pointed to by path is currently selected. If path does not point to a valid location, false is returned.

    Method select_all

      `GTK2.TreeSelection select_all()`

    Description

      Selects all the nodes. This selection must be set to GTK2.SELECTION_MULTIPLE mode.

    Method select_iter

      `GTK2.TreeSelection select_iter(GTK2.TreeIter iter)`

    Description

      Selects the specified iterator.

    Method select_path

      `GTK2.TreeSelection select_path(GTK2.TreePath path)`

    Description

      Select the row at path.

    Method select_range

      `GTK2.TreeSelection select_range(GTK2.TreePath start, GTK2.TreePath end)`

    Description

      Selects a range of nodes, determined by start and end inclusive. This selection must be set to GTK2.SELECTION_MULTIPLE mode.

    Method set_mode

      `GTK2.TreeSelection set_mode(int type)`

    Description

      Sets the selection mode. If the previous type was GTK2.SELECTION_MULTIPLE, then the anchor is kept selected, if it was previously selected. One of SELECTION_BROWSE , SELECTION_MULTIPLE , SELECTION_NONE and SELECTION_SINGLE .

    Method unselect_all

      `GTK2.TreeSelection unselect_all()`

    Description

      Unselects all the nodes.

    Method unselect_iter

      `GTK2.TreeSelection unselect_iter(GTK2.TreeIter iter)`

    Description

      Unselects the specified iterator.

    Method unselect_path

      `GTK2.TreeSelection unselect_path(GTK2.TreePath path)`

    Description

      Unselects the row at path.

    Method unselect_range

      `GTK2.TreeSelection unselect_range(GTK2.TreePath start, GTK2.TreePath end)`

    Description

      Unselects a range of nodes, determined by start and end inclusive.

  CLASS GTK2.SyntaxTag

    Inherit SourceTag

      inherit GTK2.SourceTag : SourceTag

    Method create

      `GTK2.SyntaxTag GTK2.SyntaxTag(string id, string name, string pattern_start, string pattern_end)`

    Description

      Creates a new syntax tag object with the provided arguments.

  CLASS GTK2.GladeXML

    Description

      Glade is a free GUI builder for GTK2+ and Gnome. It's normally used to create C-code, but can also produce code for other languages. Libglade is a utility library that builds the GI from the Glade XML save files. This module uses libglade and allows you to easily make GUI designs to be used with your Pike applications.

    Inherit Object

      inherit G.Object : Object

    Method create

      `GTK2.GladeXML GTK2.GladeXML(string filename_or_buffer, int|void size, string|void root, string|void domain)`

    Description

      Creates a new GladeXML object (and the corresponding widgets) from the XML file. Optionally it will only build the interface from the widget node root. This feature is useful if you only want to build say a toolbar or menu from the XML file, but not the window it is embedded in. Note also that the XML parse tree is cached to speed up creating another GladeXML object from the same file. The third optional argument is used to specify a different translation domain from the default to be used. If xml description is in a string buffer instead, specify the size (or -1 to auto-calculate). If size is 0, then it will assume a file with root and/or domain specified.

    Method get_signal_id

      `int get_signal_id(GTK2.Widget widget)`

    Description

      Used to get the signal id attached to a GladeXML object.

    Method get_widget

      `GTK2.Widget get_widget(string name)`

    Description

      This function is used to get the widget corresponding to name in the interface description. You would use this if you have to do anything to the widget after loading.

    Method get_widget_name

      `string get_widget_name(GTK2.Widget widget)`

    Description

      Used to get the name of a widget that was generated by a GladeXML object.

    Method get_widget_prefix

      `array get_widget_prefix(string name)`

    Description

      This function is used to get a list GTK2.Widgets with names that start with the string name in the interface description.

    Method signal_autoconnect

      `GTK2.GladeXML signal_autoconnect(mapping callbacks, mixed data)`

    Description

      Try to connect functions to all signals in the interface. The mapping should consist of handler name : function pairs. The data argument will be saved and sent as the first argument to all callback functions.

  CLASS GTK2.Gnome2IconEntry

    Description

      This widget provides the facilities to select an icon. An icon is displayed inside a button, when the button is pressed, an Icon selector (a dialog with a W(GnomeIconSelection) widget) pops up to let the user choose an icon. It also allows one to Drag and Drop the images to and from the preview button. Properties: string browse-dialog-title string filename string history-id GTK2.Dialog pick-dialog string pixmap-subdir

      Signals: browse

      changed

    Inherit Vbox

      inherit GTK2.Vbox : Vbox

    Method create

      `Gnome2.IconEntry GTK2.Gnome2IconEntry(string history_id, string title)`

    Description

      Creates a new icon entry widget

    Method get_filename

      `string get_filename()`

    Description

      Gets the file name of the image if it was possible to load it into the preview. That is, it will only return a filename if the image exists and it was possible to load it as an image.

    Method pick_dialog

      `GTK2.Widget pick_dialog()`

    Description

      If a pick dialog exists, returns it. This is if you need to do something with all dialogs. You would use the browse signal with connect_after to get the pick dialog when it is displayed.

    Method set_browse_dialog_title

      `Gnome2.IconEntry set_browse_dialog_title(string title)`

    Description

      Set the title of the browse dialog.

    Method set_filename

      `int set_filename(string filename)`

    Description

      Sets the icon of Gnome2.IconEntry to be the one pointed to by filename.

    Method set_history_id

      `Gnome2.IconEntry set_history_id(string history_id)`

    Description

      Set the history_id of the entry in the browse dialog and reload the history.

    Method set_pixmap_subdir

      `Gnome2.IconEntry set_pixmap_subdir(string subdir)`

    Description

      Sets the subdirectory below gnome's default pixmap directory to use as the default path for the file entry.

  CLASS GTK2.Pango.Layout

    Description

      Pango Layout.

    Method context_changed

      `Pango.Layout context_changed()`

    Description

      Forces recomputation of any state in the layout that might depend on the layout's context. This function should be called if you make changes to the context subsequent to creating the layout.

    Method copy

      `GTK2.Pango.Layout copy(GTK2.Pango.Layout src)`

    Description

      Does a copy of the src.

    Method create

      `Pango.Layout GTK2.Pango.Layout(GTK2.Pango.Context context)`

    Description

      Create a new layout with attributes initialized to default values for a particular Pango.Context

    Method get_alignment

      `int get_alignment()`

    Description

      Gets the alignment.

    Method get_auto_dir

      `int get_auto_dir()`

    Description

      Gets whether to calculate the bidirectional base direction for the layout according to the contents of the layout.

    Method get_context

      `GTK2.Pango.Context get_context()`

    Description

      Returns the Pango.Context.

    Method get_cursor_pos

      `array get_cursor_pos(int index)`

    Description

      Given an index within a layout, determines the positions of the strong and weak cursors if the insertion point is at that index. The position of each cursor is stored as a zero-width rectangle. The strong cursor is the location where characters of the directionality equal to the base direction of the layout are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction of the layout are inserted. Returns: array of mappings, each mapping is the same as index_to_pos().

    Method get_indent

      `int get_indent()`

    Description

      Gets the paragraph indent in pango units. A negative value indicates a hanging indent.

    Method get_justify

      `int get_justify()`

    Description

      Gets whether or not each complete line should be stretched to fill the entire width of the layout.

    Method get_line

      `GTK2.Pango.LayoutLine get_line(int line)`

    Description

      Retrieves a specific line.

    Method get_line_count

      `int get_line_count()`

    Description

      Retrieves the count of lines.

    Method get_single_paragraph_mode

      `int get_single_paragraph_mode()`

    Description

      Gets the value set by set_single_paragraph_mode().

    Method get_size

      `mapping get_size()`

    Description

      Determines the logical width and height in Pango units.

    Method get_spacing

      `int get_spacing()`

    Description

      Gets the amount of spacing between the lines.

    Method get_tabs

      `GTK2.Pango.TabArray get_tabs()`

    Description

      Gets the current W(TabArray) used by this layout. If no W(TabArray) has been set, then the default tabs are in use and 0 is returned. Default tabs are every 8 spaces.

    Method get_text

      `string get_text()`

    Description

      Gets the text.

    Method get_width

      `int get_width()`

    Description

      Gets the line wrap width.

    Method get_wrap

      `int get_wrap()`

    Description

      Gets the wrap mode for the layout.

    Method index_to_pos

      `mapping index_to_pos(int index)`

    Description

      Converts from an index to the onscreen position corresponding to the grapheme at that index, which is represented as a rectangle. Note that x is always the leading edge of the grapheme and x+width the trailing edge of the grapheme. If the direction of the grapheme is right-to-left, then width will be negative.

      Returns: ([ "x": x coordinate, "y": y coordinate, "width": width of the rectangle, "height": height of the rectangle ])

    Method move_cursor_visually

      `mapping move_cursor_visually(int strong, int old_index, int old_trailing, int dir)`

    Description

      Computes a new cursor position from an old position and a count of positions to move visually. If count is positive, then the new strong cursor position will be one position to the right of the old cursor position. If count is negative, then the new strong cursor position will be one position to the left of the old cursor position.

      In the presence of bidirectional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off the end of a run.

      Motion here is in cursor positions, not in characters, so a single call to move_cursor_visually() may move the cursor over multiple characters when multiple characters combine to form a single grapheme.

    Method set_alignment

      `Pango.Layout set_alignment(int alignment)`

    Description

      Sets the alignment for the layout (how partial lines are positioned within the horizontal space available.) One of .

    Method set_auto_dir

      `Pango.Layout set_auto_dir(int auto_dir)`

    Description

      Sets whether to calculate the bidirectional base direction for the layout according to the contents of the layout; when this flag is on (the default), then paragraphs that begin with strong right-to-left characters (Arabic and Hebrew principally), will have right-left-layout, paragraphs with letters from other scripts will have left-to-right layout. Paragraphs with only neutral characters get their direction from the surrounding paragraphs.

      When false, the choice between left-to-right and right-to-left layout is done by according to the base direction of the Pango.Context.

    Method set_font_description

      `Pango.Layout set_font_description(GTK2.Pango.FontDescription desc)`

    Description

      Sets the default font description for the layout. If no font description is set on the layout, the font descriptions from the layout's context is used.

    Method set_indent

      `Pango.Layout set_indent(int indent)`

    Description

      Sets the width in pango units to indent each paragraph. A negative value of indent will produce a hanging indent. That is, the first line will have the full width, and subsequent lines will be indented by the absolute value of indent.

    Method set_justify

      `Pango.Layout set_justify(int justify)`

    Description

      Sets whether or not each complete line should be stretched to fill the entire width of the layout. This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification is done by extending the characters.

    Method set_markup

      `Pango.Layout set_markup(string markup, int length)`

    Description

      Same as set_markup_with_accel(), but the markup text isn't scanned for accelerators.

    Method set_markup_with_accel

      `Pango.Layout set_markup_with_accel(string markup, int length, int|void accel_marker)`

    Description

      Sets the layout text and attribute from marked-up text. Replaces the current text and attribute list.

      If accel_marker is nonzero, the given character will mark the character following it as an accelerator. For example, the accel marker might be an ampersand or underscore. All characters marked as an acclerator will receive a GTK2.PANGO_UNDERLINE_LOW attribute, and the first character so marked will be returned. Two accel_marker characters following each other produce a single literal accel_marker character.

    Method set_single_paragraph_mode

      `Pango.Layout set_single_paragraph_mode(int setting)`

    Description

      If setting is true, do not treat newlines and similar characters as paragraph separators; instead, keep all text in a single paragraph, and display a glyph for paragraph separator characters. Used when you want to allow editing of newlines on a single text line.

    Method set_spacing

      `Pango.Layout set_spacing(int spacing)`

    Description

      Sets the amount of spacing between the lines.

    Method set_tabs

      `Pango.Layout set_tabs(GTK2.Pango.TabArray tabs)`

    Description

      Sets the tabs to use, overriding the default tabs (by default, tabs are every 8 spaces). If tabs is omitted, the default tabs are reinstated.

    Method set_text

      `Pango.Layout set_text(string text, int length)`

    Description

      Sets the text of the layout.

    Method set_width

      `Pango.Layout set_width(int width)`

    Description

      Sets the width to which the lines should be wrapped.

    Method set_wrap

      `Pango.Layout set_wrap(int wrap)`

    Description

      Sets the wrap mode; the wrap mode only has an effect if a width is set on the layout with set_width(). To turn off wrapping, set the width to -1. One of .

    Method xy_to_index

      `mapping xy_to_index(int x, int y)`

    Description

      Converts from x and y position within a layout to the byte index to the character at that logical position. If the y position is not inside the layout, the closest position is chosen (the position will be clamped inside the layout). If the X position is not within the layout, then the start or the end of the line is chosen as describe for x_to_index(). If either the x or y positions were not inside the layout, then returns 0.

      Returns: ([ "index": byte index, "trailing": where in grapheme user clicked ]).

  CLASS GTK2.GdkPixbufAnimationIter

    Description

      An iterator for a PixbufAnimation.

    Inherit Object

      inherit G.Object : Object

    Method advance

      `int advance()`

    Description

      Possibly advance an animation to a new frame.

    Method get_delay_time

      `int get_delay_time()`

    Description

      Gets the number of milliseconds the current pixbuf should be displayed, or -1 if the current pixbuf should be displayed forever.

    Method get_pixbuf

      `GTK2.GdkPixbuf get_pixbuf()`

    Description

      Gets the current pixbuf which should be displayed; the pixbuf will be the same size as the animation itself (GDK2.PixbufAnimation->get_width(), GDK2.PixbufAnimation->get_height()). This pixbuf should be displayed for get_delay_time() milliseconds.

    Method on_currently_loading_frame

      `int on_currently_loading_frame()`

    Description

      Used to determine how to respond to the area_updated signal on GDK2.PixbufLoader when loading an animation.

  CLASS GTK2.Databox

    Description

      GtkDatabox is designed to display large amounts of numerical data fast and easy. Thousands of data points (X and Y coordinate) may be displayed without any problems, zooming and scrolling as well as optional rulers are already included.

      The widget may be used as display for oscilloscopes or other applications that need to display fast changes in their data.

      `GTK2.Databox x=GTK2.Databox(); x->data_add_x_y(3, ({ 1.0, 0.5, 0.0 }), ({1.0, -1.0, 0.0}),GTK2.GdkColor(Image.Color.red), GTK2.DataboxLines,2); x->rescale(); x->set_size_request(300,300); return x;`

      Signals: marked

      selection_canceled

      selection_changed

      selection_started

      selection_stopped

      zoomed

    Inherit Vbox

      inherit GTK2.Vbox : Vbox

    Method create

      `GTK2.Databox GTK2.Databox()`

    Description

      Create a new databox widget

    Method data_add

      `int data_add(int nelems, array x, array y, GTK2.GdkColor color, int type, int dot_size)`

    Description

      Type is one of DATABOX_BARS , DATABOX_CROSS_SIMPLE , DATABOX_GRID , DATABOX_LINES , DATABOX_NOT_DISPLAYED and DATABOX_POINTS

    Method data_get_color

      `GTK2.GdkColor data_get_color(int index)`

    Description

      Get the color at index.

    Method data_get_extrema

      `array data_get_extrema()`

    Method data_get_grid_config

      `int data_get_grid_config(int index)`

    Description

      See data_set_grid_config().

    Method data_get_type

      `array data_get_type(int index)`

    Description

      Return type and dot size at index.

    Method data_get_value

      `mapping data_get_value(int x, int y)`

    Method data_get_visible_extrema

      `array data_get_visible_extrema()`

    Method data_remove

      `int data_remove(int index)`

    Description

      Remove data at index.

    Method data_remove_all

      `int data_remove_all()`

    Description

      Remove all data.

    Method data_set_color

      `int data_set_color(int index, GTK2.GdkColor color)`

    Method data_set_grid_config

      `int data_set_grid_config(int index, int hlines, int vlines)`

    Description

      Not useful unless the data type is GTK2.DATABOX_GRID.

    Method data_set_type

      `int data_set_type(int index, int type, int dot_size)`

    Description

      Type is one of DATABOX_BARS , DATABOX_CROSS_SIMPLE , DATABOX_GRID , DATABOX_LINES , DATABOX_NOT_DISPLAYED and DATABOX_POINTS

    Method get_rulers_enable

      `GTK2.Databox get_rulers_enable()`

    Description

      Get whether rulers will be displayed.

    Method get_scrollbars_enable

      `GTK2.Databox get_scrollbars_enable()`

    Description

      Get whether scrollbars will be displayed.

    Method get_selection_enable

      `int get_selection_enable()`

    Description

      Get whether selection is enabled.

    Method get_selection_fill_enable

      `int get_selection_fill_enable()`

    Description

      Get whether the selection will be filled.

    Method get_zoom_enable

      `GTK2.Databox get_zoom_enable()`

    Description

      Get whether zoom is enabled.

    Method get_zoom_limit

      `float get_zoom_limit()`

    Description

      Get the zoom limit.

    Method redraw

      `GTK2.Databox redraw()`

    Description

      Redraw.

    Method rescale

      `GTK2.Databox rescale()`

    Method rescale_inverted

      `GTK2.Databox rescale_inverted(int invertX, int invertY)`

    Description

      Rescale with an inverted x and/or y direction.

    Method rescale_with_values

      `GTK2.Databox rescale_with_values(float minx, float miny, float maxx, float maxy)`

    Method set_background_color

      `GTK2.Databox set_background_color(GTK2.GdkColor color)`

    Description

      Set the background color.

    Method set_rulers_enable

      `GTK2.Databox set_rulers_enable(int setting)`

    Description

      Set whether rulers will be displayed.

    Method set_scrollbars_enable

      `GTK2.Databox set_scrollbars_enable(int setting)`

    Description

      Set whether scrollbars will be displayed.

    Method set_selection_enable

      `GTK2.Databox set_selection_enable(int setting)`

    Description

      Set whether selection is enabled.

    Method set_selection_fill_enable

      `GTK2.Databox set_selection_fill_enable(int setting)`

    Description

      Set whether the selection will be filled.

    Method set_zoom_enable

      `GTK2.Databox set_zoom_enable(int setting)`

    Description

      Set whether zoom is enabled.

    Method set_zoom_limit

      `GTK2.Databox set_zoom_limit(float limit)`

    Description

      Set the zoom limit. Default is 0.01, which is 100 times.

  CLASS GTK2.IconView

    Description

      GTK2.IconView provides an alternative view on a list model. It displays the model as a grid of icons with labels. Like GTK2.TreeView, it allows to select one or multiple items (depending on the selection mode). In addition to seleciton with the arrow keys, GTK2.IconView supports rubberband selections, which is controlled by dragging the pointer. Properties: int column-spacing int columns int item-width int margin int markup-column GTK2.TreeModel model int orientation int pixbuf-column int row-spacing int selection-mode int spacing int text-column

      Style properties: int selection-box-alpha GDK2.Color selection-box-color

      Signals: activate_cursor_item

      item_activated

      move_cursor

      select_all

      select_cursor_item

      selection_changed

      set_scroll_adjustments

      toggle_cursor_item

      unselect_all

    Inherit Container

      inherit GTK2.Container : Container

    Method create

      `GTK2.IconView GTK2.IconView(GTK2.TreeModel model_or_props)`

    Description

      Creates a new GTK2.IconView widget Not implemented yet.

    Method get_column_spacing

      `int get_column_spacing()`

    Description

      Returns the value of the column-spacing property.

    Method get_columns

      `int get_columns()`

    Description

      Returns the value of the columns property.

    Method get_cursor

      `array get_cursor()`

    Description

      Returns the GTK2.TreePath and GTK2.CellRenderer of the current cursor path and cell. If the cursor isn't currently set, then path will be 0. If no cell currently has focus, then cell will be 0.

    Method get_item_at_pos

      `array get_item_at_pos(int x, int y)`

    Description

      Finds the path at the point (x,y) relative to widget coordinates. In contrast to get_path_at_pos(), this function also obtains the cell at the specified position.

    Method get_item_width

      `int get_item_width()`

    Description

      Returns the value of the item-width property.

    Method get_margin

      `int get_margin()`

    Description

      Returns the value of the margin property.

    Method get_markup_column

      `int get_markup_column()`

    Description

      Returns the column with markup text.

    Method get_model

      `GTK2.TreeModel get_model()`

    Description

      Gets the model.

    Method get_orientation

      `int get_orientation()`

    Description

      Returns the value of the orientation property.

    Method get_path_at_pos

      `GTK2.TreePath get_path_at_pos(int x, int y)`

    Description

      Finds the path at the point(x,y) relative to widget coordinates.

    Method get_pixbuf_column

      `int get_pixbuf_column()`

    Description

      Returns the column with pixbufs.

    Method get_reorderable

      `int get_reorderable()`

    Description

      Retrieves whether the user can reorder the list via drag-and-drop.

    Method get_row_spacing

      `int get_row_spacing()`

    Description

      Returns the value of the row-spacing property.

    Method get_selected_items

      `array get_selected_items()`

    Description

      Creates a list of paths of all selected items. Not implemented yet.

    Method get_selection_mode

      `int get_selection_mode()`

    Description

      Gets the selection mode.

    Method get_spacing

      `int get_spacing()`

    Description

      Returns the value of the spacing property

    Method get_text_column

      `int get_text_column()`

    Description

      Returns the column with text.

    Method get_visible_range

      `array get_visible_range()`

    Description

      Returns the first and last visible path. Note that there may be invisible paths in between.

    Method item_activated

      `GTK2.IconView item_activated(GTK2.TreePath path)`

    Description

      Activates the item determined by path.

    Method path_is_selected

      `int path_is_selected(GTK2.TreePath path)`

    Description

      Returns true if the icon pointed to by path is currently selected. If icon does not point to a valid location, false is returned.

    Method scroll_to_path

      `GTK2.IconView scroll_to_path(GTK2.TreePath path, int use_align, float row_align, float col_align)`

    Description

      Moves the alignments to the position specified by path. row_align determines where the row is placed, and col_align determines where column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center.

      If use_align is FALSE, then the alignment arguments are ignored, and the tree does the minimum amount of work to scroll the item onto the screen. This means that the item will be scrolled to the edge closest to its current position. If the item is currently visible on the screen, nothing is done.

      This funciton only works if the model is set, and path is a valid row on the model. If the model changes before this icon view is realized, the centered path will be modified to reflect this change.

    Method select_all

      `GTK2.IconView select_all()`

    Description

      Selects all the icons. This widget must have its selection mode set to GTK2.SELECTION_MULTIPLE.

    Method select_path

      `GTK2.IconView select_path(GTK2.TreePath path)`

    Description

      Selects the row at path

    Method set_column_spacing

      `GTK2.IconView set_column_spacing(int column_spacing)`

    Description

      Sets the column-spacing property which specifies the space which is inserted between the columns of the icon view.

    Method set_columns

      `GTK2.IconView set_columns(int columns)`

    Description

      Sets the columns property which determines in how many columns the icons are arranged. If columns is -1, the number of columns will be chosen automatically to fill the available area.

    Method set_cursor

      `GTK2.IconView set_cursor(GTK2.TreePath path, GTK2.CellRenderer cell, int|void start_editing)`

    Description

      Sets the current keyboard focus to be at path, and selects it. This is usefull when you want to focus the user's attention on a particular item. If cell is not 0, then focus is given to the cell speicified by it. Additionally, if start_editing is TRUE, then editing should be started in the specified cell.

      This function is often followed by grab_focus() in order to give keyboard focus to the widget.

    Method set_item_width

      `GTK2.IconView set_item_width(int item_width)`

    Description

      Sets the item-width property which specifies the width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size.

    Method set_margin

      `GTK2.IconView set_margin(int margin)`

    Description

      Sets the margin property.

    Method set_markup_column

      `GTK2.IconView set_markup_column(int column)`

    Description

      Sets the column with markup information to be column.

    Method set_model

      `GTK2.IconView set_model(GTK2.TreeModel model)`

    Description

      Sets the model.

    Method set_orientation

      `GTK2.IconView set_orientation(int orientation)`

    Description

      Sets the orientation property which determines whether the labels are drawn beside the icons instead of below. One of ORIENTATION_HORIZONTAL and ORIENTATION_VERTICAL

    Method set_pixbuf_column

      `GTK2.IconView set_pixbuf_column(int column)`

    Description

      Sets the column with pixbufs to be column.

    Method set_reorderable

      `GTK2.IconView set_reorderable(int setting)`

    Description

      This function is a convenience function to allow you to reorder models. Both GTK2.TreeStore and GTK2.ListStore support this. If setting is TRUE, then the user can reorder the model by dragging and dropping rows. The developer can listen to these changes by connecting to the model's "row-inserted" and "row-deleted" signals.

    Method set_row_spacing

      `GTK2.IconView set_row_spacing(int row_spacing)`

    Description

      Sets the row-spacing property which specifies the space which is inserted between the rows of the icon view.

    Method set_selection_mode

      `GTK2.IconView set_selection_mode(int mode)`

    Description

      Sets the selection mode. One of SELECTION_BROWSE , SELECTION_MULTIPLE , SELECTION_NONE and SELECTION_SINGLE

    Method set_spacing

      `GTK2.IconView set_spacing(int spacing)`

    Description

      Sets the spacing property which specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.

    Method set_text_column

      `GTK2.IconView set_text_column(int column)`

    Description

      Sets the column with text to be column.

    Method unselect_all

      `GTK2.IconView unselect_all()`

    Description

      Unselects all the icons.

    Method unselect_path

      `GTK2.IconView unselect_path(GTK2.TreePath path)`

    Description

      Unselects the row at path

  CLASS GTK2.Gnome2CanvasEllipse

    Inherit CanvasRE

      inherit Gnome2.CanvasRE : CanvasRE

  CLASS GTK2.CellView

    Description

      Properties: string background GDK2.Color background-gdk int background-set

    Inherit Widget

      inherit GTK2.Widget : Widget

    Inherit CellLayout

      inherit GTK2.CellLayout : CellLayout

    Method create

      `GTK2.CellView GTK2.CellView(string|GdkPixbuf|mapping text, int|void markup)`

    Description

      Create a new W(CellView) widget.

    Method get_cell_renderers

      `array get_cell_renderers()`

    Description

      Returns the cell renderers which have been added to this view.

    Method get_displayed_row

      `GTK2.TreePath get_displayed_row()`

    Description

      Returns a W(TreePath) referring to the currently displayed row. If no row is currently displayed, 0 is returned.

    Method get_size_of_row

      `mapping get_size_of_row(GTK2.TreePath path)`

    Description

      Returns width and height of the size needed to display the model row pointed to by path.

    Method set_background_color

      `GTK2.CellView set_background_color(GTK2.GdkColor color)`

    Description

      Sets the background color.

    Method set_displayed_row

      `GTK2.CellView set_displayed_row(GTK2.TreePath path)`

    Description

      Sets the row of the model that is currently displayed. If the path is omitted, then the contents of the cellview "stick" at their last value; this is not normally a desired result, but may be a needed intermediate state if say, the mode becomes temporarily empty.

    Method set_model

      `GTK2.CellView set_model(GTK2.TreeModel model)`

    Description

      Sets the model. If this view already has a model set, it will remove it before setting the new model.

  CLASS GTK2.HScrollbar

    Description

      A horizontal scrollbar. General documentation: See W(Scrollbar) `GTK2.HScrollbar(GTK2.Adjustment())->set_size_request(300,15)`

    Inherit Scrollbar

      inherit GTK2.Scrollbar : Scrollbar

    Method create

      `GTK2.HScrollbar GTK2.HScrollbar(GTK2.Adjustment adjustment_or_props)`

    Description

      Used to create a new hscrollbar widget.

  CLASS GTK2.TreeModelFilter

    Description

      Properties: GTK2.TreeModel child-model GTK2.TreePath virtual-root

    Inherit Object

      inherit G.Object : Object

    Inherit TreeModel

      inherit GTK2.TreeModel : TreeModel

    Inherit TreeDragSource

      inherit GTK2.TreeDragSource : TreeDragSource

    Method convert_child_iter_to_iter

      `GTK2.TreeIter convert_child_iter_to_iter(GTK2.TreeIter child_iter)`

    Description

      Returns an iter pointing to the row in this model that corresponds to the row pointed at by child_iter.

    Method convert_child_path_to_path

      `GTK2.TreePath convert_child_path_to_path(GTK2.TreePath child_path)`

    Description

      Converts child_path to a path relative to this model. That is, child_path points to a path in the child mode. The returned path will point to the same row in the sorted model.

    Method convert_iter_to_child_iter

      `GTK2.TreeIter convert_iter_to_child_iter(GTK2.TreeIter sorted_iter)`

    Description

      Returns an iter pointing to the row in this model that corresponds to the row pointed at by sorted_iter.

    Method convert_path_to_child_path

      `GTK2.TreePath convert_path_to_child_path(GTK2.TreePath sorted_path)`

    Description

      Converts sorted_path to a path on the child model.

    Method create

      `GTK2.TreeModelFilter GTK2.TreeModelFilter(GTK2.TreeModel model, GTK2.TreePath root)`

    Description

      Create a new GTK2.TreeModel, with model as the child model.

    Method refilter

      `GTK2.TreeModelFilter refilter()`

    Description

      Emits "row-changed" for each row in the child model, which causes the filter to re-evaluate whether a row is visible or not.

    Method set_visible_func

      `GTK2.TreeModelFilter set_visible_func(function f, mixed user_data)`

    Description

      Sets the comparison function used when sorting to be f. If the current sort column id of this sortable is the same as column, then the model will sort using this function.

  CLASS GTK2.FileChooserDialog

    Description

      GtkFileChooserDialog should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list, the drop-down history menu, or the TAB key can be used to navigate using filename completion common in text based editors such as emacs and jed.

      The default filename can be set using set_filename() and the selected filename retrieved using get_filename().

      Use complete() to display files that match a given pattern. This can be used for example, to show only *.txt files, or only files beginning with gtk*.

      Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using hide_fileop_buttons() and shown again using show_fileop_buttons().

      `GTK2.FileChooserDialog("File selector", 0, GTK2.FILE_CHOOSER_ACTION_OPEN, ({(["text":"Transmogrify", "id":17]), (["text":"Never mind", "id":42])}))`

    Inherit Dialog

      inherit GTK2.Dialog : Dialog

    Inherit FileChooser

      inherit GTK2.FileChooser : FileChooser

    Method create

      `GTK2.FileChooserDialog GTK2.FileChooserDialog(string title, GTK2.Window parent, int mode, array buttons)`

    Description

      Creates a new file selection dialog box. By default it will list the files in the current working directory. Operation buttons allowing the user to create a directory, delete files, and rename files will also be present by default.

  CLASS GTK2.ComboBoxEntry

    Description

      Properties: int text-column

    Inherit ComboBox

      inherit GTK2.ComboBox : ComboBox

    Inherit CellLayout

      inherit GTK2.CellLayout : CellLayout

    Inherit CellEditable

      inherit GTK2.CellEditable : CellEditable

    Method create

      `GTK2.ComboBoxEntry GTK2.ComboBoxEntry(string|TreeModel|mapping model, int|void text_column)`

    Description

      Create a new ComboBoxEntry, either empty or with a model.

    Method entry

      `GTK2.Widget entry()`

    Description

      Returns the GTK2.Entry widget

    Method get_text_column

      `int get_text_column()`

    Description

      Returns the column which this widget is using to get the strings from.

    Method set_text_column

      `GTK2.ComboBoxEntry set_text_column(int text_column)`

    Description

      Sets the model column which this widget should use to get strings from.

  CLASS GTK2.Container

    Description

      The basic container class. Properties: int border-width GTK2.Widget child int resize-mode RESIZE_IMMEDIATE , RESIZE_PARENT and RESIZE_QUEUE

      Signals: add Called when a new object is added to the container. (used internally)

      check_resize Called when the container needs resizing (used internally)

      remove Called when a object is removed from the container (used internally)

      set_focus_child

    Inherit Widget

      inherit GTK2.Widget : Widget

    Method add

      `GTK2.Container add(GTK2.Widget widget)`

    Description

      Add a subwidget to the container. Don't forget to call show() in the subwidget. Some (even most) containers can only contain one child. Calling this function might result in a resize of the container.

    Method check_resize

      `GTK2.Container check_resize()`

    Description

      Undocumented

    Method get_border_width

      `int get_border_width()`

    Description

      Retrieves the border width.

    Method get_children

      `array get_children()`

    Description

      This function returns all children of the container as an array.

    Method get_focus_chain

      `array get_focus_chain()`

    Description

      Returns the focus chain.

    Method get_focus_hadjustment

      `GTK2.Adjustment get_focus_hadjustment()`

    Description

      Retrieves the horizontal focus adjustment.

    Method get_focus_vadjustment

      `GTK2.Adjustment get_focus_vadjustment()`

    Description

      Retrieves the vertical focus adjustment.

    Method get_resize_mode

      `int get_resize_mode()`

    Description

      Returns the resize mode.

    Method remove

      `GTK2.Container remove(GTK2.Widget widget)`

    Description

      Remove a child from the container. The argument is the child to remove. Calling this function might result in a resize of the container.

    Method resize_children

      `GTK2.Container resize_children()`

    Description

      Undocumented.

    Method set_border_width

      `GTK2.Container set_border_width(int width)`

    Description

      Sets the border width.

    Method set_focus_chain

      `GTK2.Container set_focus_chain(array focusable_widgets)`

    Description

      Sets a focus chain, overriding the one computer automatically by GTK+.

      In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed.

    Method set_focus_child

      `GTK2.Container set_focus_child(GTK2.Widget child)`

    Description

      Emulate a set_focus_child signal. Focus on the specified child.

    Method set_focus_hadjustment

      `GTK2.Container set_focus_hadjustment(GTK2.Adjustment adj)`

    Description

      Set the hadjustment used to focus children.

    Method set_focus_vadjustment

      `GTK2.Container set_focus_vadjustment(GTK2.Adjustment adj)`

    Description

      Set the vadjustment used to focus children.

    Method set_reallocate_redraws

      `GTK2.Container set_reallocate_redraws(int setting)`

    Description

      Sets the reallocate_redraws flag.

    Method set_resize_mode

      `GTK2.Container set_resize_mode(int mode)`

    Description

      One of RESIZE_IMMEDIATE , RESIZE_PARENT and RESIZE_QUEUE

  CLASS GTK2.TextView

    Description

      Properties: int accepts-tab GTK2.TextBuffer buffer int cursor-visible int editable int indent int justification int left-margin int overwrite int pixels-above-lines int pixels-below-lines int pixels-inside-wrap int right-margin Pango.TabArray tabs int wrap-mode

      Style properties: GDK2.Color error-underline-color

      Signals: backspace

      copy_clipboard

      cut_clipboard

      delete_from_cursor

      insert_at_cursor

      move_cursor

      move_focus

      move_viewpoert

      page_horizontally

      paste_clipboard

      populate_popup

      select_all

      set_anchor

      set_scroll_adjustments

      toggle_overwrite

    Inherit Container

      inherit GTK2.Container : Container

    Method add_child_at_anchor

      `GTK2.TextView add_child_at_anchor(GTK2.Widget child, GTK2.TextChildAnchor anchor)`

    Description

      Adds a child widget in the text buffer, at the given anchor.

    Method add_child_in_window

      `GTK2.TextView add_child_in_window(GTK2.Widget child, int wintype, int xpos, int ypos)`

    Description

      Adds a child at fixed coordinates in one of the text widget's windows. The window must have nonzero size (see GTK2.TextView->set_border_window_size()). Note that the child coordinates are given relative to the GDK2.Window in question, and that these coordinates have no sane relationship to scrolling. When placing a child in GTK2.TEXT_WINDOW_WIDGET, scrolling is irrelevant, the child floats above all scrollable areas. But when placing a child in one of the scrollable windows (border windows or text window), you'll need to compute the child's correct position in buffer coordinates any time scrolling occurs or buffer changes occur, and then call GTK2.TextView->move_child() to update the child's position. Unfortunately there's no good way to detect that scrolling has occurred, using the current API; a possible hack would be to update all child positions when the scroll adjustments change or the text buffer changes.

    Method backward_display_line

      `int backward_display_line(GTK2.TextIter iter)`

    Description

      See forward_display_line().

    Method backward_display_line_start

      `int backward_display_line_start(GTK2.TextIter iter)`

    Description

      Moves the iter backward to the next display line start.

    Method buffer_to_window_coords

      `array buffer_to_window_coords(int wintype, int buffer_x, int buffer_y)`

    Description

      Converts coordinate (buffer_x,buffer_y) to coordinates for the window win, and returns the results. wintype is one of TEXT_WINDOW_BOTTOM , TEXT_WINDOW_LEFT , TEXT_WINDOW_PRIVATE , TEXT_WINDOW_RIGHT , TEXT_WINDOW_TEXT , TEXT_WINDOW_TOP and TEXT_WINDOW_WIDGET .

    Method create

      `GTK2.TextView GTK2.TextView(GTK2.TextBuffer buffer_or_props)`

    Description

      Create a new W(TextView).

    Method forward_display_line

      `int forward_display_line(GTK2.TextIter iter)`

    Description

      Moves iter forward by one display (wrapped) line. A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view's width; paragraphs are the same in all view, since they depend on the contents of the W(TextBuffer).

    Method forward_display_line_end

      `int forward_display_line_end(GTK2.TextIter iter)`

    Description

      Moves the iter forward to the next display line end.

    Method get_accepts_tab

      `int get_accepts_tab()`

    Description

      Returns whether pressing the Tab key inserts a tab character.

    Method get_border_window_size

      `int get_border_window_size(int wintype)`

    Description

      Gets the width of the specified border window.

    Method get_buffer

      `GTK2.TextBuffer get_buffer()`

    Description

      Returns the buffer displayed by this view.

    Method get_cursor_visible

      `int get_cursor_visible()`

    Description

      Find out whether the cursor is being displayed.

    Method get_default_attributes

      `GTK2.TextAttributes get_default_attributes()`

    Description

      Obtains a copy of the default text attributes. These are the attributes used for text unless a tag overrides them.

    Method get_editable

      `int get_editable()`

    Description

      Gets the default editability.

    Method get_indent

      `int get_indent()`

    Description

      Gets the default indentation for paragraphs.

    Method get_iter_at_location

      `GTK2.TextIter get_iter_at_location(int x, int y)`

    Description

      Retrieves the iterator at buffer coordinates x and y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portions. If you have coordinates from an event, you have to convert those to buffer coordinates with window_to_buffer_coords().

    Method get_iter_at_position

      `GTK2.TextIter get_iter_at_position(int x, int y)`

    Description

      Retrieves the iterator pointing to the character at buffer coordinates x and y.

    Method get_iter_location

      `GTK2.GdkRectangle get_iter_location(GTK2.TextIter iter)`

    Description

      Gets a rectangle which roughly contains the character at iter. The rectangle position is in buffer coordinates; use buffer_to_window_coords() to convert these coordinates to coordinates for one of the windows in the text view.

    Method get_justification

      `int get_justification()`

    Description

      Gets the default justification.

    Method get_left_margin

      `int get_left_margin()`

    Description

      Gets the default left margin size of paragraphs.

    Method get_line_at_y

      `GTK2.TextIter get_line_at_y(int y)`

    Description

      Returns a W(TextIter) for the start of the line containing the coordinate y. y is in buffer coordinates, convert from window coordinates with window_to_buffer_coords().

    Method get_line_yrange

      `mapping get_line_yrange(GTK2.TextIter iter)`

    Description

      Gets the y coordinate of the top of the line containing iter, and the height of the line. The coordinate is a buffer coordinate; convert to window coordinates with buffer_to_window_coords().

    Method get_overwrite

      `int get_overwrite()`

    Description

      Returns whether the view is in overwrite mode or not.

    Method get_pixels_above_lines

      `int get_pixels_above_lines()`

    Description

      Gets the default number of pixels to put above paragraphs.

    Method get_pixels_below_lines

      `int get_pixels_below_lines()`

    Description

      Gets the value set by set_pixels_below_lines().

    Method get_pixels_inside_wrap

      `int get_pixels_inside_wrap()`

    Description

      Gets the value set by set_pixels_inside_wrap().

    Method get_right_margin

      `int get_right_margin()`

    Description

      Gets the default right margin size of paragraphs.

    Method get_tabs

      `GTK2.Pango.TabArray get_tabs()`

    Description

      Gets the default tabs. Tags in the buffer may override the defaults. The return value will be 0 if "standard" (8-space) tabs are used.

    Method get_visible_rect

      `GTK2.GdkRectangle get_visible_rect()`

    Description

      Returns a rectangle with the currently-visible region of the buffer, in buffer coordinates. Convert to window coordinates with buffer_to_window_coords().

    Method get_window

      `GTK2.GdkWindow get_window(int wintype)`

    Description

      Retrieves the GDK2.Window corresponding to an area of the text view; possible windows include the overall widget window, child windows on the left, right, top, bottom, and the window that displays the text buffer. Windows are 0 and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized.

    Method get_window_type

      `int get_window_type(GTK2.GdkWindow window)`

    Description

      Usually used to find out which window an event corresponds to. If you connect to an event signal, this function should be called on event->window to see which window it was. One of TEXT_WINDOW_BOTTOM , TEXT_WINDOW_LEFT , TEXT_WINDOW_PRIVATE , TEXT_WINDOW_RIGHT , TEXT_WINDOW_TEXT , TEXT_WINDOW_TOP and TEXT_WINDOW_WIDGET .

    Method get_wrap_mode

      `int get_wrap_mode()`

    Description

      Gets the line wrapping mode.

    Method move_child

      `GTK2.TextView move_child(GTK2.Widget child, int x, int y)`

    Description

      Updates the position of a child.

    Method move_mark_onscreen

      `int move_mark_onscreen(GTK2.TextMark mark)`

    Description

      Moves a mark within the buffer so that it's located within the currently visible text-area.

    Method move_visually

      `int move_visually(GTK2.TextIter iter, int count)`

    Description

      Move the iterator a given number of characters visually, treating it as the strong cursor position. If count is positive, then the new strong cursor position will be count positions to the right of the old cursor position. If count is negative then the new strong cursor position will be count positions to the left of the old cursor position.

      In the presence of bidirection text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off the end of a run.

    Method place_cursor_onscreen

      `int place_cursor_onscreen()`

    Description

      Moves the cursor to the currently visible region of the buffer, if it isn't there already.

    Method scroll_mark_onscreen

      `GTK2.TextView scroll_mark_onscreen(GTK2.TextMark mark)`

    Description

      Scrolls the view the minimum distance such that mark is contained within the visible area.

    Method scroll_to_iter

      `GTK2.TextView scroll_to_iter(GTK2.TextIter iter, float within_margin, int use_align, float xalign, float yalign)`

    Description

      Scrolls the view so that iter is on the screen as with scroll_to_mark().

    Method scroll_to_mark

      `GTK2.TextView scroll_to_mark(GTK2.TextMark mark, float within_margin, int use_align, float xalign, float yalign)`

    Description

      Scrolls the view so that mark is on the screen in the position indicated by xalign and yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is false, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by the margin of size within_margin.

    Method set_accepts_tab

      `GTK2.TextView set_accepts_tab(int accepts_tab)`

    Description

      Sets the behavior of the text widget when the Tab key is pressed. If accepts_tab is true a tab character is inserted. If accepts_tab is false the keyboard focus is moved to the next widget in the focus chain.

    Method set_border_window_size

      `GTK2.TextView set_border_window_size(int wintype, int size)`

    Description

      Sets the width of GTK2.TEXT_WINDOW_LEFT or GTK2.TEXT_WINDOW_RIGHT, or the height of GTK2.TEXT_WINDOW_TOP or GTK2.TEXT_WINDOW_BOTTOM. Automatically destroys the corresponding window if the size is set to 0, and creates the window if the size is set to non-zero. This function can only be used for the "border windows", it doesn't work with GTK2.TEXT_WINDOW_WIDGET, GTK2.TEXT_WINDOW_TEXT, or GTK2.TEXT_WINDOW_PRIVATE.

    Method set_buffer

      `GTK2.TextView set_buffer(GTK2.TextBuffer buffer)`

    Description

      Sets buffer as the buffer being displayed.

    Method set_cursor_visible

      `GTK2.TextView set_cursor_visible(int setting)`

    Description

      Toggles whether the insertion point is displayed. A buffer with no editable text probably shouldn't have a visible cursor, so you may want to turn the cursor off.

    Method set_editable

      `GTK2.TextView set_editable(int setting)`

    Description

      Sets the default editability. You can override this default setting with tags in the buffer, using the "editable" attribute of tags.

    Method set_indent

      `GTK2.TextView set_indent(int indent)`

    Description

      Sets the default indentation for paragraphs. May be overridden by tags.

    Method set_justification

      `GTK2.TextView set_justification(int just)`

    Description

      Sets the default justification of text. One of JUSTIFY_CENTER , JUSTIFY_FILL , JUSTIFY_LEFT and JUSTIFY_RIGHT .

    Method set_left_margin

      `GTK2.TextView set_left_margin(int margin)`

    Description

      Sets the default left margin. May be overridden by tags.

    Method set_overwrite

      `GTK2.TextView set_overwrite(int overwrite)`

    Description

      Changes the overwrite mode, true for on, false for off.

    Method set_pixels_above_lines

      `GTK2.TextView set_pixels_above_lines(int pixels)`

    Description

      Sets the default number of blank pixels above paragraphs. Tags in the buffer may override the defaults.

    Method set_pixels_below_lines

      `GTK2.TextView set_pixels_below_lines(int pixels)`

    Description

      Sets the default number of blank pixels to put below paragraphs. May be overridden by tags applied to the buffer.

    Method set_pixels_inside_wrap

      `GTK2.TextView set_pixels_inside_wrap(int pixels)`

    Description

      Sets the default number of pixels of blank space to leave between displayed/wrapped lines within a paragraph. May be overridden by tags.

    Method set_right_margin

      `GTK2.TextView set_right_margin(int margin)`

    Description

      Sets the default right margin. May be overridden by tags.

    Method set_tabs

      `GTK2.TextView set_tabs(GTK2.Pango.TabArray tabs)`

    Description

      Sets the default tab stops for paragraphs. Tags in the buffer may override the default.

    Method set_wrap_mode

      `GTK2.TextView set_wrap_mode(int wrap_mode)`

    Description

      Sets the line wrapping. One of WRAP_CHAR , WRAP_NONE , WRAP_WORD and WRAP_WORD_CHAR .

    Method starts_display_line

      `int starts_display_line(GTK2.TextIter iter)`

    Description

      Determines whether iter is at the start of a display line.

    Method window_to_buffer_coords

      `array window_to_buffer_coords(int wintype, int window_x, int window_y)`

    Description

      Converts coordinates on the window identified by wintype to buffer coordinates, returning the result.

  CLASS GTK2.Vpaned

    Description

      The paned window widgets are useful when you want to divide an area into two parts, with the relative size of the two parts controlled by the user. A groove is drawn between the two portions with a handle that the user can drag to change the ratio. This widgets makes a vertical division

      `GTK2.Vpaned()->add1(GTK2.Label("Top Side Of Pane"))->add2(GTK2.Label("Bottom"))->set_size_request(100,100)`

    Inherit Paned

      inherit GTK2.Paned : Paned

    Method create

      `GTK2.Vpaned GTK2.Vpaned(mapping|void props)`

    Description

      Create a new W(Vpaned) widget.

  CLASS GTK2.Expander

    Description

      Properties: int expanded string label GTK2.Widget label-widget int spacing int use-markup int use-underline

      Style properties: int expander-size int expander-spacing

      Signals: activate

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.Expander GTK2.Expander(string|mapping label)`

    Description

      Create a new GTK2.Expander. Set mnemonic to 1 for a mnemonic expander, otherwise omitting it creates a regular expander.

    Method get_expanded

      `int get_expanded()`

    Description

      Returns true if the child widget is revealed.

    Method get_label

      `string get_label()`

    Description

      Fetches the text from the label of the expander.

    Method get_label_widget

      `GTK2.Widget get_label_widget()`

    Description

      Retrieves the label widget for the frame.

    Method get_spacing

      `int get_spacing()`

    Description

      Returns the spacing.

    Method get_use_markup

      `int get_use_markup()`

    Description

      Returns whether the label's text is interpreted as marked up with the Pango text markup language.

    Method get_use_underline

      `int get_use_underline()`

    Description

      Returns whether an embedded underline in the label indicates a mnemonic.

    Method set_expanded

      `GTK2.Expander set_expanded(int expanded)`

    Description

      Sets the state of the expander. Set to true if you want the child widget to be revealed, and false if you want the child widget to be hidden.

    Method set_label

      `GTK2.Expander set_label(string label)`

    Description

      Sets the text of the label of the expander.

    Method set_label_widget

      `GTK2.Expander set_label_widget(GTK2.Widget label)`

    Description

      Set the label widget for the expander. This is the widget that will appear embedded alongside the expander arrow.

    Method set_spacing

      `GTK2.Expander set_spacing(int spacing)`

    Description

      Sets the spacing field of the expander, which is the number of pixels to place between the expander and the child.

    Method set_use_markup

      `GTK2.Expander set_use_markup(int use_markup)`

    Description

      Sets whether the text of the label contains markup in Pango's text markup language.

    Method set_use_underline

      `GTK2.Expander set_use_underline(int use_underline)`

    Description

      If true, an underline in the text of the label indicates the next character should be used for the mnemonic accelarator key.

  CLASS GTK2.FileChooser

    Description

      Properties: int action GTK2.Widget extra-widget string file-system-backend GTK2.FileFilter filter int local-only GTk.Widget preview-widget int preview-widget-active int select-multiple int show-hidden int use-preview-label

      Signals: current_folder_changed

      file_activated

      selection_changed

      update_preview

    Method add_filter

      `GTK2.FileChooser add_filter(GTK2.FileFilter filter)`

    Description

      Adds filter to the list of filters that the user can select between. When a filter is selected, only files that are passed by that filter are displayed.

    Method add_shortcut_folder

      `int add_shortcut_folder(string folder)`

    Description

      Adds a folder to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "/usr/share/mydrawprogram/Clipart" folder to the volume list.

    Method add_shortcut_folder_uri

      `int add_shortcut_folder_uri(string uri)`

    Description

      Adds a folder URI to be displayed with the shortcut folders.

    Method get_action

      `int get_action()`

    Description

      Get the type of action the file chooser is performing.

    Method get_current_folder

      `string get_current_folder()`

    Description

      Gets the current folder as a local filename.

    Method get_current_folder_uri

      `string get_current_folder_uri()`

    Description

      Gets the current folder as a URI.

    Method get_do_overwrite_confirmation

      `int get_do_overwrite_confirmation()`

    Description

      Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists.

    Method get_extra_widget

      `GTK2.Widget get_extra_widget()`

    Description

      Gets the extra widget.

    Method get_filename

      `string get_filename()`

    Description

      Gets the filename for the currently select file.

    Method get_filenames

      `array get_filenames()`

    Description

      Get a list of all selected file and subfolders. The returned names are full absolute paths. If files in the current folder cannot be represented as local filenames, they will be ignored. If you want those files, You may want to use get_uris() instead.

    Method get_filter

      `GTK2.FileFilter get_filter()`

    Description

      Gets the current filter.

    Method get_local_only

      `int get_local_only()`

    Description

      Gets whether only local files can be selected in the file selector.

    Method get_preview_filename

      `string get_preview_filename()`

    Description

      Gets the filename that should be previewed in a custom preview widget.

    Method get_preview_uri

      `string get_preview_uri()`

    Description

      Gets the URI that should be previewed in a custom preview widget.

    Method get_preview_widget

      `GTK2.Widget get_preview_widget()`

    Description

      Gets the current preview widget.

    Method get_preview_widget_active

      `int get_preview_widget_active()`

    Description

      Gets whether the preview widget set by set_preview_widget_active() should be shown for the current filename.

    Method get_select_multiple

      `int get_select_multiple()`

    Description

      Gets whether multiple files can be selected.

    Method get_show_hidden

      `int get_show_hidden()`

    Description

      Gets whether hidden files and folders are displayed.

    Method get_uri

      `string get_uri()`

    Description

      Gets the URI for the currently selected file.

    Method get_uris

      `array get_uris()`

    Description

      List all the selected files and subfolders in the current folder. The returned names are full absolute URIs.

    Method get_use_preview_label

      `int get_use_preview_label()`

    Description

      Gets whether a stock label should be drawn with the name of the previewed file.

    Method list_filters

      `array list_filters()`

    Description

      Lists the current set of user-selectable filters.

    Method list_shortcut_folder_uris

      `array list_shortcut_folder_uris()`

    Description

      Queries the list of shortcut folders.

    Method list_shortcut_folders

      `array list_shortcut_folders()`

    Description

      Queries the list of shortcut folders.

    Method remove_filter

      `GTK2.FileChooser remove_filter(GTK2.FileFilter filter)`

    Description

      Removes filter from the list of filters that the user can select between.

    Method remove_shortcut_folder

      `GTK2.FileChooser remove_shortcut_folder(string folder)`

    Description

      Removes a folder from the list of shortcut folders.

    Method remove_shortcut_folder_uri

      `GTK2.FileChooser remove_shortcut_folder_uri(string uri)`

    Description

      Removes a folder URI.

    Method select_all

      `GTK2.FileChooser select_all()`

    Description

      Select all files.

    Method select_filename

      `int select_filename(string filename)`

    Description

      Selects a filename.

    Method select_uri

      `int select_uri(string uri)`

    Description

      Selects the file by uri.

    Method set_action

      `GTK2.FileChooser set_action(int action)`

    Description

      Sets type of action, from opening or saving a file, or opening or saving a folder. Options are: FILE_CHOOSER_ACTION_OPEN FILE_CHOOSER_ACTION_SAVE FILE_CHOOSER_ACTION_SELECT_FOLDER FILE_CHOOSER_ACTION_CREATE_FOLDER

    Method set_current_folder

      `int set_current_folder(string folder)`

    Description

      Sets the current folder from a local filename. The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

    Method set_current_folder_uri

      `int set_current_folder_uri(string uri)`

    Description

      Sets the current folder from a URI.

    Method set_current_name

      `GTK2.FileChooser set_current_name(string filename)`

    Description

      Sets current name.

    Method set_do_overwrite_confirmation

      `GTK2.FileChooser set_do_overwrite_confirmation(int setting)`

    Description

      Sets whether a file chooser in GTK2.FILE_CHOOSER_ACTION_SAVE mode will present a confirmation dialog if the users types a file name that already exists. This is FALSE by default.

      Regardless of this setting, the chooser will emit the "confirm-overwrite" signal when appropriate.

      If all you need is the stock confirmation dialog, set this property to TRUE. You can override the way confirmation is done by actually handling the "confirm-overwrite" signal.

    Method set_extra_widget

      `GTK2.FileChooser set_extra_widget(GTK2.Widget widget)`

    Description

      Sets an application-supplied widget to provide extra options to the user.

    Method set_filename

      `int set_filename(string filename)`

    Description

      Sets filename as the current filename. Same as unselect_all() followed by select_filename();

    Method set_filter

      `GTK2.FileChooser set_filter(GTK2.FileFilter filter)`

    Description

      Sets the current filter; only the files that pass the filter will be displayed. If the user-selectable list of filters is non-empty, then the filter should be one of the filters in that list. Setting the current filter when the list of filters is empty is useful if you want to restrict the displayed set of files without letting the user change it.

    Method set_local_only

      `GTK2.FileChooser set_local_only(int local_only)`

    Description

      Sets whether on local files can be selected.

    Method set_preview_widget

      `GTK2.FileChooser set_preview_widget(GTK2.Widget widget)`

    Description

      Sets an application-supplied widget to use to display a custom preview of the currently selected file. To implement a preview, after setting the preview widget, you connect to the "update-preview" signal, and call get_preview_filename() or get_preview_uri() on each change. If you can display a preview of the new file, update your widget and set the preview active using set_preview_widget_active(). Otherwise, set the preview inactive.

      When there is no application-supplied preview widget, or the application- supplied preview widget is not active, the file chooser may display an internally generated preview of the current file or it may display no preview at all.

    Method set_preview_widget_active

      `GTK2.FileChooser set_preview_widget_active(int setting)`

    Description

      Sets whether the preview widget set by set_preview_widget() should be shown for the current filename. When setting is set to false, the file chooser may display an internally generated preview of the current file or it may display no preview at all.

    Method set_select_multiple

      `GTK2.FileChooser set_select_multiple(int select_multiple)`

    Description

      Sets whether multiple files can be selected in the file selector. This is only relevant if the action is set to be FILE_CHOOSER_ACTION_OPEN or FILE_CHOOSER_ACTION_SAVE

    Method set_show_hidden

      `GTK2.FileChooser set_show_hidden(int setting)`

    Description

      Sets whether hidden files and folders are displayed.

    Method set_uri

      `int set_uri(string uri)`

    Description

      Sets the uri as the current file.

    Method set_use_preview_label

      `GTK2.FileChooser set_use_preview_label(int setting)`

    Description

      Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is true. Applications that want to draw the whole preview area themselves should set this to false and display the name themselves in their preview widget.

    Method unselect_all

      `GTK2.FileChooser unselect_all()`

    Description

      Unselect all files.

    Method unselect_filename

      `GTK2.FileChooser unselect_filename(string filename)`

    Description

      Unselects a currently selected filename.

    Method unselect_uri

      `GTK2.FileChooser unselect_uri(string uri)`

    Description

      Unselect the uri.

  CLASS GTK2.Item

    Description

      This class is inherited by all 'item' type of widgets.

      Signals: deselect

      select

      toggle

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method deselect

      `GTK2.Item deselect()`

    Description

      Emulate a 'deselect' event.

    Method select

      `GTK2.Item select()`

    Description

      Emulate a 'select' event.

    Method toggle

      `GTK2.Item toggle()`

    Description

      Emulate a 'toggle' event.

  CLASS GTK2.Gnome2CanvasRect

    Inherit CanvasRE

      inherit Gnome2.CanvasRE : CanvasRE

  CLASS GTK2.Gnome2Href

    Description

      This widget is a GtkButton button that contains a URL. When clicked it invokes the configured browser for the URL you provided.

      `GTK2.Gnome2Href( "http://www.gnome.org", "GNOME Web Site" )`

      `GTK2.Gnome2Href( "http://www.gnome.org" )`

      Properties: string text string url

      Style properties: GDK.Color link-color

    Inherit Button

      inherit GTK2.Button : Button

    Method create

      `Gnome2.Href GTK2.Gnome2Href(string url, string|void label)`

    Description

      Created a GNOME href object, a label widget with a clickable action and an associated URL. If label is set to 0, url is used as the label.

    Method get_text

      `string get_text()`

    Description

      Returns the contents of the label widget used to display the link text.

    Method get_url

      `string get_url()`

    Description

      Return the url

    Method set_text

      `Gnome2.Href set_text(string text)`

    Description

      Sets the internal label widget text (used to display a URL's link text) to the given value.

    Method set_url

      `Gnome2.Href set_url(string url)`

    Description

      Sets the internal URL

  CLASS GTK2.MenuItem

    Description

      Menu items, to be added to menus. Style properties: int arrow-spacing int horizontal-padding int selected-shadow-type int toggle-spacing

      Signals: activate

      activate_item

      toggle_size_allocate

      toggle_size_request

    Inherit Item

      inherit GTK2.Item : Item

    Method activate

      `GTK2.MenuItem activate()`

    Description

      Emulate an activate signal

    Method create

      `GTK2.MenuItem GTK2.MenuItem(string|mapping label_or_props)`

    Description

      If a string is supplied, a W(Label) widget is created using that string and added to the item. Otherwise, you should add another widget to the list item with -&gt;add().

    Method deselect

      `GTK2.MenuItem deselect()`

    Description

      Emulate a deselect signal

    Method get_right_justified

      `int get_right_justified()`

    Description

      Gets whether the menu item appears justified at the right side of the menu bar.

    Method get_submenu

      `GTK2.Widget get_submenu()`

    Description

      Gets the submenu underneath this menu item.

    Method remove_submenu

      `GTK2.MenuItem remove_submenu()`

    Description

      Remove the submenu for this menu button.

    Method select

      `GTK2.MenuItem select()`

    Description

      Emulate a select signal

    Method set_accel_path

      `GTK2.MenuItem set_accel_path(string path)`

    Description

      Sets the accelerator path.

    Method set_right_justified

      `GTK2.MenuItem set_right_justified(int setting)`

    Description

      Make the menu item stick to the right edge of it's container.

    Method set_submenu

      `GTK2.MenuItem set_submenu(GTK2.Widget menu)`

    Description

      Set the submenu for this menu button.

    Method toggle_size_allocate

      `GTK2.MenuItem toggle_size_allocate(int allocation)`

    Description

      Emits the "toggle-size-allocate" signal on the given item.

    Method toggle_size_request

      `int toggle_size_request(int requisition)`

    Description

      Emits the "toggle-size-request" signal on the given item.

  CLASS GTK2.Entry

    Description

      Use this widget when you want the user to input a single line of text. `GTK2.Entry()->set_text("Hello world")->set_editable(1)`

      Properties: int activates-default int cursor-position int editable int has-frame int invisible-char int max-length int scroll-offset int selection-bound string text int visibility int width-chars float xalign

      Style properties:

      Signals: activate

      backspace

      copy_clipboard

      cut_clipboard

      delete_from_cursor

      insert_at_cursor

      move_cursor

      paste_clipboard

      populate_popup

      toggle_overwrite

    Inherit Widget

      inherit GTK2.Widget : Widget

    Inherit CellEditable

      inherit GTK2.CellEditable : CellEditable

    Inherit Editable

      inherit GTK2.Editable : Editable

    Method create

      `GTK2.Entry GTK2.Entry(int|mapping maxlen_or_props)`

    Description

      Create a new W(Entry) widget.

    Method get_activates_default

      `int get_activates_default()`

    Description

      Retrieves the value set by set_activates_default().

    Method get_alignment

      `float get_alignment()`

    Description

      Gets the value set by set_alignment().

    Method get_completion

      `GTK2.EntryCompletion get_completion()`

    Description

      Returns the completion object.

    Method get_has_frame

      `int get_has_frame()`

    Description

      Gets the value set by set_has_frame().

    Method get_invisible_char

      `int get_invisible_char()`

    Description

      Retrieves the character displayed in place of the real characters for entries with visibility set to false.

    Method get_layout

      `GTK2.Pango.Layout get_layout()`

    Description

      Gets the Pango.Layout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with get_layout_offsets().

      Keep in mind that the layout text may contain a preedit string, so layout_index_to_text_index() and text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

    Method get_layout_offsets

      `mapping get_layout_offsets()`

    Description

      Obtains the position of the Pango.Layout used to render text in the entry, in widget coordinates. Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

      Also useful to convert mouse events into coordinates inside the Pango.Layout, e.g. to take some action if some part of the entry text is clicked.

      Keep in mind that the layout text may contain a preedit string, so layout_index_to_text_index() and text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

    Method get_max_length

      `int get_max_length()`

    Description

      Retrieves the maximum allowed length of the text.

    Method get_text

      `string get_text()`

    Description

      Returns the contents of the entry widget.

    Method get_visibility

      `int get_visibility()`

    Description

      Retrieves whether the text is visible.

    Method get_width_chars

      `int get_width_chars()`

    Description

      Gets the value set by set_width_chars().

    Method layout_index_to_text_index

      `int layout_index_to_text_index(int layout_index)`

    Description

      Converts from a position in the entry contents (returned by get_text()) to a position in the entry's Pango.Layout (returned by get_layout()), with text retrieved via Pango.Layout->get_text().

    Method set_activates_default

      `GTK2.Entry set_activates_default(int setting)`

    Description

      If setting is true, pressing Enter will activate the default widget for the window containing the entry. This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.

    Method set_alignment

      `GTK2.Entry set_alignment(float align)`

    Description

      Sets the alignment for the ocntents of the entry. This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.

    Method set_completion

      `GTK2.Entry set_completion(GTK2.EntryCompletion completion)`

    Description

      Sets completion to be the auxiliary completion object to use. All further configuration of the completion mechanism is done on completion using the GTK2.EntryCompletion API.

    Method set_has_frame

      `GTK2.Entry set_has_frame(int setting)`

    Description

      Sets whether the entry has a beveled frame around it.

    Method set_invisible_char

      `GTK2.Entry set_invisible_char(int ch)`

    Description

      Sets the character to use in place of the actual text when set_invisibility() has been called to set text visibility to false. i.e. this is the character used in "password" mode to show the user how many characters have been type. The default invisible char is an asterisk ('*'). If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

    Method set_max_length

      `GTK2.Entry set_max_length(int maxlen)`

    Description

      Sets the maximum allowed length of the contents. If the current contents are longer than the given length, then they will be truncated to fit. Range is 0-65536. 0 means no maximum.

    Method set_text

      `GTK2.Entry set_text(string text)`

    Description

      Set the text to the specified string, replacing the current contents.

    Method set_visibility

      `GTK2.Entry set_visibility(int visiblep)`

    Description

      0 indicates invisible text (password boxes, as an example)

    Method set_width_chars

      `GTK2.Entry set_width_chars(int n_chars)`

    Description

      changes the size request of the entry to be about the right size for n_chars characters. Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.

    Method text_index_to_layout_index

      `int text_index_to_layout_index(int text_index)`

    Description

      Opposite of layout_index_to_text_index().

  CLASS GTK2.IconInfo

    Description

      Contains information found when looking up an icon in an icon theme.

    Method copy

      `GTK2.IconInfo copy()`

    Description

      Make a copy.

    Method get_base_size

      `int get_base_size()`

    Description

      Gets the base size for the icon. The base size is a size for the icon that was specified by the icon theme creator. This may be different than the actual size of image; an example of this is small emblem icons that can be attached to a larger icon. These icons will be given the same base size as the larger icons to which they are attached.

    Method get_builtin_pixbuf

      `GTK2.GdkPixbuf get_builtin_pixbuf()`

    Description

      Gets the built-in image for this icon, if any. To allow GTK2+ to use built-in icon images, you must pass the GTK2.ICON_LOOKUP_USE_BUILTIN to GTK2.IconTheme->lookup_icon().

    Method get_filename

      `string get_filename()`

    Description

      Gets the filename for the icon. If the GTK2.ICON_LOOKUP_USE_BUILTIN flag was passed to GTK2.IconTheme->lookup_icon(), there may be no filename if a builtin icon is returned; in this case, you should use get_builtin_pixbuf().

    Method load_icon

      `GTK2.GdkPixbuf load_icon()`

    Description

      Renders an icon previously looked up in an icon theme using GTK2.IconTheme->lookup_icon(); the size will be based on the size passed to GTK2.IconTheme->lookup_icon(). Note that the resulting pixbuf may not be exactly this size; an icon theme may have icons that differe slightly from their nominal sizes, and in addition GTK2+ will avoid scaling icons that it considers sufficiently close to the requested size or for which the source image would have to be scaled up too far. (This maintains sharpness.)

  CLASS GTK2.TreeView

    Description

      Properties: int enable-search GTK2.TreeViewColumn expander-column int fixed-height-mode GTK2.Adjustment hadjustment int headers-clickable int headers-visible int hover-expand int hover-selection GTK2.TreeModel model int reorderable int rules-hint int search-column GTK2.Adjustment vadjustment

      Style properties: int allow-rules GDK2.Color even-row-color int expander-size int horizontal-separator int indent-expanders GDK2.Color odd-row-color int vertical-separator

      Signals: columns_changed

      cursor_changed

      expand_collapse_cursor_row

      move_cursor

      row_activated

      row_collapsed

      row_expanded

      select_all

      select_cursor_parent

      select_cursor_row

      set_scroll_adjustments

      start_interactive_search

      test_collapse_row

      test_expand_row

      toggle_cursor_row

      unselect_all

    Inherit Container

      inherit GTK2.Container : Container

    Method append_column

      `GTK2.TreeView append_column(GTK2.TreeViewColumn column)`

    Description

      Appends column to the list of columns. If this tree view has "fixed_height" mode enabled, then column must have its "sizing" property set to be GTK2.TREE_VIEW_COLUMN_FIXED.

    Method collapse_all

      `GTK2.TreeView collapse_all()`

    Description

      Recursively collapses all visible, expanded nodes.

    Method collapse_row

      `int collapse_row(GTK2.TreePath path)`

    Description

      Collapses a row (hides its child rows, if they exist).

    Method columns_autosize

      `GTK2.TreeView columns_autosize()`

    Description

      Resizes all columns to their optimal width. Only works after the treeview has been realized.

    Method create

      `GTK2.TreeView GTK2.TreeView(GTK2.TreeModel model_or_props)`

    Description

      Create a new W(TreeView), with or without a default model.

    Method expand_all

      `GTK2.TreeView expand_all()`

    Description

      Recursively expands all nodes.

    Method expand_row

      `int expand_row(GTK2.TreePath path, int open_all)`

    Description

      Opens the row so its children are visible.

    Method expand_to_path

      `GTK2.TreeView expand_to_path(GTK2.TreePath path)`

    Description

      Expands the row at path. This will also expand all parent rows of path as necessary.

    Method get_background_area

      `GTK2.GdkRectangle get_background_area(GTK2.TreePath path, GTK2.TreeViewColumn column)`

    Description

      Similar to get_cell_area(). The returned rectangle is equivalent to the background_area passed to GTK2.CellRenderer->render(). These background area tiles to cover the entire tree window (except for the area used for header buttons). Contrast with get_cell_area(), which returns only the cell itself, excluding surrounding borders and the tree expander area.

    Method get_bin_window

      `GTK2.GdkWindow get_bin_window()`

    Description

      Returns the window that this view renders to. This is used primarily to compare to event->window to confirm that the event on this view is on the right window.

    Method get_cell_area

      `GTK2.GdkRectangle get_cell_area(GTK2.TreePath path, GTK2.TreeViewColumn column)`

    Description

      Fills the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column. If path is omitted or 0, or points to a path not currently displayed, the y and height fields of the rectangle will be 0. If column is omitted, the x and width fields will be o. The sum of all cell rects does not cover the entire tree; there are extra pixels in between rows, for example. The returned rectangle is equivalent to the cell_area passed to GTK2.CellRenderer->render(). This function is only valid if the view is realized.

    Method get_column

      `GTK2.TreeViewColumn get_column(int n)`

    Description

      Gets the W(TreeViewColumn) at the given position.

    Method get_columns

      `array get_columns()`

    Description

      Returns an array of all the W(TreeViewColumn)'s current in the view.

    Method get_cursor

      `mapping get_cursor()`

    Description

      Returns the current path and focus column. If the cursor isn't currently set, then "path" will be 0. If no column currently has focus, then "focus_column" will be 0. Returns ([ "path": GTK2.TreePath, "column": GTK2.TreeViewColumn ]);

    Method get_enable_search

      `int get_enable_search()`

    Description

      Returns whether or not the tree allows to start interactive searching by typing in text.

    Method get_expander_column

      `GTK2.TreeViewColumn get_expander_column()`

    Description

      Returns the column that is the current expander column. This column has the expander arrow drawn next to it.

    Method get_hadjustment

      `GTK2.Adjustment get_hadjustment()`

    Description

      Gets the W(Adjustment) currently being used for the horizontal aspect.

    Method get_headers_visible

      `int get_headers_visible()`

    Description

      Returns true if the headers are visible.

    Method get_model

      `GTK2.TreeModel get_model()`

    Description

      Returns the model this TreeView is based on.

    Method get_path_at_pos

      `mapping get_path_at_pos(int x, int y)`

    Description

      Finds the path at the point (x,y) relative to widget coordinates. That is, x and y are relative to an events coordinates. x and y must come from an event on the view only where event->window==get_bin(). It is primarily for things like popup menus. Returns GTK2.TreePath, GTK2.TreeViewColumn, and cell_x and cell_y, which are the coordinates relative to the cell background (i.e. the background_area passed to GTK2.CellRenderer->render()). This function is only meaningful if the widget is realized.

    Method get_reorderable

      `int get_reorderable()`

    Description

      Retrieves whether the user can reorder the tree via drag-and-drop.

    Method get_rules_hint

      `int get_rules_hint()`

    Description

      Gets the setting set by set_rules_hint().

    Method get_search_column

      `int get_search_column()`

    Description

      Gets the column searched on by the interactive search code.

    Method get_selection

      `GTK2.TreeSelection get_selection()`

    Description

      Gets the W(TreeSelection) associated with this TreeView.

    Method get_vadjustment

      `GTK2.Adjustment get_vadjustment()`

    Description

      Gets the W(Adjustment) currently being used for the vertical aspect.

    Method get_visible_range

      `array get_visible_range()`

    Description

      Returns the first and last visible path. Note that there may be invisible paths in between.

    Method get_visible_rect

      `GTK2.GdkRectangle get_visible_rect()`

    Description

      Returns a GDK2.Rectangle with the currently-visible region of the buffer, in tree coordinates. Conver to widget coordinates with tree_to_widget_coords(). Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire scrollable area of the tree.

    Method insert_column

      `int insert_column(GTK2.TreeViewColumn column, int position)`

    Description

      This inserts the column at position. If position is -1, then the column is inserted at the end. If this tree view has "fixed_height" mode enabled, then column must have its "sizing property set to GTK2.TREE_VIEW_COLUMN_FIXED.

    Method move_column_after

      `GTK2.TreeView move_column_after(GTK2.TreeViewColumn column, GTK2.TreeViewColumn base)`

    Description

      Moves column to be after base. If base is omitted, then column is placed in the first position.

    Method remove_column

      `int remove_column(GTK2.TreeViewColumn column)`

    Description

      Removes column.

    Method row_activated

      `GTK2.TreeView row_activated(GTK2.TreePath path, GTK2.TreeViewColumn column)`

    Description

      Activates the cell determined by path and column.

    Method row_expanded

      `int row_expanded(GTK2.TreePath path)`

    Description

      Returns true if the node pointed to by path is expanded.

    Method scroll_to_cell

      `GTK2.TreeView scroll_to_cell(GTK2.TreePath path, GTK2.TreeViewColumn column, float|void row_align, float|void col_align)`

    Description

      Moves the alignments of the view to the position specified by column and path. If column is 0, then no horizontal scrolling occurs. Likewise, if path is 0, no vertical scrolling occurs. At a minimum, one of column or path needs to be non-zero. row_align determines where the row is placed, and col_align determines where column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center.

      If row_align exists, then col_align must exist, otherwise neither will be used. If neither are used, the tree does the minimum amount of work to scroll the cell onto the screen. This means that the cell will be scrolled to the edge closest to its current position. If the cell is currently visible on the screen, nothing is done.

      This function only works if the model is set, and path is a valid row on the model. If the model changes before the view is realized, the centered path will be modifed to reflect this change.

    Method scroll_to_point

      `GTK2.TreeView scroll_to_point(int x, int y)`

    Description

      Scrolls the tree view such that the top-left corner of the visible area is x,y, where x and y are specified in tree window coordinates. The view must be realized before this function is called. If it isn't, you probably want to be using scroll_to_cell().

      If either x or y are -1, then that direction isn't scrolled.

    Method set_cursor

      `GTK2.TreeView set_cursor(GTK2.TreePath path, GTK2.TreeViewColumn focus_column, int|void start_editing)`

    Description

      Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user's attention on a particular row. If focus_column is present, then focus is given to the column specified by it. Additionally, if focus_column is specified, and start_editing is true, then editing should be started in the specified cell. This function is often followed by grab_focus() in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.

    Method set_cursor_on_cell

      `GTK2.TreeView set_cursor_on_cell(GTK2.TreePath path, GTK2.TreeViewColumn focus_column, int|void start_editing, GTK2.CellRenderer focus_cell)`

    Description

      Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user's attention on a particular row. If focus_column is present, then focus is given to the column specified by it. If focus_column and focus_cell are present, and focus_column contains 2 or more editable or activatable cells, then focus is given to the cell specified by focus_cell. Additionally, if focus_column is specified, and start_editing is true, then editing should be started in the specified cell. This function is often followed by grab_focus() in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.

    Method set_enable_search

      `GTK2.TreeView set_enable_search(int enable_search)`

    Description

      If enable_search is set, then the user can type in text to search through the tree interactively (this is sometimes called "typeahead find").

      Note that even if this is false, the user can still initiate a search using the "start-interactive-search" key binding.

    Method set_expander_column

      `GTK2.TreeView set_expander_column(GTK2.TreeViewColumn column)`

    Description

      Sets the column to draw the expander arrow at. It must be in the view. If column is omitted, then the expander arrow is always at the first visible column.

    Method set_hadjustment

      `GTK2.TreeView set_hadjustment(GTK2.Adjustment hadj)`

    Description

      Sets the W(Adjustment) for the current horizontal aspect.

    Method set_headers_clickable

      `GTK2.TreeView set_headers_clickable(int setting)`

    Description

      Allow the column title buttons to be clicked.

    Method set_headers_visible

      `GTK2.TreeView set_headers_visible(int headers_visible)`

    Description

      Sets the visibility state of the headers.

    Method set_model

      `GTK2.TreeView set_model(GTK2.TreeModel model)`

    Description

      Sets the model. If this TreeView already has a model set, it will remove it before setting the new model.

    Method set_reorderable

      `GTK2.TreeView set_reorderable(int reorderable)`

    Description

      This function is a convenience function to allow you to reorder models. If reorderable is true, then the user can reorder the model by dragging and dropping rows. The developer can listen to these changes by connecting to the model's "row-inserted" and "row-deleted" signals.

      This function does not give you any degree of control over the order -- any reordering is allowed. If more control is needed, you should probably handle drag and drop manually.

    Method set_rules_hint

      `GTK2.TreeView set_rules_hint(int setting)`

    Description

      This function tells GTK2+ that the user interface for your application requires users to read across tree rows and associate cells with one another. By default, GTK2+ will then render the tree with alternating row colors. Do not use it just because you prefer the appearance of the ruled tree; that's a question for the theme. Some themes will draw tree rows in alternating colors even when rules are turned off, and users who prefer that appearance all the time can choose those themes. You should call this function only as a semantic hint to the theme engine that your tree makes alternating colors usefull from a functional standpoint (since it has lots of columns, generally).

    Method set_search_column

      `GTK2.TreeView set_search_column(int column)`

    Description

      Sets column as the column where the interactive search code should search in.

      If the sort column is set, users can use the "start-interactive-search" key binding to bring up search popup. The enable-search property controls whether simply typing text will also start an interactive search.

      Note that column refers to a column of the model.

    Method set_vadjustment

      `GTK2.TreeView set_vadjustment(GTK2.Adjustment vadj)`

    Description

      Sets the W(Adjustment) for the current vertical aspect.

    Method tree_to_widget_coords

      `mapping tree_to_widget_coords(int tx, int ty)`

    Description

      Converts tree coordinates (coordinates in full scrollable area of the tree) to widget coordinates.

    Method widget_to_tree_coords

      `mapping widget_to_tree_coords(int wx, int wy)`

    Description

      converts widget coordinates to coordinates for the tree window (the full scrollable area of the tree).

  CLASS GTK2.Label

    Description

      A simple text label. `GTK2.Label("A simple text label")`

      `GTK2.Label("Multi\nline text\nlabel here")`

      `GTK2.Label("Multi\nline text\nlabel here")->set_justify(GTK2.JUSTIFY_LEFT)`

      `GTK2.Label("Multi\nline text\nlabel here")->set_justify(GTK2.JUSTIFY_RIGHT)`

      Properties: float angle Pango.AttrList attributes int cursor-position int ellipsize int justfy JUSTIFY_CENTER , JUSTIFY_FILL , JUSTIFY_LEFT and JUSTIFY_RIGHT string label int max-width-chars int mnemonic-keyval int mnemonic-widget string pattern int selectable int single-line-mode int use-markup int use-underline int width-chars int wrap

      Signals: copy_clipboard

      move_cursor

      populate_popup

    Inherit Misc

      inherit GTK2.Misc : Misc

    Method create

      `GTK2.Label GTK2.Label(string|mapping text_or_props)`

    Description

      Creates a new label.

    Method get_angle

      `float get_angle()`

    Description

      Gets the angle of rotation for the label.

    Method get_ellipsize

      `int get_ellipsize()`

    Description

      Returns the ellipsizing position of the label.

    Method get_justify

      `int get_justify()`

    Description

      Returns the justification of the label.

    Method get_label

      `string get_label()`

    Description

      Fetches the text from a label widget including any underlines indicating mnemonics and Pango markup.

    Method get_layout

      `GTK2.Pango.Layout get_layout()`

    Description

      Gets the Pango.Layout used to display the label. The layout is useful to e.g. convert text positions to pixel positions, in combination with get_layout_offsets().

    Method get_layout_offsets

      `mapping get_layout_offsets()`

    Description

      Obtains the coordinates where the label will draw the Pango.Layout representing the text in the label; useful to convert mouse events into coordinates inside the Pango.Layout, e.g. to take some action if some part of the label is clicked. Of course, you will need to create a GTK2.EventBox to receive the events, and pack the label inside it, since labels are a GTK2.NO_WINDOW widget. Remember when using the Pango.Layout functions you need to convert to and from pixels using GTK2.PANGO_SCALE.

    Method get_line_wrap

      `int get_line_wrap()`

    Description

      Returns whether lines in the label are automatically wrapped.

    Method get_max_width_chars

      `int get_max_width_chars()`

    Description

      Retrieves the desired maximum width, in characters.

    Method get_mnemonic_keyval

      `int get_mnemonic_keyval()`

    Description

      If the label has been set so that is has a mnemonic key, this function returns the keyval used for the mnemonic accelerator. If there is no mnemonic set up it returns GDK_VoidSymbol.

    Method get_mnemonic_widget

      `GTK2.Widget get_mnemonic_widget()`

    Description

      Retrieves the target of the mnemonic (keyboard shortcut).

    Method get_selectable

      `int get_selectable()`

    Description

      Gets the value set by set_selectable().

    Method get_selection_bounds

      `mapping get_selection_bounds()`

    Description

      Gets the selected range of characters in the label. If there isn't a selection, returns -1 for both start and end.

    Method get_single_line_mode

      `int get_single_line_mode()`

    Description

      Returns whether the label is in single line mode.

    Method get_text

      `string get_text()`

    Description

      Fetches the text from a label widget, as displayed on the screen. This does not include any embedded underlines indicating mnemonics or Pango markup. (see get_label()).

    Method get_use_markup

      `int get_use_markup()`

    Description

      Returns whether the label's text is interpreted as marked up with the Pango text markup language.

    Method get_use_underline

      `int get_use_underline()`

    Description

      Returns whether an embedded underline in the label indicates a mnemonic.

    Method get_width_chars

      `int get_width_chars()`

    Description

      Retrieves the desired width, in characters.

    Method select_region

      `GTK2.Label select_region(int start_offset, int end_offset)`

    Description

      Selects a range of characters in the label, if the label is selectable. See set_selectable(). If the label is not selectable, this function has no effect. If start_offset or end_offset are -1, then the end of the label will be substituted.

    Method set_angle

      `GTK2.Label set_angle(int|float angle)`

    Description

      Sets the angle of rotation for the label. An angle of 90 reads from bottom to top, and angle of 270, from top to bottom. The angle setting for the label is igrnored if the lable is selectable, wrapped, or ellipsized.

    Method set_ellipsize

      `GTK2.Label set_ellipsize(int mode)`

    Description

      Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string. One of .

    Method set_justify

      `GTK2.Label set_justify(int jtype)`

    Description

      Sets the alignment of the lines in the text of the label relative to each other. GTK2.JUSTIFY_LEFT is the default value when the widget is first created. If you instead want to set the alignment of the label as a whole, use set_alignment() instead. set_justify() has no efect on labels containing only a single line. One of JUSTIFY_CENTER , JUSTIFY_FILL , JUSTIFY_LEFT and JUSTIFY_RIGHT .

    Method set_label

      `GTK2.Label set_label(string text)`

    Description

      Sets the text of the label. The label is interpreted as including embedded underlines and/or Pango markup depending on the values of use-underline and use-markup.

    Method set_line_wrap

      `GTK2.Label set_line_wrap(int wrap)`

    Description

      Toggles line wrapping within the widget. True makes it break lines if text exceeds the widget's size. False lets the text get cut off by the edge of the widget if it exceeds the widget size.

    Method set_markup

      `GTK2.Label set_markup(string text)`

    Description

      Parses text which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results.

    Method set_markup_with_mnemonic

      `GTK2.Label set_markup_with_mnemonic(string text)`

    Description

      Parses text which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results. If characters in text are preceded by an underscore, they are underline indicating that they represent a keyboard accelerator called a mnemonic.

      The mnemonic key can be used to activate another widget, chosen automatically, or explicitly using set_mnemonic_widget().

    Method set_max_width_chars

      `GTK2.Label set_max_width_chars(int n_chars)`

    Description

      Sets the desired maximum width in characters to n_chars.

    Method set_mnemonic_widget

      `GTK2.Label set_mnemonic_widget(GTK2.Widget widget)`

    Description

      If the label has been set so that it has a mnemonic key (using i.e. set_markup_with_mnemonic(), set_text_with_mnemonic(), or the "use_underline" property) the label can be associated with a widget that is the target of the mnemonic. When the label is inside a widget (like a GTK2.Button or GTK2.Notebook tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is a GTK2.Entry next to the label) you need to set it explicitly using this function.

      The target widget will be accelerated by emitting "mnemonic_activate" on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.

    Method set_pattern

      `GTK2.Label set_pattern(string pattern_string)`

    Description

      A string with either spaces or underscores. It should be of the same length as the text.

      When a character in the text has a matching _ in the pattern, the character in the label will be underlined.

    Method set_selectable

      `GTK2.Label set_selectable(int setting)`

    Description

      Selectable labels allow the user to select text from the label, for copy and past.

    Method set_single_line_mode

      `GTK2.Label set_single_line_mode(int mode)`

    Description

      Sets whether the label is in single line mode.

    Method set_text

      `GTK2.Label set_text(string text)`

    Description

      Set the text in the label

    Method set_text_with_mnemonic

      `GTK2.Label set_text_with_mnemonic(string text)`

    Description

      Sets the label's text from the string text. If characters in text are preceded by an underscore, they are underlined indicating that they represent a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget, chose automatically, or explicitly using set_mnemonic_widget().

    Method set_use_markup

      `GTK2.Label set_use_markup(int setting)`

    Description

      Sets whether the text of the label contains markup in Pango's text markup language.

    Method set_use_underline

      `GTK2.Label set_use_underline(int setting)`

    Description

      If true, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

    Method set_width_chars

      `GTK2.Label set_width_chars(int n_chars)`

    Description

      Sets the desired width in characters to n_chars.

  CLASS GTK2.StringTag

    Inherit SourceTag

      inherit GTK2.SourceTag : SourceTag

    Method create

      `GTK2.StringTag GTK2.StringTag(string id, string name, string pattern_start, string pattern_end, int end_at_line_end)`

    Description

      Creates a new string tag object with the provided arguments.

  CLASS GTK2.Gnome2CanvasRE

    Description

      Properties: float x1 float x2 float y1 float y2

    Inherit CanvasShape

      inherit Gnome2.CanvasShape : CanvasShape

  CLASS GTK2.TreeViewColumn

    Description

      Properties: float alignment int clickable int expand int fixed-width int max-width int min-width int reorderable int resizable int sizing TREE_VIEW_COLUMN_AUTOSIZE , TREE_VIEW_COLUMN_FIXED and TREE_VIEW_COLUMN_GROW_ONLY int sort-indicator int sort-order SORT_ASCENDING and SORT_DESCENDING int spacing string title int visible GTK2.Widget widget int width

      Signals: clicked

    Inherit Data

      inherit GTK2.Data : Data

    Inherit CellLayout

      inherit GTK2.CellLayout : CellLayout

    Method add_attribute

      `GTK2.TreeViewColumn add_attribute(GTK2.CellRenderer cell_renderer, string attribute, int column)`

    Description

      Adds an attribute mapping to the list. The column is the column of the model to get a value from, and the attribute is the parameter on cell_rendere to be set from the value. So for example if column 2 of the model contains strings, you could have the "text" attribute of a W(CellRendererText) get its values from column 2.

    Method cell_get_position

      `mapping cell_get_position(GTK2.CellRenderer cell_renderer)`

    Description

      Obtains the horizontal position and size of a cell in a column. If the cell is not found in the column, returns -1 for start_pos and width.

    Method cell_get_size

      `mapping cell_get_size(GTK2.GdkRectangle cell_area)`

    Description

      Obtains the width and height needed to render the column.

    Method cell_is_visible

      `int cell_is_visible()`

    Description

      Returns true if any of the cells packed into the colum are visible. For this to be meaningful, you must first initialize the cells with cell_set_cell_data().

    Method cell_set_cell_data

      `GTK2.TreeViewColumn cell_set_cell_data(GTK2.TreeModel model, GTK2.TreeIter iter, int is_expander, int is_expanded)`

    Description

      Sets the cell renderer based on the model and iter. That is, for every attribute mapping in this column, it will get a value from the set column on the iter, and use that value to set the attribute on the cell renderer. This is used primarily by the W(TreeView).

    Method clear

      `GTK2.TreeViewColumn clear()`

    Description

      Unsets all the mappings on all renderers.

    Method clear_attributes

      `GTK2.TreeViewColumn clear_attributes(GTK2.CellRenderer cell_renderer)`

    Description

      Clears all existing attributes previously set.

    Method clicked

      `GTK2.TreeViewColumn clicked()`

    Description

      Emits the "clicked" signal on the column. This function will only work if this column is clickable.

    Method create

      `GTK2.TreeViewColumn GTK2.TreeViewColumn(string|mapping title_or_props, GTK2.CellRenderer renderer, string|void property, int|void col)`

    Description

      Creates a new W(TreeViewColumn).

    Method focus_cell

      `GTK2.TreeViewColumn focus_cell(GTK2.CellRenderer cell)`

    Description

      Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells.

    Method get_alignment

      `float get_alignment()`

    Description

      Returns the current x alignment. This value can range between 0.0 and 1.0.

    Method get_cell_renderers

      `array get_cell_renderers()`

    Description

      Returns an array of all the cell renderers in the column, in no partciular order.

    Method get_clickable

      `int get_clickable()`

    Description

      Returns true if the user can click on the header for the column.

    Method get_expand

      `int get_expand()`

    Description

      Return true if the column expands to take any available space.

    Method get_fixed_width

      `int get_fixed_width()`

    Description

      Gets the fixed width of the column.

    Method get_max_width

      `int get_max_width()`

    Description

      Returns the maximum width in pixels, or -1 if no maximum width is set.

    Method get_min_width

      `int get_min_width()`

    Description

      Returns the minimum width in pixels, or -1 if no minimum width is set.

    Method get_reorderable

      `int get_reorderable()`

    Description

      Returns true if the column can be reordered by the user.

    Method get_resizable

      `int get_resizable()`

    Description

      Returns true if the column can be resized by the end user.

    Method get_sizing

      `int get_sizing()`

    Description

      Returns the current type.

    Method get_sort_column_id

      `int get_sort_column_id()`

    Description

      Gets the logical column_id that the model sorts on when this column is selected for sorting.

    Method get_sort_indicator

      `int get_sort_indicator()`

    Description

      Gets the value set by set_sort_indicator();

    Method get_sort_order

      `int get_sort_order()`

    Description

      Gets the value set by set_sort_order().

    Method get_spacing

      `int get_spacing()`

    Description

      Returns the spacing.

    Method get_title

      `string get_title()`

    Description

      Returns the title of the widget.

    Method get_visible

      `int get_visible()`

    Description

      Returns true if the column is visible.

    Method get_widget

      `GTK2.Widget get_widget()`

    Description

      Returns the W(Widget) in the button on the column header. If a custom widget has not been set then 0 is returned.

    Method get_width

      `int get_width()`

    Description

      Returns the current size in pixels.

    Method pack_end

      `GTK2.TreeViewColumn pack_end(GTK2.CellRenderer cell, int expand)`

    Description

      Packs the cell to the end of the column.

    Method pack_start

      `GTK2.TreeViewColumn pack_start(GTK2.CellRenderer cell, int expand)`

    Description

      Packs the cell into the beginning of the column. If expand is false, then the cell is allocated no more space than it needs. Any unused space is divied evenly between cels for which expand is true.

    Method queue_resize

      `GTK2.TreeViewColumn queue_resize()`

    Description

      Flags the column, and the cell renderers added to this column, to have their sizes renegotiated.

    Method set_alignment

      `GTK2.TreeViewColumn set_alignment(float xalign)`

    Description

      Sets the alignment of the title or custom widget inside the column header. The alignment determines its location inside the button - 0.0 for left, 0.5 for center, 1.0 for right.

    Method set_clickable

      `GTK2.TreeViewColumn set_clickable(int clickable)`

    Description

      Sets the header to be active if clickable is true. When the header is active, then it can take keyboard focus, and can be clicked.

    Method set_expand

      `GTK2.TreeViewColumn set_expand(int expand)`

    Description

      Sets the column to take available extra space. This space is shared equally amongst all columns that have the expand set to true. If no column has this option set, then the last column gets all extra space. By default, every column is created with this false.

    Method set_fixed_width

      `GTK2.TreeViewColumn set_fixed_width(int fixed_width)`

    Description

      Sets the size of the column in pixels. The is meaningful only if the sizing type is GTK2.TREE_VIEW_COLUMN_FIXED. The size of the column is clamped to the min/max width for the column. Please note that the min/max width of the column doesn't actually affect the "fixed-width" property of the widget, just the actual size when displayed.

    Method set_max_width

      `GTK2.TreeViewColumn set_max_width(int max_width)`

    Description

      Sets the maximum width. If max_width is -1, then the maximum width is unset. Note, the column can actually be wider than max width if it's the last column in a view. In this case, the column expands to fill any extra space.

    Method set_min_width

      `GTK2.TreeViewColumn set_min_width(int min_width)`

    Description

      Sets the minimum width. If min_width is -1, then the minimum width is unset.

    Method set_reorderable

      `GTK2.TreeViewColumn set_reorderable(int reorderable)`

    Description

      If reorderable is true, then the column can be reorderd by the end user dragging the header.

    Method set_resizable

      `GTK2.TreeViewColumn set_resizable(int resizable)`

    Description

      If resizable is true, then the user can explicitly resize the column by grabbing the outer edge of the column button. If resizable is ture and the sizing mode of the column is GTK2.TREE_VIEW_COLUMN_AUTOSIZE, then the sizing mode is changed to GTK2.TREE_VIEW_COLUMN_GROW_ONLY.

    Method set_sizing

      `GTK2.TreeViewColumn set_sizing(int type)`

    Description

      Sets the growth behavior of this columnt to type. One of TREE_VIEW_COLUMN_AUTOSIZE , TREE_VIEW_COLUMN_FIXED and TREE_VIEW_COLUMN_GROW_ONLY .

    Method set_sort_column_id

      `GTK2.TreeViewColumn set_sort_column_id(int column_id)`

    Description

      Sets the logical column_id that this column sorts on when this column is selected for sorting. Doing so makes the column header clickable.

    Method set_sort_indicator

      `GTK2.TreeViewColumn set_sort_indicator(int setting)`

    Description

      Call this function with a setting of true to display an arrow in the header button indicating the column is sorted. Call set_sort_order() to change the direction of the arrow.

    Method set_sort_order

      `GTK2.TreeViewColumn set_sort_order(int order)`

    Description

      Changes the appearance of the sort indicator.

      This does not actually sort the model. Use set_sort_column_id() if you wnat automatic sorting support. This function is primarily for custom sorting behavior, and should be used in conjunction with GTK2.TreeSortable->set_sort_column() to do that. For custom models, the mechanism will vary.

      The sort indicator changes direction to indicate normal sort or reverse sort. Note that you must have the sort indicator enabled to see anything when calling this function. One of SORT_ASCENDING and SORT_DESCENDING .

    Method set_spacing

      `GTK2.TreeViewColumn set_spacing(int spacing)`

    Description

      Sets the spacing field, which is the number of pixels to place between cell renderers packed into it.

    Method set_title

      `GTK2.TreeViewColumn set_title(string title)`

    Description

      Sets the title. If a custom widget has been set, then this value is ignored.

    Method set_visible

      `GTK2.TreeViewColumn set_visible(int visible)`

    Description

      Sets the visibility.

    Method set_widget

      `GTK2.TreeViewColumn set_widget(GTK2.Widget widget)`

    Description

      Sets the widget in the header to be widget. If widget is omitted, then the header button is set with a W(Label) set to the title.

  CLASS GTK2.Gnome2IconSelection

    Inherit Vbox

      inherit GTK2.Vbox : Vbox

    Method add_defaults

      `Gnome2.IconSelection add_defaults()`

    Description

      Adds the default pixmap directory into the selection widget.

    Method add_directory

      `Gnome2.IconSelection add_directory(string dir)`

    Description

      Adds the icons from the directory dir to the selection widget.

    Method clear

      `Gnome2.IconSelection clear(int|void not_shown)`

    Description

      Clear the currently shown icons, the ones that weren't shown yet are not cleared unless the not_shown parameter is given, in which case even those are cleared.

    Method create

      `Gnome2.IconSelection GTK2.Gnome2IconSelection()`

    Description

      Creates a new icon selection widget, it uses a W(GnomeIconList) for the listing of icons

    Method get_box

      `GTK2.Widget get_box()`

    Description

      Gets the W(Vbox) widget.

    Method get_icon

      `string get_icon(int full_path)`

    Description

      Gets the currently selected icon name, if full_path is true, it returns the full path to the icon, if none is selected it returns 0.

    Method select_icon

      `Gnome2.IconSelection select_icon(string filename)`

    Description

      Selects the icon filename. This icon must have already been added and shown

    Method show_icons

      `Gnome2.IconSelection show_icons()`

    Description

      Shows the icons inside the widget that were added with add_defaults and add_directory. Before this function isf called the icons aren't actually added to the listing and can't be picked by the user.

    Method stop_loading

      `Gnome2.IconSelection stop_loading()`

    Description

      Stop the loading of images when we are in the loop in show_icons.

  CLASS GTK2.Tooltips

    Description

      Tooltips are the messages that appear next to a widget when the mouse pointer is held over it for a short amount of time. They are especially helpful for adding more verbose descriptions of things such as buttons in a toolbar.

      An individual tooltip belongs to a group of tooltips. A group is created with a call to GTK2.Tooltips(). Every tooltip in the group can then be turned off with a call to disable() and enabled with enable().

      The length of time the user must keep the mouse over a widget before the tip is shown, can be altered with set_delay(). This is set on a 'per group of tooltips' basis.

      To assign a tip to a particular W(Widget), set_tip() is used.

      The default appearance of all tooltips in a program is determined by the current gtk theme that the user has selected. To change the tooltip appearance manually, use set_colors(). Again, this is per group of tooltips.

    Inherit Data

      inherit GTK2.Data : Data

    Method create

      `GTK2.Tooltips GTK2.Tooltips()`

    Description

      Creates an empty group of tooltips. This function initialises a GTK2.Tooltips structure. Without at least one such structure, you can not add tips to your application.

    Method disable

      `GTK2.Tooltips disable()`

    Description

      Disable this tooltip collection.

    Method enable

      `GTK2.Tooltips enable()`

    Description

      Enable this tooltip collection.

    Method force_window

      `GTK2.Tooltips force_window()`

    Description

      Realize the tooltip window (as returned from get_gdkwindow())

    Method set_tip

      `GTK2.Tooltips set_tip(GTK2.Widget in, string to)`

    Description

      Adds a tooltip containing the message tip_text to the specified W(Widget).

  CLASS GTK2.Frame

    Description

      The frame widget is a Bin that surrounds its child with a decorative frame and an optional label. If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with set_label_align().

      Used to visually group objects.

      `GTK2.Frame("Title")->add(GTK2.Label("Contents"))`

      `GTK2.Frame()->add(GTK2.Label("Contents"))`

      `GTK2.Frame()->add(GTK2.Label("Contents"))->set_shadow_type(GTK2.SHADOW_IN)`

      Properties: string label GTK2.Widget label-widget float label-xalign float label-yalign int shadow int shadow-type

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.Frame GTK2.Frame(string|mapping label_or_props)`

    Description

      Create a new W(Frame) widget.

    Method get_label

      `string get_label()`

    Description

      Return the text in the label widget.

    Method get_label_align

      `array get_label_align()`

    Description

      Retrieves the x and y alignment of the label.

    Method get_label_widget

      `GTK2.Widget get_label_widget()`

    Description

      Retrieves the label widget.

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      Return the shadow type.

    Method set_label

      `GTK2.Frame set_label(string|void label_text)`

    Description

      Set the text of the label.

    Method set_label_align

      `GTK2.Frame set_label_align(float xalign, float yalign)`

    Description

      Arguments are xalignment and yalignment. 0.0 is left or topmost, 1.0 is right or bottommost. The default value for a newly created Frame is 0.0.

    Method set_label_widget

      `GTK2.Frame set_label_widget(GTK2.Widget label)`

    Description

      Sets the label widget for the frame. This is the widget that will appear embedded in the top edge of the frame as a title.

    Method set_shadow_type

      `GTK2.Frame set_shadow_type(int shadow_type)`

    Description

      Set the shadow type for the Frame widget. The type is one of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

  CLASS GTK2.SelectionData

    Description

      Placeholder class for GtkSelectionData.

  CLASS GTK2.CheckMenuItem

    Description

      A check menu item is more or less identical to a check button, but it should be used in menus. `GTK2.CheckMenuItem("Hi there")`

      `GTK2.CheckMenuItem("Hi there")->set_active(1)`

      Properties: int active int draw-as-radio int inconsistent

      Style properties: int indicator-size

      Signals: toggled Called when the state of the menu item is changed

    Inherit MenuItem

      inherit GTK2.MenuItem : MenuItem

    Method create

      `GTK2.CheckMenuItem GTK2.CheckMenuItem(string|mapping label_or_props)`

    Description

      The argument, if specified, is the label of the item. If no label is specified, use object->add() to add some other widget (such as an pixmap or image widget)

    Method get_active

      `int get_active()`

    Description

      Get whether item is active.

    Method get_draw_as_radio

      `int get_draw_as_radio()`

    Description

      Get whether check menu item is drawn like a radio button.

    Method get_inconsistent

      `int get_inconsistent()`

    Description

      Retrieves the value set by set_inconsistent().

    Method set_active

      `GTK2.CheckMenuItem set_active(int new_state)`

    Description

      State is either 1 or 0. If 1, the button will be 'pressed'.

    Method set_draw_as_radio

      `GTK2.CheckMenuItem set_draw_as_radio(int draw_as_radio)`

    Description

      Set whether check menu item is drawn like a radio button.

    Method set_inconsistent

      `GTK2.CheckMenuItem set_inconsistent(int setting)`

    Description

      If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a boolean setting, and the current values in that range are inconsistent, you may want to display the check in an "in between" state. This function turns on "in between" display.

    Method toggled

      `GTK2.CheckMenuItem toggled()`

    Description

      Emulate a toggled event

  CLASS GTK2.IconTheme

    Description

      Looking up icons by name.

      Signals: changed

    Inherit Object

      inherit G.Object : Object

    Method append_search_path

      `GTK2.IconTheme append_search_path(string path)`

    Description

      Appends a directory to the search path.

    Method create

      `GTK2.IconTheme GTK2.IconTheme()`

    Description

      Creates a new icon theme object. Icon theme objects are used to lookup an icon by name in a particular icon theme. Usually you'll want to use get_default() rather than creating a new icon theme object from scratch.

    Method get_example_icon_name

      `string get_example_icon_name()`

    Description

      Gets the name of an icon that is representative of the current theme (for instance, to use when presenting a list of themes to the user.)

    Method get_icon_sizes

      `array get_icon_sizes(string name)`

    Description

      Returns an array of integers describing the sizes at which the icon is available without scaling. A size of -1 means that the icon is available in a scalable format.

    Method get_search_path

      `array get_search_path()`

    Description

      Gets the current search path.

    Method has_icon

      `int has_icon(string icon_name)`

    Description

      Checks whether this icon theme includes an icon for a particular name.

    Method list_icons

      `array list_icons(string|void context)`

    Description

      Lists the icons in the current icon theme. Only a subset of the icons can be listed by providing a context string. The set of values for the context string is system dependent, but will typically include such values as 'apps' and 'mimetypes'.

    Method load_icon

      `GTK2.GdkPixbuf load_icon(string name, int size, int flags)`

    Description

      Looks up an icon in an icon theme, scales it to the given size and renders it into a pixbuf.

    Method lookup_icon

      `GTK2.IconInfo lookup_icon(string name, int size, int flags)`

    Description

      Looks up a named icon and returns an object containing information such as the filename of the icon. The icon can then be rendered into a pixbuf using GTK2.IconInfo->load_icon().

    Method prepend_search_path

      `GTK2.IconTheme prepend_search_path(string path)`

    Description

      Prepends a directory to the search path.

    Method rescan_if_needed

      `int rescan_if_needed()`

    Description

      Checks to see if the icon theme has changed; if it has, any currently cached information is discarded and will be reloaded next time this theme is accessed.

    Method set_custom_theme

      `GTK2.IconTheme set_custom_theme(string theme_name)`

    Description

      Sets the name of the icon theme that the GTK2.IconTheme object uses overriding system configuration. This function cannot be called on the icon theme objects return from get_default().

    Method set_search_path

      `GTK2.IconTheme set_search_path(array path)`

    Description

      Sets the search path for the icon theme object. When looking for an icon theme, GTK2+ will search for a subdirectory of one or more of the directories in path with the same name as the icon theme. (Themes from multiple of the path elemets are combined to allow themes to be extended by adding icons in the user's home directory.)

      In addition if an icon found isn't found either in the current icon theme or the default icon theme, and an image file with the right name is found directly in one of the elements of path, then that image will be used for the icon name. (This is a legacy feature, and new icons should be put into the default icon theme, which is called DEFAULT_THEME_NAME, rather than directly on the icon path.)

  CLASS GTK2.TreeIter

    Description

      TreeIter.

    Method copy

      `GTK2.TreeIter copy()`

    Description

      Creates a copy of this tree iter.

  CLASS GTK2.LineCommentTag

    Inherit SourceTag

      inherit GTK2.SourceTag : SourceTag

    Method create

      `GTK2.LineCommentTag GTK2.LineCommentTag(string id, string name, string pattern_start)`

    Description

      Creates a new line comment tag object with the provided arguments.

  CLASS GTK2.GdkDrawable

    Description

      The GDK2.Bitmap, GDK2.Window and GDK2.Pixmap classes are all GDK drawables.

      This means that you can use the same set of functions to draw in them.

      Pixmaps are offscreen drawables. They can be drawn upon with the standard drawing primitives, then copied to another drawable (such as a GDK2.Window) with window->draw_pixmap(), set as the background for a window or widget, or otherwise used to show graphics (in a W(Pixmap), as an example). The depth of a pixmap is the number of bits per pixels. Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off).

      Bitmaps are mostly used as masks when drawing pixmaps, or as a shape for a GDK2.Window or a W(Widget)

    Inherit Object

      inherit G.Object : Object

    Method clear

      `GDK2.Drawable clear(int|void x, int|void y, int|void width, int|void height)`

    Description

      Either clears the rectangle defined by the arguments, of if no arguments are specified, the whole drawable.

    Method copy_area

      `GDK2.Drawable copy_area(GTK2.GdkGC gc, int xdest, int ydest, GTK2.Widget source, int xsource, int ysource, int width, int height)`

    Description

      Copies the rectangle defined by xsource,ysource and width,height from the source drawable, and places the results at xdest,ydest in the drawable in which this function is called.

    Method draw_arc

      `GDK2.Drawable draw_arc(GTK2.GdkGC gc, int filledp, int x1, int y1, int x2, int y2, int angle1, int angle2)`

    Description

      Draws a single circular or elliptical arc. Each arc is specified by a rectangle and two angles. The center of the circle or ellipse is the center of the rectangle, and the major and minor axes are specified by the width and height. Positive angles indicate counterclockwise motion, and negative angles indicate clockwise motion. If the magnitude of angle2 is greater than 360 degrees, it is truncated to 360 degrees.

    Method draw_bitmap

      `GDK2.Drawable draw_bitmap(GTK2.GdkGC gc, GTK2.GdkBitmap bitmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw a GDK2(Bitmap) in this drawable. NOTE: This drawable must be a bitmap as well. This will be fixed in GTK 1.3

    Method draw_image

      `GDK2.Drawable draw_image(GTK2.GdkGC gc, GTK2.GdkImage image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK2(Image) at xdest,ydest in the destination drawable

    Method draw_line

      `GDK2.Drawable draw_line(GTK2.GdkGC gc, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK2.DrawingArea()->set_size_request(100,100); delay: g = GDK2.GC(w)->set_foreground( GDK2.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_line(g,x*10,0,100-x*10,99); img_end

    Method draw_pixbuf

      `GDK2.Drawable draw_pixbuf(GTK2.GdkGC gc, GTK2.GdkPixbuf pixbuf, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw a GDK2(Pixbuf) in this drawable.

    Method draw_pixmap

      `GDK2.Drawable draw_pixmap(GTK2.GdkGC gc, GTK2.GdkPixmap pixmap, int xsrc, int ysrc, int xdest, int ydest, int width, int height)`

    Description

      Draw the rectangle specified by xsrc,ysrc+width,height from the GDK2(Pixmap) at xdest,ydest in the destination drawable

    Method draw_point

      `GDK2.Drawable draw_point(GTK2.GdkGC gc, int x, int y)`

    Description

      img_begin w = GTK2.DrawingArea()->set_size_request(10,10); delay: g = GDK2.GC(w)->set_foreground( GDK2.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_point(g, x, x); img_end

    Method draw_rectangle

      `GDK2.Drawable draw_rectangle(GTK2.GdkGC gc, int filledp, int x1, int y1, int x2, int y2)`

    Description

      img_begin w = GTK2.DrawingArea()->set_size_request(100,100); delay: g = GDK2.GC(w)->set_foreground( GDK2.Color(255,0,0) ); delay: for(int x = 0; x<10; x++) w->draw_rectangle(g,0,x*10,0,100-x*10,99); img_end img_begin w = GTK2.DrawingArea()->set_size_request(100,100); delay: g = GDK2.GC(w); delay: for(int x = 0; x<30; x++) { delay: g->set_foreground(GDK2.Color(random(255),random(255),random(255)) ); delay: w->draw_rectangle(g,1,x*10,0,100-x*10,99); delay: } img_end

    Method draw_text

      `GDK2.Drawable draw_text(GTK2.GdkGC gc, int x, int y, string text)`

    Description

      y is used as the baseline for the text.

    Method get_geometry

      `mapping get_geometry()`

    Description

      Get width, height position and depth of the drawable as a mapping.

      ([ "x":xpos, "y":ypos, "width":xsize, "height":ysize, "depth":bits_per_pixel ])

    Method set_background

      `GDK2.Drawable set_background(GTK2.GdkColor to)`

    Description

      Set the background color or image. The argument is either a GDK2.Pixmap or a GDK2.Color object.

    Method xid

      `int xid()`

    Description

      Return the xwindow id.

    Method xsize

      `int xsize()`

    Description

      Returns the width of the drawable specified in pixels

    Method ysize

      `int ysize()`

    Description

      Returns the height of the drawable specified in pixels

  CLASS GTK2.SourceLanguage

    Inherit Object

      inherit G.Object : Object

    Method get_escape_char

      `int get_escape_char()`

    Description

      Gets the value of the ESC character in the given language.

    Method get_mime_types

      `array get_mime_types()`

    Description

      Returns a list of mime types for this language.

    Method get_name

      `string get_name()`

    Description

      Returns the localized name of the language.

    Method get_section

      `string get_section()`

    Description

      Returns the localized section of the language. Each language belongs to a section (ex. HTML belongs to the Markup section).

    Method get_style_scheme

      `GTK2.SourceStyleScheme get_style_scheme()`

    Description

      Gets the style scheme associated with this language.

    Method get_tag_default_style

      `mapping get_tag_default_style(string id)`

    Description

      Gets the default style of the tag id.

    Method get_tag_style

      `mapping get_tag_style(string id)`

    Description

      Gets the style of the tag id. If the style is not defined, then returns the default style.

    Method get_tags

      `array get_tags()`

    Description

      Returns a list of tags for this language.

    Method set_mime_types

      `GTK2.SourceLanguage set_mime_types(array|void types)`

    Description

      Sets a list of mime types for this language. If omitted, this function will use the default mime types from the language file.

    Method set_tag_style

      `GTK2.SourceLanguage set_tag_style(string id, mapping|void style)`

    Description

      Sets the style of the tag id. If style is omitted, this function will restore the default style.

  CLASS GTK2.ProgressBar

    Description

      A simple progress bar. Useful when you are doing things that take a long time. Try to always have an 'abort' button whenever it makes sence. `GTK2.ProgressBar()->set_fraction(0.1)`

      `GTK2.ProgressBar()->set_property("show_text", 1)->set_fraction(0.3)`

      `GTK2.ProgressBar()->set_fraction(0.6)`

      `GTK2.ProgressBar()->set_fraction(1.0)`

      Properties: int discrete-blocks int ellipsize float fraction int orientation PROGRESS_BOTTOM_TO_TOP , PROGRESS_CONTINUOUS , PROGRESS_DISCRETE , PROGRESS_LEFT_TO_RIGHT , PROGRESS_RIGHT_TO_LEFT and PROGRESS_TOP_TO_BOTTOM float pulse-step string text

    Inherit Progress

      inherit GTK2.Progress : Progress

    Method create

      `GTK2.ProgressBar GTK2.ProgressBar(mapping|void props)`

    Description

      Create a new progress bar. The default values are: Min 0.0, max 1.0, current 0.0

    Method get_ellipsize

      `int get_ellipsize()`

    Description

      Returns the ellipsizing position of the progressbar.

    Method get_fraction

      `float get_fraction()`

    Description

      Returns the current fraction of the task that's been completed.

    Method get_orientation

      `int get_orientation()`

    Description

      Retrieves the current progress bar orientation.

    Method get_pulse_step

      `float get_pulse_step()`

    Description

      Retrieves the pulse step.

    Method get_text

      `string get_text()`

    Description

      Retrieves the text displayed superimposed on the progress bar, if any.

    Method pulse

      `GTK2.ProgressBar pulse()`

    Description

      Indicates that some progress is made, but you don't know how much. Causes the progress bar to enter "activity mode", where a block bounces back and forth. Each call to pulse() causes the block to move by a little bit (the amount of movement per pulse is determined by set_pulse_step()).

    Method set_ellipsize

      `GTK2.ProgressBar set_ellipsize(int mode)`

    Description

      Sets the mode used to ellipsize (add an ellipsis: "...") the text if there is not enough space to render the entire string. One of .

    Method set_fraction

      `GTK2.ProgressBar set_fraction(float fraction)`

    Description

      Causes the progress bar to "fill in" the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.

    Method set_orientation

      `GTK2.ProgressBar set_orientation(int style)`

    Description

      Causes the progress bar to switch to a different orientation (left-to-right, right-to-left, top-to-bottom, or bottom-to-top). One of PROGRESS_BOTTOM_TO_TOP , PROGRESS_CONTINUOUS , PROGRESS_DISCRETE , PROGRESS_LEFT_TO_RIGHT , PROGRESS_RIGHT_TO_LEFT and PROGRESS_TOP_TO_BOTTOM .

    Method set_pulse_step

      `GTK2.ProgressBar set_pulse_step(float fraction)`

    Description

      Sets the fraction of total progress bar length to move the bouncing block for each call to pulse().

    Method set_text

      `GTK2.ProgressBar set_text(string text)`

    Description

      Causes the given text to appear superimposed on the progress bar.

  CLASS GTK2.TextBuffer

    Description

      Properties: GTK2.TextTagTable tag_table string text

      Signals: apply_tag

      begin_user_action

      changed

      delete_range

      end_user_action

      insert_child_anchor

      insert_pixbuf

      insert_text

      mark_deleted

      mark_set

      modified_changed

      remove_tag

    Inherit Object

      inherit G.Object : Object

    Method add_selection_clipboard

      `GTK2.TextBuffer add_selection_clipboard(GTK2.Clipboard clipboard)`

    Description

      Adds clipboard to the list of clipboards in which the selection contents of the buffer are available. In most cases, clipboard will be the GTK2.Clipboard of GDK2.SELECTION_PRIMARY for a view of this buffer.

    Method apply_tag

      `GTK2.TextBuffer apply_tag(GTK2.TextTag tag, GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Emits the "apply-tag" signal. The default handler for the signal applies tag to the given range, start and end do not have to be in order.

    Method apply_tag_by_name

      `GTK2.TextBuffer apply_tag_by_name(string name, GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Calls GTK2.TextTagTable->lookup() on the buffers tag table to get a GTK2.TextTag, then calls apply_tag().

    Method backspace

      `int backspace(GTK2.TextIter iter, int interactive, int default_editable)`

    Description

      Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter. In the normal case a single character will be deleted, but when combining accents are involved, more than one character can be deleted, and when precomposed character and accent combinations are involved, less than one character will be deleted.

      Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, iter will be re-initialized to point to the location where text was deleted.

    Method begin_user_action

      `GTK2.TextBuffer begin_user_action()`

    Description

      Called to indicate that the buffer operations between here and call end_user_action() are part of a single user-visible operation. The operations between begin_user_action() and end_user_action() can then be grouped when creating an undo stack. W(TextBuffer) maintains a count of calls to begin_user_action() that have not been closed with a call to end_user_action(), and emits the "begin-user-action" and "end-user-action" signals only for the outermost pair of calls. This allows you to build user actions from other user actions.

      The "interactive" buffer mutation functions, such as insert_interactive(), automatically call begin/end user action around the buffer operations they perform, so there's no need to add extra calls if your user action consists solely of a single call to one of those functions.

    Method copy_clipboard

      `GTK2.TextBuffer copy_clipboard(GTK2.Clipboard clipboard)`

    Description

      Copies the currently-selected text to a clipboard.

    Method create

      `GTK2.TextBuffer GTK2.TextBuffer(GTK2.TextTagTable table_or_props)`

    Description

      Creates a new text buffer.

    Method create_child_anchor

      `GTK2.TextChildAnchor create_child_anchor(GTK2.TextIter iter)`

    Description

      This is a convenience function which simply creates a child anchor with GTK2.TextChildAnchor->create() and inserts it into the buffer with insert_child_anchor(). The new anchor is owned by the buffer; no reference count is returned.

    Method create_mark

      `GTK2.TextMark create_mark(GTK2.TextIter where, int left_gravity, string|void mark_name)`

    Description

      Creates a mark at position where. If mark_name is omitted, the mark is anonymous; otherwise, the mark can be retrieve by name using get_mark(). If a mark has left gravity, and text is inserted at the mark's current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity, the mark will end up on the right of the newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing). Emits the "mark-set" signal as notification of the mark's initial placement.

    Method create_tag

      `GTK2.TextTag create_tag(string tag_name, mapping props)`

    Description

      Creates a tag and adds it to the tag table. Equivalent to calling GTK2.TextTag->create() and then adding the tag to the tag table. The returned tag is owned by the tag table.

    Method cut_clipboard

      `GTK2.TextBuffer cut_clipboard(GTK2.Clipboard clipboard, int default_editable)`

    Description

      Copies the currently-selected text to a clipboard, then deletes said text if it's editable.

    Method delete

      `GTK2.TextBuffer delete(GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Deletes text between start and end. The order of start and end is not actually relevant; delete() will reorder them. This function actually emits the "delete-range" signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, start and end will be re-initialized to point to the location where text was deleted.

    Method delete_interactive

      `int delete_interactive(GTK2.TextIter start, GTK2.TextIter end, int default_editable)`

    Description

      Deletes all editable text in the given range. Calls delete() for each editable sub-range of [start,end). start and end are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted.

    Method delete_mark

      `GTK2.TextBuffer delete_mark(GTK2.TextMark mark)`

    Description

      Deletes mark, so that it's no longer located anywhere in the buffer. Removes the reference the buffer holds to the mark. There is no way to undelete a mark. The "mark-deleted" signal will be emitted as notification after the mark is deleted.

    Method delete_mark_by_name

      `GTK2.TextBuffer delete_mark_by_name(string name)`

    Description

      Deletes the mark named name; the mark must exist.

    Method delete_selection

      `int delete_selection(int interactive, int default_editable)`

    Description

      Deletes the range between the "insert" and "selection_bound" marks, that is, the currently-selected text. If interactive is true, the editability of the selection will be considered (users can't delete uneditable text).

    Method end_user_action

      `GTK2.TextBuffer end_user_action()`

    Description

      Should be paired with begin_user_action();

    Method get_bounds

      `array get_bounds()`

    Description

      Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end).

    Method get_char_count

      `int get_char_count()`

    Description

      Gets the number of characters in the buffer; note that characters and bytes are not the same, you can't e.g. expect the contents of the buffer in string form to be this many bytes long.

    Method get_end_iter

      `GTK2.TextIter get_end_iter()`

    Description

      Returns the "end iterator", one past the last valid character in the buffer. If dereferenced with W(TextIter)->get_char(), the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer to the end iterator.

    Method get_insert

      `GTK2.TextMark get_insert()`

    Description

      Returns the mark that represents the cursor (insertion point). Equivalent to calling get_mark() to get the mark named "insert", but very slightly more efficient, and involves less typing.

    Method get_iter_at_child_anchor

      `GTK2.TextIter get_iter_at_child_anchor(GTK2.TextChildAnchor anchor)`

    Description

      Returns the location of anchor.

    Method get_iter_at_line

      `GTK2.TextIter get_iter_at_line(int line)`

    Description

      Returns a W(TextIter) to the start of the given line.

    Method get_iter_at_line_index

      `GTK2.TextIter get_iter_at_line_index(int line, int byte_index)`

    Description

      Obtains an iterator point to byte_index with the given line. byte_index must be the start of a UTF-8 character, and must not be beyond the end of the line. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.

    Method get_iter_at_line_offset

      `GTK2.TextIter get_iter_at_line_offset(int line_number, int char_offset)`

    Description

      Obtains an iterator pointing to char_offset within the given line. The char_offset must exist, offsets off the end of the line are not allowed. Note characters, not bytes; UTF-8 may encode one character as multiple bytes.

    Method get_iter_at_mark

      `GTK2.TextIter get_iter_at_mark(GTK2.TextMark mark)`

    Description

      Returns an iterator with the current position of mark.

    Method get_iter_at_offset

      `GTK2.TextIter get_iter_at_offset(int offset)`

    Description

      Returns an iterator at position offset chars from the start of the entire buffer. If offset is -1 or greater than the number of characters in the buffer, returns the end iterator, the iterator one past the last valid character in the buffer.

    Method get_line_count

      `int get_line_count()`

    Description

      Obtains the number of lines in the buffer.

    Method get_mark

      `GTK2.TextMark get_mark(string name)`

    Description

      Returns the mark named name.

    Method get_modified

      `int get_modified()`

    Description

      Indicates whether the buffer has been modified since the last call to set_modified() set the modification flag to false. Used for example to enable a "save" function in a text editor.

    Method get_selection_bound

      `GTK2.TextMark get_selection_bound()`

    Description

      Returns the mark that represents the selection bound. Equivalent to calling get_mark() to get the mark named "selection_bound", but very slightly more efficient, and involves less typing.

      The currently-selected text in the buffer is the region between the "selection_bound" and "insert" marks. If "selection_bound" and "insert" are in the same place, then there is no current selection. get_selection_bounds() is another convenient function for handling the selection, if you just want to know whether there's a selection and what its bounds are.

    Method get_selection_bounds

      `array get_selection_bounds()`

    Description

      Returns either a start and end W(TextIter) if some text is selected, or 2 0's.

    Method get_slice

      `string get_slice(GTK2.TextIter start, GTK2.TextIter end, int include_hidden_chars)`

    Description

      Returns the text in the range [start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with get_text(). Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer.

    Method get_start_iter

      `GTK2.TextIter get_start_iter()`

    Description

      Returns an iterator with the first position in the text buffer. This is the same as using get_iter_at_offset() to get the iter at character offset 0.

    Method get_tag_table

      `GTK2.TextTagTable get_tag_table()`

    Description

      Get the W(TextTagTable) associated with this buffer.

    Method get_text

      `string get_text(GTK2.TextIter start, GTK2.TextIter end, int include_hidden_chars)`

    Description

      Returns the text int the range [start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with get_slice().

    Method insert

      `GTK2.TextBuffer insert(GTK2.TextIter iter, string text, int len)`

    Description

      Insert len bytes of text at position iter. If len is -1, string will be inserted in its entirely. Emits the 'insert-text' signal. iter is invalidated after insertion, but the default signal handler revalidates it to point to the end of the inserted text.

    Method insert_at_cursor

      `GTK2.TextBuffer insert_at_cursor(string text, int len)`

    Description

      Simply calls insert(), using the current cursor position as the insertion point.

    Method insert_child_anchor

      `GTK2.TextBuffer insert_child_anchor(GTK2.TextIter iter, GTK2.TextChildAnchor anchor)`

    Description

      Inserts a child widget anchor into the buffer at iter. The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" oxFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for child anchors, but the "text" variants do not. e.g. see get_slice() and get_text(). Consider create_child_anchor() as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion.

    Method insert_interactive

      `int insert_interactive(GTK2.TextIter iter, string text, int len, int default_editable)`

    Description

      Like insert(), but the insertion will not occur if iter is at a non- editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive).

      default_edtibale indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of get_editable() is appropriate here.

    Method insert_interactive_at_cursor

      `int insert_interactive_at_cursor(string text, int len, int default_editable)`

    Description

      Calls insert_interactive() at the cursor position.

    Method insert_pixbuf

      `GTK2.TextBuffer insert_pixbuf(GTK2.TextIter iter, GTK2.GdkPixbuf pixbuf)`

    Description

      Inserts an image into the text buffer at iter. The image will be counted as one character in character counts, and when obtaining the contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for pixbufs, but the "text" variants do not. e.g. see get_slice() and get_text().

    Method insert_range

      `GTK2.TextBuffer insert_range(GTK2.TextIter iter, GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Copies text, tags, and pixbufs between start and end (the order of start and end doesn't matter) and inserts the copy at iter. Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from this buffer, the two buffers must share the same tag table.

      Implemented via emissions of the insert-text and apply-tag signals, so expect those.

    Method insert_range_interactive

      `int insert_range_interactive(GTK2.TextIter iter, GTK2.TextIter start, GTK2.TextIter end, int default_editable)`

    Description

      Same as insert_range(), but does nothing if the insertion point isn't editable. The default_editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability.

    Method insert_with_tags

      `GTK2.TextBuffer insert_with_tags(GTK2.TextIter iter, string text, int len, array tags)`

    Description

      Inserts text into the buffer at iter, applying the list of tags to the newly-inserted text. Equivalent to calling insert(), then apply_tag() on the insert text; insert_with_tags() is just a convenience function.

    Method insert_with_tags_by_name

      `GTK2.TextBuffer insert_with_tags_by_name(GTK2.TextIter iter, string text, int len, array tag_names)`

    Description

      Same as insert_with_tags(), but allows you to pass in tag names instead of tag objects.

    Method move_mark

      `GTK2.TextBuffer move_mark(GTK2.TextMark mark, GTK2.TextIter where)`

    Description

      Moves mark to the new location where. Emits the "mark-set" signal as notification of the move.

    Method move_mark_by_name

      `GTK2.TextBuffer move_mark_by_name(string name, GTK2.TextIter where)`

    Description

      Moves the mark named name (which must exist) to location where.

    Method paste_clipboard

      `GTK2.TextBuffer paste_clipboard(GTK2.Clipboard clipboard, int|void default_editable, GTK2.TextIter location)`

    Description

      Pastes the contents of a clipboard at the insertion point, or at override_location.

    Method place_cursor

      `GTK2.TextBuffer place_cursor(GTK2.TextIter where)`

    Description

      This function moves the "insert" and "selection_bound" marks simultaneously. If you move them to the same place in two steps with move_mark(), you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.

    Method remove_all_tags

      `GTK2.TextBuffer remove_all_tags(GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Removes all tags in the range between start and end. Be careful with this function; it could remove tags added in code unrelated to the code you're currently writing. That is, using this function is probably a bad idea if you have two or more unrelated code sections that add tags.

    Method remove_selection_clipboard

      `GTK2.TextBuffer remove_selection_clipboard(GTK2.Clipboard clipboard)`

    Description

      Removes a clipboard that was added with add_selection_clipboard().

    Method remove_tag

      `GTK2.TextBuffer remove_tag(GTK2.TextTag tag, GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Emits the "remove-tag" signal. The default handler for the signal removes all occurrences of tag from the given range. start and end do not have to be in order.

    Method remove_tag_by_name

      `GTK2.TextBuffer remove_tag_by_name(string name, GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Removes a tag. See apply_tag_by_name().

    Method select_range

      `GTK2.TextBuffer select_range(GTK2.TextIter ins, GTK2.TextIter bound)`

    Description

      This function removes the "insert" and "selection_bound" marks simultaneously. If you move them in two steps with move_mark(), you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.

    Method set_modified

      `GTK2.TextBuffer set_modified(int setting)`

    Description

      Used to keep track of whether the buffer has been modified since the last time it was saved. Whenever the buffer is saved to disk, call set_modified(0). When the buffer is modified, it will automatically toggle on the modified bit again. When the modifed bit flips, the buffer emits a "modified-changed" signal.

    Method set_text

      `GTK2.TextBuffer set_text(string text, int len)`

    Description

      Deletes current contents of this buffer, and inserts text instead. If len is -1, text must be nul-terminated. text must be valid UTF-8.

  CLASS GTK2.Pango.AttrList

    Description

      A PangoAttrList.

    Method copy

      `GTK2.Pango.AttrList copy()`

    Description

      Copy the list.

    Method create

      `Pango.AttrList GTK2.Pango.AttrList()`

    Description

      Create a new empty attribute list.

  CLASS GTK2.MenuShell

    Description

      A GTK2.MenuShell is the abstract base class used to derive the W(Menu) and W(MenuBar) subclasses.

      A GTK2.MenuShell is a container of W(MenuItem) objects arranged in a list which can be navigated, selected, and activated by the user to perform application functions. A W(MenuItem) can have a submenu associated with it, allowing for nested hierarchical menus.

      Signals: activate_current An action signal that activates the current menu item within the menu shell.

      cancel An action signal which cancels the selection within the menu shell. Causes the selection-done signal to be emitted.

      cycle_focus

      deactivate This signal is emitted when a menu shell is deactivated.

      move_current An action signal which moves the current menu item in the direction specified.

      selection_done This signal is emitted when a selection has been completed within a menu shell.

    Inherit Container

      inherit GTK2.Container : Container

    Method activate_item

      `GTK2.MenuShell activate_item(GTK2.Widget menu_item, int force_deactivate)`

    Description

      Activates the menu item within the menu shell.

    Method append

      `GTK2.MenuShell append(GTK2.Widget what)`

    Description

      Adds a new W(MenuItem) to the end of the menu shell's item list. Same as 'add'.

    Method cancel

      `GTK2.MenuShell cancel()`

    Description

      Cancels the selection within the menu shell.

    Method deactivate

      `GTK2.MenuShell deactivate()`

    Description

      Deactivates the menu shell. Typically this results in the menu shell being erased from the screen.

    Method deselect

      `GTK2.MenuShell deselect()`

    Description

      Deselects the currently selected item from the menu shell, if any.

    Method get_children

      `array get_children()`

    Description

      This function returns all children of the menushell as an array.

    Method get_take_focus

      `int get_take_focus()`

    Description

      Returns TRUE if the menu shell will take the keyboard focus on popup.

    Method insert

      `GTK2.MenuShell insert(GTK2.Widget what, int where)`

    Description

      Add a widget after the specified location

    Method prepend

      `GTK2.MenuShell prepend(GTK2.Widget what)`

    Description

      Add a menu item to the start of the widget (for a menu: top, for a bar: left)

    Method select_first

      `GTK2.MenuShell select_first(int search_sensitive)`

    Description

      Select the first visible or selectable child of the menu shell; don't select tearoff items unless the only item is a tearoff item.

    Method select_item

      `GTK2.MenuShell select_item(GTK2.Widget menuitem)`

    Description

      Selects the menu item from the menu shell.

    Method set_take_focus

      `GTK2.MenuShell set_take_focus(int setting)`

    Description

      If setting is TRUE (the default), the menu shell will take the keyboard focus so that it will receive all keyboard events which is needed to enable keyboard navigation in menus.

  CLASS GTK2.ToggleButton

    Description

      Toggle buttons are derived from normal buttons and are very similar, except they will always be in one of two states, alternated by a click. They may be depressed, and when you click again, they will pop back up. Click again, and they will pop back down.

      `GTK2.ToggleButton("Toggle button")`

      `GTK2.ToggleButton("Toggle button")->set_active( 1 )`

      Properties: int active int draw-indicator int inconsistent

      Signals: toggled

    Inherit Button

      inherit GTK2.Button : Button

    Method create

      `GTK2.ToggleButton GTK2.ToggleButton(string|mapping label_or_props, int|void mnemonic)`

    Description

      If you supply a string, a label will be created and inserted in the button. Otherwise, use -&gt;add(widget) to create the contents of the button.

    Method get_active

      `int get_active()`

    Description

      Returns true if button is pressed, and false if it is raised.

    Method get_inconsistent

      `int get_inconsistent()`

    Description

      Gets the value set by set_inconsistent().

    Method get_mode

      `int get_mode()`

    Description

      Retrieves whether the button is displayed as a separator indicator and label.

    Method set_active

      `GTK2.ToggleButton set_active(int activep)`

    Description

      If activep is true, the toggle button will be activated.

    Method set_inconsistent

      `GTK2.ToggleButton set_inconsistent(int setting)`

    Description

      If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. This function turns on "in between" display.

    Method set_mode

      `GTK2.ToggleButton set_mode(int mode)`

    Description

      If true, draw indicator

    Method toggled

      `GTK2.ToggleButton toggled()`

    Description

      emulate a 'toggle' of the button. This will emit a 'toggled' signal.

  CLASS GTK2.TextMark

    Description

      Marks for the text.

    Inherit Object

      inherit G.Object : Object

    Method get_buffer

      `GTK2.TextBuffer get_buffer()`

    Description

      Gets the buffer this mark is located inside, or empty if the mark is deleted.

    Method get_deleted

      `int get_deleted()`

    Description

      Returns true if the mark has been removed from its buffer with delete_mark(). Marks can't be used once deleted.

    Method get_left_gravity

      `int get_left_gravity()`

    Description

      Determines whether the mark has left gravity.

    Method get_name

      `string get_name()`

    Description

      Returns the mark name; returns empty for anonymous marks.

    Method get_visible

      `int get_visible()`

    Description

      Returns true if the mark is visible.

    Method set_visible

      `GTK2.TextMark set_visible(int setting)`

    Description

      Sets the visibility of the mark; the insertion point is normally visible, i.e. you can see it as a vertical bar. Also the text widget uses a visible mark to indicate where a drop will occur when dragging-and-dropping text. Most other marks are not visible. Marks are not visible by default.

  CLASS GTK2.GdkBitmap

    Description

      A bitmap is a black and white pixmap. Most commonly used as masks for images, widgets and pixmaps.

      NOIMG

    Inherit Drawable

      inherit GDK2.Drawable : Drawable

    Method create

      `GDK2.Bitmap GTK2.GdkBitmap(int|Image.Image xsize_or_image, int|void ysize, string|void bitmap)`

    Description

      Create a new GDK2.Bitmap object. Argument is either an Image.image object, or {xsisze,ysize,xbitmapdata}.

    Method destroy

      `GDK2.Bitmap destroy()`

    Description

      Destructor. Destroys the bitmap. This will free the bitmap on the X-server.

    Method ref

      `GDK2.Bitmap ref()`

    Description

      Add a reference

    Method unref

      `GDK2.Bitmap unref()`

    Description

      Remove a reference

  CLASS GTK2.Data

    Description

      A class inherited by all objects used to store data (they are not widgets)

      Signals: disconnect

    Inherit Object

      inherit GTK2.Object : Object

  CLASS GTK2.RadioButton

    Description

      Radio buttons are similar to check buttons except they are grouped so that only one may be selected/depressed at a time. This is good for places in your application where you need to select from a short list of options. To connect the buttons, use another button in the desired group as the second argument to GTK2.RadioButton().

      `GTK2.RadioButton("Button");`

      Properties: GTK2.RadioButton group

      Signals: group_changed

    Inherit CheckButton

      inherit GTK2.CheckButton : CheckButton

    Method create

      `GTK2.RadioButton GTK2.RadioButton(string|mapping title, GTK2.RadioButton groupmember, int|void mnemonic)`

    Description

      Normal creation: object GTK2.RadioButton(string title) - First button (with label) object GTK2.RadioButton()->add(widget) - First button (with widget) object GTK2.RadioButton(title, another_radio_button) - Second to n:th button (with title) object GTK2.RadioButton(0,another_radio_button)->add(widget) - Second to n:th button (with widget)

    Method get_group

      `array get_group()`

    Description

      Returns an array of members in this group.

    Method set_group

      `GTK2.RadioButton set_group(GTK2.RadioButton groupmember)`

    Description

      the argument is another radio button to whose group this button should be added to. It is prefereable to use the second argument to the constructor instead, but if you for some reason want to move the button to another group, use this function.

  CLASS GTK2.Vseparator

    Description

      Simply creates a vertical separator. No bells or whistles. `GTK2.Vseparator()->set_size_request(3,50)`

    Inherit Separator

      inherit GTK2.Separator : Separator

    Method create

      `GTK2.Vseparator GTK2.Vseparator(mapping|void props)`

    Description

      Used to create a new vseparator widget.

  CLASS GTK2.Gnome2Client

    Inherit Object

      inherit GTK2.Object : Object

    Method create

      `Gnome2.Client GTK2.Gnome2Client()`

    Description

      Gets the master session management client.

    Method disconnect

      `Gnome2.Client disconnect()`

    Description

      Disconnect the client from the session manager.

    Method flush

      `Gnome2.Client flush()`

    Description

      This will force the underlying connection to the session manager to be flushed. This is useful if you have some pending changes that you want to make sure get committed.

    Method get_config_prefix

      `string get_config_prefix()`

    Description

      Get the config prefix. This config prefix provides a suitable place to store any details about the state of the client which can not be described using the app's command line arguments (as set in the restart command).

    Method get_desktop_id

      `string get_desktop_id()`

    Description

      Get the client ID of the desktop's current instance, i.e. if you consider the desktop as a whole as a session managed app, this returns its session ID using a gnome extension to session management. May return empty for apps not running under a recent version of gnome-session; apps should handle that case.

    Method get_flags

      `int get_flags()`

    Description

      Determine the client's status with the session manager.

    Method get_global_config_prefix

      `string get_global_config_prefix()`

    Description

      Get the config prefix that will be returned by get_config_prefix() for clients which have NOT been restarted or cloned (i.e. for clients started by the user without '--sm-' options). This config prefix may be used to write the user's preferred config for these "new"clients".

      You could also use this prefix as a place to store and retrieve config details that you wish to apply to ALL instances of the app. However, this practice limits the users freedom to configure each instance in a different way so it should be used with caution.

    Method get_id

      `string get_id()`

    Description

      Returns the session management ID.

    Method get_previous_id

      `string get_previous_id()`

    Description

      Get the session management ID from the previous session.

    Method request_phase_2

      `Gnome2.Client request_phase_2()`

    Description

      Request the session manager to emit the "save-yourself" signal for a second time after all the clients in the session have ceased interacting with the user and entered an idle state. This might be useful if your app managers other apps and requires that they are in an idle state before saving its final data.

    Method request_save

      `Gnome2.Client request_save(int save_style, int shutdown, int interact_style, int fast, int global)`

    Description

      Request the session manager to save the session in some way. The arguments correspond with the arguments passed to the "save-yourself" signal handler.

      The save_style (GNOME_SAVE_BOTH , GNOME_SAVE_GLOBAL and GNOME_SAVE_LOCAL ) indicates whether the save should affect data accessible to other users (GTK2.GNOME_SAVE_GLOBAL) or only the state visible to the current user (GTK2.GNOME_SAVE_LOCAL), or both. Setting shutdown to true will initiate a logout. The interact_style (GNOME_INTERACT_ANY , GNOME_INTERACT_ERRORS and GNOME_INTERACT_NONE ) specifies which kinds of interaction will be available. Setting fast to true will limit the save to setting the session manager properties plus any essential data. Setting the value of global to true will request that all the other apps in the session do a save as well. A global save is mandatory when doing a shutdown.

    Method save_any_dialog

      `Gnome2.Client save_any_dialog(GTK2.Dialog dialog)`

    Description

      May be called during a "save-yourself" handler to request that a (modal) dialog is presented to the user. The session manager decides when the dialog is shown, but it will not be shown it unless the session manager is sending an interaction style of GTK2.GNOME_INTERACT_ANY. "Cancel" and "Log out" buttons will be added during a shutdown.

    Method save_error_dialog

      `Gnome2.Client save_error_dialog(GTK2.Dialog dialog)`

    Description

      May be called during a "save-yourself" handler when an error has occurred during the save.

    Method set_clone_command

      `Gnome2.Client set_clone_command(array argv)`

    Description

      Set a command the session manager can use to create a new instance of the application. Not implemented yet.

    Method set_current_directory

      `Gnome2.Client set_current_directory(string dir)`

    Description

      Set the directory to be in when running shutdown, discard, restart, etc. commands.

    Method set_discard_command

      `Gnome2.Client set_discard_command(array argv)`

    Description

      Provides a command to run when a client is removed from the session. It might delete session-specific config files, for example. Executing the discard command on the local host should delete the information saved as part of the session save that was in progress when the discard command was set. For example: string prefix=client->get_config_prefix(); array argv=({ "rm","-r" }); argv+=({ Gnome2.Config->get_real_path(prefix) }); client->set_discard_command(argv); Not implemented yet.

    Method set_environment

      `Gnome2.Client set_environment(string name, string value)`

    Description

      Set an environment variable to be placed in the client's environment prior to running restart, shutdown, discard, etc. commands.

    Method set_global_config_prefix

      `Gnome2.Client set_global_config_prefix(string prefix)`

    Description

      Set the value used for the global config prefix. The global config prefix defaults to a name based on the name of the executable. This function allows you to set it to a different value. It should be called BEFORE retrieving the config prefix for the first time. Later calls will be ignored.

    Method set_priority

      `Gnome2.Client set_priority(int priority)`

    Description

      The gnome-session manager restarts clients in order of their priorities in a similar way to the start up ordering in SysV. This function allows the app to suggest a position in this ordering. The value should be between 0 and 99. A default value of 50 is assigned to apps that do not provide a value. The user may assign a different priority.

    Method set_resign_command

      `Gnome2.Client set_resign_command(array argv)`

    Description

      Some clients can be "undone", removing their effects and deleting any saved state. For example, xmodmap could register a resign command to undo the keymap changes it saved.

      Used by clients that use the GTK2.GNOME_RESTART_ANYWAY restart style to undo their effects (these clients usually perform initialization functions and leave effects behind after they die). The resign command combines the effects of a shutdown command and a discard command. It is executed when the user decides that the client should cease to be restarted. Not implemented yet.

    Method set_restart_command

      `Gnome2.Client set_restart_command(array argv)`

    Description

      When clients crash or the user logs out and back in, they are restarted. This command should perform the restart. Executing the restart command on the local host should reproduce the state of the client at the time of the session save as closely as possible. Saving config info under the get_config_prefix() is generally useful. Not implemented yet.

    Method set_restart_style

      `Gnome2.Client set_restart_style(int style)`

    Description

      Tells the session manager how the client should be restarted in future sessions. One of GNOME_RESTART_ANYWAY , GNOME_RESTART_IF_RUNNING , GNOME_RESTART_IMMEDIATELY and GNOME_RESTART_NEVER

    Method set_shutdown_command

      `Gnome2.Client set_shutdown_command(array argv)`

    Description

      GTK2.GNOME_RESTART_ANYWAY clients can set this command to run when the user logs out but the client is no longer running.

      Used by clients that use the GTK2.GNOME_RESTART_ANYWAY restart style to undo their effects (these clients usually perform initialization functions and leave effects behind after they die). The shutdown command simply undoes the effects of the client. It is executed during a normal logout. Not implemented yet.

  CLASS GTK2.TreeStore

    Description

      A tree-like data structure that can be used with W(TreeView).

    Inherit Object

      inherit G.Object : Object

    Inherit TreeModel

      inherit GTK2.TreeModel : TreeModel

    Inherit TreeSortable

      inherit GTK2.TreeSortable : TreeSortable

    Inherit TreeDragSource

      inherit GTK2.TreeDragSource : TreeDragSource

    Inherit TreeDragDest

      inherit GTK2.TreeDragDest : TreeDragDest

    Method append

      `GTK2.TreeIter append(GTK2.TreeIter parent)`

    Description

      Append a new row. If parent is valid, then it will append the new row after the last child, otherwise it will append a row to the toplevel.

    Method clear

      `GTK2.TreeStore clear()`

    Description

      Removes all rows.

    Method create

      `GTK2.TreeStore GTK2.TreeStore(array types)`

    Description

      Create a new tree store with as many columns as there are items in the array. A type is either a string representing a type name, such as "int" or "float", or an actual widget. If it is a widget, the column in question should be a widget of the same type that you would like this column to represent.

    Method insert

      `GTK2.TreeIter insert(GTK2.TreeIter parent, int position)`

    Description

      Insert a row at position. If parent is valid, will create as child, otherwise at top level. If position is larger than then number of rows at that level, it will be added to the end of the list. iter will be changed to point to the new row.

    Method insert_after

      `GTK2.TreeIter insert_after(GTK2.TreeIter parent, GTK2.TreeIter sibling)`

    Description

      Insert a new row after sibling. If sibling is 0, then the row will be prepended to parent's children. If parent and sibling are both 0, then the row will be prepended to the toplevel.

    Method insert_before

      `GTK2.TreeIter insert_before(GTK2.TreeIter parent, GTK2.TreeIter sibling)`

    Description

      Insert a row before sibling. If sibling is 0, then the row will be appended to parent's children. If parent and sibling are 0, then the row will be appended to the toplevel.

    Method is_ancestor

      `int is_ancestor(GTK2.TreeIter iter, GTK2.TreeIter descendant)`

    Description

      Returns true if iter is an ancestor of descendant.

    Method iter_depth

      `int iter_depth(GTK2.TreeIter iter)`

    Description

      Get the depth of iter. This will be 0 for anything on the root level, 1 for anything down a level, and so on.

    Method move_after

      `GTK2.TreeStore move_after(GTK2.TreeIter iter, GTK2.TreeIter position)`

    Description

      Moves iter to after position. These should be at the same level. This only works if the store is unsorted. If position is omitted, iter will be moved to the start of the level.

    Method move_before

      `GTK2.TreeStore move_before(GTK2.TreeIter iter, GTK2.TreeIter position)`

    Description

      Moves iter to before position. These should be at the same level. This only works if the store is unsorted. If position is omitted, iter will be moved to the end of the level.

    Method prepend

      `GTK2.TreeIter prepend(GTK2.TreeIter parent)`

    Description

      Prepend a new row. If parent is valid, then it will prepend the new row before the first child of parent, otherwise it will prepend a new row to the toplevel.

    Method remove

      `GTK2.TreeStore remove(GTK2.TreeIter iter)`

    Description

      Remove iter. iter is set to the next valid row at that level, or invalidated if it was the last one.

    Method set_row

      `GTK2.TreeStore set_row(GTK2.TreeIter iter, array values)`

    Description

      Set the data in an entire row.

    Method set_value

      `GTK2.TreeStore set_value(GTK2.TreeIter iter, int column, mixed value)`

    Description

      Set the data in the cell specified by iter and column.

    Method swap

      `GTK2.TreeStore swap(GTK2.TreeIter a, GTK2.TreeIter b)`

    Description

      Swap 2 rows. Only works if this store is unsorted.

  CLASS GTK2.Settings

    Description

      Properties: int gtk-alternative-button-order int gtk-button-images int gtk-can-change-accels string gtk-color-palette int gtk-cursor-blink int gtk-cursor-blink-time string gtk-cursor-theme-name int gtk-cursor-theme-size int gtk-dnd-drag-threshold int gtk-double-click-distance int gtk-double-click-time int gtk-enable-animations int gtk-entry-select-on-focus string gtk-font-name string gtk-icon-sizes string gtk-icon-theme-name string gtk-key-theme-name string gtk-menu-bar-accel gint gtk-menu-bar-popup-delay int gtk-menu-images int gtk-menu-popdown-delay int gtk-menu-popup-delay string gtk-modules int gtk-split-cursor string gtk-theme-name int gtk-toolbar-icon-size int gtk-toolbar-style int gtk-xft-antialias int gtk-xft-dpi int gtk-xft-hinting string gtk-xft-hintstyle string gtk-xft-rgba

    Inherit Object

      inherit G.Object : Object

    Method create

      `GTK2.Settings GTK2.Settings()`

    Description

      Get the default GTK2.Settings object

  CLASS GTK2.EventBox

    Description

      Some gtk widgets don't have associated X windows, so they just draw on their parents. Because of this, they cannot receive events and if they are incorrectly sized, they don't clip so you can get messy overwritting etc. If you require more from these widgets, the EventBox is for you.

      At first glance, the EventBox widget might appear to be totally useless. It draws nothing on the screen and responds to no events. However, it does serve a function - it provides an X window for its child widget. This is important as many GTK2 widgets do not have an associated X window. Not having an X window saves memory and improves performance, but also has some drawbacks. A widget without an X window cannot receive events, and does not perform any clipping on it's contents. Although the name EventBox emphasizes the event-handling function, the widget can also be used for clipping.

      The primary use for this widget is when you want to receive events for a widget without a window. Examples of such widgets are labels and images.

      `GTK2.EventBox()->set_size_request(100,100)`

      Properties: int above-child int visible-window

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.EventBox GTK2.EventBox(mapping|void props)`

    Description

      Create a new event box widget

    Method get_above_child

      `int get_above_child()`

    Description

      Returns whether the event box window is above or below the windows of its child.

    Method get_visible_window

      `int get_visible_window()`

    Description

      Returns whether the event box has a visible window.

    Method set_above_child

      `GTK2.EventBox set_above_child(int above_child)`

    Description

      Sets whether the event box window is positioned above the windows of its child, as opposed to below it. If the window is above, all events inside the event box will go to the event box. If the window is below, events in windows of child widgets will first go to that widget, and then to its parents.

      The default is to keep the window below the child.

    Method set_visible_window

      `GTK2.EventBox set_visible_window(int visible_window)`

    Description

      Sets whether the event box uses a visible or invisible child window. The default is to use visible windows.

  CLASS GTK2.CellRendererPixbuf

    Description

      Properties: GDK2.Pixbuf pixbuf GDK2.Pixbuf pixbuf-expander-closed GDK2.Pixbuf pixbuf-expander-open string stock-detail string stock-id int stock-size

    Inherit CellRenderer

      inherit GTK2.CellRenderer : CellRenderer

    Method create

      `GTK2.CellRendererPixbuf GTK2.CellRendererPixbuf(mapping|void props)`

    Description

      Creates a new W(CellRendererPixbuf). Adjust rendering parameters using object properties. Object properties can be set globally with G.Object->set(). Also, with W(TreeViewColumn), you can bind a property to a value in a W(TreeModel). For example, you can bind the "pixbuf" property on the cell renderer to a pixbuf value in the model, thus rendering a different image in each row of the W(TreeView).

  CLASS GTK2.Scale

    Description

      The GTK2.Scale widget is an abstract class, used only for deriving the subclasses GTK2.Hscale and GTK2.Vscale.

      See W(Range) for generic range documentation

      Properties: int digits int draw-value int value-pos

      Style properties: int slider-length int value-spacing

      Signals: format_value

    Inherit Range

      inherit GTK2.Range : Range

    Method get_digits

      `int get_digits()`

    Description

      Gets the number of decimal places that are displayed.

    Method get_draw_value

      `int get_draw_value()`

    Description

      Returns whether the current value is displayed as a string next to the slider.

    Method get_layout

      `GTK2.Pango.Layout get_layout()`

    Description

      Gets the Pango.Layout used to display the scale.

    Method get_layout_offsets

      `mapping get_layout_offsets()`

    Description

      Obtains the coordinates where the scale will draw the Pango.Layout representing the text in the scale. Remember when using the Pango.Layout function you need to convert to and from pixels using PANGO_SCALE.

    Method get_value_pos

      `int get_value_pos()`

    Description

      Gets the position in which the current value is displayed.

    Method set_digits

      `GTK2.Scale set_digits(int precision)`

    Description

      Sets the number of decimal places that are displayed in the value.

    Method set_draw_value

      `GTK2.Scale set_draw_value(int drawp)`

    Description

      Specifies whether the current value is displayed as a string next to the slider.

    Method set_value_pos

      `GTK2.Scale set_value_pos(int where)`

    Description

      Sets the position in which the current value is displayed. One of POS_BOTTOM , POS_LEFT , POS_RIGHT and POS_TOP

  CLASS GTK2.SeparatorMenuItem

    Description

      A separator menu item.

    Inherit MenuItem

      inherit GTK2.MenuItem : MenuItem

    Method create

      `GTK2.SeparatorMenuItem GTK2.SeparatorMenuItem(mapping|void props)`

    Description

      Create a new GTK2.SeparatorMenuItem.

  CLASS GTK2.Clipboard

    Description

      Clipboard implementation.

    Inherit Object

      inherit G.Object : Object

    Method clear

      `GTK2.Clipboard clear()`

    Description

      Clears the contents of the clipboard.

    Method get

      `GTK2.Clipboard get(GDK2.Atom selection)`

    Description

      Returns the clipboard object for the given selection.

    Method get_display

      `GTK2.GdkDisplay get_display()`

    Description

      Gets the GDK2.Display associated with this clipboard.

    Method get_for_display

      `GTK2.Clipboard get_for_display(GTK2.GdkDisplay display, GDK2.Atom selection)`

    Description

      Returns the clipboard object for the given selection.

    Method set_image

      `GTK2.Clipboard set_image(GTK2.GdkPixbuf pixbuf)`

    Description

      Sets the contents of the clipboard to the given GDK2(Pixbuf).

    Method set_text

      `GTK2.Clipboard set_text(string text, int len)`

    Description

      Sets the contents of the clipboard to the given UTF-8 string.

    Method wait_for_image

      `GTK2.GdkPixbuf wait_for_image()`

    Description

      Requests the contents of the clipboard as image and converts the result to a GDK2.Pixbuf.

    Method wait_for_text

      `string wait_for_text()`

    Description

      Requests the contents of the clipboard as text and converts the result to UTF-8 if necessary.

    Method wait_is_image_available

      `int wait_is_image_available()`

    Description

      Test to see if tehre is an image available to be pasted.

    Method wait_is_text_available

      `int wait_is_text_available()`

    Description

      Test to see if there is text available to be pasted. This is done by requesting the TARGETS atom and checking if it contains any of the supported text targets.

  CLASS GTK2.FileChooserButton

    Description

      Properties: GTK2.FileChooserDialog dialog string title int width-chars

    Inherit Hbox

      inherit GTK2.Hbox : Hbox

    Method create

      `GTK2.FileChooserButton GTK2.FileChooserButton(string|mapping title_or_props, int|void action)`

    Description

      Create a new file-selecting button widget. action is one of FILE_CHOOSER_ACTION_CREATE_FOLDER , FILE_CHOOSER_ACTION_OPEN , FILE_CHOOSER_ACTION_SAVE and FILE_CHOOSER_ACTION_SELECT_FOLDER

    Method get_title

      `string get_title()`

    Description

      Retrieves the title of the browse dialog.

    Method get_width_chars

      `int get_width_chars()`

    Description

      Retrieves the width in characters of the button widget's entry and/or label.

    Method set_title

      `GTK2.FileChooserButton set_title(string title)`

    Description

      Modifies the title of the browse dialog.

    Method set_width_chars

      `GTK2.FileChooserButton set_width_chars(int n_chars)`

    Description

      Sets the width (in characters) that the button will use.

  CLASS GTK2.TreeDragDest

    Method drag_data_received

      `int drag_data_received(GTK2.TreePath path, GTK2.SelectionData sel)`

    Description

      Asks to insert a row before the path dest, deriving the contents of the row from the sel. If this dest is outside the tree so that inserting before it is impossible, false will be returned. Also, false may be returned if the new row is not created for some model-specific reason.

    Method row_drop_possible

      `int row_drop_possible(GTK2.TreePath path, GTK2.SelectionData sel)`

    Description

      Determines whether a drop is possible before past, at the same depth as path. i.e., can we drop the data in sel at that location. path does not have to exist; the return value will almost certainly be false if the parent of path doesn't exist, though.

  CLASS GTK2.TextTag

    Description

      Properties: string background int background-full-height int background-full-height-set GDK2.Color background-gdk int background-set GDK2.Pixmap background-stipple int background-stipple-set int direction One of int editable int editable-set string family int family-set string font Pango.FontDescription font-desc string foreground GDK2.Color foreground-gdk int foreground-set GDK2.Pixmap foreground-stipple int foreground-stipple-set int indent int indent-set int invisible int invisible_set int justification One of int justification-set string language; int language-set; int left-margin; int left-margin-set; string name; int pixels-above-lines; int pixels-above-lines-set; int pixels-below-lines; int pixels-below-lines-set; int pixels-inside-wrap; int pixels-inside-wrap-set; int right-margin; int right-margin-set; int rise; int rise-set; float scale; int scale-set; int size; double size-points; int size-set; int stretch; One of PANGO_STRETCH_CONDENSED , PANGO_STRETCH_EXPANDED , PANGO_STRETCH_EXTRA_CONDENSED , PANGO_STRETCH_EXTRA_EXPANDED , PANGO_STRETCH_NORMAL , PANGO_STRETCH_SEMI_CONDENSED , PANGO_STRETCH_SEMI_EXPANDED , PANGO_STRETCH_ULTRA_CONDENSED and PANGO_STRETCH_ULTRA_EXPANDED int stretch-set; int strikethrough; int strikethrough-set; int style; One of PANGO_STYLE_ITALIC , PANGO_STYLE_NORMAL and PANGO_STYLE_OBLIQUE int style-set; Pango.TabArray tabs int tabs-set; int underline; One of PANGO_UNDERLINE_DOUBLE , PANGO_UNDERLINE_ERROR , PANGO_UNDERLINE_LOW , PANGO_UNDERLINE_NONE and PANGO_UNDERLINE_SINGLE int underline-set; int variant; One of PANGO_VARIANT_NORMAL and PANGO_VARIANT_SMALL_CAPS int variant-set; int weight; int weight-set; int wrap-mode; One of int wrap-mode-set;

      Signals: event

    Inherit Object

      inherit G.Object : Object

    Method create

      `GTK2.TextTag GTK2.TextTag(string|mapping name_or_props)`

    Description

      Creates a new text tag.

    Method event

      `int event(GTK2.G.Object event_object, GTK2.GdkEvent event, GTK2.TextIter iter)`

    Description

      Emits the 'event' signal.

    Method get_priority

      `int get_priority()`

    Description

      Gets the tag priority.

    Method set_priority

      `GTK2.TextTag set_priority(int priority)`

    Description

      Sets the priority. Valid priorities start at 0 and go to 1 less than W(TextTagTable)->get_size().

  CLASS GTK2.TextTagTable

    Description

      Table of text tags.

      Signals: tag_added

      tag_changed

      tag_removed

    Inherit Object

      inherit G.Object : Object

    Method add

      `GTK2.TextTagTable add(GTK2.TextTag tag)`

    Description

      Add a tag to the table. The tag is assigned the highest priority in the table.

    Method create

      `GTK2.TextTagTable GTK2.TextTagTable()`

    Description

      Creates a new W(TextTagTable).

    Method get_size

      `int get_size()`

    Description

      Returns the size of the table (number of tags).

    Method lookup

      `GTK2.TextTag lookup(string name)`

    Description

      Look up a named tag.

    Method remove

      `GTK2.TextTagTable remove(GTK2.TextTag tag)`

    Description

      Remove a tag from the table.

  CLASS GTK2.TreeRowReference

    Description

      A TreeRowReference.

    Method copy

      `GTK2.TreeRowReference copy()`

    Description

      Copies a GTK2.TreeRowReference.

    Method create

      `GTK2.TreeRowReference GTK2.TreeRowReference(GTK2.TreeModel model, GTK2.TreePath path)`

    Description

      Creates a row reference based on path. This reference will keep pointing to the node pointed to by path, so long as it exists.

    Method get_model

      `GTK2.TreeModel get_model()`

    Description

      Returns the model which this references is monitoring.

    Method get_path

      `GTK2.TreePath get_path()`

    Description

      Returns a path that the row reference currently points to.

    Method valid

      `int valid()`

    Description

      Return TRUE if the reference referes to a current valid path.

  CLASS GTK2.GdkPixbuf

    Description

      Properties: int bits-per-sample int colorspace (GdkColorspace) int has-alpha int height int n-channels object pixels int rowstride int width

    Inherit Object

      inherit G.Object : Object

    Method add_alpha

      `GTK2.GdkPixbuf add_alpha(int substitute_color, int r, int g, int b)`

    Description

      Adds an alpha channel to this pixbuf and returns a copy. If it already has an alpha channel, the channel values are copied from the original; otherwise, the alpha channel is initialized to 255 (full opacity). If substitute_color is true, then the color specified by (r,g,b) will be assigned zero opacity. That is, if you pass (255,255,255) for the substitute color, all white pixels will become fully transparent.

    Method composite

      `GTK2.GdkPixbuf composite(GTK2.GdkPixbuf dest, int dest_x, int dest_y, int dest_width, int dest_height, float offset_x, float offset_y, float scale_x, float scale_y, int type, int overall_alpha)`

    Description

      Creates a transformation of the source image by scalling by scale_x and scale_y, then translating by offset_x and offset_y. This gives an image in the coordinates of the destination pixbuf. The rectangle (dest_x,dest_y,dest_width,dest_height) is then composited onto the corresponding rectangle of the original destination image. when the destination rectangle contain parts not in the source image, the data at the edges of the source image is replicated to infinity.

    Method composite_color

      `GTK2.GdkPixbuf composite_color(GTK2.GdkPixbuf dest, int dest_x, int dest_y, int dest_width, int dest_height, float offset_x, float offset_y, float scale_x, float scale_y, int type, int overall_alpha, int check_x, int check_y, int check_size, int color1, int color2)`

    Description

      Creates a transformation of the source image by scaling by scale_x and scale_y, then translating by offset_x and offset_y, then composites the rectangle (dest_x,dest_y,dest_width,dest_height) of the resulting image with a checkboard of the colors color1 and color2 and renders it onto the destinagion image.

      See composite_color_simple() for a simpler variant of this function suitable for many tasks.

    Method composite_color_simple

      `GTK2.GdkPixbuf composite_color_simple(int dest_width, int dest_height, int type, int overall_alpha, int check_size, int color1, int color2)`

    Description

      Creates a new W(Pixbuf) by scalling src to dest_width x dest_height and compositing the result with a checkboard of colors color1 and color2.

    Method copy

      `GTK2.GdkPixbuf copy()`

    Description

      Creates a new GDK2.Pixbuf with a copy of this one.

    Method copy_area

      `GTK2.GdkPixbuf copy_area(GTK2.GdkPixbuf dest, int src_x, int src_y, int widt, int height, int dest_x, int dest_y)`

    Description

      Copies a rectangular area from this pixbuf to dest. Conversion of pixbuf formats is done automatically.

    Method create

      `GDK2.Pixbuf GTK2.GdkPixbuf(string|mapping options)`

    Description

      Create a GDK2.Pixbuf object. options is either a filename or a mapping of options. options can be:

      filename | name of file to load
      bits | number of bits per sample
      width | width of image
      height | height of image
      alpha | true if alpha channel
      scale | true if use width and height as scale
      preserve | true if preserve aspect ratio
      xpm | if this key exists, then value is xpm data to create from

      data

      if this key exists, then value is pixel data The following is a list of valid keys if key data exists:

      colorspace | colorspace, default GDK2.COLORSPACE_RGB, currently ignored
      rowstride | distance in bytes between row starts

    Method flip

      `GTK2.GdkPixbuf flip(int horizontal)`

    Description

      Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf.

    Method get_bits_per_sample

      `int get_bits_per_sample()`

    Description

      Queries the number of bits per color sample.

    Method get_colorspace

      `int get_colorspace()`

    Description

      Queries the color space.

    Method get_has_alpha

      `int get_has_alpha()`

    Description

      Queries whether a pixbuf has an alpha channel.

    Method get_height

      `int get_height()`

    Description

      Queries the height.

    Method get_n_channels

      `int get_n_channels()`

    Description

      Queries the number of channels.

    Method get_option

      `string get_option(string key)`

    Description

      Looks up key in the list of options that may have been attached to the pixbuf when it was loaded.

    Method get_pixels

      `string get_pixels()`

    Description

      Returns the pixel data as a string.

    Method get_rowstride

      `int get_rowstride()`

    Description

      Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row and the start of the next row.

    Method get_width

      `int get_width()`

    Description

      Queries the width.

    Method new_subpixbuf

      `GTK2.GdkPixbuf new_subpixbuf(int src_x, int src_y, int width, int height)`

    Description

      Creates a new pixbuf which represents a sub-region of src. The new pixbuf shares its pixels with the original pixbuf, so writing to one affects both. The new pixbuf holds a reference to this one, so this object will not be finalized until the new pixbuf is finalized.

    Method put_pixel

      `int put_pixel(int x, int y, int r, int g, int b)`

    Description

      Set pixel to value.

    Method render_threshold_alpha

      `GTK2.GdkBitmap render_threshold_alpha(int src_x, int src_y, int dest_c, int dest_y, int width, int height, int alpha_threshold)`

    Description

      Takes the opacity values in a rectangular portion of a pixbuf and thresholds them to produce a bi-level alpha mask that can be used as a clipping mask for a drawable.

    Method rotate_simple

      `GTK2.GdkPixbuf rotate_simple(int angle)`

    Description

      Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf. angle is either a multiple of 90 degrees (0,90,180,270), or one of GDK_PIXBUF_ROTATE_CLOCKWISE , GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE , GDK_PIXBUF_ROTATE_NONE and GDK_PIXBUF_ROTATE_UPSIDEDOWN , which are merely aliases.

    Method saturate_and_pixelate

      `GDK2.Pixbuf saturate_and_pixelate(GTK2.GdkPixbuf dest, float saturation, int pixelate)`

    Description

      Modifes saturation and optionally pixelates this pixbuf, placing the result in dest. The source and dest may be the same pixbuf with no ill effects. If saturation is 1.0 then saturation is not changed. If it's less than 1.0, saturation is reduced (the image is darkened); if greater than 1.0, saturation is increased (the image is brightened). If pixelate is true, then pixels are faded in a checkerboard pattern to create a pixelated image. This pixbuf and dest must have the same image format, size, and rowstride.

    Method save

      `GTK2.GdkPixbuf save(string filename, string type, mapping|void options)`

    Description

      Save to a file in format type. "jpeg", "png", "ico", "bmp", are the only valid writable types at this time. Quality is only valid for jpeg images.

    Method scale

      `GTK2.GdkPixbuf scale(GTK2.GdkPixbuf dest, int dest_x, int dest_y, int dest_width, int dest_height, float offset_x, float offset_y, float scale_x, float scale_y, int type)`

    Description

      Creates a transformation of the source image by scaling by scale_x and scale_y, then translating by offset_x and offset_y, then renders the rectangle (dest_x,dest_y,dest_width,dest_height) of the resulting image onto the destination image replacing the previous contents. Try to use scale_simple() first, this function is the industrial- strength power tool you can fall back to if scale_simple() isn't powerful enough.

    Method scale_simple

      `GTK2.GdkPixbuf scale_simple(int dest_width, int dest_height, int|void interp_type)`

    Description

      Create a new W(Pixbuf) containing a copy of this W(Pixbuf) scaled to dest_width x dest_height. Leaves this W(Pixbuf) unaffected. intertype should be GDK2.INTERP_NEAREST if you want maximum speed (but when scaling down GDK2.INTERP_NEAREST is usually unusably ugly). The default interp_type should be GDK2.INTERP_BILINEAR which offers reasonable quality and speed. You can scale a sub-portion by create a sub-pixbuf with new_subpixbuf().

    Method set_alpha

      `int set_alpha(int x, int y, int setting)`

    Description

      Set alpha value.

    Method set_option

      `int set_option(string key, string value)`

    Description

      Attaches a key/value pair as an option. If the key already exists in the list of options, the new value is ignored.

  CLASS GTK2.RadioMenuItem

    Description

      Exactly like W(RadioButton), but it is an menu item. `GTK2.RadioMenuItem("Menu item")`

      Properties:

      GTK2.RadioMenuItem group

      Signals: group_changed

    Inherit CheckMenuItem

      inherit GTK2.CheckMenuItem : CheckMenuItem

    Method create

      `GTK2.RadioMenuItem GTK2.RadioMenuItem(string|mapping title, GTK2.RadioMenuItem groupmember)`

    Description

      object GTK2.RadioMenuItem(string title) - First button (with label) object GTK2.RadioMenuItem()->add(widget) - First button (with widget) object GTK2.RadioMenuItem(title, another_radio_button) - Second to n:th button (with title) object GTK2.RadioMenuItem(0,another_radio_button)->add(widget) - Second to n:th button (with widget)

    Method get_group

      `array get_group()`

    Description

      Returns the group to which the radio menu item belongs.

    Method set_group

      `GTK2.RadioMenuItem set_group(GTK2.RadioMenuItem groupmember)`

    Description

      The argument is another radio menu item to whose group this button should be added to. It is prefereable to use the second argument to the constructor instead, but if you for some reason want to move the button to another group, use this function.

  CLASS GTK2.Gnome2CanvasPixbuf

    Description

      Properties: int anchor float height int height-in-pixels int height-set GDK2.Pixbuf pixbuf float width int width-in-pixels int width-set float x int x-in-pixels float y int y-in-pixels

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

  CLASS GTK2.VScrollbar

    Description

      General documentation: See W(Scrollbar) `GTK2.VScrollbar(GTK2.Adjustment())->set_size_request(15,60)`

    Inherit Scrollbar

      inherit GTK2.Scrollbar : Scrollbar

    Method create

      `GTK2.VScrollbar GTK2.VScrollbar(GTK2.Adjustment pos_or_props)`

    Description

      Used to create a new vscrollbar widget.

  CLASS GTK2.SourcePrintJob

    Description

      Properties: GTK2.SourceBuffer buffer Gnome.PrintConfig config string font Pango.FontDescription font-desc string header-footer-font Pango.FontDescription header-footer-font-desc int highlight string numbers-font Pango.FontDescript numbers-font-desc int print-footer int print-header int print-numbers int tabs-width int wrap-mode

      Signals: begin_page

      finished

    Inherit Object

      inherit G.Object : Object

    Method cancel

      `GTK2.SourcePrintJob cancel()`

    Description

      Cancels an asynchronous printing operation. This will remove any pending print idle handler.

    Method create

      `GTK2.SourcePrintJob GTK2.SourcePrintJob(GTK2.SourceBuffer buffer)`

    Description

      Creates a new print job object.

    Method get_buffer

      `GTK2.SourceBuffer get_buffer()`

    Description

      Gets the GTK2.SourceBuffer the print job would print.

    Method get_highlight

      `int get_highlight()`

    Description

      Determines if the job is configured to print the text highlighted with colors and font styles. Note that highlighting will happen only if the buffer to print has highlighting activated.

    Method get_page

      `int get_page()`

    Description

      Determines the currently printing page number.

    Method get_page_count

      `int get_page_count()`

    Description

      Determines the total number of pages the job will print. The returned value is only meaningful after pagination has finished. In practice, for synchronous printing this means when "begin_page" is emitted, or after print_range_async() has returned.

    Method get_print_footer

      `int get_print_footer()`

    Description

      Determines if a footer is set to be printed for each page. A footer will be printed if this function returns true and some format strings have been specified with set_footer_format().

    Method get_print_header

      `int get_print_header()`

    Description

      Determines if a header is set to be printed for each page. A header will be printed if this function returns true and some format strings have been specified with set_header_format().

    Method get_print_numbers

      `int get_print_numbers()`

    Description

      Determines the interval used for line number printing. If the value is 0, no line numbers will be printed. The default value is 1 (i.e. numbers printed in all lines).

    Method get_tabs_width

      `int get_tabs_width()`

    Description

      Determines the configured width (in equivalent spaces) of tabulations. The default value is 8.

    Method get_text_margins

      `mapping get_text_margins()`

    Description

      Determines the user set margins for the job. The default for all four margins is 0.0.

    Method get_wrap_mode

      `int get_wrap_mode()`

    Description

      Determines the wrapping style for text lines wider than the printable width. The default is no wrapping.

    Method print

      `GTK2.SourcePrintJob print()`

    Description

      Print the document.

    Method print_range

      `GTK2.SourcePrintJob print_range(GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Similar to print(), except you can specify a range of text to print. start and end can be in any order.

    Method print_range_async

      `GTK2.SourcePrintJob print_range_async(GTK2.TextIter start, GTK2.TextIter end)`

    Description

      Starts to print job asynchronously. This function will ready the job for printing and install an idle handler that will render one page at a time.

      This function will not return immediately, as only page rendering is done asynchronously. Text retrieval and paginating happens within this function. Also, if highlighting is enabled, the whole buffer needs to be highlighted first.

      To get notification when the job has finished, you must connect to the "finished" signal.

    Method set_buffer

      `GTK2.SourcePrintJob set_buffer(GTK2.SourceBuffer buffer)`

    Description

      Sets the GTK2.SourceBuffer the print job will print. You need to specify a buffer to print, either by the use of this function or by creating the print job with create().

    Method set_footer_format

      `GTK2.SourcePrintJob set_footer_format(string|void left, string|void center, string|void right, int separator)`

    Description

      Like set_header_format(), but for the footer.

    Method set_header_format

      `GTK2.SourcePrintJob set_header_format(string|void left, string|void center, string|void right, int separator)`

    Description

      Sets strftime like header format strings, to be printed on the left, center and right of the top of each page. The strings may include strftime(3) codes which will be expanded at print time. All strftime() codes are accepted, with the addition of N for the page number and Q for the page count.

      separator specifies if a solid line should be drawn to separate the header from the document text.

      If 0 is given for any of the three arguments, that particular string will not be printed. For the header to be printed, in addition to specifying format strings, you need to enable header printing with set_print_header().

    Method set_highlight

      `GTK2.SourcePrintJob set_highlight(int setting)`

    Description

      Sets whether the printed text will be highlighted according to the buffer rules. Both color and font style are applied.

    Method set_print_footer

      `GTK2.SourcePrintJob set_print_footer(int setting)`

    Description

      Sets whether you want to print a footer in each page. The default footer consists of three pieces of text and an optional line separator, configurable with set_footer_format().

      Note that be default the footer format is unspecified, and if it's empty it will not be printed, regardless of this setting.

    Method set_print_header

      `GTK2.SourcePrintJob set_print_header(int setting)`

    Description

      Sets whether you want to print a header in each page. The default header consists of three pieces of text and an optional line separator, configurable with set_header_format().

      Note that by default the header format is unspecified, and if it's empty it will not be printed, regardless of this setting.

    Method set_print_numbers

      `GTK2.SourcePrintJob set_print_numbers(int interval)`

    Description

      Sets the interval for printed line numbers. If interval is 0 no numbers will be printed. If greater than 0, a number will be printed every interval lines (i.e. 1 will print all line numbers).

    Method set_tabs_width

      `GTK2.SourcePrintJob set_tabs_width(int tabs_width)`

    Description

      Sets the width (equivalent spaces) of tabulations for the printed text. The width in printing units will be calculated as the width of a string containing tabs_width spaces of the default font. Tabulation stops are set for the full width of printed text.

    Method set_text_margins

      `GTK2.SourcePrintJob set_text_margins(float top, float bottom, float left, float right)`

    Description

      Sets the four user margins for the print job. These margins are in addition to the document margins provided in the GnomePrintConfig and will not be used for headers, footers, or line numbers (those are calculated separately). You can print in the space allocate by these margins by connecting to the "begin-page" signal. The space is around the printed text, and inside the margins specified in the GnomePrintConfig.

      The margin numbers are given in device units. If any of the given values is less than 0, that particular margin is not altered by this function.

    Method set_wrap_mode

      `GTK2.SourcePrintJob set_wrap_mode(int setting)`

    Description

      Sets the wrap mode for lines of text larger than the printable width.

    Method setup_from_view

      `GTK2.SourcePrintJob setup_from_view(GTK2.SourceView view)`

    Description

      Convenience function to set several configuration options at once, so that the printed output matches view. The options set are buffer (if not set already), tabs width, highlighting, wrap mode and default font.

  CLASS GTK2.CellRendererProgress

    Description

      Properties: string text int value

    Inherit CellRenderer

      inherit GTK2.CellRenderer : CellRenderer

    Method create

      `GTK2.CellRendererProgress GTK2.CellRendererProgress(mapping|void props)`

    Description

      Create a new W(CellRendererProgress).

  CLASS GTK2.MenuBar

    Description

      Basically a horizontal W(Menu). The menu image cannot be grabbed automatically, but this is how you would create a menu all in one line. This is not the recommended coding style. `GTK2.MenuBar()->add(GTK2.MenuItem("Menu")->set_submenu(GTK2.Menu()->add(GTK2.MenuItem("Sub")))->select()->activate())->add(GTK2.MenuItem("Bar"))`

      Properties: int child-pack-direction int pack-direction

      Style properties: int internal-padding int shadow-type

    Inherit MenuShell

      inherit GTK2.MenuShell : MenuShell

    Method create

      `GTK2.MenuBar GTK2.MenuBar(mapping|void props)`

    Description

      Create a new menu bar.

    Method get_child_pack_direction

      `int get_child_pack_direction()`

    Description

      Retrieves the current child pack direction.

    Method get_pack_direction

      `int get_pack_direction()`

    Description

      Retrieves the current pack direction of the menubar.

    Method set_child_pack_direction

      `GTK2.MenuBar set_child_pack_direction(int setting)`

    Description

      Sets how widgets should be packed inside the children of a menubar.

    Method set_pack_direction

      `GTK2.MenuBar set_pack_direction(int setting)`

    Description

      Sets how items should be packed inside a menubar. One of .

  CLASS GTK2.AboutDialog

    Description

      Properties: array(string) artists array(string) authors string comments string copyright array(string) documenters string license GDK2.Pixbuf logo string logo-icon-name string name string translator-credits string version string website string website-label

      Style properties: GDK2.Color link-color

    Inherit Dialog

      inherit GTK2.Dialog : Dialog

    Method create

      `GTK2.AboutDialog GTK2.AboutDialog(mapping|void props)`

    Description

      Create a new GTK2.AboutDialog.

    Method get_artists

      `array get_artists()`

    Description

      Returns the strings which are displayed in the artists tab of the secondary credits dialog.

    Method get_authors

      `array get_authors()`

    Description

      Returns the strings which are displayed in the authors tab of the secondary credits dialog.

    Method get_comments

      `string get_comments()`

    Description

      Returns the comments string.

    Method get_copyright

      `string get_copyright()`

    Description

      Returns the copyright string.

    Method get_documenters

      `array get_documenters()`

    Description

      Returns the strings which are displayed in the documenters tab of the secondary credits dialog.

    Method get_license

      `string get_license()`

    Description

      Returns the license information.

    Method get_logo

      `GTK2.GdkPixbuf get_logo()`

    Description

      Returns the pixbuf displayed as logo.

    Method get_logo_icon_name

      `string get_logo_icon_name()`

    Description

      Returns the icon name.

    Method get_name

      `string get_name()`

    Description

      Returns the program name.

    Method get_property

      `mixed get_property(string property)`

    Description

      Get property.

    Method get_translator_credits

      `string get_translator_credits()`

    Description

      Returns the translator credis.

    Method get_version

      `string get_version()`

    Description

      Returns the version string.

    Method get_website

      `string get_website()`

    Description

      Returns the website URL.

    Method get_website_label

      `string get_website_label()`

    Description

      Returns the label used for the website link.

    Method get_wrap_license

      `int get_wrap_license()`

    Description

      Returns whether the license text is automatically wrapped.

    Method set_artists

      `GTK2.AboutDialog set_artists(array art)`

    Description

      Sets the strings which are displayed in the artists tab of the secondary credits dialog.

    Method set_authors

      `GTK2.AboutDialog set_authors(array auth)`

    Description

      Sets the strings which are displayed in the authors tab of the secondary credits dialog.

    Method set_comments

      `GTK2.AboutDialog set_comments(string comments)`

    Description

      Sets the comment string.

    Method set_copyright

      `GTK2.AboutDialog set_copyright(string copyright)`

    Description

      Sets the copyright string.

    Method set_documenters

      `GTK2.AboutDialog set_documenters(array doc)`

    Description

      Sets the strings which are displayed in the documenters tab of the secondary credits dialog.

    Method set_license

      `GTK2.AboutDialog set_license(string license)`

    Description

      Sets the license information.

    Method set_logo

      `GTK2.AboutDialog set_logo(GTK2.GdkPixbuf logo)`

    Description

      Sets the pixbuf to be displayed as the logo.

    Method set_logo_icon_name

      `GTK2.AboutDialog set_logo_icon_name(string name)`

    Description

      Sets the icon name.

    Method set_name

      `GTK2.AboutDialog set_name(string name)`

    Description

      Sets the name to display.

    Method set_translator_credits

      `GTK2.AboutDialog set_translator_credits(string credits)`

    Description

      Sets the translator credits.

    Method set_version

      `GTK2.AboutDialog set_version(string version)`

    Description

      Sets the version string.

    Method set_website

      `GTK2.AboutDialog set_website(string website)`

    Description

      Sets the URL to use for the website link.

    Method set_website_label

      `GTK2.AboutDialog set_website_label(string label)`

    Description

      Sets the label used for the website link. Defaults to the website URL.

    Method set_wrap_license

      `GTK2.AboutDialog set_wrap_license(int setting)`

    Description

      Sets whether the license text is automatically wrapped.

  CLASS GTK2.Gnome2CanvasWidget

    Description

      Properties: int anchor float height int size-pixels GTK2.Widget widget float width float x float y

    Inherit CanvasItem

      inherit Gnome2.CanvasItem : CanvasItem

  CLASS GTK2.CheckButton

    Description

      Check buttons inherent many properties and functions from the the toggle buttons, but look a little different. Rather than being buttons with text inside them, they are small squares with the text to the right of them. These are often used for toggling options on and off in applications. `GTK2.CheckButton( "title" )`

      Style properties: int indicator-size int indicator-spacing

    Inherit ToggleButton

      inherit GTK2.ToggleButton : ToggleButton

    Method create

      `GTK2.CheckButton GTK2.CheckButton(string|mapping label_or_props, int|void mnemonic)`

    Description

      The argument, if specified, is the label of the item. If no label is specified, use object->add() to add some other widget (such as an pixmap or image widget)

  CLASS GTK2.AccelLabel

    Description

      A label for accelerators. Properties: GTK2.Widget accel-widget

    Inherit Label

      inherit GTK2.Label : Label

    Method create

      `GTK2.AccelLabel GTK2.AccelLabel(string|mapping text_or_props)`

    Description

      Creates a new W(AccelLabel).

    Method get_accel_widget

      `GTK2.Widget get_accel_widget()`

    Description

      Fetches the widget monitored by this accelerator label.

    Method get_accel_width

      `int get_accel_width()`

    Description

      Returns the width needed to display the accelerator key(s). This is used by menus to align all of the W(MenuItem).

    Method refetch

      `int refetch()`

    Description

      Recreates the string representing the accelerator keys. This should not be needed since the string is automatically updated whenever accelerators are added or removed from the associated widget.

    Method set_accel_widget

      `GTK2.AccelLabel set_accel_widget(GTK2.Widget accel_widget)`

    Description

      Sets the widget to be monitored.

  CLASS GTK2.SourceStyleScheme

    Method get_name

      `string get_name()`

    Description

      Gets the name of this scheme.

    Method get_tag_style

      `mapping get_tag_style(string name)`

    Description

      Gets the tag associated with the given name in this style.

  CLASS GTK2.Window

    Description

      The basic window. Nothing much to say about it. It can only contain one child widget. Show the main window last to avoid annoying flashes when the subwidget (and it's subwidgets) are added to it, this is done automatically by calling 'window->show_all' when you are done with your widget packing. Properties: int accept-focus int allow-grow int allow-shrink int decorated int default-height int default-width int destroy-with-parent int focus-on-map int gravity GDK_GRAVITY_CENTER , GDK_GRAVITY_EAST , GDK_GRAVITY_NORTH , GDK_GRAVITY_NORTH_EAST , GDK_GRAVITY_NORTH_WEST , GDK_GRAVITY_SOUTH , GDK_GRAVITY_SOUTH_EAST , GDK_GRAVITY_SOUTH_WEST , GDK_GRAVITY_STATIC and GDK_GRAVITY_WEST int has-toplevel-focus GDK2.Pixbuf icon string icon-name int is-active int modal int resizable string role GDK2.Screen screen int skip-pager-hint int skip-taskbar-hint string title GTK2.Window transient-for int type WINDOW_POPUP and WINDOW_TOPLEVEL int type-hint GDK_WINDOW_TYPE_HINT_DESKTOP , GDK_WINDOW_TYPE_HINT_DIALOG , GDK_WINDOW_TYPE_HINT_DOCK , GDK_WINDOW_TYPE_HINT_MENU , GDK_WINDOW_TYPE_HINT_NORMAL , GDK_WINDOW_TYPE_HINT_SPLASHSCREEN , GDK_WINDOW_TYPE_HINT_TOOLBAR and GDK_WINDOW_TYPE_HINT_UTILITY int urgency-hint int window-position WIN_POS_CENTER , WIN_POS_CENTER_ALWAYS , WIN_POS_CENTER_ON_PARENT , WIN_POS_MOUSE and WIN_POS_NONE

      Signals: activate_default

      activate_focus

      frame_event

      keys_changed

      move_focus

      set_focus

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method activate_default

      `int activate_default()`

    Description

      Activates the default widget, unless the current focused widget has been configured to receive the default action, in which case the focuses widget is activated.

    Method activate_focus

      `int activate_focus()`

    Description

      Activates the current focused widget.

    Method add_accel_group

      `GTK2.Window add_accel_group(GTK2.AccelGroup group)`

    Description

      This function adds an accelerator group to the window. The shortcuts in the table will work in the window, it's child, and all children of it's child that do not select keyboard input.

    Method add_mnemonic

      `GTK2.Window add_mnemonic(int keyval, GTK2.Widget target)`

    Description

      Adds a mnemonic to this window.

    Method begin_move_drag

      `GTK2.Window begin_move_drag(int button, int root_x, int root_y, int timestamp)`

    Description

      Starts moving a window. This function is used if an application has window movement grips.

    Method begin_resize_drag

      `GTK2.Window begin_resize_drag(int edge, int button, int root_x, int root_y, int timestamp)`

    Description

      Starts resizing a window. This function is used if an application has window resizing controls. When GDK can support it, the resize will be done using the standard mechanism for the window manager or windowing system.

    Method create

      `GTK2.Window GTK2.Window(int|mapping props)`

    Description

      Argument is one of WINDOW_POPUP and WINDOW_TOPLEVEL , or a mapping of allowed properties.

    Method deiconify

      `GTK2.Window deiconify()`

    Description

      Opposite of iconify().

    Method fullscreen

      `GTK2.Window fullscreen()`

    Description

      Asks to place this window in the fullscreen state. Same caveats iconify().

    Method get_accept_focus

      `int get_accept_focus()`

    Description

      Gets the value set by set_accept_focus().

    Method get_decorated

      `int get_decorated()`

    Description

      Returns whether the window has been set to have decorations such as a title bar.

    Method get_default_size

      `mapping get_default_size()`

    Description

      Gets the default size of the window. A value of -1 for the width or height indicates that a default size has not been explicitly set for that dimeension, so the "natural" size of the window will be used.

    Method get_destroy_with_parent

      `int get_destroy_with_parent()`

    Description

      Returns whether the window will be destroyed with its transient parent.

    Method get_focus

      `GTK2.Widget get_focus()`

    Description

      Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then has_focus() will not be true for the widget.

    Method get_focus_on_map

      `int get_focus_on_map()`

    Description

      Gets the value set by set_focus_on_map().

    Method get_gravity

      `GTK2.Window get_gravity()`

    Description

      Gets the value set by set_gravity().

    Method get_icon

      `GTK2.GdkPixbuf get_icon()`

    Description

      Gets the value set by set_icon().

    Method get_icon_list

      `array get_icon_list()`

    Description

      Retrieves the list of icons set by set_icon_list().

    Method get_icon_name

      `string get_icon_name()`

    Description

      Returns the name of the themed icon for the window.

    Method get_mnemonic_modifier

      `int get_mnemonic_modifier()`

    Description

      Returns the mnemonic modifier for this window.

    Method get_modal

      `int get_modal()`

    Description

      Returns whether the window is modal.

    Method get_position

      `mapping get_position()`

    Description

      This function returns the position you need to pass to move() to keep this window in its current position. This means that the meaning of the returned value varies with window gravity.

      If you haven't changed the window gravity, its gravity will be GDK2.GRAVITY_NORTH_WEST. This means that get_position() gets the position of the top-left corner of the window manager frame for the window. move() sets the position of this same top-left corner.

      get_position() is not 100% reliable because X does not specify a way to obtain the geometry of the decorations placed on a window by the window manager. Thus GTK+ is using a "best guess" that works with most window managers.

      Moreover, nearly all window managers are historically broken with respect to their handling of window gravity. So moving a window to its current position as returned by get_position() tends to result in moving the window slightly. Window managers are slowly getting better over time.

      If a window has gravity GDK2.GRAVITY_STATIC the window manager frame is not relevant, and thus get_position() will always produc accurate results. However you can't use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations.

      If you are saving and restoring your application's window positions, you should know that it's impossible for applications to do this without getting it somewhat wrong because applications do not have sufficient knowledge of window manager state.

    Method get_resizable

      `GTK2.Window get_resizable()`

    Description

      Gets the whether this window is resizable.

    Method get_size

      `mapping get_size()`

    Description

      Obtains the current size of window.

    Method get_skip_pager_hint

      `int get_skip_pager_hint()`

    Description

      Gets the value set by set_skip_pager_hint().

    Method get_skip_taskbar_hint

      `int get_skip_taskbar_hint()`

    Description

      Gets the value set by set_skip_taskbar_hint().

    Method get_title

      `string get_title()`

    Description

      Retrieves the title of the window.

    Method get_transient_for

      `GTK2.Window get_transient_for()`

    Description

      Fetches the transient parent for this window.

    Method get_type_hint

      `int get_type_hint()`

    Description

      Gets the type hint.

    Method get_urgency_hint

      `int get_urgency_hint()`

    Description

      Gets the value set by set_urgency_hint().

    Method has_toplevel_focus

      `int has_toplevel_focus()`

    Description

      Returns whether the input focus is within this window. For real toplevel windows, this is identical to is_active(), but for embedded windows, like W(Plug), the results will differ.

    Method iconify

      `GTK2.Window iconify()`

    Description

      Asks to iconify (minimize) this window. Note that you shouldn't assume the window is definitely iconified afterward, because other entities (e.g. the user or window manager) could deiconify it again, or there may not be a window manager in which case iconification isn't possible, etc.

    Method is_active

      `int is_active()`

    Description

      Returns whether the window is part of the current active toplevel. (That is, the toplevel window receiving keystrokes.) The return value is true if the window is active toplevel itself, but also if it is, say, a W(Plug) embedded in the active toplevel. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window().

    Method lower

      `GTK2.Window lower()`

    Description

      Lower this window if the window manager allows that.

    Method maximize

      `GTK2.Window maximize()`

    Description

      Maximize a window. Same caveats as iconify().

    Method mnemonic_activate

      `int mnemonic_activate(int keyval, int modifier)`

    Description

      Activates the targets associated with the mnemonic. modifier is one of GDK2.SHIFT_MASK, GDK2.LOCK_MASK, GDK2.CONTROL_MASK, GDK2.MOD1_MASK, GDK2.MOD2_MASK, GDK2.MOD3_MASK, GDK2.MOD4_MASK, GDK2.MOD5_MASK, GDK2.BUTTON1_MASK, GDK2.BUTTON2_MASK, GDK2.BUTTON3_MASK, GDK2.BUTTON4_MASK GDK2.BUTTON5_MASK, GDK2.RELEASE_MASK, GDK2.MODIFIER_MASK

    Method move

      `GTK2.Window move(int x, int y)`

    Description

      Asks the window manage to move the window to the given position. Window managers are free to ignore this; most window managers ignore request for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown.

      Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is position at the reference point.

      By default the gravity is GDK2.GRAVITY_NORTH_WEST, so the reference point is simply the x,y supplied to move(). The top-left corner of the window decorations (aka window frame or border) will be place at x,y. Therefore, to position a window at the top left of the screen, you want to use the default gravity (which is GDK2.GRAVITY_NORTH_WEST) and move the window to 0,0.

      To position a window at the bottom right corner of the screen, you would set GDK2.GRAVITY_SOUTH_EAST, which means that the reference point is at x + the window width and y + the window height, and the bottom-right corner of the window border will be placed at that reference point.

    Method parse_geometry

      `int parse_geometry(string geometry)`

    Description

      Parses a standard X geometry string.

    Method present

      `GTK2.Window present()`

    Description

      Presents this window to the user. This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user's platform, window manager, and preferences.

      If hidden, it calls show() as well.

    Method present_with_time

      `GTK2.Window present_with_time(int timestamp)`

    Description

      Presents a window to the user with a timestamp. See present().

    Method raise

      `GTK2.Window raise()`

    Description

      Raise this window if the window manager allows that.

    Method remove_accel_group

      `GTK2.Window remove_accel_group(GTK2.AccelGroup group)`

    Description

      Reverses the effects of add_accel_group().

    Method remove_mnemonic

      `GTK2.Window remove_mnemonic(int keyval, GTK2.Widget target)`

    Description

      Removes a mnemonic from this window.

    Method reshow_with_initial_size

      `GTK2.Window reshow_with_initial_size()`

    Description

      Hides the window, then reshows it, resetting the default size and position of the window.

    Method resize

      `GTK2.Window resize(int width, int height)`

    Description

      Resizes the window as if the user had done so, obeying geometry constraints.

    Method set_accept_focus

      `GTK2.Window set_accept_focus(int setting)`

    Description

      Windows may set a hint asking the desktop environment not to receive the input focus.

    Method set_decorated

      `GTK2.Window set_decorated(int setting)`

    Description

      Add title bar, resize controls, etc. Default is true, so you may only need to use this function if you want to remove decorations. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling show().

    Method set_default

      `GTK2.Window set_default(GTK2.Widget child)`

    Description

      The default widget is the widget that's activated when the user presses Enter in a dialog (for example). This function sets or unsets the default widget. When setting (rather than unsetting) the default widget it's generally easier to call GTK2.Widget->grab_focus() on the widget.

    Method set_default_size

      `GTK2.Window set_default_size(int width, int height)`

    Description

      Sets the default size of a window. If the window's "natural" size (its size request) is larger than the default, the default will be ignored. more generally, if the default size does not obey the geometry hints for the window (set_geometry_hints() can be used to set these explicitly), the default size will be clamped to the nearest permitted size.

      Unlike set_size_request(), which sets a size request for a widget and thus would keep users from shrinking the window, this function only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the "natural" default size (the size request of the window).

      For more control over a window's initial size and how resizing works, investigate set_geometry_hints().

      For some uses, resize() is a more appropriate function. resize() changes the current size of the window, rather than the size to be used on initial display. resize() always affects the window itself, not the geometry widget.

      The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.

      Window scan't actually be 0x0 in size, they must be at least 1x1, but passing 0 for width and height is OK, resulting in a 1x1 default size.

    Method set_destroy_with_parent

      `GTK2.Window set_destroy_with_parent(int setting)`

    Description

      If setting is true, then destroying the transient parent of this window will also destroy the window itself. This is useful for dialogs that shouldn't persist beyond the lifetime of the main window they're associated with, for example.

    Method set_focus

      `GTK2.Window set_focus(GTK2.Widget child)`

    Description

      If child is not the current focus widget, and is focusable, sets it as the focus widget for the window. If child is 0, unsets the focus widget for this window. To set the focus to a particular widget in the toplevel, it is usually more convenient to use GTK2.Widget->grab_focus() instead of this function.

    Method set_focus_on_map

      `GTK2.Window set_focus_on_map(int setting)`

    Description

      Windows may set a hint asking the desktop environment not to receive the input focus when the window is mapped.

    Method set_geometry_hints

      `GTK2.Window set_geometry_hints(GTK2.Widget widget, mapping geometry)`

    Description

      This function sets up hints about how a window can be resized by the user. You can set a minimum and maximum size; allowed resized increments (e.g. for xterm, you can only resize by the size of a character); aspect ratios; and more. geometry is a mapping with the following fields. Any field which is omitted is left as the default: ([ "min_width": int, "min_height": int, "max_width": int, "max_height": int, "base_width": int, "base_height": int, "width_inc": int, "height_inc": int, "min_aspect": float, "max_aspect": float, "win_gravity": int, GDK_GRAVITY_CENTER , GDK_GRAVITY_EAST , GDK_GRAVITY_NORTH , GDK_GRAVITY_NORTH_EAST , GDK_GRAVITY_NORTH_WEST , GDK_GRAVITY_SOUTH , GDK_GRAVITY_SOUTH_EAST , GDK_GRAVITY_SOUTH_WEST , GDK_GRAVITY_STATIC and GDK_GRAVITY_WEST ]); min_width/min_height/max_width/max_height may be set to -1, and it will substitute the size request of the window or geometry widget. If the minimum size hint is not provided, it will use its requisition as the minimum size. If the minimum size is provided and a geometry widget is set, it will take the minimum size as the minimum size of the geometry widget rather than the entire window. The base size is treat similarly. min_width: minimum width of the window (-1 to use requisition) min_height: minimum height of window (-1 to use requisition) max_width: maximum width of window (-1 to use requisition) max_height: maximum height of window (-1 to use requisition) base_width: allow window widths are base_width+width_inc*N (-1 allowed) base_height: allowed window widths are base_height+height_inc*N (-1 allowed) width_inc: width resize increment height_inc: height resize increment min_aspect: minimum width/height ratio max_aspect: maximum width/height ratio win_gravity: window gravity

    Method set_gravity

      `GTK2.Window set_gravity(int gravity)`

    Description

      Window gravity defines the meaning of coordinates passed to move().

      The default window gravity is GDK2.GRAVITY_NORTH_WEST, which will typically "do what you mean."

    Method set_icon

      `GTK2.Window set_icon(GTK2.GdkPixbuf icon)`

    Description

      Sets up the icon representing this window. This icon is used when the window is minimized (also know as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts.

      The icon should be provided in whatever size it was naturally drawn; that is, don't scale the image before passing it. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality.

      If you have your icon hand-drawn in multiple sizes, use set_icon_list(). Then the best size will be used.

    Method set_icon_from_file

      `int set_icon_from_file(string filename)`

    Description

      Sets the icon from a file.

    Method set_icon_list

      `GTK2.Window set_icon_list(array list)`

    Description

      Set up the icons for minimizing.

      set_icon_list() allows you to pass in the same icon in several hand-drawn sizes. The list should contain the natural sizes your icon is avilable in; that is, don't scale the image before passing it. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality.

      By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling.

      Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them.

    Method set_icon_name

      `GTK2.Window set_icon_name(string name)`

    Description

      Sets the icon for the window from a named themed icon.

    Method set_keep_above

      `GTK2.Window set_keep_above(int setting)`

    Description

      Keep window above.

    Method set_keep_below

      `GTK2.Window set_keep_below(int setting)`

    Description

      Keep window below.

    Method set_mnemonic_modifier

      `GTK2.Window set_mnemonic_modifier(int modifier)`

    Description

      Sets the mnemonic modifer for this window.

    Method set_modal

      `GTK2.Window set_modal(int setting)`

    Description

      Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use set_transient_for() to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

    Method set_position

      `GTK2.Window set_position(int pos)`

    Description

      Sets a position contraint for this window. If the old or new constraint is GTK2.WIN_POS_CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

    Method set_resizable

      `GTK2.Window set_resizable(int setting)`

    Description

      Sets whether the user can resize a window. Windows are user resizable by default.

    Method set_skip_pager_hint

      `GTK2.Window set_skip_pager_hint(int setting)`

    Description

      Windows may set a hint asking the desktop environment not to display the window in the pager.

    Method set_skip_taskbar_hint

      `GTK2.Window set_skip_taskbar_hint(int setting)`

    Description

      Windows may set a hint asking the desktop environment not to display the window in the task bar. This function sets this hint.

    Method set_title

      `GTK2.Window set_title(string title)`

    Description

      Set the window title. The default title is the value sent to setup_gtk, or if none is sent, Pike GTK.

    Method set_transient_for

      `GTK2.Window set_transient_for(GTK2.Window parent)`

    Description

      Dialog window should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window. W(Dialog) and other convenience objects in GTK+ will sometimes call set_transient_for on your behalf.

    Method set_type_hint

      `GTK2.Window set_type_hint(int hint)`

    Description

      Set type of window. Values are GDK_WINDOW_TYPE_HINT_DESKTOP , GDK_WINDOW_TYPE_HINT_DIALOG , GDK_WINDOW_TYPE_HINT_DOCK , GDK_WINDOW_TYPE_HINT_MENU , GDK_WINDOW_TYPE_HINT_NORMAL , GDK_WINDOW_TYPE_HINT_SPLASHSCREEN , GDK_WINDOW_TYPE_HINT_TOOLBAR and GDK_WINDOW_TYPE_HINT_UTILITY

    Method set_urgency_hint

      `GTK2.Window set_urgency_hint(int setting)`

    Description

      Windows may set a hint asking the desktop environment to draw the users attention to the window. This function sets this hint.

    Method set_wmclass

      `GTK2.Window set_wmclass(string name, string class)`

    Description

      Set the window manager application name and class.

    Method stick

      `GTK2.Window stick()`

    Description

      Makes this window sticky. Same caveats as iconify().

    Method unfullscreen

      `GTK2.Window unfullscreen()`

    Description

      Opposite of fullscreen().

    Method unmaximize

      `GTK2.Window unmaximize()`

    Description

      Opposite of maximize().

    Method unstick

      `GTK2.Window unstick()`

    Description

      Opposite of stick().

  CLASS GTK2.GdkEvent

    Description

      Gdk events.

    Method _index

      `mixed _index(string ind)`

    Description

      Return an index.

    Method cast

      `mixed cast(string to)`

    Description

      Cast to different types.

  CLASS GTK2.Calendar

    Description

      A calendar widget. `GTK2.Calendar();`

      `GTK2.Calendar()->select_day( 16 );`

      Properties: int day int month int no-month-change int show-day-names int show-heading int show-week-numbers int year

      Signals: day_selected

      day_selected_double_click

      month_changed

      next_month

      next_year

      prev_month

      prev_year

    Inherit Widget

      inherit GTK2.Widget : Widget

    Method clear_marks

      `GTK2.Calendar clear_marks()`

    Description

      Remove all day markers

    Method create

      `GTK2.Calendar GTK2.Calendar(mapping|void props)`

    Description

      Create a new calendar widget

    Method freeze

      `GTK2.Calendar freeze()`

    Description

      Suspend all dynamic updating of the widget

    Method get_date

      `mapping get_date()`

    Description

      returns a mapping: ([ "year":year, "month":month, "day":day ])

    Method get_display_options

      `int get_display_options()`

    Description

      Returns the current display options.

    Method get_marked_dates

      `array get_marked_dates()`

    Description

      Returns an array (with 31 elements) with 1es and 0es.

    Method mark_day

      `GTK2.Calendar mark_day(int day_of_month)`

    Description

      Mark a day

    Method select_day

      `GTK2.Calendar select_day(int day_of_month)`

    Description

      Select a certain day of the currently selected month

    Method select_month

      `int select_month(int month, int year)`

    Description

      Select the month to be viewed.

    Method set_display_options

      `GTK2.Calendar set_display_options(int options)`

    Description

      Bitwise or of one or more of CALENDAR_NO_MONTH_CHANGE , CALENDAR_SHOW_DAY_NAMES , CALENDAR_SHOW_HEADING , CALENDAR_SHOW_WEEK_NUMBERS and CALENDAR_WEEK_START_MONDAY .

    Method thaw

      `GTK2.Calendar thaw()`

    Description

      Resume dynamic updating of the widget

    Method unmark_day

      `GTK2.Calendar unmark_day(int day_of_month)`

    Description

      Unmark a day

  CLASS GTK2.TextChildAnchor

    Description

      Anchors for embedding widgets in a TextBuffer.

    Inherit Object

      inherit G.Object : Object

    Method create

      `GTK2.TextChildAnchor GTK2.TextChildAnchor()`

    Description

      Creates a new W(TextChildAnchor). Usually you would then insert it into W(TextBuffer) with W(TextBuffer)->insert_child_anchor(). To perform the creation and insertion in one step, use the convenience function W(TextBuffer)->create_child_anchor().

    Method get_deleted

      `int get_deleted()`

    Description

      Determines whether a child anchor has been deleted from the buffer.

    Method get_widgets

      `array get_widgets()`

    Description

      Gets a list of all widgets anchored at this child anchor.

  CLASS GTK2.RadioToolButton

    Description

      Properties: GTK2.RadioToolButton group

    Inherit ToggleToolButton

      inherit GTK2.ToggleToolButton : ToggleToolButton

    Method create

      `GTK2.RadioToolButton GTK2.RadioToolButton(GTK2.RadioToolButton groupmember)`

    Description

      Create a GTK2.RadioToolButton. Use without a parameter for a new group. Use with another GTK2.RadioToolButton to add another button to the same group as a previous button.

    Method get_group

      `array get_group()`

    Description

      Get the group this button belongs to.

  CLASS GTK2.Hseparator

    Description

      Simply creates a horizontal separator. No bells or whistles. `GTK2.Hseparator()->set_size_request(300,3)`

    Inherit Separator

      inherit GTK2.Separator : Separator

    Method create

      `GTK2.Hseparator GTK2.Hseparator(mapping|void props)`

    Description

      Used to create a new hseparator widget.

  CLASS GTK2.GdkDisplay

    Description

      GdkDisplay object.

      Signals: closed

    Inherit Object

      inherit G.Object : Object

    Method beep

      `GDK2.Display beep()`

    Description

      Emits a short beep on display

    Method close

      `GDK2.Display close()`

    Description

      Closes the connection to the window system for the given display, and cleans up associated resources.

    Method create

      `GDK2.Display GTK2.GdkDisplay()`

    Description

      Get the default display.

    Method flush

      `GDK2.Display flush()`

    Description

      Flushes any requests queued for the windowing system; this happens automatically when the main loop blocks waiting for new events, but if your application is drawing without returning control to the main loop, you may need to call this function explicitly. A common case where this function needs to be called is when an application is executing drawing commands from a thread other than the thread where the main loop is running.

    Method get_default_cursor_size

      `int get_default_cursor_size()`

    Description

      Returns the default size to use for cursors.

    Method get_default_group

      `GTK2.GdkWindow get_default_group()`

    Description

      Returns the default group leader window for all toplevel windows. This window is implicitly create by GDK.

    Method get_default_screen

      `GTK2.GdkScreen get_default_screen()`

    Description

      Get the default screen.

    Method get_event

      `GTK2.GdkEvent get_event()`

    Description

      Gets the next GDK2.Event to be processed, fetching events from the windowing system if necessary.

    Method get_maximal_cursor_size

      `mapping get_maximal_cursor_size()`

    Description

      Returns the maximal size to use for cursors.

    Method get_n_screens

      `int get_n_screens()`

    Description

      Gets the number of screens managed by the display.

    Method get_name

      `string get_name()`

    Description

      Gets the name of the display.

    Method get_pointer

      `mapping get_pointer()`

    Description

      Gets the current location of the pointer and the current modifier mask.

    Method get_screen

      `GTK2.GdkScreen get_screen(int screen_num)`

    Description

      Returns a screen for one of the screens.

    Method get_window_at_pointer

      `mapping get_window_at_pointer()`

    Description

      Obtains the window underneath the mouse pointer, and the x,y location. Returns 0 if the window is not known to GDK (for example, belongs to another application).

    Method keyboard_ungrab

      `GDK2.Display keyboard_ungrab()`

    Description

      Release any keyboard grab.

    Method open

      `GDK2.Display open(string name)`

    Description

      Opens a display.

    Method peek_event

      `GTK2.GdkEvent peek_event()`

    Description

      Gets a copy of the first GDK2.Event in the event queue, without removing the event from the queue. (Note that this function will not get more events from the windowing system. It only checks the events that have already been moved to the GDK event queue.)

    Method pointer_is_grabbed

      `int pointer_is_grabbed()`

    Description

      Test if the pointer is grabbed.

    Method pointer_ungrab

      `GDK2.Display pointer_ungrab()`

    Description

      Release any pointer grab.

    Method put_event

      `GDK2.Display put_event(GTK2.GdkEvent event)`

    Description

      Appends a copy of the given event onto the front of the event queue.

    Method request_selection_notification

      `int request_selection_notification(GDK2.Atom selection)`

    Description

      Request GdkEventOwnerChange events for ownership changes of the selection named by the given atom.

    Method set_double_click_distance

      `GDK2.Display set_double_click_distance(int distance)`

    Description

      Sets the double click distance (two clicks within this distance count as a double click and result in a GDK_2BUTTON_PRESS event). See also set_double_click_time().

    Method set_double_click_time

      `GDK2.Display set_double_click_time(int msec)`

    Description

      Sets the double click time (two clicks within this time interval counts as a double click and result in a GDK_2BUTTON_PRESS event). Applications should not set this, it is a global user-configured setting.

    Method store_clipboard

      `GDK2.Display store_clipboard(GTK2.GdkWindow clipboard_window, array targets)`

    Description

      Issues a request to the clipboard manager to store the clipboard data.

    Method supports_clipboard_persistence

      `int supports_clipboard_persistence()`

    Description

      Returns whether the specified display supports clipboard persistence, i.e. if it's possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.

    Method supports_cursor_alpha

      `int supports_cursor_alpha()`

    Description

      Returns true if cursors can use an 8bit alpha channel. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).

    Method supports_cursor_color

      `int supports_cursor_color()`

    Description

      Returns true if multicolored cursors are supported. Otherwise, cursors have only a foreground and a background color.

    Method supports_selection_notification

      `int supports_selection_notification()`

    Description

      Returns whether GdkEventOwnerChange events will be sent when the owner of a selection changes.

    Method sync

      `GDK2.Display sync()`

    Description

      Flushes any requests queued for the windowing system and waits until all requests have been handled. This is often used for making sure that the display is synchronized with the current state of the program. Calling sync() before (gdk_error_trap_pop()) makes sure that any errors generated from earlier requests are handled before the error trap is removed.

      This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

    Method warp_pointer

      `GDK2.Display warp_pointer(GTK2.GdkScreen screen, int x, int y)`

    Description

      Warps the pointer to the point x,y on the screen, unless the pointer is confined to a window by a grab, in which case it will be moved as far as allowed by the grab. Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.

  CLASS GTK2.Object

    Description

      The basic GTK class. All other GTK classes inherit this class. The only user-callable functions are the signal related ones. Properties: gpointer user-data

      Signals: destroy

    Inherit Object

      inherit G.Object : Object

  CLASS GTK2.Plug

    Description

      Together with W(Socket), GTK2.Plug provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a W(Socket) widget and, passes the XID of that widgets window to the other process, which then creates a GTK2.Plug window with that XID. Any widgets contained in the GTK2.Plug then will appear inside the first applications window.

      Signals: embedded

    Inherit Window

      inherit GTK2.Window : Window

    Method create

      `GTK2.Plug GTK2.Plug(int|mapping socket_id_or_props)`

    Description

      Create a new plug, the socket_id is the window into which this plug will be plugged.

    Method get_id

      `int get_id()`

    Description

      Gets the window id of this widget.

  CLASS GTK2.Socket

    Description

      Together with W(Plug), GTK2.Socket provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a GTK2.Socket widget and, passes the XID of that widget's window to the other process, which then creates a W(Plug) window with that XID. Any widgets contained in the W(Plug) then will appear inside the first applications window.

      Note that if you pass the XID of the socket to another process that will create a plug in the socket, you must make sure that the socket widget is not destroyed until that plug is created. Violating this rule will cause unpredictable consequences, the most likely consequence being that the plug will appear as a separate toplevel window.

      A socket can also be used to swallow arbitrary pre-existing top-level windows using steal(), though the integration when this is done will not be as close as between a W(Plug) and a GTK2.Socket.

      Signals: plug_added

      plug_removed

    Inherit Container

      inherit GTK2.Container : Container

    Method add_id

      `GTK2.Socket add_id(int wid)`

    Description

      Adds an XEMBED client, such as a W(Plug), to the W(Socket).

    Method create

      `GTK2.Socket GTK2.Socket(mapping|void props)`

    Description

      Create a new GTK2.Socket.

    Method get_id

      `int get_id()`

    Description

      Gets the window id of a W(Socket) widget, which can then be used to create a client embedded inside the socket, for instance with GTK2.Plug->create().

    Method id

      `int id()`

    Description

      Returns the window id, to be sent to the application providing the plug. You must realize this widget before calling this function.

  CLASS GTK2.Action

    Description

      Properties: GTK2.ActionGroup action-group int hide-if-empty int is-important string label string name int sensitive string short-label string stock-id string tooltip int visible int visible-horizontal int visible-overflown int visible-vertical

      Signals: activate

    Inherit Object

      inherit G.Object : Object

    Method activate

      `GTK2.Action activate()`

    Description

      Emits the "activate" signal, if it isn't insensitive.

    Method block_activate_from

      `GTK2.Action block_activate_from(GTK2.Widget proxy)`

    Description

      Disables calls to the activate() function by signals on the proxy. This is used to break notification loops for things like check or radio actions.

    Method connect_accelerator

      `GTK2.Action connect_accelerator()`

    Description

      Installs the accelerator if this action widget has an accel path and group.

    Method connect_proxy

      `GTK2.Action connect_proxy(GTK2.Widget proxy)`

    Description

      Connects a widget to an action object as a proxy. Synchronises various properties of the action with the widget (such as label text, icon, tooltip, etc), and attaches a callback so that the action gets activated when the proxy widget does.

    Method create

      `GTK2.Action GTK2.Action(string|mapping name_or_props, string|void label, string|void tooltip, string|void stock_id)`

    Description

      Creates a new object.

    Method create_icon

      `GTK2.Widget create_icon(int icon_size)`

    Description

      This function is intended for use by action implementations to create icons displayed in the proxy widgets. One of ICON_SIZE_BUTTON , ICON_SIZE_DIALOG , ICON_SIZE_DND , ICON_SIZE_INVALID , ICON_SIZE_LARGE_TOOLBAR , ICON_SIZE_MENU and ICON_SIZE_SMALL_TOOLBAR .

    Method create_menu_item

      `GTK2.Widget create_menu_item()`

    Description

      Creates a menu item widget that proxies for the action.

    Method create_tool_item

      `GTK2.Widget create_tool_item()`

    Description

      Creates a toolbar item widget that proxies for the action.

    Method disconnect_accelerator

      `GTK2.Action disconnect_accelerator()`

    Description

      Undoes the effect of one call to connect_accelerator().

    Method disconnect_proxy

      `GTK2.Action disconnect_proxy(GTK2.Widget proxy)`

    Description

      Disconnects a proxy widget. Does not destroy the widget.

    Method get_accel_path

      `string get_accel_path()`

    Description

      Returns the accel path for this action.

    Method get_name

      `string get_name()`

    Description

      Returns the name of the action.

    Method get_proxies

      `array get_proxies()`

    Description

      Returns the proxy widgets.

    Method get_sensitive

      `int get_sensitive()`

    Description

      Returns whether the action itself is sensitive. Note that this doesn't necessarily mean effective sensitivity.

    Method get_visible

      `int get_visible()`

    Description

      Returns whether the action itself is visible.

    Method is_sensitive

      `int is_sensitive()`

    Description

      Returns whether the action is effectively sensitive.

    Method is_visible

      `int is_visible()`

    Description

      Returns whether the action is effectively visible.

    Method set_accel_group

      `GTK2.Action set_accel_group(GTK2.AccelGroup group)`

    Description

      Sets the GTK2.AccelGroup in which the accelerator for this action will be installed.

    Method set_accel_path

      `GTK2.Action set_accel_path(string accel_path)`

    Description

      Sets the accel path for this action. All proxy widgets associated with this action will have this accel path, so that their accelerators are consistent.

    Method set_sensitive

      `GTK2.Action set_sensitive(int setting)`

    Description

      Sets the sensitive property.

    Method set_visible

      `GTK2.Action set_visible(int setting)`

    Description

      Sets the visible property.

    Method unblock_activate_from

      `GTK2.Action unblock_activate_from(GTK2.Widget proxy)`

    Description

      Re-enables calls to the activate() function.

  CLASS GTK2.CellRendererText

    Description

      Properties: Pango.AttrList attributes string background GDK2.Color background-gdk int background-set int editable int editable-set int ellipsize int ellipsize-set string family int family-set string font Pango.FontDescription font-desc string foreground GDK2.Color foreground-gdk int foreground-set string language int language-set string markup int rise int rise-set float scale int scale-set int single-paragraph-mode int size float size-points int size-set int stretch PANGO_STRETCH_CONDENSED , PANGO_STRETCH_EXPANDED , PANGO_STRETCH_EXTRA_CONDENSED , PANGO_STRETCH_EXTRA_EXPANDED , PANGO_STRETCH_NORMAL , PANGO_STRETCH_SEMI_CONDENSED , PANGO_STRETCH_SEMI_EXPANDED , PANGO_STRETCH_ULTRA_CONDENSED and PANGO_STRETCH_ULTRA_EXPANDED int stretch-set int strikethrough int strikethrough-set int style PANGO_STYLE_ITALIC , PANGO_STYLE_NORMAL and PANGO_STYLE_OBLIQUE int style-set string text int underline PANGO_UNDERLINE_DOUBLE , PANGO_UNDERLINE_ERROR , PANGO_UNDERLINE_LOW , PANGO_UNDERLINE_NONE and PANGO_UNDERLINE_SINGLE int underline-set int variant PANGO_VARIANT_NORMAL and PANGO_VARIANT_SMALL_CAPS int variant-set int weight int weight-set int width-chars

      Signals: edited

    Inherit CellRenderer

      inherit GTK2.CellRenderer : CellRenderer

    Method create

      `GTK2.CellRendererText GTK2.CellRendererText(mapping|void props)`

    Description

      Creates a new W(CellRendererText). Adjust how text is drawn using object properties. Object properties can be set globally (with G.Object->set()). Also, with W(TreeViewColumn), you can bind a property to a value in a W(TreeModel). For example, you can bind the "text" property on the cell renderer to a string value in the model, thus rendering a different string in each row of the W(TreeView).

    Method set_fixed_height_from_font

      `GTK2.CellRendererText set_fixed_height_from_font(int number_of_rows)`

    Description

      Sets the height of a renderer to explicitly be determined by the "font" and "y_bad" property set on it. Further changes in these properties do not affect the height, so they must be accompanied by a subsequent call to this function. Using this function is unflexible, and should really only be used if calculating the size of cell is too slow (i.e., a massive number of cells displayed). If number_of_rows is -1, then the fixed height is unset, and the height is determined by the properties again.

  CLASS GTK2.IconSet

    Description

      Iconset. A single icon.

    Method add_source

      `GTK2.IconSet add_source(GTK2.IconSource source)`

    Description

      Icon sets have a list of GTK2.IconSource, which they use as base icons for rendering icons in different states and sizes. Icons are scaled, made to look insensitive, etc. in render_icon(), but GTK2.IconSet needs base images to work with. The base images and when to use them are described by a GTK2.IconSource.

      This function copies source, so you can reuse the same source immediately without affecting the icon set.

      An example of when you'd use this function: a web browser's "Back to Previous Page" icon might point in a different direciton in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode (small/large icons). So a single icon set would contain all those variants of the icon, and you might add a separate source for each one.

      You should nearly always add a "default" icon source with all fields wildcarded, which will be used as a fallback if no more specific source matches. GTK2.IconSet always prefers more specific icon sources to more generic icon sources. The order in which you add the sources to the icon set does not matter.

    Method copy

      `GTK2.IconSet copy()`

    Description

      Create a copy.

    Method create

      `GTK2.IconSet GTK2.IconSet(GTK2.GdkPixbuf pixbuf)`

    Description

      Create a new GTK2.IconSet. A GTK2.IconSet represents a single icon in various sizes and widget states. It can provide a GDK2.Pixbuf for a given size and state on request, and automatically caches some of the rendered GDK2.Pixbuf objects.

      Normally you would use GTK2.Widget->render_icon() instead of using GTK2.IconSet directly. The one case where you'd use GTK2.IconSet is to create application-specific icon sets to place in a GTK2.IconFactory.

    Method get_sizes

      `array get_sizes()`

    Description

      Obtains a list of icon sizes this icon set can render.

  CLASS GTK2.Menu

    Description

      A GTK2.Menu is a W(MenuShell) that implements a drop down menu consisting of a list of W(MenuItem) objects which can be navigated and activated by the user to perform application functions.

      A GTK2.Menu is most commonly dropped down by activating a W(MenuItem) in a W(MenuBar) or popped up by activating a W(MenuItem) in another GTK2.Menu.

      A GTK2.Menu can also be popped up by activating a W(OptionMenu). Other composite widgets such as the W(Notebook) can pop up a GTK2.Menu as well.

      Applications can display a GTK2.Menu as a popup menu by calling the popup() function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.

             GTK2.Menu menu = create_menu();
             GTK2.Window window = create_window();
             window->signal_connect( "button_press_event", lambda(GTK2.Menu m,
                                                                  GTK2.Window w,
                                                                  mapping e ) {
                       if( e->button == 3 )
                        menu->popup();
                    }, menu );

      Properties: int tearoff-state string tearoff-title

      Child properties: int bottom-attach int left-attach int right-attach int top-attach

      Style properties: int horizontal-offset int vertical-offset int vertical-padding

      Signals: move_scroll

    Inherit MenuShell

      inherit GTK2.MenuShell : MenuShell

    Method attach

      `GTK2.Menu attach(GTK2.Widget child, int left_attach, int right_attach, int top_attach, int bottom_attach)`

    Description

      Adds a new W(MenuItem) to a (table) menu. The number of 'cells' that an item will occupy is specified by left_attach, right_attach, top_attach, and bottom_attach. These each represent the leftmost, rightmost, uppermost and lower column row numbers of the table.

    Method create

      `GTK2.Menu GTK2.Menu(mapping|void props)`

    Description

      Creates a new GTK2.Menu widget.

    Method detach

      `GTK2.Menu detach()`

    Description

      Detaches the menu from the widget to which it had been attached.

    Method get_accel_group

      `GTK2.AccelGroup get_accel_group()`

    Description

      Gets the W(AccelGroup) which holds global accelerators for the menu.

    Method get_active

      `GTK2.Widget get_active()`

    Description

      Returns the selected menu item from the menu. This is used by the W(OptionMenu).

    Method get_attach_widget

      `GTK2.Widget get_attach_widget()`

    Description

      Returns the W(Widget) that the menu is attached to.

    Method get_for_attach_widget

      `array get_for_attach_widget()`

    Description

      Returns a list of the menus which are attached to this widget.

    Method get_tearoff_state

      `int get_tearoff_state()`

    Description

      Returns whether the menu is torn off.

    Method get_title

      `string get_title()`

    Description

      Returns the title of the menu.

    Method popdown

      `GTK2.Menu popdown()`

    Description

      Removes the menu from the screen.

    Method popup

      `GTK2.Menu popup(int|void button_pressed_to_show_menu)`

    Description

      The default button is 3.

    Method reorder_child

      `GTK2.Menu reorder_child(GTK2.Widget child, int position)`

    Description

      Moves a W(MenuItem) to a new position within the GTK2.Menu.

    Method reposition

      `GTK2.Menu reposition()`

    Description

      Repositions the menu according to its position function.

    Method set_accel_group

      `GTK2.Menu set_accel_group(GTK2.AccelGroup accelerators)`

    Description

      Set the W(AccelGroup) which holds global accelerators for the menu.

    Method set_accel_path

      `GTK2.Menu set_accel_path(string accel_path)`

    Description

      Sets an accelerator path for this menu.

    Method set_active

      `GTK2.Menu set_active(int activep)`

    Description

      Selects the specified menu item within the menu. This is used by the W(OptionMenu).

    Method set_screen

      `GTK2.Menu set_screen(GTK2.GdkScreen screen)`

    Description

      Sets the screen on which the menu is displayed.

    Method set_tearoff_state

      `GTK2.Menu set_tearoff_state(int torn_off)`

    Description

      Changes the tearoff state of the menu. A menu is normally displayed as a drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.

    Method set_title

      `GTK2.Menu set_title(string new_title)`

    Description

      Sets the title string for the menu. The title is displayed when the menu is shown as a tearoff menu.

  CLASS GTK2.IconSize

    Description

      Iconsize.

    Method from_name

      `int from_name(string name)`

    Description

      Looks up the icon size associated with name.

    Method get_name

      `string get_name(int size)`

    Description

      Gets the canonical name of the given icon size.

    Method register

      `int register(string name, int width, int height)`

    Description

      Registers a new icon size, along the same lines as GTK2.ICON_SIZE_MENU, etc. Returns the integer value for the size.

    Method register_alias

      `GTK2.IconSize register_alias(string alias, int target)`

    Description

      Registers alias as another name for target. So calling GTK2.IconSize->from_name() with alias will return target.

  CLASS GTK2.ToolItem

    Description

      Properties: int is-important int visible-horizontal int visible-vertical

      Signals: create_menu_proxy

      set_tooltip

      toolbar_reconfigured

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method create

      `GTK2.ToolItem GTK2.ToolItem(mapping|void props)`

    Description

      Creates a new GTK2.ToolItem.

    Method get_expand

      `int get_expand()`

    Description

      Returns whether this item is allocated extra space.

    Method get_homogeneous

      `int get_homogeneous()`

    Description

      Returns whether this item is the same size as the other homogeneous items.

    Method get_icon_size

      `int get_icon_size()`

    Description

      Returns the icon size used for this item. One of ICON_SIZE_BUTTON , ICON_SIZE_DIALOG , ICON_SIZE_DND , ICON_SIZE_INVALID , ICON_SIZE_LARGE_TOOLBAR , ICON_SIZE_MENU and ICON_SIZE_SMALL_TOOLBAR

    Method get_is_important

      `int get_is_important()`

    Description

      Returns whether this item is considered important.

    Method get_orientation

      `int get_orientation()`

    Description

      Returns the orientation used for this item. One of ORIENTATION_HORIZONTAL and ORIENTATION_VERTICAL

    Method get_proxy_menu_item

      `GTK2.Widget get_proxy_menu_item(string menu_item_id)`

    Description

      If menu_item_id matches the string passed to set_proxy_menu_item(), then return the corresponding GTK2.MenuItem.

    Method get_relief_style

      `int get_relief_style()`

    Description

      Returns the relief style of this item. One of RELIEF_HALF , RELIEF_NONE and RELIEF_NORMAL

    Method get_toolbar_style

      `int get_toolbar_style()`

    Description

      Returns the toolbar style use for this item. One of TOOLBAR_BOTH , TOOLBAR_BOTH_HORIZ , TOOLBAR_ICONS , TOOLBAR_SPACE_EMPTY , TOOLBAR_SPACE_LINE and TOOLBAR_TEXT

    Method get_use_drag_window

      `int get_use_drag_window()`

    Description

      Returns whether this item has a drag window.

    Method get_visible_horizontal

      `int get_visible_horizontal()`

    Description

      Returns whether this item is visible on toolbars that are docked horizontally.

    Method get_visible_vertical

      `int get_visible_vertical()`

    Description

      Returns whether this item is visible when the toolbar is docked vertically.

    Method rebuild_menu

      `GTK2.ToolItem rebuild_menu()`

    Description

      Calling this function signals to the toolbar that the overflow menu item for this item has changed. If the overflow menu is visible when this function is called, the menu will be rebuilt.

    Method retrieve_proxy_menu_item

      `GTK2.Widget retrieve_proxy_menu_item()`

    Description

      Returns the GTK2.MenuItem that was last set by set_proxy_menu_item().

    Method set_expand

      `GTK2.ToolItem set_expand(int expand)`

    Description

      Sets whether this item is allocated extra space when there is more room on the toolbar than needed for the items. The effect is that the item gets bigger when the toolbar gets bigger and smaller when the toolbar gets smaller.

    Method set_homogeneous

      `GTK2.ToolItem set_homogeneous(int homogeneous)`

    Description

      Sets whether this item is to be allocated the same size as other homogeneous items. The effect is that all homogeneous items will have the same width as the widest of the items.

    Method set_is_important

      `GTK2.ToolItem set_is_important(int is_important)`

    Description

      Sets whether this item should be considered important.

    Method set_proxy_menu_item

      `GTK2.ToolItem set_proxy_menu_item(string menu_item_id, GTK2.Widget menu_item)`

    Description

      Sets the GTK2.MenuItem used in the toolbar overflow menu. The menu_item_id is used to identify the caller of this function and should also be used with get_proxy_menu_item().

    Method set_tooltip

      `GTK2.ToolItem set_tooltip(GTK2.Tooltips tooltips, string tip_text, string tip_private)`

    Description

      Sets the GTK2.Tooltips object to be used for this item, the text to be displayed as tool tip on the item and the private text to be used.

    Method set_use_drag_window

      `GTK2.ToolItem set_use_drag_window(int use_drag_window)`

    Description

      Sets whether this item has a drag window. When true the toolitem can be used as a drag source. When this item has a drag window it will intercept all events, even those that would otherwise be sent to a child.

    Method set_visible_horizontal

      `GTK2.ToolItem set_visible_horizontal(int visible_horizontal)`

    Description

      Sets whether toolitem is visible when the toolbar is docked horizontally.

    Method set_visible_vertical

      `GTK2.ToolItem set_visible_vertical(int visible_vertical)`

    Description

      Sets whether this item is visible when the toolbar is docked vertically. Some tool items, such as text entries, are too wide to be useful on a vertically docked toolbar. If visible_vertical is false then this item will not appear on toolbars that are docked vertically.

  CLASS GTK2.Dialog

    Description

      A dialog is a window with a few default widgets added. The 'vbox' is the main content area of the widget. The 'action_area' is allocated for buttons (ok, cancel etc) Properties: int has-separator

      Style properties: int action-area-border int button-spacing int content-area-border

      Signals: close

      response

    Inherit Window

      inherit GTK2.Window : Window

    Method add_action_widget

      `GTK2.Dialog add_action_widget(GTK2.Widget child, int response_id)`

    Description

      Adds an activatable widget to the action area, connecting a signal handler that will emit the "response" signal on the dialog when the widget is activated.

    Method add_button

      `GTK2.Widget add_button(string button_text, int response_id)`

    Description

      Adds a button with the given text (or a stock button) and sets things up so that clicking the button will emit the "response" signal with the given response_id.

    Method create

      `GTK2.Dialog GTK2.Dialog(mapping|void props)`

    Description

      Create a new dialog widget.

    Method get_action_area

      `GTK2.HbuttonBox get_action_area()`

    Description

      The action area, this is where the buttons (ok, cancel etc) go

    Method get_has_separator

      `int get_has_separator()`

    Description

      Accessor for whether the dialog has a separator.

    Method get_response_for_widget

      `int get_response_for_widget(GTK2.Widget widget)`

    Description

      Gets the response id of a widget in the action area.

    Method get_vbox

      `GTK2.Vbox get_vbox()`

    Description

      The vertical box that should contain the contents of the dialog

    Method response

      `GTK2.Dialog response(int response_id)`

    Description

      Emits the "response" signal with the given response ID.

    Method run

      `int run()`

    Description

      Run the selected dialog.

    Method set_default_response

      `GTK2.Dialog set_default_response(int response_id)`

    Description

      Sets the last widget in the action area with the given response_id as the default widget. Pressing "Enter" normally activates the default widget.

    Method set_has_separator

      `GTK2.Dialog set_has_separator(int setting)`

    Description

      Sets whether this dialog has a separator above the buttons. True by default.

    Method set_response_sensitive

      `GTK2.Dialog set_response_sensitive(int response_id, int setting)`

    Description

      Calls GTK2.Widget->set_sensitive() for each widget in the dialog's action area with the given response_id.

  CLASS GTK2.Gnome2Druid

    Description

      The GNOME druid is a system for assisting the user with installing a service. It is roughly equivalent in functionality to the "Wizards" available in Windows.

      There are two major parts of the druid, the Gnome2.Druid widget, and the set of W(Gnome2.DruidPage) widgets. The Gnome2.Druid widget is the main widget that interacts with the user. It has a Next, a Prev, and a Cancel button, and acts as a container for the pages. It is not a top-level window, so it needs to be put in a W(GTK2.Window) in almost all cases. The W(Gnome2.DruidPage) is a virtual widget, from which all of the actual content of the page inherits from. There are currently three of these available within gnome-libs.

      GNOME druids are fairly simple to program with. You start by creating a GnomeDruid into which you put all of your pages. This widget will handle the presentation of the W(GnomeDruidPage) widgets.

      You then create all appropriate W(GnomeDruidPage) widgets. There are three implementations of these, although there is no reason why more couldn't be written. They are the W(GnomeDruidPageStart), the W(GnomeDruidPageStandard), and the W(GnomeDruidPageFinish). The W(GnomeDruidPageStandard) acts as a W(Container), and is probably the most commonly used druid page. The other ones, as their names might suggest, are used at the endpoints of the druid. More information on the specific properties of these widgets can be found on their respective pages.

      You will need to add the pages to the druid in order for them to appear. The druid itself keeps an internal list of all pages, and using the prepend_page(), append_page(), and insert_page() functions will place them into it.

      Properties: int show-finish int show-help

      Signals: cancel This signal is emitted when the "cancel" button has been pressed. Note that the current druid page has the option to trap the signal and use it, if need be, preventing this signal from being emitted.

      help

    Inherit Container

      inherit GTK2.Container : Container

    Method append_page

      `Gnome2.Druid append_page(GTK2.Gnome2DruidPage page)`

    Description

      This will append a GnomeDruidPage into the internal list of pages that the druid has.

    Method create

      `Gnome2.Druid GTK2.Gnome2Druid()`

    Description

      Create a new druid

    Method insert_page

      `Gnome2.Druid insert_page(GTK2.Gnome2DruidPage back_page, GTK2.Gnome2DruidPage page)`

    Description

      This will insert page after back_page into the list of internal pages that the druid has. If back_page is not present in the list or is 0, page will be prepended to the list.

    Method prepend_page

      `Gnome2.Druid prepend_page(GTK2.Gnome2DruidPage page)`

    Description

      This will prepend a GnomeDruidPage into the internal list of pages that the druid has.

    Method set_buttons_sensitive

      `Gnome2.Druid set_buttons_sensitive(int back_sensitive, int next_sensitive, int cancel_sensitive, int help_sensitive)`

    Description

      Sets the sensitivity of the druid's control-buttons. If the variables are TRUE, then they will be clickable. This function is used primarily by the actual W(GnomeDruidPage) widgets.

    Method set_page

      `Gnome2.Druid set_page(GTK2.Gnome2DruidPage page)`

    Description

      This will make page the currently showing page in the druid. page must already be in the druid.

    Method set_show_finish

      `Gnome2.Druid set_show_finish(int show_finish)`

    Description

      Sets the text on the last button on the druid. If show_finish is TRUE, then the text becomes "Finish". If show_finish is FALSE, then the text becomes "Cancel".

    Method set_show_help

      `Gnome2.Druid set_show_help(int show_help)`

    Description

      Sets the "Help" button on the druid to be visible in the lower left corner of the widget, if show_help is true.

  CLASS GTK2.CellRenderer

    Description

      Properties: string cell-background GDK2.Color cell-background-gdk int cell-background-set int height int is-expanded int is-expander int mode CELL_RENDERER_MODE_ACTIVATABLE , CELL_RENDERER_MODE_EDITABLE and CELL_RENDERER_MODE_INERT int sensitive int visible int width float xalign int xpad float yalign int ypad

      Signals: editing_canceled

      editing_started

    Inherit Data

      inherit GTK2.Data : Data

    Method activate

      `int activate(GTK2.GdkEvent event, GTK2.Widget widget, string path, GTK2.GdkRectangle background_area, GTK2.GdkRectangle cell_area, int flags)`

    Description

      Passes an activate event to the cell renderer for possible processing. Some cell renderers may use events; for example, W(CellRendererToggle) toggles when it gets a mouse click.

    Method get_fixed_size

      `mapping get_fixed_size()`

    Description

      Fills in width and height with the appropriate size of the cell.

    Method get_size

      `mapping get_size(GTK2.Widget widget, GTK2.GdkRectangle cell_area)`

    Description

      Obtains the width and heigh needed to render the cell. Used by widgets to determine the appropriate size for the cell_area passed to render(). If cell_area is present, fills in the x and y offset of the cell relative to this location. Please note that the values set in width and height, as well as those in x_offset and y_offset are inclusive of the xpad and ypad properties.

    Method render

      `GTK2.CellRenderer render(GTK2.GdkWindow window, GTK2.Widget widget, GTK2.GdkRectangle background_area, GTK2.GdkRectangle cell_area, GTK2.GdkRectangle expose_area, int flags)`

    Description

      Invokes the virtual render function of the W(CellRenderer). The three passed-in rectangles are areas of window. Most renderers will draw within cell_area; the xalign, yalign, xpad, and ypad fields of the W(CellRenderer) should be honored with respect to cell_area. background_area includes the blank space around the cell, and also the area containing the tree expander; so the background_area rectangles for all cells tile to cover the entire window. expose_area is a clip rectangle. flags is one of CELL_RENDERER_FOCUSED , CELL_RENDERER_INSENSITIVE , CELL_RENDERER_MODE_ACTIVATABLE , CELL_RENDERER_MODE_EDITABLE , CELL_RENDERER_MODE_INERT , CELL_RENDERER_PRELIT , CELL_RENDERER_SELECTED and CELL_RENDERER_SORTED .

    Method set_fixed_size

      `GTK2.CellRenderer set_fixed_size(int width, int height)`

    Description

      Sets the renderer size to be explicit, independent of the properties set.

    Method start_editing

      `GTK2.CellRenderer start_editing(GTK2.GdkEvent event, GTK2.Widget widget, string path, GTK2.GdkRectangle background_area, GTK2.GdkRectangle cell_area, int flags)`

    Description

      Passes an activate event to the cell renderer for possible processing.

    Method stop_editing

      `GTK2.CellRenderer stop_editing(int canceled)`

    Description

      Informs the cell renderer that the editing is stopped. If canceled is true, the cell renderer will emit the "editing-canceled" signal. This function should be called by cell renderer implementations in response to the "editing-done" signal of W(CellEditable).

  CLASS GTK2.ImageMenuItem

    Description

      Properties: GTK2.Widget image

    Inherit MenuItem

      inherit GTK2.MenuItem : MenuItem

    Method create

      `GTK2.ImageMenuItem GTK2.ImageMenuItem(string|mapping label)`

    Description

      Create a new ImageMenuItem.

    Method get_image

      `GTK2.Widget get_image()`

    Description

      Gets the widget that is currently set as the image.

    Method set_image

      `GTK2.ImageMenuItem set_image(GTK2.Widget image)`

    Description

      Sets the image of the image menu item.

  CLASS GTK2.ActionGroup

    Description

      Actions are organized into groups. An action group is essentially a map from names to GTK2.Action objects.

      All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most non-trivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window's menus would be constructed from a combination of two action groups.

      Accelerators are handled by the GTK2+ accelerator map. All actions are assigned an accelerator path (which normally has the form &lt;Actions&gt;/group-name/action-name) and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The GTK2+ accelerator map code makes sure that the correct shortcut is displayed next to the menu item. Properties: string name int sensitive int visible

      Signals: connect_proxy

      disconnect_proxy

      post_activate

      pre_activate

    Inherit Object

      inherit G.Object : Object

    Method add_action

      `GTK2.ActionGroup add_action(GTK2.Action action, string|void accelerator)`

    Description

      Adds an action object to the action group and sets up the accelerator.

      If accelerator is omitted, attempts to use the accelerator associated with the stock_id of the action.

      Accel paths are set to &lt;Actions&gt;/group-name/action-name.

    Method add_actions

      `GTK2.ActionGroup add_actions(array entries)`

    Description

      This is a convenience function to create a number of actions and add them to the action group.

      The "activate" signals of the actions are connect to the callbacks and their accel paths are set to <Actions>/group-name/action-name.

      Mapping is: ([ "name": string, "stock_id": string, "label": string, "accelerator": string, "tooltip": string, "callback": function(callback) "data": mixed ]);

    Method add_radio_actions

      `GTK2.ActionGroup add_radio_actions(array entries, function cb, mixed user_data)`

    Description

      This is a convenience routine to create a group of radio actions and add them to the action group.

      Mapping is: ([ "name": string, "stock_id": string, "label": string, "accelerator": string, "tooltip": string, "value": int ]);

    Method add_toggle_actions

      `GTK2.ActionGroup add_toggle_actions(array entries)`

    Description

      This is a convenience function to create a number of toggle actions and add them to the action group.

      Mapping is: ([ "name": string, "stock_id": string, "label": string, "accelerator": string, "tooltip": string, "callback": function(callback), "data": mixed, "is_active": int ]);

    Method create

      `GTK2.ActionGroup GTK2.ActionGroup(string|mapping name_or_props)`

    Description

      Creates a new GTK2.ActionGroup object. The name of the action group is used when associating keybindings with the actions.

    Method get_action

      `GTK2.Action get_action(string name)`

    Description

      Looks up an action in the action group by name.

    Method get_name

      `string get_name()`

    Description

      Gets the name of the action group.

    Method get_sensitive

      `int get_sensitive()`

    Description

      Returns true if the group is sensitive. The constituent actions can only be logically sensitive if they are sensitive and their group is sensitive.

    Method get_visible

      `int get_visible()`

    Description

      Returns true if the group is visible. The constituent actions can only be logically visible if they are visible and their group is visible.

    Method list_actions

      `array list_actions()`

    Description

      Lists the actions in the action group.

    Method remove_action

      `GTK2.ActionGroup remove_action(GTK2.Action action)`

    Description

      Removes an action object.

    Method set_sensitive

      `GTK2.ActionGroup set_sensitive(int setting)`

    Description

      Changes the sensitivity.

    Method set_visible

      `GTK2.ActionGroup set_visible(int setting)`

    Description

      Changes the visibility.

  CLASS GTK2.Pango.TabArray

    Inherit Object

      inherit G.Object : Object

    Method copy

      `GTK2.Pango.TabArray copy()`

    Description

      Returns a copy.

    Method create

      `Pango.TabArray GTK2.Pango.TabArray(int initial_size, int position_in_pixels)`

    Description

      Creates an array of initial_size tab stops. Tab stops are specified in pixel units if positions_in_pixels is true, otherwise in Pango units. All stops are initially at position 0.

    Method get_positions_in_pixels

      `int get_positions_in_pixels()`

    Description

      Returns true if the tab positions are in pixels, false if they are in Pango units.

    Method get_size

      `int get_size()`

    Description

      Gets the number of tab stops.

    Method get_tab

      `mapping get_tab(int tab_index)`

    Description

      Gets the alignment and position of a tab stop.

    Method get_tabs

      `array get_tabs()`

    Description

      Gets alignments and locations of all tab stops.

    Method resize

      `Pango.TabArray resize(int new_size)`

    Description

      Resizes the array. You must subsequently initialize any tabs that were added as a result of growing the array.

    Method set_tab

      `Pango.TabArray set_tab(int tab_index, int alignment, int location)`

    Description

      Sets the alignment and location of a tab stop. Alignment must always be PANGO_TAB_LEFT .

  CLASS GTK2.Gnome2CanvasClipgroup

    Description

      Properties: string path int wind

    Inherit CanvasGroup

      inherit Gnome2.CanvasGroup : CanvasGroup

  CLASS GTK2.GdkVisual

    Description

      A GdkVisual describes a particular video hardware display format. It includes information about the number of bits used for each color, the way the bits are translated into an RGB value for display, and the way the bits are stored in memory.

    Inherit Object

      inherit G.Object : Object

    Method create

      `GDK2.Visual GTK2.GdkVisual(int|void best, int|void depth, int|void type)`

    Parameter `best`

      If best is false the systems default GDK screen is returned, otherwise the screen that best fulfills the given depth and type. If none is given, the one with most colors is selected.

    Parameter `depth`

      The requested bit depth, or 0.

    Parameter `type`

      The requested visual type.

      `GDK_VISUAL_STATIC_GRAY` | Each pixel value indexes a grayscale value directly.
      `GDK_VISUAL_GRAYSCALE` | Each pixel is an index into a color map that maps pixel values into grayscale values. The color map can be changed by an application.
      `GDK_VISUAL_STATIC_COLOR` | Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values.
      `GDK_VISUAL_PSEUDO_COLOR` | Each pixel is an index into a color map that maps pixel values into rgb values. The color map can be changed by an application.
      `GDK_VISUAL_TRUE_COLOR` | Each pixel value directly contains red, green, and blue components. The red_mask, green_mask, and blue_mask fields of the GdkVisual structure describe how the components are assembled into a pixel value.
      `GDK_VISUAL_DIRECT_COLOR` | Each pixel value contains red, green, and blue components as for GDK_VISUAL_TRUE_COLOR , but the components are mapped via a color table into the final output table instead of being converted directly.

    Method get_screen

      `GTK2.GdkScreen get_screen()`

    Description

      Gets the screen to which this visual belongs.

  CLASS GTK2.Table

    Description

      The GTK2.Table allows the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically.

      `GTK2.Table(2,2,0)->attach_defaults( GTK2.Label("0,0"), 0, 1, 0, 1)->attach_defaults( GTK2.Label("0,1"), 0, 1, 1, 2)->attach_defaults( GTK2.Label("1,0"), 1, 2, 0, 1)->attach_defaults( GTK2.Label("1,1"), 1, 2, 1, 2)->set_col_spacings(10)->set_row_spacings(10)`

      `GTK2.Table(2,2,0)->attach_defaults( GTK2.Label("0,0-1,0"), 0, 2, 0, 1)->attach_defaults( GTK2.Label("0,1"), 0, 1, 1, 2)->attach_defaults( GTK2.Label("1,1"), 1, 2, 1, 2)->set_col_spacings(10)->set_row_spacings(10)`

      Properties: int column-spacing int homogeneous int n-columns int n-rows int row-spacing

      Child properties: int bottom-attach int left-attach int right-attach int top-attach int x-options int x-padding int y-options int y-padding

    Inherit Container

      inherit GTK2.Container : Container

    Method attach

      `GTK2.Table attach(GTK2.Widget subwidget, int left, int right, int top, int bottom, int xoptions, int yoptions, int xpad, int ypad)`

    Description

      The left and right attach arguments specify where to place the widget, and how many boxes to use. If you want a button in the lower right table entry of our 2x2 table, and want it to fill that entry ONLY. left_attach would be = 1, right_attach = 2, top_attach = 1, bottom_attach = 2.

      Now, if you wanted a widget to take up the whole top row of our 2x2 table, you'd use left_attach = 0, right_attach = 2, top_attach = 0, bottom_attach = 1.

      The xoptions and yoptions are used to specify packing options and may be OR'ed together to allow multiple options.

      These options are: <ul> <li> GTK2.Fill - If the table box is larger than the widget, and GTK_FILL is specified, the widget will expand to use all the room available.</li> <li> GTK2.Shrink - If the table widget was allocated less space then was requested (usually by the user resizing the window), then the widgets would normally just be pushed off the bottom of the window and disappear. If GTK_SHRINK is specified, the widgets will shrink with the table.</li> <li> GTK2.Expand - This will cause the table cell to expand to use up any remaining space in the window.</li> </ul>

      Padding is just like in boxes, creating a clear area around the widget specified in pixels

    Method attach_defaults

      `GTK2.Table attach_defaults(GTK2.Widget subwidget, int left, int right, int top, int bottom)`

    Description

      As there are many options associated with attach(), this convenience function provides the programmer with a means to add children to a table with identical padding and expansion options.

      xoptions, yoptions, xpadding and ypadding are all set the their default values. For the options that is GTK2.Fill|GTK2.Expand. For the padding it is 0.

    Method create

      `GTK2.Table GTK2.Table(int|mapping width_or_props, int|void height, int|void homogeneousp)`

    Description

      Used to create a new table widget. An initial size must be given by specifying how many rows and columns the table should have, although this can be changed later with resize().

      There can never be more than 65535 colums nor more than 65535 rows.

      setting homogeneousp to 1 forces the all tablecells to be exactly the same size.

    Method get_col_spacing

      `int get_col_spacing(int col)`

    Description

      Gets the amound of space between col and col+1.

    Method get_default_col_spacing

      `int get_default_col_spacing()`

    Description

      Gets the default column spacing for the table.

    Method get_default_row_spacing

      `int get_default_row_spacing()`

    Description

      Gets the default row spacing for the table.

    Method get_homogeneous

      `int get_homogeneous()`

    Description

      Returns whether the table cells are all constrained to the same width and height.

    Method get_row_spacing

      `int get_row_spacing(int row)`

    Description

      Gets the amount of space between row and row+1.

    Method resize

      `GTK2.Table resize(int rows, int columns)`

    Description

      If you need to change a table's size after it has been created, this function allows you to do so.

    Method set_col_spacing

      `GTK2.Table set_col_spacing(int x, int spacing)`

    Description

      alters the amount of space between a given table column and the adjacent columns.

    Method set_col_spacings

      `GTK2.Table set_col_spacings(int spacing)`

    Description

      Sets the space between every column in the table equal to spacing.

    Method set_homogeneous

      `GTK2.Table set_homogeneous(int homogeneousp)`

    Description

      Set the homogeneous flag.

    Method set_row_spacing

      `GTK2.Table set_row_spacing(int y, int spacing)`

    Description

      alters the amount of space between a given table row and the adjacent rows.

    Method set_row_spacings

      `GTK2.Table set_row_spacings(int spacing)`

    Description

      Sets the space between every row in the table equal to spacing.

  CLASS GTK2.ScrolledWindow

    Description

      Scrolled windows are used to create a scrollable area with another widget insite it. You may insert any type of widget into a scrolled window, and it will be accessible regardless of the size by using the scrollbars.

      `GTK2.ScrolledWindow(GTK2.Adjustment(),GTK2.Adjustment())->add(GTK2.Label("A small label"))->set_policy(GTK2.POLICY_AUTOMATIC,GTK2.POLICY_AUTOMATIC)`

      `GTK2.ScrolledWindow(GTK2.Adjustment(),GTK2.Adjustment())->add(GTK2.Label("A small label"))->set_policy(GTK2.POLICY_AUTOMATIC,GTK2.POLICY_AUTOMATIC)`

      `GTK2.ScrolledWindow(GTK2.Adjustment(),GTK2.Adjustment())->add(GTK2.Label("A small label"))`

      `GTK2.ScrolledWindow(GTK2.Adjustment(),GTK2.Adjustment())->add(GTK2.Label("a ver huge label"))`

      Properties: GTK2.Adjustment hadjustment int hscrollbar-policy int shadow-type GTK2.Adjustment vadjustment int vscrollbar-policy int window-placement

      Style properties: int scrollbar-spacing

      Signals: move_focus_out

      scroll_child

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method add

      `GTK2.ScrolledWindow add(GTK2.Widget victim)`

    Description

      Add a widget to this container. This is equivalent to the C-GTK function gtk_scrolled_window_add_with_viewport or gtk_container_add, depending on whether or not the child supports the set_scroll_adjustments signal.

      What this means in practice is that you do not have to care about this at all, it's all handled automatically.

    Method create

      `GTK2.ScrolledWindow GTK2.ScrolledWindow(GTK2.Adjustment hadjustment_or_props, GTK2.Adjustment vadjustments)`

    Description

      The two adjustments are most commonly set to 0.

    Method get_hadjustment

      `GTK2.Adjustment get_hadjustment()`

    Description

      Get the horizontal adjustment.

    Method get_hscrollbar

      `GTK2.HScrollbar get_hscrollbar()`

    Description

      Returns the horizontal scrollbar.

    Method get_placement

      `int get_placement()`

    Description

      Gets the placement of the scrollbars.

    Method get_policy

      `mapping get_policy()`

    Description

      Returns the current policy values for the horizontal and vertical scrollbars. ([ "h-policy": horizontal policy, "v-policy": vertical policy ]);

    Method get_shadow_type

      `int get_shadow_type()`

    Description

      Gets the shadow type.

    Method get_vadjustment

      `GTK2.Adjustment get_vadjustment()`

    Description

      Get the vertical adjustment.

    Method get_vscrollbar

      `GTK2.VScrollbar get_vscrollbar()`

    Description

      Returns the vertical scrollbar.

    Method set_hadjustment

      `GTK2.ScrolledWindow set_hadjustment(GTK2.Adjustment hadjustment)`

    Description

      Set the horizontal adjustment object.

    Method set_placement

      `GTK2.ScrolledWindow set_placement(int window_placement)`

    Description

      The location of the window relative to the scrollbars. One of CORNER_BOTTOM_LEFT , CORNER_BOTTOM_RIGHT , CORNER_TOP_LEFT and CORNER_TOP_RIGHT

    Method set_policy

      `GTK2.ScrolledWindow set_policy(int xpolicy, int ypolicy)`

    Description

      Vertical and horizontal policy. Both are one of POLICY_ALWAYS , POLICY_AUTOMATIC and POLICY_NEVER

    Method set_shadow_type

      `GTK2.ScrolledWindow set_shadow_type(int type)`

    Description

      Changes the type of shadow drawn around the contents. One of SHADOW_ETCHED_IN , SHADOW_ETCHED_OUT , SHADOW_IN , SHADOW_NONE and SHADOW_OUT

    Method set_vadjustment

      `GTK2.ScrolledWindow set_vadjustment(GTK2.Adjustment vadjustment)`

    Description

      Set the vertical adjustment object.

  CLASS GTK2.SizeGroup

    Description

      Provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically usefull when you want a column of widgets to have the same size, but you can't use a W(Table) widget.

      In detail, the size requiest for each widget in a GTK2.SizeGroup is the maximum of the sizes that would have been requested for each widget in the size group if they were not in the size group. The mode of the size group (see set_mode() determines whether this applies to the horizontal size, the vertical size, or both sizes.

      Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a GTK2.SizeGroup to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include the GTK2.FILL flag.

      GTK2.SizeGroup objects are referenced by each widget in the size group, so one you have added all widgets to a GTK2.SizeGroup, you can drop the initial reference to the size group. If the widgets in the size group are subsequently destroyed, then they will be removed from the size group; when allow idgets have been removed, the size group will be freed.

      Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal requisition of all widgets that can be reached from the widget by a chain of size groups of type GTK2.SIZE_GROUP_HORIZONTAL or GTK2.SIZE_GROUP_BOTH, and the vertical size from the vertical requisition of all widgets that can be reached from the widget by a chain of size groups of type GTK2.SIZE_GROUP_VERTICAL or GTK2.SIZE_GROUP_BOTH. Properties: int mode The directions in which the size group effects the requested sizes of its componenent widgets.

    Inherit Object

      inherit G.Object : Object

    Method add_widget

      `GTK2.SizeGroup add_widget(GTK2.Widget widget)`

    Description

      Adds a widget to the group. In the future, the requisition of the widget will be determined as the maximum of its requisition and the requisition of the other widgets in the size group. Whether this applies horizontally, vertically, or in both directions depends on the mode.

    Method create

      `GTK2.SizeGroup GTK2.SizeGroup(int|mapping mode_or_props)`

    Description

      Create a new group.

    Method get_ignore_hidden

      `int get_ignore_hidden()`

    Description

      Returns if invisible widgets are ignored when calculating the size.

    Method get_mode

      `int get_mode()`

    Description

      Gets the current mode.

    Method remove_widget

      `GTK2.SizeGroup remove_widget(GTK2.Widget widget)`

    Description

      Removes a widget.

    Method set_ignore_hidden

      `GTK2.SizeGroup set_ignore_hidden(int setting)`

    Description

      Sets whether invisible widgets should be ignored when calculating the size.

    Method set_mode

      `GTK2.SizeGroup set_mode(int mode)`

    Description

      Sets the mode of the size group. One of SIZE_GROUP_BOTH , SIZE_GROUP_HORIZONTAL , SIZE_GROUP_NONE and SIZE_GROUP_VERTICAL . The mode of the size group determines whether the widgets in the size group should all have the same horizontal requisition, all have the same vertical requisition, or should all have the same requisition in both directions.

  CLASS GTK2.GdkPixmap

    Description

      This class creates a GDK2.Pixmap from either an GDK2.Image or Image.image object (or a numeric ID, see your X-manual for XIDs). The GDK2.Pixmap object can be used in a lot of different GTK widgets. The most notable is the W(Pixmap) widget.

      NOIMG

    Inherit Drawable

      inherit GDK2.Drawable : Drawable

    Method create

      `GDK2.Pixmap GTK2.GdkPixmap(int|object image)`

    Description

      Create a new GDK2.Pixmap object. Argument is a GDK2.Image object or a Image.Image object

    Method ref

      `GDK2.Pixmap ref()`

    Description

      Ref this object.

    Method set

      `GDK2.Pixmap set(GTK2.GdkImage image)`

    Description

      Argument is a GDK2.Image object or an Image.image object. It is much faster to use an gdkImage object, especially one allocated in shared memory. This is only an issue if you are going to change the contents of the pixmap often, toggling between a small number of images.

    Method unref

      `GDK2.Pixmap unref()`

    Description

      Unref this object.

  CLASS GTK2.UiManager

    Description

      Constructing menus and toolbars from an XML description. Properties: int add-tearoffs string ui

      Signals: actions_changed Emitted whenever the actions changes.

      add_widget Emitted for each generated menubar and toolbar, but not for generated popup menus.

      connect_proxy Emitted after connecting a proxy to an action.

      disconnect_proxy Emitted after disconnecting a proxy from an action.

      post_activate Emitted just after the action is activated.

      pre_activate Emitted just before the action is activated. A UI definition: &lt;ui&gt; &lt;menubar&gt; &lt;menu name="FileMenu" action="FileMenuAction"&gt; &lt;menuitem name="New" action="New2Action" /&gt; &lt;placeholder name="FileMenuAdditions" /&gt; &lt;/menu> &lt;menu name="JustifyMenu" action="JustifyMenuAction"&gt; &lt;menuitem name="Left" action="justify-left"/&gt; &lt;menuitem name="Centre" action="justify-center"/&gt; &lt;menuitem name="Right" action="justify-right"/&gt; &lt;menuitem name="Fill" action="justify-fill"/&gt; &lt;/menu&gt; &lt;/menubar&gt; &lt;toolbar action="toolbar1"&gt; &lt;placeholder name="JustifyToolItems"&gt; &lt;separator/&gt; &lt;toolitem name="Left" action="justify-left"/&gt; &lt;toolitem name="Centre" action="justify-center"/&gt; &lt;toolitem name="Right" action="justify-right"/&gt; &lt;toolitem name="Fill" action="justify-fill"/&gt; &lt;separator/&gt; &lt;/placeholder&gt; &lt;/toolbar&gt; &lt;/ui&gt;

    Inherit Object

      inherit G.Object : Object

    Method add_ui

      `GTK2.UiManager add_ui(int merge_id, string path, string name, string action, int type, int top)`

    Description

      Adds a ui element to the current contents.

      If type is GTK2.UI_MANAGER_AUTO, GTK2+ inserts a menuitem, toolitem or separator if such an element can be inserted at the place determined by path. Otherwise type must indicate an element that can be inserted at the place determined by path.

    Method add_ui_from_file

      `int add_ui_from_file(string filename)`

    Description

      Parses a file containing a ui definition.

    Method add_ui_from_string

      `int add_ui_from_string(string buffer)`

    Description

      Parses a string containing a ui definition and merges it with the current contents. An enclosing &gt;ui&lt; element is added if it is missing.

    Method create

      `GTK2.UiManager GTK2.UiManager(mapping|void props)`

    Description

      Creates a new ui manager object.

    Method ensure_update

      `GTK2.UiManager ensure_update()`

    Description

      Makes sure that all pending updates to the ui have been completed.

    Method get_accel_group

      `GTK2.AccelGroup get_accel_group()`

    Description

      Returns the GTK2.AccelGroup associated with this.

    Method get_action

      `GTK2.Action get_action(string path)`

    Description

      Looks up an action by following a path.

    Method get_action_groups

      `array get_action_groups()`

    Description

      Returns the list of action groups.

    Method get_add_tearoffs

      `int get_add_tearoffs()`

    Description

      Returns whether menus generated by this manager will have tearoff menu items.

    Method get_toplevels

      `array get_toplevels(int types)`

    Description

      Obtains a list of all toplevel widgets of the requested types. Bitwise or of UI_MANAGER_ACCELERATOR , UI_MANAGER_AUTO , UI_MANAGER_MENU , UI_MANAGER_MENUBAR , UI_MANAGER_MENUITEM , UI_MANAGER_PLACEHOLDER , UI_MANAGER_POPUP , UI_MANAGER_SEPARATOR , UI_MANAGER_TOOLBAR and UI_MANAGER_TOOLITEM .

    Method get_ui

      `string get_ui()`

    Description

      Creates a ui definition of the merged ui.

    Method get_widget

      `GTK2.Widget get_widget(string path)`

    Description

      Looks up a widget by following a path. The path consists of the names specified in the xml description of the ui, separated by '/'. Elements which don't have a name or action attribute in the xml (e.g. &gt;popup&lt;) can be addressed by their xml element name (e.g. "popup"). The root element ("/ui") can be omitted in the path.

      Note that the widget found be following a path that ends in a &gt;menu&lt; element is the menuitem to which the menu is attached, not the menu itself.

    Method insert_action_group

      `GTK2.UiManager insert_action_group(GTK2.ActionGroup group, int pos)`

    Description

      Inserts an action group into the list of action groups. Actions in earlier groups hide actions with the same name in later groups.

    Method new_merge_id

      `int new_merge_id()`

    Description

      Returns an unused merge id, suitable for use with add_ui().

    Method remove_action_group

      `GTK2.UiManager remove_action_group(GTK2.ActionGroup group)`

    Description

      Removes an action group from the list of action groups.

    Method remove_ui

      `GTK2.UiManager remove_ui(int merge_id)`

    Description

      Unmerges the part of the content identified by merge_id.

    Method set_add_tearoffs

      `GTK2.UiManager set_add_tearoffs(int setting)`

    Description

      Sets the "add-tearoffs" property, which controls whether menus generated by this manager will have tearoff menu items.

      Note that this only affects regular menus. Generated popup menus never have tearoff menu items.

  CLASS GTK2.IconFactory

    Description

      Icon factory, for holding icon sets.

    Inherit Object

      inherit G.Object : Object

    Method add

      `GTK2.IconFactory add(string stock_id, GTK2.IconSet icon_set)`

    Description

      Adds the given icon_set to the icon factory, under the name of stock_id. stock_id should be namespaced for your application, e.g. "myapp-whatever-icon". Normally applications create a GTK2.IconFactory, then add it to the list of default factories with add_default(). Then they pass the stock_id to widgets such as GTK2.Image to display the icon. Themes can provide an icon with the same name (such as "myapp-whatever-icon") to override your application's default icons. If an icon already existed in this factory for stock_id, it is unreferenced and replaced with the new icon_set.

    Method add_default

      `GTK2.IconFactory add_default()`

    Description

      Adds an icon factory to the list of icon factories search by GTK2.Style->lookup_icon_set(). This means that, for example, GTK2.Image->create("stock-id") will be able to find icons in factory. There will normally be an icon factory added for each library or application that comes with icons. The default icon factories can be overridden by themes.

    Method create

      `GTK2.IconFactory GTK2.IconFactory()`

    Description

      Creates a new GTK2.IconFactory. An icon factory manages a collection of GTK2.IconSets; a GTK2.IconSet manages a set of variants of a particular icon (i.e. a GTK2.IconSet contains variants for different sizes and widget states). Icons in an icon factory are named by a stock ID, which is a simple string identifying the icon. Each GTK2.Style has a list of GTK2.IconFactorys derived from the current theme; those icon factories are consulted first when searching for an icon. If the theme doesn't set a particular icon, GTK2+ looks for the icon in a list of default icon factories, maintained by add_default() and remove_default(). Applications with icons should add a default icon factory with their icons, which will allow themes to override the icons for the application.

    Method lookup

      `GTK2.IconSet lookup(string stock_id)`

    Description

      Looks up stock_id in the icon factory, returning an icon set if found, otherwise 0. For display to the user, you should use GTK2.Style->lookup_icon_set() on the GTK2.Style for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.

    Method lookup_default

      `GTK2.IconSet lookup_default(string stock_id)`

    Description

      Looks for an icon in the list of default icon factories. For display to the user, you should use GTK2.Style->lookup_icon_set() on the GTK2.Style for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.

    Method remove_default

      `GTK2.IconFactory remove_default()`

    Description

      Removes an icon factory from the list of default icon factories.

  CLASS GTK2.Box

    Description

      A box is a container that can contain more than one child. The basic 'Box' class cannot be instantiated, it is a virtual class that only defines some common 'Box' functions shared with all other Box widgets. Properties: int homogeneous int spacing

      Child properties: int expand int fill int pack-type int padding int position

    Inherit Container

      inherit GTK2.Container : Container

    Method get_homogeneous

      `int get_homogeneous()`

    Description

      Returns whether the box is homogeneous.

    Method get_spacing

      `int get_spacing()`

    Description

      Gets the spacing.

    Method pack_end

      `GTK2.Box pack_end(GTK2.Widget widget, int expandp, int fillp, int padding)`

    Description

      Pack from the right (or bottom) of the box. Arguments are widget, expand, fill, paddingb widget, expand, fill, padding

    Method pack_end_defaults

      `GTK2.Box pack_end_defaults(GTK2.Widget widget)`

    Description

      The argument is the widget to add.

    Method pack_start

      `GTK2.Box pack_start(GTK2.Widget widget, int expandp, int fillp, int padding)`

    Description

      Pack from the left (or top) of the box. Argument are widget, expand, fill, padding pack(widget,1,1,0) is equivalent to 'add' or 'pack_start_defaults'

    Method pack_start_defaults

      `GTK2.Box pack_start_defaults(GTK2.Widget widget)`

    Description

      The argument is the widget to add. This function is equivalent to 'add'

    Method query_child_packing

      `mapping query_child_packing(GTK2.Widget child)`

    Description

      Return a mapping: ([ "expand":expandp, "fill":fillp, "padding":paddingp, "type":type ])

    Method reorder_child

      `GTK2.Box reorder_child(GTK2.Widget child, int new_position)`

    Description

      Move widget to pos, pos is an integer, between 0 and sizeof(box->children())-1

    Method set_child_packing

      `GTK2.Box set_child_packing(GTK2.Widget child_widget, int expandp, int fillp, int padding, int pack_type)`

    Description

      widget, expand, fill, padding, pack_type. If exand is true, the widget will be expanded when the box is resized. If 'fill' is true, the widget will be resized to fill up all available space. Padding is the amount of padding to use, and pack_type is one of PACK_END and PACK_START .

      You can emulate pack_start and pack_end with add and set_child_packing.

    Method set_homogeneous

      `GTK2.Box set_homogeneous(int homogeneousp)`

    Description

      If true, all widgets in the box will get exactly the same amount of space

    Method set_spacing

      `GTK2.Box set_spacing(int spacing)`

    Description

      This is the amount of spacing (in pixels) inserted beween all widgets

  CLASS GTK2.Hscale

    Description

      The GTK2.HScale widget is used to allow the user to select a value using a horizontal slider. A GTK2.Adjustment is used to set the initial value, the lower and upper bounds, and the step and page increments.

      See W(Scale) for details

      The position to show the current value, and the number of decimal places shown can be set using the parent W(Scale) class's functions.

      `GTK2.Hscale(GTK2.Adjustment())->set_size_request(300,30)`

    Inherit Scale

      inherit GTK2.Scale : Scale

    Method create

      `GTK2.Hscale GTK2.Hscale(GTK2.Adjustment settings_or_min_props, float|void max, float|void step)`

    Description

      Used to create a new hscale widget. Either pass an W(Adjustment), or three floats representing min, max, and step values.

  CLASS GTK2.SourceLanguagesManager

    Inherit Object

      inherit G.Object : Object

    Method create

      `GTK2.SourceLanguagesManager GTK2.SourceLanguagesManager()`

    Description

      Create a new language manager.

    Method get_available_languages

      `array get_available_languages()`

    Description

      Gets a list of available languages.

    Method get_lang_files_dirs

      `array get_lang_files_dirs()`

    Description

      Gets a list of language files directories.

    Method get_language_from_mime_type

      `GTK2.SourceLanguage get_language_from_mime_type(string type)`

    Description

      Gets the GTK2.SourceLanguage which is associated with the given type in the language manager.

    Method get_language_from_name

      `GTK2.SourceLanguage get_language_from_name(string name)`

    Description

      Gets the GTK2.SourceLanguage which has this name.

  CLASS GTK2.Misc

    Description

      The GTK2.Misc widget is an abstract widget which is not useful itself, but is used to derive subclasses which have alignment and padding attributes.

      The horizontal and vertical padding attributes allows extra space to be added around the widget.

      The horizontal and vertical alignment attributes enable the widget to be positioned within its allocated area. Note that if the widget is added to a container in such a way that it expands automatically to fill its allocated area, the alignment settings will not alter the widgets position.

      `GTK2.Vbox(0,0)->add(GTK2.Label("Label"))->set_size_request(100,20)`

      `GTK2.Vbox(0,0)->add(GTK2.Label("Label")->set_alignment(1.0,0.0))->set_size_request(100,20)`

      `GTK2.Vbox(0,0)->add(GTK2.Label("Label")->set_alignment(0.0,0.0))->set_size_request(100,20)`

      Properties: float xalign The horizontal alignment, from 0 (left) to 1 (right). int xpad The amount of space to add on the left and right of the widget, in pixels. float yalign The vertical alignment, from 0 (top) to 1 (bottom). int ypad The amount of space to add on the top and bottom of the widget, in pixels.

    Inherit Widget

      inherit GTK2.Widget : Widget

    Method get_alignment

      `mapping get_alignment()`

    Description

      Gets the x and y alignment.

    Method get_padding

      `mapping get_padding()`

    Description

      Gets the x and y padding.

    Method set_alignment

      `GTK2.Misc set_alignment(float xalign, float yalign)`

    Description

      Sets the alignment of the widget. 0.0 is left or topmost, 1.0 is right or bottommost.

    Method set_padding

      `GTK2.Misc set_padding(int xpad, int ypad)`

    Description

      Sets the amount of space to add around the widget. xpad and ypad are specified in pixels.

  CLASS GTK2.Button

    Description

      A container that can only contain one child, and accepts events. draws a bevelbox around itself. `GTK2.Button("A button")`

      `GTK2.Button("A button\nwith multiple lines\nof text")`

      `GTK2.Button()->add(GTK2.Image(GTK2.GdkImage(0)->set(Image.Image(100,40)->test())))`

      Properties: int focus-on-click GTK2.Widget image string label int relief int use-stock int use-underline float xalign float yalign

      Style properties: int child-displacement-x int child-displacement-y GTK2.Border default-border GTK2.Border default-outside-border int displace-focus int image-spacing

      Signals: activate

      clicked Called when the button is pressed, and then released

      enter Called when the mouse enters the button

      leave Called when the mouse leaves the button

      pressed Called when the button is pressed

      released Called when the button is released

    Inherit Bin

      inherit GTK2.Bin : Bin

    Method clicked

      `GTK2.Button clicked()`

    Description

      Emulate a 'clicked' event (press followed by release).

    Method create

      `GTK2.Button GTK2.Button(string|mapping label_or_props)`

    Description

      If a string is supplied, a W(Label) is created and added to the button.

    Method enter

      `GTK2.Button enter()`

    Description

      Emulate a 'enter' event.

    Method get_alignment

      `mapping get_alignment()`

    Description

      Gets the alignment of the child.

    Method get_focus_on_click

      `int get_focus_on_click()`

    Description

      Returns whether the button grabs focus when it is clicked.

    Method get_image

      `GTK2.Widget get_image()`

    Description

      Gets the widget that is currently set as the image of the button.

    Method get_label

      `string get_label()`

    Description

      Get the text from the label of the button.

    Method get_relief

      `int get_relief()`

    Description

      One of RELIEF_HALF , RELIEF_NONE and RELIEF_NORMAL , set with set_relief()

    Method get_use_stock

      `int get_use_stock()`

    Description

      Returns whether the button label is a stock item.

    Method get_use_underline

      `int get_use_underline()`

    Description

      Returns whether an embedded underline in the button indicates a mnemonic.

    Method leave

      `GTK2.Button leave()`

    Description

      Emulate a 'leave' event.

    Method pressed

      `GTK2.Button pressed()`

    Description

      Emulate a 'press' event.

    Method released

      `GTK2.Button released()`

    Description

      Emulate a 'release' event.

    Method set_alignment

      `GTK2.Button set_alignment(float xalign, float yalign)`

    Description

      Sets the alignment of the child.

    Method set_focus_on_click

      `GTK2.Button set_focus_on_click(int focus_on_click)`

    Description

      Sets whether the button will grab focus when it is clicked.

    Method set_image

      `GTK2.Button set_image(GTK2.Widget widget)`

    Description

      Set the image of the button to the given widget. Note that it depends on the gtk-button-images setting whether the image will be displayed or not.

    Method set_label

      `GTK2.Button set_label(string label)`

    Description

      Set the text of the label.

    Method set_relief

      `GTK2.Button set_relief(int newstyle)`

    Description

      One of RELIEF_HALF , RELIEF_NONE and RELIEF_NORMAL

    Method set_use_stock

      `GTK2.Button set_use_stock(int use_stock)`

    Description

      If true, the label set on the button is used as a stock id to select the stock item for the button.

    Method set_use_underline

      `GTK2.Button set_use_underline(int use_underline)`

    Description

      If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

  CLASS GTK2.GdkScreen

    Description

      Properties: font-options float resolution

      Signals: composite_changed

      size_changed

    Inherit Object

      inherit G.Object : Object

    Method create

      `GDK2.Screen GTK2.GdkScreen()`

    Description

      Gets the default screen.

    Method get_default_colormap

      `GTK2.GdkColormap get_default_colormap()`

    Description

      Gets the default colormap.

    Method get_display

      `GTK2.GdkDisplay get_display()`

    Description

      Gets the display to which this screen belongs.

    Method get_height

      `int get_height()`

    Description

      Gets the height in pixels.

    Method get_height_mm

      `int get_height_mm()`

    Description

      Returns the height in millimeters.

    Method get_monitor_at_point

      `int get_monitor_at_point(int x, int y)`

    Description

      Returns the monitor number in which x,y is located.

    Method get_monitor_at_window

      `int get_monitor_at_window(GTK2.GdkWindow window)`

    Description

      Returns the number of the monitor in which the largest area of the bounding rectangle of window resides.

    Method get_monitor_geometry

      `GTK2.GdkRectangle get_monitor_geometry(int num)`

    Description

      Retrieves the GDK2.Rectangle representing the size and position of the individual monitor within the entire screen area.

    Method get_n_monitors

      `int get_n_monitors()`

    Description

      Returns the number of monitors which this screen consists of.

    Method get_number

      `int get_number()`

    Description

      Gets the index of this screen among the screens in the display to which it belongs.

    Method get_rgb_colormap

      `GTK2.GdkColormap get_rgb_colormap()`

    Description

      Gets the preferred colormap for rendering image data.

    Method get_rgb_visual

      `GTK2.GdkVisual get_rgb_visual()`

    Description

      Get a "preferred visual" chosen by GdkRGB for rendering image data.

    Method get_rgba_colormap

      `GTK2.GdkColormap get_rgba_colormap()`

    Description

      Gets a colormap to use for creating windows or pixmaps with an alpha channel.

    Method get_rgba_visual

      `GTK2.GdkVisual get_rgba_visual()`

    Description

      Gets a visual to use for creating windows or pixmaps with an alpha channel.

    Method get_root_window

      `GTK2.GdkWindow get_root_window()`

    Description

      Gets the root window.

    Method get_system_colormap

      `GTK2.GdkColormap get_system_colormap()`

    Description

      Gets the system default colormap.

    Method get_system_visual

      `GTK2.GdkVisual get_system_visual()`

    Description

      Get the default system visual.

    Method get_toplevel_windows

      `array get_toplevel_windows()`

    Description

      Returns a list of all toplevel windows known to GDK on the screen.

    Method get_width

      `int get_width()`

    Description

      Gets the width of the screen in pixels.

    Method get_width_mm

      `int get_width_mm()`

    Description

      Gets the width in millimeters.

    Method list_visuals

      `array list_visuals(int|void def)`

    Description

      List the available visuals. If def is true, return the available visuals for the default screen.

    Method make_display_name

      `string make_display_name()`

    Description

      Determines the name to pass to GDK2.Display->open() to get a GDK2.Display with this screen as the default screen.

    Method set_default_colormap

      `GDK2.Screen set_default_colormap(GTK2.GdkColormap colormap)`

    Description

      Sets the default colormap.

  CLASS GTK2.FileSelection

    Description

      GtkFileSelection should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list, the drop-down history menu, or the TAB key can be used to navigate using filename completion common in text based editors such as emacs and jed.

      The default filename can be set using set_filename() and the selected filename retrieved using get_filename().

      Use complete() to display files that match a given pattern. This can be used for example, to show only *.txt files, or only files beginning with gtk*.

      Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using hide_fileop_buttons() and shown again using show_fileop_buttons().

      `GTK2.FileSelection("File selector")`

      Properties: string filename int select-multiple int show-fileops

    Inherit Dialog

      inherit GTK2.Dialog : Dialog

    Method complete

      `GTK2.FileSelection complete(string pattern)`

    Description

      Will attempt to match pattern to a valid filename in the current directory. If a match can be made, the matched filename will appear in the text entry field of the file selection dialog. If a partial match can be made, the "Files" list will contain those file names which have been partially matched.

    Method create

      `GTK2.FileSelection GTK2.FileSelection(string|mapping title_or_props)`

    Description

      Creates a new file selection dialog box. By default it will list the files in the current working directory. Operation buttons allowing the user to create a directory, delete files, and rename files will also be present by default.

    Method get_action_area

      `GTK2.Vbox get_action_area()`

    Description

      The action area

    Method get_button_area

      `GTK2.HbuttonBox get_button_area()`

    Description

      The button area

    Method get_cancel_button

      `GTK2.Button get_cancel_button()`

    Description

      The cancel button

    Method get_filename

      `string get_filename()`

    Description

      Return the filename.

    Method get_fileop_c_dir

      `GTK2.Button get_fileop_c_dir()`

    Description

      The create directory button in the file operation button group

    Method get_fileop_del_file

      `GTK2.Button get_fileop_del_file()`

    Description

      The delete file button in the file operation button group

    Method get_fileop_dialog

      `GTK2.Dialog get_fileop_dialog()`

    Description

      Dialog box for GTK2.FileSelection

    Method get_fileop_ren_file

      `GTK2.Button get_fileop_ren_file()`

    Description

      The rename file button in the file operation button group

    Method get_help_button

      `GTK2.Button get_help_button()`

    Description

      The help button

    Method get_main_vbox

      `GTK2.Vbox get_main_vbox()`

    Description

      The main vbox

    Method get_ok_button

      `GTK2.Button get_ok_button()`

    Description

      The ok button

    Method get_select_multiple

      `int get_select_multiple()`

    Description

      Gets whether the user is allowed to select multiple files.

    Method get_selection

      `array get_selection()`

    Description

      Retrieves the list of selections the user has made.

    Method hide_fileop_buttons

      `GTK2.FileSelection hide_fileop_buttons()`

    Description

      Hides the file operation buttons that normally appear at the top of the dialog. Useful if you wish to create a custom file selector, based on GTK2.FileSelection.

    Method set_filename

      `GTK2.FileSelection set_filename(string fname)`

    Description

      Sets a default path for the file requestor. If filename includes a directory path, then the requestor will open with that path as its current working directory.

    Method set_select_multiple

      `GTK2.FileSelection set_select_multiple(int select_multiple)`

    Description

      Sets whether the user is allowed to select multiple files.

    Method show_fileop_buttons

      `GTK2.FileSelection show_fileop_buttons()`

    Description

      Shows the file operation buttons, if they have previously been hidden. The rest of the widgets in the dialog will be resized accordingly.

  CLASS GTK2.GdkRegion

    Description

      Region information.

    Method create

      `GDK2.Region GTK2.GdkRegion()`

    Description

      Create a new (empty) region

      NOIMG

    Method equal

      `int equal(GTK2.GdkRegion victim)`

    Description

      Return true if the region used as an argument is equal to the current region. Also available as a==b when a is a region.

    Method intersect

      `GTK2.GdkRegion intersect(GTK2.GdkRegion victim)`

    Description

      Computes the intersection of the given region and the region. Also available as region &amp; region

    Method offset

      `GDK2.Region offset(int dx, int dy)`

    Description

      Offset(move) the region by dx,dy pixels.

    Method point_in

      `int point_in(int x, int y)`

    Description

      Returns true if the given point resides in the given region

    Method rect_in

      `int rect_in(GTK2.GdkRectangle r)`

    Description

      Returns true if the given rectangle resides inside the given region

    Method shrink

      `GDK2.Region shrink(int dx, int dy)`

    Description

      reduces the size of a region by a specified amount. Positive values shrink the size of the region, and negative values expand the region.

    Method subtract

      `GTK2.GdkRegion subtract(GTK2.GdkRegion victim)`

    Description

      Computes the difference of the given region and the region. Also available as region - region

    Method union

      `GTK2.GdkRegion union(GTK2.GdkRegion victim)`

    Description

      Computes the union of the given rectangle or region and the region. Also available as region | rectangle, region | region, region + region and region + rectangle.

    Method xor

      `GTK2.GdkRegion xor(GTK2.GdkRegion victim)`

    Description

      Computes the exlusive or of the given region and the region. Also available as region ^ region

  CLASS GTK2.Toolbar

    Description

      Toolbars are usually used to group some number of widgets in order to simplify customization of their look and layout. Typically a toolbar consists of buttons with icons, labels and tooltips, but any other widget can also be put inside a toolbar. Finally, items can be arranged horizontally or vertically and buttons can be displayed with icons, labels, or both.

      Examples: `lambda(){object t=GTK2.Toolbar( /*GTK2.ORIENTATION_HORIZONTAL, GTK2.TOOLBAR_TEXT*/ );t->append_item( "Button 1", "Tooltip 1", "", GTK2.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 2", "Tooltip 2", "", GTK2.Frame(), lambda(){},0);t->append_item( "Button 3", "Tooltip 3", "", GTK2.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 4", "Tooltip 4", "", GTK2.Frame(), lambda(){},0);t->append_item( "Button 5", "Tooltip 5", "", GTK2.Frame(), lambda(){},0);return t;}()`

      `lambda(){object t=GTK2.Toolbar( /*GTK2.ORIENTATION_VERTICAL, GTK2.TOOLBAR_TEXT*/ );t->append_item( "Button 1", "Tooltip 1", "", GTK2.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 2", "Tooltip 2", "", GTK2.Frame(), lambda(){},0);t->append_item( "Button 3", "Tooltip 3", "", GTK2.Frame(), lambda(){},0);t->append_space();t->append_item( "Button 4", "Tooltip 4", "", GTK2.Frame(), lambda(){},0);t->append_item( "Button 5", "Tooltip 5", "", GTK2.Frame(), lambda(){},0);return t;}()`

      `lambda(){object i=GTK2.GdkImage()->set(Image.Image(20,20)->test());object t=GTK2.Toolbar( /*GTK2.ORIENTATION_HORIZONTAL, GTK2.TOOLBAR_BOTH*/ );t->append_item( "Button 1", "Tooltip 1", "", GTK2.Image(i), lambda(){},0);t->append_space();t->append_item( "Button 2", "Tooltip 2", "", GTK2.Image(i), lambda(){},0);t->append_item( "Button 3", "Tooltip 3", "", GTK2.Image(i), lambda(){},0);t->append_space();t->append_item( "Button 4", "Tooltip 4", "", GTK2.Image(i), lambda(){},0);t->append_item( "Button 5", "Tooltip 5", "", GTK2.Image(i), lambda(){},0);return t;}()`

      Properties: int orientation int show-arrow int toolbar-style int tooltips

      Child properties: int expand int homogeneous

      Style properties: int button-relief int internal-padding int shadow-type int space-size int space-style

      Signals: orientation_changed

      popup_context_menu

      style_changed

    Inherit Container

      inherit GTK2.Container : Container

    Method create

      `GTK2.Toolbar GTK2.Toolbar(mapping|void props)`

    Description

      Creates a new toolbar.

    Method get_drop_index

      `int get_drop_index(int x, int y)`

    Description

      Returns the position corresponding to the indicated point on the toolbar. This is useful when dragging items to the toolbar: this function returns the position a new item should be inserted.

      x and y are in toolbar coordinates.

    Method get_icon_size

      `int get_icon_size()`

    Description

      Retrieves the icon size for the toolbar. One of ICON_SIZE_BUTTON , ICON_SIZE_DIALOG , ICON_SIZE_DND , ICON_SIZE_INVALID , ICON_SIZE_LARGE_TOOLBAR , ICON_SIZE_MENU and ICON_SIZE_SMALL_TOOLBAR .

    Method get_item_index

      `int get_item_index(GTK2.ToolItem item)`

    Description

      Returns the position of item on the toolbar, starting from 0.

    Method get_n_items

      `int get_n_items()`

    Description

      Returns the number of items on the toolbar.

    Method get_nth_item

      `GTK2.ToolItem get_nth_item(int n)`

    Description

      Returns the n's item on the toolbar, or empty if the toolbar does not contain an n'th item.

    Method get_orientation

      `int get_orientation()`

    Description

      Retrieves the current orientation of the toolbar.

    Method get_relief_style

      `int get_relief_style()`

    Description

      Returns the relief style of buttons.

    Method get_show_arrow

      `int get_show_arrow()`

    Description

      Returns whether the toolbar has an overflow menu.

    Method get_style

      `int get_style()`

    Description

      Retrieves whether the toolbar has text, icons, or both. One of TOOLBAR_BOTH , TOOLBAR_BOTH_HORIZ , TOOLBAR_ICONS , TOOLBAR_SPACE_EMPTY , TOOLBAR_SPACE_LINE and TOOLBAR_TEXT ;

    Method get_tooltips

      `int get_tooltips()`

    Description

      Retrieves whether tooltips are enabled.

    Method insert

      `GTK2.Toolbar insert(GTK2.ToolItem item, int pos)`

    Description

      Insert a W(ToolItem) into the toolbar at position pos. If pos is 0 the item is prepended to the start of the toolbar. If pos is negative, the item is appended to the end of the toolbar.

    Method set_drop_highlight_item

      `GTK2.Toolbar set_drop_highlight_item(GTK2.ToolItem item, int index)`

    Description

      Highlights the toolbar to give an ide aof what it would like if item was added at the position indicated by index.

      The item passed to this function must not be part of any widget hierarchy. When an item is set as drop highlight item it can not be added to any widget hierarchy or used as highlight item for another toolbar.

    Method set_orientation

      `GTK2.Toolbar set_orientation(int orientation)`

    Description

      Sets whether a toolbar should appear horizontally or vertically. One of ORIENTATION_HORIZONTAL and ORIENTATION_VERTICAL .

    Method set_show_arrow

      `GTK2.Toolbar set_show_arrow(int show_arrow)`

    Description

      Sets whether to show an overflow menu when the toolbar doesn't have room for all items on it. If true, items for which there are not room are are available through an overflow menu.

    Method set_style

      `GTK2.Toolbar set_style(int style)`

    Description

      Set the style, one of TOOLBAR_BOTH , TOOLBAR_BOTH_HORIZ , TOOLBAR_ICONS , TOOLBAR_SPACE_EMPTY , TOOLBAR_SPACE_LINE and TOOLBAR_TEXT

    Method set_tooltips

      `GTK2.Toolbar set_tooltips(int enable)`

    Description

      Sets if the tooltips should be active or not.

    Method unset_style

      `GTK2.Toolbar unset_style()`

    Description

      Unsets a toolbar style, so that user preferences will be used to determine the toolbar style.

  CLASS GTK2.IconSource

    Description

      Iconsource.

    Method create

      `GTK2.IconSource GTK2.IconSource()`

    Description

      Creates a new GTK2.IconSource. A GTK2.IconSource contains a GDK2.Pixbuf (or image filename) that serves as the base image for one or more of the icons in a GTK2.IconSet, along with a specification for which icons in the icon set will be based on that pixbuf or image file. An icon set contains a set of icons that represent "the same" logical concept in different states, different global text directions, and different sizes.

      So for example a web browser's "Back to Previous Page" icon might point in a different direction in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode small/large icons). So a single icon set would contain all those variants of the icon. GTK2.IconSet contains a list of GTK2.IconSource from which it can derive specific icon variants in the set.

      In the simplest case, GTK2.IconSet contains one source pixbuf from which it derives all variants. The convenience function GTK2.IconSet->create(pixbuf) handles this case; if you only have one source pixbuf, just use that function.

      If you want to use a different base pixbuf for different icon variants, you create multiple icon sources, mark which variants they'll be used to create, and add them to the icon set with GTK2.IconSet->add_source().

      By default, the icon source has all parameters wildcarded. That is, the icon source will be used as the base icon for any desired text direction, widget state, or icon size.

    Method get_direction

      `int get_direction()`

    Description

      Obtains the text direction this icon source applies to. The return value is only useful/meaningful if the text direction is not wildcarded.

    Method get_direction_wildcarded

      `int get_direction_wildcarded()`

    Description

      Gets the value set by set_direction_wildcarded().

    Method get_filename

      `string get_filename()`

    Description

      Retrieves the source filename, or empty.

    Method get_icon_name

      `string get_icon_name()`

    Description

      Retrieves the source icon name, or empty.

    Method get_pixbuf

      `GTK2.GdkPixbuf get_pixbuf()`

    Description

      Retrieves the source pixbuf, or 0. In addition, if a filename source is in use, this function in some cases will return the pixbuf loaded from the filename. This is, for example, true for the GTK2.IconSource passed to the GTK2.Style->render_icon() virtual function.

    Method get_size

      `int get_size()`

    Description

      Obtains the icon size this source applies to. The return value is only useful/meaningful if the icon size is not wildcarded.

    Method get_size_wildcarded

      `int get_size_wildcarded()`

    Description

      Gets the value set by set_size_wildcarded().

    Method get_state

      `int get_state()`

    Description

      Obtains the widget state this icon source applies to. The return value is only useful/meaningful if the widget state is not wildcarded.

    Method get_state_wildcarded

      `int get_state_wildcarded()`

    Description

      Gets the value set by set_state_wildcarded().

    Method set_direction

      `GTK2.IconSource set_direction(int dir)`

    Description

      Sets the text direction this icon source is intended to be used with.

      Setting the text direction on an icon source makes no difference if the text direction is wildcarded. Therefore, you should usually call set_direction_wildcarded() to un-wildcard it in addition to calling this function.

    Method set_direction_wildcarded

      `GTK2.IconSource set_direction_wildcarded(int setting)`

    Description

      If the text direction is wildcarded, this source can be used as the base image for an icon in any text direction. If the text direction is not wildcarded, then the text direction the icon source applies to should be set with set_direction(), and the icon source will only be used with that text direction.

      GTK2.IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.

    Method set_filename

      `GTK2.IconSource set_filename(string filename)`

    Description

      Sets the name of an image file to use as a base image when creating icon variants for GTK2.IconSet. The filename must be absolute.

    Method set_icon_name

      `GTK2.IconSource set_icon_name(string name)`

    Description

      Sets the name of an icon to look up in the current icon theme to use as a base image.

    Method set_pixbuf

      `GTK2.IconSource set_pixbuf(GTK2.GdkPixbuf pixbuf)`

    Description

      Sets a pixbuf to use as a base image.

    Method set_size

      `GTK2.IconSource set_size(int size)`

    Description

      Sets the icon size this icon source is intended to be with.

    Method set_size_wildcarded

      `GTK2.IconSource set_size_wildcarded(int setting)`

    Description

      If the icon size is wildcarded, this source can be used as the base image for an icon of any size. If the size is not wildcarded, then the size the source applies to should be set with set_size() and the icon source will only be used with that specific size.

    Method set_state

      `GTK2.IconSource set_state(int state)`

    Description

      Sets the widget state this icon source is intended to be used with.

    Method set_state_wildcarded

      `GTK2.IconSource set_state_wildcarded(int setting)`

    Description

      If the widget state is wildcarded, this source can be used as the base image for an icon in any state. If the widget state is not wildcarded, then the state the source applies to should be set with set_state() and the icon source will only be used with that specific state.

Module ADT

  Description

    Various Abstract Data Types.

  Inherit _ADT

    inherit _ADT : _ADT

  CLASS ADT.Sequence

    Description

      The sequence work similar to an array but has the possibilities to insert and remove elements. It also has a more powerful iterator.

    Method `[]

      `mixed `[](int index)`

    Description

      Index operator.

    Parameter `index`

      The index to get the value for, could be negative to index from the end.

    Returns

      The value at the index index .

    Throws

      An error if the index is out of range.

    Method `[]=

      `mixed `[]=(int index, mixed value)`

    Description

      Index assign operator. Set the value at the index index to be value .

    Parameter `index`

      The index to set.

    Parameter `value`

      The new value.

    Returns

      The new value at the index index .

    Method `+

      `Sequence `+(Sequence ... coll)`

    Description

      Addition operator

      Append the content of @coll to this sequence and return the results as a new Sequence .

    Parameter `coll`

      The sequences to append to this sequence.

    Returns

      The result of the append as a new Sequence .

    Method `-

      `Sequence `-(Sequence ... coll)`

    Description

      Subtraction operator

      Removes those values in this sequence that also are present in @coll and return the results as a new Sequence .

    Parameter `coll`

      The sequence to subtract from this sequence.

    Returns

      The result of the subtraction as a new Sequence .

    Method `&

      `Sequence `&(Sequence coll)`

    Description

      And operator Perform an and on this sequence and the coll sequence by only returning those values that is present in both sequences as a new Sequence . The remaining values is in the same order as they are in this sequence and the values are compared using `==.

    Parameter `coll`

      The sequence to and to this sequence.

    Returns

      The result of the and as a new Sequence .

    Method `|

      `Sequence `|(Sequence coll)`

    Description

      Or operator Perform an or on this sequence and the coll sequence by returning those values that is present in both sequences as a new Sequence . The values are compared using `==.

    Parameter `coll`

      The sequence to or with this sequence.

    Returns

      The result of the or as a new Sequence .

    Method `^

      `Sequence `^(Sequence coll)`

    Description

      Xor operator Perform a xor on this sequence and the coll sequence by returning those values that is present in one of the sequences but not in both adapters as a new Sequence . The values are compared using `==.

    Parameter `coll`

      The sequence to xor with this sequence.

    Returns

      The result of the xor as a new Sequence .

    Method _equal

      `int(0..1) _equal(mixed coll)`

    Returns

      Returns `true` if the object coll is a Sequence and contains the same values in the same order.

    Method _indices

      `array _indices()`

    Returns

      The indices in this adapter as an array.

    Method _insert_element

      `void _insert_element(int index, mixed value)`

    Description

      Insert an element in the sequence at the position index , the value at the position index and all above will have their index increased by one.

    Parameter `index`

      The index to insert the value at.

    Parameter `value`

      The new value.

    Method _remove_element

      `mixed _remove_element(int index)`

    Description

      Remove the values at index index from the sequence.

    Parameter `index`

      The index to remove.

    Returns

      The removed value.

    Method _search

      `int _search(mixed value, void|int start)`

    Description

      Search the sequence for a specific value. Return the index of the first value that is equal to value . If no value was found `UNDEFINED` is returned instead.

    Parameter `value`

      The value to find.

    Parameter `start`

      If a start value is supplied it will start searching at the index start .

    Returns

      Returns the index of the found value or `UNDEFINED`.

    Method _sizeof

      `int _sizeof()`

    Returns

      The number of elements in this adapter.

    Method _values

      `array _values()`

    Returns

      The values in this adapter as an array.

    Method add

      `void add(mixed value)`

    Description

      Add a value at the end of the sequence.

    Parameter `value`

      The value to add.

    Method cast

      `mixed cast(string type)`

    Description

      Cast operator.

    Parameter `type`

      Casts to this type.

      Casts to the following types are supported:

      `"array"` | Cast the content of this sequence to an array.

    Returns

      An array with the contents of this sequence.

    Method clear

      `void clear()`

    Description

      Clear the contents of the sequence.

    Method delete_value

      `int delete_value(mixed value)`

    Description

      Remove the first occurrence of the value value from the sequence.

    Parameter `value`

      The value to remove from the sequence.

    Returns

      The index of the removed element or -1 if there was no value to remove.

    Method is_empty

      `int(0..1) is_empty()`

    Returns

      Returns `1` if the sequence is empty otherwise `0`.

    Method max_size

      `int max_size()`

    Returns

      Returns -1.

    Method create

      `void ADT.Sequence(array|int arg)`

    Description

      Creates a new Sequence around the array arg or a new Sequence with the size of arg.

    Method _get_iterator

      `SequenceIterator _get_iterator(void|int ind)`

    Description

      Create and initiate a new SequenceIterator that could be used to iterate over this sequence.

    Parameter `ind`

      If an ind value is supplied the iterator will be positioned at that index.

    Returns

      An iterator.

    Method first

      `SequenceIterator first()`

    Description

      Create and initiate a new SequenceIterator that could be used to iterate over this sequence.

    Returns

      An iterator positioned at the first element in the sequence.

    Method last

      `SequenceIterator last()`

    Description

      Create and initiate a new SequenceIterator that could be used to iterate over this sequence.

    Returns

      An iterator positioned after the last element in the sequence.

    CLASS ADT.Sequence.SequenceIterator

      Description

        This is the iterator for the Sequence. It implements the IndexIterator and the OutputIterator

      Method create

        `void ADT.Sequence.SequenceIterator(object sequence, void|int start)`

      Description

        Creates a new iterator for the sequence sequence . If start is supplied it will try to position the iterator at start .

      Method index

        `int index()`

      Returns

        The index at the current position.

      Method value

        `mixed value()`

      Returns

        The value at the current position.

      Method `+

        `SequenceIterator `+(int steps)`

      Description

        Move the iterator steps steps forward (negative value on steps will cause the iterator to move backwards) and return the result as a new iterator.

      Returns

        A new iterator positioned steps steps forward.

      Method `+=

        `SequenceIterator `+=(int steps)`

      Description

        Move this iterator steps steps forward (negative value on steps will cause the iterator to move backwards) and return the result.

      Returns

        This iterator positioned steps steps forward.

      Method `-

        `SequenceIterator `-(int steps)`

      Description

        Move the iterator steps steps backwards (negative value on steps will cause the iterator to move forwards) and return the result as a new iterator.

      Returns

        A new iterator positioned steps steps backwards.

      Method has_next

        `int(0..1) has_next(void|int steps)`

      Returns

        Returns `true` if it is possible to move steps steps forwards, if steps weren't supplied it check if it is possible to move one step forward.

      Method has_previous

        `int(0..1) has_previous(void|int steps)`

      Returns

        Returns `true` if it is possible to move steps steps backwards, if steps weren't supplied it check if it is possible to move one step backward.

      Method `!

        `int(0..1) `!()`

      Returns

        Returns `false` if the iterator has reached the end.

      Method _equal

        `int(0..1) _equal(mixed iter)`

      Description

        Compare this iterator with another iterator.

      Parameter `iter`

        The iterator to compare with.

      Returns

        Returns `true` if both iterators iterates over the same objects and are positioned at the same spot.

      Method `<

        `int(0..1) `<(mixed iter)`

      Description

        Less then operator.

      Returns

        Returns `true` if this iterator has a lower index then iter .

      Method `>

        `int(0..1) `>(mixed iter)`

      Description

        Greater then operator.

      Returns

        Returns `true` if this iterator has a higher index then iter .

      Method distance

        `int distance(object iter)`

      Parameter `iter`

        The iterator to measure the distance to.

      Returns

        Returns distance between this iterator and iter .

      Throws

        An error if the two iterator could not be compared.

      Method get_collection

        `Sequence get_collection()`

      Returns

        Returns the Sequence this iterator currently iterates over.

      Method set_value

        `mixed set_value(mixed val)`

      Description

        Set the value at the current position.

      Parameter `val`

        The new value.

      Returns

        Returns the old value.

  CLASS ADT.CircularList

    Description

      This is an circular list implemented by an array. It has a constant time complexity for pop and push. It has a limited max size but it can be increased with the method allocate.

    Method `[]

      `mixed `[](int index)`

    Description

      Index operator

    Parameter `index`

      The index to get the value for, could be negative to index from the end.

    Returns

      The value at the index index

    Throws

      An error if the index is out of range.

    Method `[]=

      `mixed `[]=(int index, mixed value)`

    Description

      Index assign operator. Set the value at the index index to be value

    Parameter `index`

      The index to set

    Parameter `value`

      The new value

    Returns

      The new value at the index index

    Throws

      An error if the index is out of range.

    Method `+

      `CircularList `+(CircularList ... coll)`

    Description

      Addition operator

      Append the content of this CircularList and @coll and return the results as a new CircularList .

    Parameter `coll`

      The lists to append to this list

    Returns

      The result of the append as a new CircularList .

    Method _equal

      `int(0..1) _equal(mixed coll)`

    Returns

      Returns `true` if the object coll is a CircularList and contains the same values in the same order.

    Method _indices

      `array _indices()`

    Returns

      The indices in this list as an array.

    Method _insert_element

      `void _insert_element(int index, mixed value)`

    Description

      Insert an element in the list at the position index , the value at the position index and all above will have their index increased by one.

    Parameter `index`

      The index to insert the value at.

    Parameter `value`

      The new value.

    Throws

      An error if the index is out of range.

    Method _remove_element

      `mixed _remove_element(int index)`

    Description

      Remove the values at index index from the list.

    Parameter `index`

      The index to remove.

    Returns

      The removed value.

    Throws

      An error if the index is out of range.

    Method _search

      `int _search(mixed value, void|int start)`

    Description

      Search the list for a specific value. Return the index of the first value that is equal to value . If no value was found `UNDEFINED` is returned instead

    Parameter `value`

      The value to find

    Parameter `start`

      If a start value is supplied it will start searching at the index start .

    Returns

      Returns the index of the found value or `UNDEFINED`.

    Throws

      An error if the start is out of range.

    Method _sizeof

      `int _sizeof()`

    Returns

      The number of elements in this list.

    Method _values

      `array _values()`

    Returns

      The values in this list as an array.

    Method add

      `void add(mixed value)`

    Description

      Add a value at the front of the list

    Parameter `value`

      The value to add.

    Throws

      An error if the list is full.

    Method allocate

      `void allocate(int elements)`

    Description

      Increase the maxsize of the CircularlList.

    Parameter `elements`

      Add this number of new elements to the list.

    Method cast

      `mixed cast(string type)`

    Description

      Cast operator.

    Parameter `type`

      Casts to this type.

      Casts to the following types are supported:

      `"array"` | Cast the content of this list to an array.

    Returns

      An array with the contents of this list.

    Method clear

      `void clear()`

    Description

      Clear the contents of the list.

    Method delete_value

      `int delete_value(mixed value)`

    Description

      Remove the first occurrence of the value value from the list.

    Parameter `value`

      The value to remove from the list.

    Returns

      The index of the removed element or -1 if there was no value to remove.

    Method is_empty

      `int(0..1) is_empty()`

    Returns

      Returns `1` if the list is empty otherwise `0`.

    Method max_size

      `int max_size()`

    Returns

      Returns the maximal size of this list.

    Method peek_back

      `mixed peek_back()`

    Returns

      The value at the back of the list but do not remove it from the list.

    Method peek_front

      `mixed peek_front()`

    Returns

      The value at the front of the list but do not remove it from the list.

    Method pop_back

      `mixed pop_back()`

    Description

      Remove the value at the back of the list and return it.

    Returns

      The value at the back of the list.

    Method pop_front

      `mixed pop_front()`

    Description

      Remove the value at the front of the list and return it.

    Returns

      The value at the front of the list.

    Method push_back

      `void push_back(mixed value)`

    Description

      Add a new value at the end of the list.

    Parameter `value`

      The value to add.

    Method push_front

      `void push_front(mixed value)`

    Description

      Add a new value at the end of the list.

    Parameter `value`

      The value to add.

    Method create

      `void ADT.CircularList(array|int arg)`

    Description

      Creates a new CircularList around the array arg or a new CircularList with the maximum size of arg.

    Method _get_iterator

      `CircularListIterator _get_iterator(void|int ind)`

    Description

      Create and initiate a new CircularListIterator that could be used to iterate over this list.

    Parameter `ind`

      If an ind value is supplied the iterator will be positioned at that index.

    Returns

      An iterator.

    Method first

      `CircularListIterator first()`

    Description

      Create and initiate a new CircularListIterator that could be used to iterate over this list.

    Returns

      An iterator positioned at the first element in the list.

    Method last

      `CircularListIterator last()`

    Description

      Create and initiate a new CircularListIterator that could be used to iterate over this list.

    Returns

      An iterator positioned after the last element in the list.

    CLASS ADT.CircularList.CircularListIterator

      Description

        This is the iterator for the CircularList. It implements the IndexIterator and the OutputIterator.

      Method create

        `void ADT.CircularList.CircularListIterator(object list, void|int start)`

      Description

        Creates a new iterator for the CircularList list . If start is supplied it will try to position the iterator at start .

      Method index

        `int index()`

      Returns

        The index at the current position.

      Method value

        `mixed value()`

      Returns

        The value at the current position.

      Method `+

        `CircularListIterator `+(int steps)`

      Description

        Move the iterator steps steps forward (negative value on steps will cause the iterator to move backwards) and return the result as a new iterator.

      Returns

        A new iterator positioned steps steps forward.

      Method `+=

        `CircularListIterator `+=(int steps)`

      Description

        Move this iterator steps steps forward (negative value on steps will cause the iterator to move backwards) and return the result.

      Returns

        This iterator positioned steps steps forward.

      Method `-

        `CircularListIterator `-(int steps)`

      Description

        Move the iterator steps steps backwards (negative value on steps will cause the iterator to move forwards) and return the result as a new iterator.

      Returns

        A new iterator positioned steps steps backwards.

      Method has_next

        `int(0..1) has_next(void|int steps)`

      Returns

        Returns `true` if it is possible to move steps steps forwards, if steps weren't supplied it check if it is possible to move one step forward.

      Method has_previous

        `int(0..1) has_previous(void|int steps)`

      Returns

        Returns `true` if it is possible to move steps steps backwards, if steps weren't supplied it check if it is possible to move one step backward.

      Method `!

        `int(0..1) `!()`

      Returns

        Returns `false` if the iterator has reached the end.

      Method _equal

        `int(0..1) _equal(mixed iter)`

      Description

        Compare this iterator with another iterator.

      Parameter `iter`

        The iterator to compare with

      Returns

        Returns `true` if both iterators iterates over the same objects and are positioned at the same spot.

      Method `<

        `int(0..1) `<(mixed iter)`

      Description

        Less then operator

      Returns

        Returns `true` if this iterator has a lower index then iter .

      Method `>

        `int(0..1) `>(mixed iter)`

      Description

        Greater then operator

      Returns

        Returns `true` if this iterator has a higher index then iter .

      Method distance

        `int distance(object iter)`

      Parameter `iter`

        The iterator to measure the distance to.

      Returns

        Returns distance between this iterator and iter .

      Throws

        An error if the two iterator could not be compared.

      Method get_collection

        `CircularList get_collection()`

      Returns

        Returns the CircularList this iterator currently iterates over.

      Method set_value

        `mixed set_value(mixed val)`

      Description

        Set the value at the current position.

      Parameter `val`

        The new value

      Returns

        Returns the old value

  CLASS ADT.List

    Description

      Linked list of values.

    Method is_empty

      `int(0..1) is_empty()`

    Description

      Check if the list is empty.

    Returns

      Returns `1` if the list is empty, and `0` (zero) if there are elements in the list.

    Method _sizeof

      `int(0..) _sizeof()`

    Description

      Returns the number of elements in the list.

    Method _sprintf

      `string _sprintf(int c, mapping(string:mixed)|void attr)`

    Description

      Describe the list.

    See also

      sprintf() , lfun::_sprintf()

    Method head

      `mixed head()`

    Description

      Get the element at the head of the list.

    Throws

      Throws an error if the list is empty.

    See also

      is_empty() , tail() , pop()

    Method tail

      `mixed tail()`

    Description

      Get the element at the tail of the list.

    Throws

      Throws an error if the list is empty.

    See also

      is_empty() , head() , pop()

    Method pop

      `mixed pop()`

    Description

      Pop the element at the head of the list from the list.

    Throws

      Throws an error if the list is empty.

    See also

      is_empty() , head() , tail()

    Method append

      `void append(mixed ... values)`

    Description

      Append values to the end of the list.

    See also

      insert()

    Method insert

      `void insert(mixed ... values)`

    Description

      Insert values at the front of the list.

    See also

      append()

    Method create

      `void ADT.List(mixed ... values)`

    Description

      Create a new List , and initialize it with values .

    FIXME

      Ought to reset the List if called multiple times.

    CLASS ADT.List._get_iterator

      Description

        Iterator that loops over the List .

      Method value

        `mixed value()`

      Returns

        Returns the value at the current position.

      Method first

        `int(0..1) first()`

      Description

        Reset the iterator to point to the first element in the list.

      Returns

        Returns `1` if there are elements in the list, and `0` (zero) if the list is empty.

      Method next

        `int(0..1) next()`

      Description

        Advance to the next element in the list.

      Returns

        Returns `1` on success, and `0` (zero) at the end of the list.

      See also

        prev()

      Method prev

        `int(0..1) prev()`

      Description

        Retrace to the previous element in the list.

      Returns

        Returns `1` on success, and `0` (zero) at the beginning of the list.

      See also

        next()

      Method `+=

        `Iterator `+=(int steps)`

      Description

        Advance or retrace the specified number of steps .

      See also

        next() , prev

      Method insert

        `void insert(mixed val)`

      Description

        Insert val at the current position.

      See also

        append() , delete() , set()

      Method append

        `void append(mixed val)`

      Description

        Append val after the current position.

      See also

        insert() , delete() , set()

      Method delete

        `void delete()`

      Description

        Delete the current node.

        The current position will advance to the next node. This function thus performes the reverse operation of insert() .

      See also

        insert() , append() , set()

      Method set

        `void set(mixed val)`

      Description

        Set the value of the current position to val .

      See also

        insert() , append() , delete()

  CLASS ADT.struct

    Description

      String buffer with the possibility to read and write data as they would be formatted in structs.

    Method create

      `void ADT.struct(void|string s)`

    Description

      Create a new buffer, optionally initialized with the value s .

    Method contents

      `string contents()`

    Description

      Trims the buffer to only contain the data after the read pointer and returns the contents of the buffer.

    Method add_data

      `void add_data(string s)`

    Description

      Adds the data s verbatim to the end of the buffer.

    Method pop_data

      `string pop_data()`

    Description

      Return all the data in the buffer and empties it.

    Method put_uint

      `void put_uint(int i, int(0..) len)`

    Description

      Appends an unsigned integer in network order to the buffer.

    Parameter `i`

      Unsigned integer to append.

    Parameter `len`

      Length of integer in bytes.

    Method put_var_string

      `void put_var_string(string s, int(0..) len_width)`

    Description

      Appends a variable string s preceded with an unsigned integer of the size len_width declaring the length of the string. The string s should be 8 bits wide.

    Method put_bignum

      `void put_bignum(Gmp.mpz i, int(0..)|void len_width)`

    Description

      Appends a bignum i as a variable string preceded with an unsigned integer of the size len_width declaring the length of the string. len_width defaults to 2.

    Method put_fix_string

      `void put_fix_string(string s)`

    Description

      Appends the fix sized string s to the buffer.

    Method put_fix_uint_array

      `void put_fix_uint_array(array(int) data, int(0..) item_size)`

    Description

      Appends an array of unsigned integers of width item_size to the buffer.

    Method put_var_uint_array

      `void put_var_uint_array(array(int) data, int(0..) item_size, int(0..) len)`

    Description

      Appends an array of unsigned integers of width item_size to the buffer, preceded with an unsigned integer len declaring the size of the array.

    Method get_uint

      `int(0..) get_uint(int len)`

    Description

      Reads an unsigned integer from the buffer.

    Method get_fix_string

      `string get_fix_string(int len)`

    Description

      Reads a fixed sized string of length len from the buffer.

    Method get_var_string

      `string get_var_string(int len)`

    Description

      Reads a string written by put_var_string from the buffer.

    Method get_bignum

      `Gmp.mpz get_bignum(int|void len)`

    Description

      Reads a bignum written by put_bignum from the buffer.

    Method get_rest

      `string get_rest()`

    Description

      Get the remaining data from the buffer and clears the buffer.

    Method get_fix_uint_array

      `array(int) get_fix_uint_array(int item_size, int size)`

    Description

      Reads an array of integers as written by put_fix_uint_array from the buffer.

    Method get_var_uint_array

      `array(int) get_var_uint_array(int item_size, int len)`

    Description

      Reads an array of integers as written by put_var_uint_array from the buffer.

    Method is_empty

      `int(0..1) is_empty()`

    Description

      Returns one of there is any more data to read.

  CLASS ADT.Queue

    Description

      A simple FIFO queue.

    Method create

      `void ADT.Queue(mixed ... args)`

    Description

      Creates a queue with the initial items args in it.

    Method write
    Method put

      `void write(mixed item)`
      `void put(mixed item)`

    Description

      Adds the item to the queue.

    Method read
    Method get

      `mixed read()`
      `mixed get()`

    Description

      Returns the next element from the queue.

    Method peek

      `mixed peek()`

    Description

      Returns the next element from the queue without removing it from the queue.

    Method is_empty

      `int(0..1) is_empty()`

    Description

      Returns true if the queue is empty, otherwise zero.

    Method flush

      `void flush()`

    Description

      Empties the queue.

    Method cast

      `mixed cast(string to)`

    Description

      It is possible to cast ADT.Queue to an array.

  CLASS ADT.Stack

    Description

      This class implements a simple stack. Instead of adding and removing elements to an array, and thus making it vary in size for every push and pop operation, this stack tries to keep the stack size constant. If however the stack risks to overflow, it will allocate double its current size, i.e. pushing an element on an full 32 slot stack will result in a 64 slot stack with 33 elements.

    Method push

      `void push(mixed val)`

    Description

      Push an element on the top of the stack.

    Method top

      `mixed top()`

    Description

      Returns the top element from the stack, without popping it.

    Throws

      Throws an error if called on an empty stack.

    Method quick_pop

      `void quick_pop(void|int val)`

    Description

      Pops val entries from the stack, or one entry if no value is given. The popped entries are not actually freed, only the stack pointer is moved.

    Method pop

      `mixed pop(void|int val)`

    Description

      Pops and returns entry val from the stack, counting from the top. If no value is given the top element is popped and returned. All popped entries are freed from the stack.

    Method reset

      `void reset(int|void initial_size)`

    Description

      Empties the stack, resets the stack pointer and shrinks the stack size to the given value or 32 if none is given.

    See also

      create

    Method create

      `void ADT.Stack(int|void initial_size)`

    Description

      An initial stack size can be given when a stack is cloned. The default value is 32.

    Method set_stack

      `void set_stack(array stack)`

    Description

      Sets the stacks content to the provided array.

    Method _sizeof

      `int _sizeof()`

    Description

      sizeof on a stack returns the number of entries in the stack.

    Method _values

      `array _values()`

    Description

      values on a stack returns all the entries in the stack, in order.

    Method `+

      `this_program `+(this_program s)`

    Description

      A stack added with another stack yields a third a third stack will all the stack elements from the two first stacks.

  CLASS ADT.History

    Description

      A history is a stack where you can only push entries. When the stack has reached a certain size the oldest entries are removed on every push. Other proposed names for this data type is leaking stack and table (where you push objects onto the table in one end and objects are falling off the table in the other.

    Method create

      `void ADT.History(int max_size)`

    Description

      max_size is the maximum number of entries that can reside in the history at the same time.

    Method set_no_adjacent_duplicates

      `void set_no_adjacent_duplicates(int(0..1) i)`

    Description

      Change how the History object should treat two identical values in a row. If 1 than only unique values are allowed after each other.

    See also

      query_no_adjacent_duplicates

    Method query_no_adjacent_duplicates

      `int(0..1) query_no_adjacent_duplicates()`

    Description

      Tells if the History object allows adjacent equal values. 1 means that only uniqe values are allowed adter each other.

    See also

      set_no_adjacent_duplicates

    Method push

      `void push(mixed value)`

    Description

      Push a new value into the history.

    Method _sizeof

      `int _sizeof()`

    Description

      A sizeof operation on this object returns the number of elements currently in the history, e.g. <= the current max size.

    Method get_maxsize

      `int get_maxsize()`

    Description

      Returns the maximum number of values in the history

    See also

      set_maxsize

    Method get_latest_entry_num

      `int get_latest_entry_num()`

    Description

      Returns the absolute sequence number of the latest result inserted into the history.

    Method get_first_entry_num

      `int get_first_entry_num()`

    Description

      Returns the absolute sequence number of the oldest result still in the history. Returns 0 if there are no results in the history.

    Method `[]

      `mixed `[](int i)`

    Description

      Get a value from the history as if it was an array, e.g. both positive and negative numbers may be used. The positive numbers are however offset with 1, so [1] is the first entry in the history and [-1] is the last.

    Method `[]=

      `void `[]=(int i, mixed value)`

    Description

      Overwrite one value in the history. The history position may be identified either by positive or negative offset, like `[] .

    Method set_maxsize

      `void set_maxsize(int _maxsize)`

    Description

      Set the maximume number of entries that can be stored in the history simultaneous.

    See also

      get_maxsize

    Method flush

      `void flush()`

    Description

      Empties the history. All entries in the history are removed, to allow garbage collect to remove them. The entry sequence counter is not reset.

    Method _indices

      `array(int) _indices()`

    Description

      Returns the index numbers of the history entries available.

    Method _values

      `array _values()`

    Description

      Returns the values of the available history entries.

  CLASS ADT.Priority_queue

    Description

      This class implements a priority queue. Each element in the priority queue is assigned a priority value, and the priority queue always remains sorted in increasing order of the priority values. The top of the priority queue always holds the element with the smallest priority. The priority queue is realized as a (min-)heap.

    Inherit Heap

      inherit .Heap : Heap

    Method push

      `mixed push(int pri, mixed val)`

    Description

      Push an element val into the priority queue and assign a priority value pri to it. The priority queue will automatically sort itself so that the element with the smallest priority will be at the top.

    Method adjust_pri

      `void adjust_pri(mixed handle, int new_pri)`

    Description

      Adjust the priority value new_pri of an element handle in the priority queue. The priority queue will automatically sort itself so that the element with the smallest priority value will be at the top.

    Method pop

      `mixed pop()`

    Description

      Removes and returns the item on top of the heap, which also is the smallest value in the heap.

    Method peek

      `mixed peek()`

    Description

      Returns the item on top of the priority queue (which is also the element with the smallest priority value) without removing it.

  CLASS ADT.Set

    Description

      ADT.Set implements a datatype for sets. These sets behave much like multisets, except that they are restricted to containing only one instance of each member value.

      From a performance viewpoint, it is probably more efficient for a Pike program to use mappings to serve as sets, rather than using an ADT.Set,so ADT.Set is mainly provided for the sake of completeness and code readability.

    Method reset

      `void reset()`

    Description

      Remove all items from the set.

    Method add

      `void add(mixed ... items)`

    Description

      Add items to the set.

    Method remove

      `void remove(mixed ... items)`

    Description

      Remove items from the set.

    Method contains

      `int(0..1) contains(mixed item)`

    Description

      Check whether a value is a member of the set.

    Method is_empty

      `int(0..1) is_empty()`

    Description

      Returns 1 if the set is empty, otherwise 0.

    Method map

      `array(mixed) map(function f)`

    Description

      Map the values of a set: calls the map function f once for each member of the set, returning an array which contains the result of each one of those function calls. Note that since a set isn't ordered, the values in the returned array will be in more or less random order. If you need to know which member value produced which result, you have to make that a part of what the filtering function returns.

      The filtering function f is called with a single, mixed-type argument which is the member value to be mapped.

    Method filter

      `this_program filter(function f)`

    Description

      Return a filtered version of the set, containing only those members for which the filtering function f returned true.

      The filtering function is called with a single mixed-type argument which is the member value to be checked.

    Method filter_destructively

      `this_program filter_destructively(function f)`

    Description

      Destructively filter the set, i.e. remove every element for which the filtering function f returns 0, and then return the set.

      The filtering function is called with a single mixed-type argument which is the member value to be checked.

    Method subset

      `int(0..1) subset(ADT.Set other)`

    Description

      Subset. A <= B returns true if all items in A are also present in B.

    Method superset

      `int(0..1) superset(ADT.Set other)`

    Description

      Superset. A >= B returns true if all items in B are also present in A.

    Method `==

      `int(0..1) `==(ADT.Set other)`

    Description

      Equality. A == B returns true if all items in A are present in B, and all items in B are present in A. Otherwise, it returns false.

    Method `<

      `int(0..1) `<(ADT.Set other)`

    Description

      True subset. A < B returns true if each item in A is also present in B, and B contains at least one item not present in A.

    Method `>

      `int(0..1) `>(ADT.Set other)`

    Description

      True superset. A > B returns true if each item in B is also present in A, and A contains at least one item not present in B.

    Variable `<=

      `function ADT.Set.`<=`

    Description

      Subset operator.

    Variable `>=

      `function ADT.Set.`>=`

    Description

      Superset operator.

    Method `!=

      `int(0..1) `!=(ADT.Set other)`

    Description

      Inequality. A != B is equivalent to !(A == B).

    Method `|

      `this_program `|(ADT.Set other)`

    Description

      Union. Returns a set containing all elements present in either or both of the operand sets.

    Method `&

      `this_program `&(ADT.Set other)`

    Description

      Intersection. Returns a set containing those values that were present in both the operand sets.

    Method `-

      `this_program `-(ADT.Set other)`

    Description

      Difference. The expression 'A - B', where A and B are sets, returns all elements in A that are not also present in B.

    Method `[]

      `int(0..1) `[](mixed item)`

    Description

      Indexing a set with a value V gives 1 if V is a member of the set, otherwise 0.

    Method `[]=

      `int `[]=(mixed item, int value)`

    Description

      Setting an index V to 0 removes V from the set. Setting it to a non-0 value adds V as a member of the set.

    Method _indices

      `array(mixed) _indices()`

    Description

      In analogy with multisets, indices() of an ADT.Set givess an array containing all members of the set.

    Method _values

      `array(mixed) _values()`

    Description

      In analogy with multisets, values() of an ADT.Set givess an array indicating the number of occurrences in the set for each position in the member array returned by indices(). (Most of the time, this is probably rather useless for sets, since the result is an array which just contain 1's, one for each member of the set. Still, this function is provided for consistency.

    Method cast

      `mixed cast(string to)`

    Description

      An ADT.Set can be cast to an array or a multiset.

    Method _sizeof

      `int _sizeof()`

    Description

      Number of items in the set.

    Method _sprintf

      `string _sprintf(int t)`

    Description

      Printable representation of the set.

    Method create

      `void ADT.Set(void|ADT.Set|array|multiset|mapping initial_data)`

    Description

      Create an ADT.Set, optionally initialized from another ADT.Set or a compatible type. If no initial data is given, the set will start out empty.

  CLASS ADT.Struct

    Description

      Implements a struct which can be used for serialization and deserialization of data.

    Example

          class ID3 {
               inherit ADT.Struct;
               Item head = Chars(3);
               Item title = Chars(30);
               Item artist = Chars(30);
               Item album = Chars(30);
               Item year = Chars(4);
               Item comment = Chars(30);
               Item genre = Byte();
             }
             Stdio.File f = Stdio.File("foo.mp3");
             f->seek(-128);
             ADT.Struct tag = ID3(f);
             if(tag->head=="TAG") {
               write("Title: %s\n", tag->title);
               tag->title = "A new title" + "\0"*19;
               f->seek(-128);
               f->write( (string)tag );
             }

    Example

          class HollerithString {
               inherit ADT.Struct;
               Item strlen = Word();
               Item str = Chars(strlen);
             }

    Method create

      `void ADT.Struct(void|string|Stdio.File data)`

    Parameter `data`

      Data to be decoded and populate the struct. Can either be a file object or a string.

    Method decode

      `void decode(string|Stdio.File data)`

    Description

      Decodes data according to the struct and populates the struct variables. The data can either be a file object or a string.

    Method encode

      `string encode()`

    Description

      Serializes the struct into a string. This string is equal to the string fed to decode if nothing in the struct has been altered.

    Method `[]
    Method `->

      `mixed `[](string item)`
      `mixed `->(string item)`

    Description

      The struct can be indexed by item name to get the associated value.

    Method `[]=
    Method `->=

      `mixed `[]=(string item)`
      `mixed `->=(string item)`

    Description

      It is possible to assign a new value to a struct item by indexing it by name and assign a value.

    Method _indices

      `array(string) _indices()`

    Description

      The indices of a struct is the name of the struct items.

    Method _values

      `array _values()`

    Description

      The values of a struct is the values of the struct items.

    Method _sizeof

      `int _sizeof()`

    Description

      The size of the struct object is the number of bytes allocated for the struct.

    Method cast

      `mixed cast(string to)`

    Description

      The struct can be casted into a string, which is eqivivalent to running encode , or into an array. When casted into an array each array element is the encoded value of that struct item.

    CLASS ADT.Struct.Item

      Description

        Interface class for struct items.

    CLASS ADT.Struct.Byte

      Description

        One byte, integer value between 0 and 255.

      Inherit Item

        inherit Item : Item

      Method create

        `void ADT.Struct.Byte(void|int(0..255) initial_value)`

      Description

        The byte can be initialized with an optional value.

    CLASS ADT.Struct.SByte

      Description

        One byte, signed integer value between -128 and 127.

      Inherit Item

        inherit Item : Item

      Method create

        `void ADT.Struct.SByte(void|int(-128..127) initial_value)`

      Description

        The byte can be initialized with an optional value.

    CLASS ADT.Struct.Word

      Description

        One word (2 bytes) in network order, integer value between 0 and 65535.

      See also

        Drow

      Inherit Item

        inherit Item : Item

      Method create

        `void ADT.Struct.Word(void|int(0..65535) initial_value)`

      Description

        The word can be initialized with an optional value.

    CLASS ADT.Struct.SWord

      Description

        One word (2 bytes) in network order, signed integer value between 0 and 65535.

      Inherit Item

        inherit Item : Item

      Method create

        `void ADT.Struct.SWord(void|int(-32768..32767) initial_value)`

      Description

        The word can be initialized with an optional value.

    CLASS ADT.Struct.Drow

      Description

        One word (2 bytes) in intel order, integer value between 0 and 65535.

      See also

        Word

      Inherit Word

        inherit Word : Word

    CLASS ADT.Struct.Long

      Description

        One longword (4 bytes) in network order, integer value between 0 and 2^32.

      See also

        Gnol

      Inherit Word

        inherit Word : Word

      Method create

        `void ADT.Struct.Long(void|int(0..) initial_value)`

      Description

        The longword can be initialized with an optional value.

    CLASS ADT.Struct.SLong

      Description

        One longword (4 bytes) in network order, signed integer value -(2^31) <= x < 2^31-1.

      Inherit SWord

        inherit SWord : SWord

      Method create

        `void ADT.Struct.SLong(void|int initial_value)`

      Description

        The longword can be initialized with an optional value.

    CLASS ADT.Struct.Gnol

      Description

        One longword (4 bytes) in intel order, integer value between 0 and 2^32.

      See also

        Long

      Inherit Drow

        inherit Drow : Drow

      Method create

        `void ADT.Struct.Gnol(void|int(0..) initial_value)`

      Description

        The longword can be initialized with an optional value.

    CLASS ADT.Struct.Chars

      Description

        A string of bytes.

      Inherit Item

        inherit Item : Item

      Method create

        `void ADT.Struct.Chars(int|Item size, void|string value)`

      Description

        size is the number of bytes that are part of this struct item, or optionally an earlier Item that will be looked up in runtime. The initial value of the char string is value or, if not provided, a string of zero bytes.

    CLASS ADT.Struct.int8

      Description

        Alias for SByte

      Inherit SByte

        inherit SByte : SByte

    CLASS ADT.Struct.uint8

      Description

        Alias for Byte

      Inherit Byte

        inherit Byte : Byte

    CLASS ADT.Struct.int16

      Description

        Alias for SWord

      Inherit SWord

        inherit SWord : SWord

    CLASS ADT.Struct.uint16

      Description

        Alias for Word

      Inherit Word

        inherit Word : Word

    CLASS ADT.Struct.int32

      Description

        Alias for SLong

      Inherit SLong

        inherit SLong : SLong

    CLASS ADT.Struct.uint32

      Description

        Alias for Long

      Inherit Long

        inherit Long : Long

    CLASS ADT.Struct.int64

      Description

        64 bit signed integer.

      Inherit SLong

        inherit SLong : SLong

    CLASS ADT.Struct.uint64

      Description

        64 bit unsigned integer.

      Inherit Long

        inherit Long : Long

  CLASS ADT.Heap

    Description

      This class implements a (min-)heap. The value of a child node will always be greater than or equal to the value of its parent node. Thus, the top node of the heap will always hold the smallest value.

    Method push

      `void push(mixed value)`

    Description

      Push an element onto the heap. The heap will automatically sort itself so that the smallest value will be at the top.

    Method adjust

      `void adjust(mixed value)`

    Description

      Takes a value in the heap and sorts it through the heap to maintain its sort criteria (increasing order).

    Method pop

      `mixed pop()`

    Description

      Removes and returns the item on top of the heap, which also is the smallest value in the heap.

    Method _sizeof

      `int _sizeof()`

    Description

      Returns the number of elements in the heap.

    Method top

      `__deprecated__ mixed top()`

    Description

      Removes and returns the item on top of the heap, which also is the smallest value in the heap.

    Deprecated

    Method size

      `__deprecated__ int size()`

    Description

      Returns the number of elements in the heap.

    Deprecated

    Method peek

      `mixed peek()`

    Description

      Returns the item on top of the heap (which is also the smallest value in the heap) without removing it.

  CLASS ADT.BitBuffer

    Description

      Implements a FIFO bit buffer, i.e. a buffer that operates on bits instead of bytes. It is not designed for performance, but as a way to handle complicated file formats and other standards where you may need to work on unaligned data units of sub byte size, without having to fry your brain while keeping track of all the bits yourself.

    Example

          > ADT.BitBuffer b=ADT.BitBuffer();
             > b->put1(2);
             (1) Result: ADT.BitBuffer(11)
             > b->put0(15);
             (2) Result: ADT.BitBuffer("À\0"0)
             > b->drain();
             (3) Result: "À\0"
             > sizeof(b);
             (4) Result: 1

    Method create

      `void ADT.BitBuffer(void|string _data)`

    Description

      The buffer can be initialized with initial data during creation.

    Method feed

      `this_program feed(string x)`

    Description

      Adds full bytes to the buffer.

    Method drain

      `string drain()`

    Description

      Drains the buffer of all full (8-bits wide) bytes.

    Method get

      `int get(int bits)`

    Description

      Get bits from the buffer.

    Throws

      Throws an error in case of data underflow.

    Method read

      `string read(void|int bytes)`

    Description

      Reads bytes (or less) bytes from the buffer and returns as string.

    Method put

      `this_program put(int value, int bits)`

    Description

      Put bits number of bits with the value value into the buffer.

    Note

      value must not be larger than what can be stored with the number of bits given in bits .

    Method put0

      `this_program put0(int bits)`

    Description

      Put bits number of 0 bits into the buffer.

    Method put1

      `this_program put1(int bits)`

    Description

      Put bits number of 1 bits into the buffer.

    Method _sizeof

      `int _sizeof()`

    Description

      sizeof() will return the number of bits in the buffer.

  Module ADT.Relation

    CLASS ADT.Relation.Binary

      Method contains

        `mixed contains(mixed left, mixed right)`

      Description

        Return true/false: does the relation "left R right " exist?

      Method `()

        `mixed `()(mixed left, mixed right)`

      Description

        Does the same as the contains function: returns true if the relation "left R right " exists, and otherwise false.

      Method add

        `this_program add(mixed left, mixed right)`

      Description

        Adds "left R right " as a member of the relation. Returns the same relation.

      Method remove

        `this_program remove(mixed left, mixed right)`

      Description

        Removes "left R right " as a member of the relation. Returns the same relation.

      Method map

        `array map(function f)`

      Description

        Maps every entry in the relation. The function f gets two arguments: the left and the right relation value. Returns an array with the return values of f for each and every mapped entry.

        Note: since the entries in the relation are not ordered, the returned array will have its elements in no particular order. If you need to know which relation entry produced which result in the array, you have to make that information part of the value that f returns.

      Method filter

        `object filter(function f)`

      Description

        Filters the entries in the relation, and returns a relation with all those entries for which the filtering function f returned true. The function f gets two arguments: the left and the right value for every entry in the relation.

      Method filter_destructively

        `this_program filter_destructively(function f)`

      Description

        Filters the entries in the relation destructively, removing all entries for which the filtering function f returns false. The function f gets two arguments: the left and the right value for each entry in the relation.

      Method _sizeof

        `mixed _sizeof()`

      Description

        Returns the number of relation entries in the relation. (Or with other words: the number of relations in the relation set.)

      Method `<=

        `mixed `<=(object rel)`

      Description

        The expression `rel1 <= rel2' returns true if every relation entry in rel1 is also present in rel2.

      Method `&

        `mixed `&(mixed rel)`

      Description

        The expression `rel1 & rel2' returns a new relation which has those and only those relation entries that are present in both rel1 and rel2.

      Method `+
      Method `|

        `mixed `+(mixed rel)`
        `mixed `|(mixed rel)`

      Description

        The expression `rel1 | rel2' and `rel1 + rel2' returns a new relation which has all the relation entries present in rel1, or rel2, or both.

      Method `-

        `mixed `-(mixed rel)`

      Description

        The expression `rel1 - rel2' returns a new relation which has those and only those relation entries that are present in rel1 and not present in rel2.

      Method make_symmetric

        `this_program make_symmetric()`

      Description

        Makes the relation symmetric, i.e. makes sure that if xRy is part of the relation set, then yRx should also be a part of the relation set.

      Method find_shortest_path

        `array find_shortest_path(mixed from, mixed to, void|multiset avoiding)`

      Description

        Assuming the relation's domain and range sets are equal, and that the relation xRy means "there is a path from node x to node y", find_shortest_path attempts to find a path with a minimum number of steps from one given node to another. The path is returned as an array of nodes (including the starting and ending node), or 0 if no path was found. If several equally short paths exist, one of them will be chosen pseudorandomly.

        Trying to find a path from a node to itself will always succeed, returning an array of one element: the node itself. (Or in other words, a path with no steps, only a starting/ending point).

        The argument avoiding is either 0 (or omitted), or a multiset of nodes that must not be part of the path.

      Method get_id

        `mixed get_id()`

      Description

        Return the ID value which was given as first argument to create().

      CLASS ADT.Relation.Binary._get_iterator

        Description

          An iterator which makes all the left/right entities in the relation available as index/value pairs.

  Module ADT.Table

    Description

      ADT.Table is a generic module for manipulating tables.

      Each table contains one or several columns. Each column is associated with a name, the column name. Optionally, one can provide a column type. The Table module can do a number of operations on a given table, like computing the sum of a column, grouping, sorting etc.

      All column references are case insensitive. A column can be referred to by its position (starting from zero). All operations are non-destructive. That means that a new table object will be returned after, for example, a sort.

    CLASS ADT.Table.table

      Description

        The table base-class.

      Method encode

        `string encode()`

      Description

        This method returns a binary string representation of the table. It is useful when one wants to store a the table, for example in a file.

      Method decode

        `object decode(string s)`

      Description

        This method returns a table object from a binary string representation of a table, as returned by encode() .

      Method _indices

        `array(string) _indices()`

      Description

        This method returns the column names for the table. The case used when the table was created will be returned.

      Method _values

        `array(array) _values()`

      Description

        This method returns the contents of a table as a two dimensional array. The format is an array of rows. Each row is an array of columns.

      Method _sizeof

        `int _sizeof()`

      Description

        This method returns the number of rows in the table.

      Method reverse

        `object reverse()`

      Description

        This method reverses the rows of the table and returns a new table object.

      Method col

        `array col(int|string column)`

      Description

        This method returns the contents of a given column as an array.

      Method row

        `array row(int row_number)`

      Description

        This method returns the contents of a given row as an array.

      Method `[]

        `array `[](int|string column)`

      Description

        Same as col() .

      Method `==

        `int `==(object table)`

      Description

        This method compares two tables. They are equal if the contents of the tables and the column names are equal. The column name comparison is case insensitive.

      Method append_bottom

        `object append_bottom(object table)`

      Description

        This method appends two tables. The table given as an argument will be added at the bottom of the current table. Note, the column names must be equal. The column name comparison is case insensitive.

      Method append_right

        `object append_right(object table)`

      Description

        This method appends two tables. The table given as an argument will be added on the right side of the current table. Note that the number of rows in both tables must be equal.

      Method select

        `object select(int|string ... columns)`

      Description

        This method returns a new table object with the selected columns only.

      Method remove

        `object remove(int|string ... columns)`

      Description

        Like select() , but the given columns will not be in the resulting table.

      Method where

        `object where(array(int|string)|int|string columns, function f, mixed ... args)`

      Description

        This method calls the function for each row. If the function returns zero, the row will be thrown away. If the function returns something non-zero, the row will be kept. The result will be returned as a new table object.

      Method group

        `this_program group(mapping(int|string:function)|function f, mixed ... args)`

      Description

        This method calls the function f for each column each time a non uniqe row will be joined. The table will be grouped by the columns not listed. The result will be returned as a new table object.

      Method sum

        `this_program sum(int|string ... columns)`

      Description

        This method sums all equal rows. The table will be grouped by the columns not listed. The result will be returned as a new table object.

      Method distinct

        `this_program distinct(int|string ... columns)`

      Description

        This method groups by the given columns and returns a table with only unique rows. When no columns are given, all rows will be unique. A new table object will be returned.

      Method map

        `object map(function f, array(int|string)|int|string columns, mixed ... args)`

      Description

        This method calls the function f for all rows in the table. The value returned will replace the values in the columns given as argument to map. If the function returns an array, several columns will be replaced. Otherwise the first column will be replaced. The result will be returned as a new table object.

      Method sort

        `object sort(int|string ... columns)`

      Description

        This method sorts the table in ascendent order on one or several columns and returns a new table object. The left most column is sorted last. Note that the sort is stable.

      See also

        rsort()

      Method rsort

        `object rsort(int|string ... columns)`

      Description

        Like sort() , but in descending order.

      Method limit

        `object limit(int n)`

      Description

        This method truncates the table to the first n rows and returns a new object.

      Method rename

        `object rename(string|int from, string to)`

      Description

        This method renames the column named from to to and returns a new table object. Note that from can be the column position.

      Method type

        `mapping type(int|string column, void|mapping type)`

      Description

        This method gives the type for the given column .

        If a second argument is given, the old type will be replaced with type . The column type is only used when the table is displayed. The format is as specified in create() .

      Method create

        `void ADT.Table.table(array(array) table, array(string) column_names, array(mapping(string:string))|void column_types)`

      Description

        The ADT.Table.table class takes two or three arguments:

      Parameter `table`

        The first argument is a two-dimensional array consisting of one array of columns per row. All rows must have the same number of columns as specified in column_names .

      Parameter `column_names`

        This argument is an array of column names associated with each column in the table. References by column name are case insensitive. The case used in column_names will be used when the table is displayed. A column can also be referred to by its position, starting from zero.

      Parameter `column_types`

        This is an optional array of mappings. The column type information is only used when displaying the table. Currently, only the keyword `"type"` is recognized. The type can be specified as `"text"` or `"num"` (numerical). Text columns are left adjusted, whereas numerical columns are right adjusted. If a mapping in the array is 0 (zero), it will be assumed to be a text column. If column_types is omitted, all columns will displayed as text.

        See ADT.Table.ASCII.encode() on how to display a table.

      See also

        ADT.Table.ASCII.encode()

    Module ADT.Table.ASCII

      Method encode

        `string encode(object table, void|mapping options)`

      Description

        This method returns a table represented in ASCII suitable for human eyes. options is an optional mapping. If the keyword `"indent"` is used with a number, the table will be indented with that number of space characters.

Module Mapping

  Constant delete

    `constant Mapping.delete`

  Description

    Alias for m_delete()

  CLASS Mapping.Iterator

    Description

      An object of this class is returned by get_iterator() when called with a mapping.

    See also

      get_iterator

    Inherit predef::Iterator

      inherit predef::Iterator : predef::Iterator

  CLASS Mapping.ShadowedMapping

    Description

      A mapping look-alike that overrides (ie shadows) another parent mapping.

      The class implements most of the usual mapping operations.

    syntax

      `protected mapping|ShadowedMapping Mapping.ShadowedMapping.parent` `void Mapping.ShadowedMapping(mapping|ShadowedMapping parent)`

    Method create

      `void Mapping.ShadowedMapping(mapping|ShadowedMapping parent, mapping|void shadow, int(0..1)|void modify_parent)`

    Parameter `parent`

      Mapping to be shadowed.

    Parameter `shadow`

      Initial shadow of parent .

    Parameter `modify_parent`

      Modifications should be done to parent rather than to shadow . If this is set, only entries that are already present in shadow can be modified by later operations.

Module Array

  Description

    General functions to operate on arrays.

  Method interleave_array

    `array(int) interleave_array(array(mapping(int:mixed)) tab)`

  Description

    Interleave a sparse matrix.

    Returns an array with offsets that describe how to shift the rows of tab so that only at most one non-zero value exists in every column.

  Method longest_ordered_sequence

    `array(int) longest_ordered_sequence(array a)`

  Description

    Find the longest ordered sequence of elements.

    This function returns an array of the indices in the longest ordered sequence of elements in the array.

  See also

    diff()

  Method permute

    `array permute(array in, int number)`

  Description

    Give a specified permutation of an array.

    The number of permutations is equal to `sizeof(<font face='courier'>in` )! (the factorial of the size of the given array).

  See also

    shuffle()

  Method diff

    `array(array(array)) diff(array a, array b)`

  Description

    Calculates which parts of the arrays that are common to both, and which parts that are not.

  Returns

    Returns an array with two elements, the first is an array of parts in array a , and the second is an array of parts in array b .

  See also

    diff_compare_table() , diff_longest_sequence() , String.fuzzymatch()

  Method diff_compare_table

    `array(array(int)) diff_compare_table(array a, array b)`

  Description

    Returns an array which maps from index in a to corresponding indices in b .

         > Array.diff_compare_table( ({ "a","b","c" }), ({ "b", "b", "c", "d", "b" }));
         Result: ({
                     ({ }),
                     ({
                         0,
                         1,
                         4
                     }),
                     ({
                         2
         	        })
                 })

  See also

    diff() , diff_longest_sequence() , String.fuzzymatch()

  Method diff_longest_sequence

    `array(int) diff_longest_sequence(array a, array b)`

  Description

    Gives the longest sequence of indices in b that have corresponding values in the same order in a .

  See also

    diff() , diff_compare_table() , String.fuzzymatch()

  Method diff_dyn_longest_sequence

    `array(int) diff_dyn_longest_sequence(array a, array b)`

  Description

    Gives the longest sequence of indices in b that have corresponding values in the same order in a .

    This function performs the same operation as diff_longest_sequence() , but uses a different algorithm, which in some rare cases might be faster (usually it's slower though).

  See also

    diff_longest_sequence() , diff() , diff_compare_table() , String.fuzzymatch()

  Method uniq

    `array uniq(array a)`

  Description

    Remove elements that are duplicates.

  Returns

    This function returns an copy of the array a with all duplicate values removed. The order of the values is kept in the result; it's always the first of several equal elements that is kept.

  Note

    Elements are compared with `== . They are also hashed (see lfun::__hash for further details if the array contains objects).

  Method splice

    `array(mixed) splice(array(mixed) arr1, array(mixed) arr2, array(mixed) ... more_arrays)`

  Description

    Splice two or more arrays.

    This means that the returned array has the first element in the first given array, then the first argument in next array and so on for all arrays. Then the second elements are added, etc.

  See also

    `/() , `*() , `+() , `-() , everynth()

  Method everynth

    `array(mixed) everynth(array(mixed) a, void|int n, void|int start)`

  Description

    Return an array with every n :th element of the array a .

    If n is zero every other element will be returned.

  See also

    splice() , `/()

  Method transpose

    `array(array) transpose(array(array) matrix)`

  Description

    Takes an array of equally sized arrays (essentially a matrix of size M*N) and returns the transposed (N*M) version of it, where rows and columns are exchanged for one another.

  Method reduce

    `mixed reduce(function fun, array arr, mixed|void zero)`

  Description

    reduce() sends the first two elements in arr to fun , then the result and the next element in arr to fun and so on. Then it returns the result. The function will return zero if arr is the empty array. If arr has only one element, that element will be returned.

  See also

    rreduce()

  Method rreduce

    `mixed rreduce(function fun, array arr, mixed|void zero)`

  Description

    rreduce() sends the last two elements in arr to fun , then the third last element in arr and the result to fun and so on. Then it returns the result. The function will return zero if arr is the empty array. If arr has only one element, that element will be returned.

  See also

    reduce()

  Method shuffle

    `array shuffle(array arr)`

  Description

    shuffle() gives back the same elements, but in random order. The array is modified destructively.

  See also

    permute()

  Method combinations

    `array(array) combinations(array arr, int len)`

  Description

    Returns an array of all combinations of length len of elements from arr .

  See also

    permute()

  Method search_array

    `int search_array(array arr, string|function|int fun, mixed ... args)`

  Description

    search_array() works like map() , only it returns the index of the first call that returnes true instead.

    If no call returns true, -1 is returned.

  See also

    sum() , map()

  Method sum_arrays

    `array sum_arrays(function(int(0..0) ... :mixed) sum, array ... args)`

  Description

    Applies the function sum columnwise on the elements in the provided arrays. E.g. `sum_array(`+,a,b,c)` does the same as ``+(a[*],b[*],c[*])`.

  Method sort_array

    `array sort_array(array arr, function|void cmp, mixed ... args)`

  Description

    This function sorts the array arr after a compare-function cmp which takes two arguments and should return `1` if the first argument is larger then the second. Returns the sorted array - arr is not sorted destructively.

    The remaining arguments args will be sent as 3rd, 4th etc. argument to cmp .

    If cmp is omitted, `>() is used instead.

  See also

    map() , sort() , `>() , dwim_sort_func , lyskom_sort_func , oid_sort_func

  Method columns

    `array(array) columns(array x, array ind)`

  Description

    Get multiple columns from an array.

    This function is equvivalent to

           map(ind, lambda(mixed i) { return column(x, i); })

  See also

    column()

  Method diff3

    `array(array(array)) diff3(array a, array b, array c)`

  Description

    Return the three-way difference between the arrays.

  See also

    Array.diff() , Array.diff_longest_sequence()

  Method compact_diff3

    `array(array(array)) compact_diff3(array a, array b, array old)`

  Description

    Given three arrays like those returned from diff3 , this function "compacts" the diff3 result by removing all differences where `a` and `b` agrees against `old`. The result is on the same form as the result from diff , and doesn't include the sequence from `old`.

  Method dwim_sort_func

    `int(-1..1) dwim_sort_func(string a, string b)`

  Description

    Sort without respect to number formatting (most notably leading zeroes).

  Method lyskom_sort_func

    `int(-1..1) lyskom_sort_func(string a, string b)`

  Description

    Sort comparison function that does not care about case, nor about the contents of any parts of the string enclosed with '()'

    Example: "Foo (bar)" is given the same weight as "foo (really!)"

  Method flatten

    `array flatten(array a, mapping(array:array)|void state)`

  Description

    Flatten a multi-dimensional array to a one-dimensional array.

  Note

    Prior to Pike 7.5.7 it was not safe to call this function with cyclic data-structures.

  Method sum

    `mixed sum(array a)`

  Description

    Sum the elements of an array using `+. The empty array results in 0.

  Method uniq2

    `array uniq2(array a)`

  Description

    Perform the same action as the Unix uniq command on an array, that is, fold consecutive occurrences of the same element into a single element of the result array:

    aabbbcaababb -> abcabab.

    See also the uniq function.

  Method arrayify

    `array arrayify(void|array|mixed x)`

  Description

    Make an array of the argument, if it isn't already. A zero_type argument gives the empty array. This is useful when something is either an array or a basic datatype, for instance in headers from the MIME module or Protocols.HTTP.Server.

  Parameter `x`

    Result depends of the argument type:

    arrayp(x)

      arrayify(x) => x

    zero_type(x)

      arrayify(x) => ({})

    otherwise

      arrayify(x) => ({ x })

  Method oid_sort_func

    `int(-1..1) oid_sort_func(string a, string b)`

  Description

    Sort with care of numerical sort for OID values, e.g. "1.2.1" before "1.11.1".

  Returns

    `-1` | `a<b`
    `0` | `a==b`
    `1` | `a>b`

  Note

    In Pike 7.6 and older this function returned `0` both when `a<b` and `a==b`.

  See also

    sort_array

  Method greedy_diff

    `array(array(array)) greedy_diff(array from, array to)`

  Description

    Like Array.diff , but tries to generate bigger continuous chunks of the differences, instead of maximizing the number of difference chunks. More specifically, greedy_diff optimizes the cases where Array.diff returns `({ ..., A, Z, B, ({}), C, ... })` `({ ..., A, X, B, Y+B, C, ... })` into the somewhat shorter diff arrays `({ ..., A, Z, B+C, ... })` `({ ..., A, X+B+Y, B+C, ... })`

  Method count

    `int count(array|mapping|multiset haystack, mixed needle)`
    `mapping(mixed:int) count(array|mapping|multiset haystack)`

  Description

    Returns the number of occurrences of needle in haystack . If the optional needle argument is omitted, count instead works similar to the unix command `sort|uniq -c`, returning a mapping with the number of occurrences of each element in haystack . For array or mapping haystack s, it's the values that are counted, for multisets the indices, as you'd expect.

  See also

    String.count , search , has_value

  Method common_prefix

    `array common_prefix(array(array) arrs)`

  Description

    Find the longest common prefix from an array of arrays.

  See also

    String.common_prefix

  Method all

    `int(0..1) all(array a, function(int(0..0):mixed) predicate, mixed ... extra_args)`

  Description

    Returns 1 if all of the elements in a fulfills the requirement predicate ( a [i], @extra_args ), otherwise 0. The predicate should return non-zero for an element that meets the requirements and zero for those that do not.

  Example

        Array.all( ({ 2, 4, 6, 8 }), `<, 17 )

  See also

    any , has_value

  Method any

    `int(0..1) any(array a, function(int(0..0):mixed) predicate, mixed ... extra_args)`

  Description

    Returns 1 if any of the elements in a fulfills the requirement predicate ( a [i], @extra_args ), otherwise 0. The predicate should return non-zero for an element that meets the requirements and zero for those that do not.

  Example

        Array.any( ({ 2, 4, 6, 8 }), `>, 5 )

  See also

    all , has_value

  Method partition

    `array(array) partition(array a, function(int(0..0):mixed) arbiter, mixed ... extra_args)`

  Description

    Splits an array in two, according to an arbitration function arbiter . The elements in a who return non-zero for the expression arbiter ( a [i], @extra_args ) end up in the first sub-array, the others in the second. The order is preserved from the original array.

  Example

        Array.partition( enumerate( 9 ), lambda(int n) { return n>3 && n<7; } );
           > ({ ({ 4, 5, 6 }), ({ 0, 1, 2, 3, 7, 8 }) })

  See also

    filter , `/ , `%

  Method push

    `array push(array list, mixed element)`

  Description

    Threats an Array as a stack and pushes the element onto the end.

  Example

        Array.push(({ "a", "b", "c", "d" }), "e");
           > ({ "a", "b", "c", "d", "e" })

  See also

    ADT.Stack , ADT.Stack.push

  Method pop

    `array pop(array list)`

  Description

    Pops and returns the last value of the array, shortening the array by one element. If there are no elements in the array then 0 is returned otherwise an array is returned where the first returned element is the popped value, and the second element is the modified array.

  Example

        Array.pop(({ "a", "b", "c", "d" }));
           > ({ "d", ({ "a", "b", "c" }) })

  See also

    ADT.Stack , ADT.Stack.pop , ADT.Stack.quick_pop

  Method shift

    `array shift(array list)`

  Description

    Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. If there are no elements in the array it returns 0. Returns an array where the first element is the shifted value and the second element is the modified array.

  Example

        Array.shift(({ "a", "b", "c", "d"}));
           > ({ "a", ({ "b", "c", "d" }) })

  See also

    ADT.Stack

  Method unshift

    `array unshift(array list, mixed element)`

  Description

    Does the opposite of "shift". Or the opposite of a "push", depending on how you look at it. Prepends the element to the front of the array and returns the new array.

  Example

        Array.unshift(({ "b", "c", "d" }), "a");
           > ({ "a", "b", "c", "d" })

  See also

    ADT.Stack

  CLASS Array.Iterator

    Description

      An object of this class is returned by get_iterator() when called with an array.

    See also

      get_iterator

    Inherit predef::Iterator

      inherit predef::Iterator : predef::Iterator

Module Multiset

  CLASS Multiset.Iterator

    Description

      An object of this class is returned by get_iterator() when called with a multiset.

    See also

      get_iterator

    Inherit predef::Iterator

      inherit predef::Iterator : predef::Iterator

Module Program

  Method inherit_list

    `array(program) inherit_list(program p)`

  Description

    Returns an array with the programs that p has inherited.

  Method all_inherits

    `array(program) all_inherits(program p)`

  FIXME

    Document this function.

  Method inherit_tree

    `array inherit_tree(program p)`

  Description

    Recursively builds a inheritance tree by fetching programs inheritance lists.

  Returns

    Returns an array with programs or arrays as elements.

  Example

        > class a{}
          > class b{}
          > class c{ inherit a; }
          > class d{ inherit b; inherit c; }
          > Program.inherit_tree(d);
          Result: ({ /* 3 elements */
                      d,
                      ({ /* 1 element */
                          program
                      }),
                      ({ /* 2 elements */
                          c,
                          ({ /* 1 element */
                              program
                          })
                      })
                  })

  Method implements

    `int implements(program prog, program api)`

  Description

    Returns 1 if prog implements api .

  Method inherits

    `int inherits(program child, program parent)`

  Description

    Returns 1 if child has inherited parent .

  Method defined

    `string defined(program p)`

  Description

    Returns a string with filename and linenumber describing where the program p was defined.

    The returned string is of the format `"filename:linenumber"`.

    If it cannot be determined where the program was defined, `0` (zero) will be returned.

Module Function

  Method defined

    `string defined(function fun)`

  Description

    Returns a string with filename and linenumber where fun was defined.

    Returns `0` (zero) when no line can be found, e.g. for builtin functions and functions in destructed objects.

  Method splice_call

    `mixed splice_call(array args, function f, mixed|void ... extra)`

  Description

    Calls the given function with the args array plus the optional extra arguments as its arguments and returns the result.

    Most useful in conjunction with map , and particularly in combination with sscanf with `"...%{...%}..."` scan strings (which indeed was what it was invented for in the first place).

  Parameter `args`

    The first arguments the function f expects.

  Parameter `f`

    The function to apply the arguments on.

  Parameter `extra`

    Optional extra arguments to send to f .

  Returns

    Whatever the supplied function f returns.

  Example

    class Product(string name, string version) { string _sprintf() { return sprintf("Product(%s/%s)", name, version); } } map(({ ({ "pike", "7.1.11" }), ({ "whitefish", "0.1" }) }), Function.splice_call, Product); ({ /* 2 elements */ Product(pike/7.1.11), Product(whitefish/0.1) })

Method Y

  `function Y(function f)`

Description

  The dreaded fixpoint combinator "Y".

  The Y combinator is useful when writing recursive lambdas. It converts a lambda that expects a self-reference as its first argument into one which can be called without this argument.

Example

      This example creates a lambda that computes the faculty function.

  Function.Y(lambda(function f, int n) { return n>1? n*f(n-1) : 1; })

Method curry

  `function curry(function f)`

Description

  Partially evaluate a function call.

  This function allows N parameters to be given to a function taking M parameters (N<=M), yielding a new function taking M-N parameters.

  What is actually returned from this function is a function taking N parameters, and returning a function taking M-N parameters.

Example

      This example creates a function adding 7 to its argument.

  Function.curry(`+)(7)

Method call_callback

  `void call_callback(function f, mixed ... args)`

Description

  Call a callback function, but send throws from the callback function (ie, errors) to master()->handle_error. Also accepts if f is zero (0) without error.

Example

  Functions.call_callback(the_callback,some,arguments);

equals

    {
          mixed err=catch { if (the_callback) the_callback(some,arguments); };
          if (err) master()->handle_error(err);
       }

(Approximately, since call_callback also calls handle_error if 0 were thrown.)

Module Pike

  Method get_runtime_info

    `mapping(string:int|string) get_runtime_info()`

  Description

    Get information about the Pike runtime.

  Returns

    Returns a mapping with the following content:

    `"bytecode_method" : string` | A string describing the bytecode method used by the Pike interpreter.
    `"abi" : int` | The number of bits in the ABI. Usually `32` or `64`.
    `"native_byteorder" : int` | The byte order used by the native cpu. Usually `1234` (aka little endian) or `4321` (aka bigendian).
    `"int_size" : int` | The number of bits in the native integer type. Usually `32` or `64`.
    `"float_size" : int` | The number of bits in the native floating point type. Usually `32` or `64`.
    `"auto_bignum" : int(0..1)` | Present if integers larger than the native size are automatically converted into bignums.

    `constant Pike.WEAK_INDICES`
    `constant Pike.WEAK_VALUES`
    `constant Pike.WEAK`

  Description

    Flags for use together with set_weak_flag and get_weak_flag . See set_weak_flag for details.

    `constant Pike.INDEX_FROM_BEG`
    `constant Pike.INDEX_FROM_END`
    `constant Pike.OPEN_BOUND`

  Description

    Used with predef::`[..] and lfun::`[..] to specify how the corresponding index maps to an upper or lower range bound:

    INDEX_FROM_BEG

      The index is relative to the beginning of the string or array (or any other sequence implemented through an object). Sequences typically start at zero.

    INDEX_FROM_END

      The index is relative to the end of the sequence. In strings and arrays, the last element is at zero, the one before that at one, etc.

    OPEN_BOUND

      The range is open in the corresponding direction. The index is irrelevant in this case.

  Constant Backend

    `constant Pike.Backend`

  Description

    The class of the DefaultBackend .

    Typically something that has inherited __Backend .

  See also

    __Backend , DefaultBackend

  Variable SmallBackend

    `program Pike.SmallBackend`

  Description

    This is the most suitable backend implementation if you only want to monitor a small number of Stdio.File objects.

  Method gc_parameters

    `mapping(string:float) gc_parameters(void|mapping(string:mixed) params)`

  Description

    Set and get various parameters that control the operation of the garbage collector. The passed mapping contains the parameters to set. If a parameter is missing from the mapping, the current value will be filled in instead. The same mapping is returned. Thus an empty mapping, or no argument at all, causes a mapping with all current settings to be returned.

    The following parameters are recognized:

    `"enabled" : int` | If this is 1 then the gc is enabled as usual. If it's 0 then all automatically scheduled gc runs are disabled and the parameters below have no effect, but explicit runs through the gc function still works as usual. If it's -1 then the gc is completely disabled so that even explicit gc calls won't do anything.
    `"garbage_ratio_low" : float` | As long as the gc time is less than time_ratio below, aim to run the gc approximately every time the ratio between the garbage and the total amount of allocated things is this.
    `"time_ratio" : float` | When more than this fraction of the time is spent in the gc, aim for garbage_ratio_high instead of garbage_ratio_low.
    `"garbage_ratio_high" : float` | Upper limit for the garbage ratio - run the gc as often as it takes to keep it below this.

    `"min_gc_time_ratio" : float`

    This puts an upper limit on the gc interval, in addition to the factors above. It is specified as the minimum amount of time spent doing gc, as a factor of the total time. The reason for this limit is that the current amount of garbage can only be measured in a gc run, and if the gc starts to run very seldom due to very little garbage, it might get too slow to react to an increase in garbage generation. Set to 0.0 to turn this limit off.

    `"average_slowness" : float` | When predicting the next gc interval, use a decaying average with this slowness factor. It should be a value between 0.0 and 1.0 that specifies the weight to give to the old average value. The remaining weight up to 1.0 is given to the last reading.

  See also

    gc , Debug.gc_status

  Method implicit_gc_real_time

    `int implicit_gc_real_time(void|int nsec)`

  Description

    Returns the total amount of real time that has been spent in implicit GC runs. The time is normally returned in microseconds, but if the optional argument nsec is nonzero it's returned in nanoseconds.

  See also

    Debug.gc_status

  Method count_memory

    `int count_memory(int|mapping(string:int) options, array|multiset|mapping|object|program|string|type(mixed)|int ... things)`

  Description

    In brief, if you call `Pike.count_memory(0,x)` you get back the number of bytes `x` occupies in memory.

    The detailed story is a bit longer:

    This function calculates the number of bytes that all things occupy. Or put another way, it calculates the number of bytes that would be freed if all those things would lose their references at the same time, i.e. not only the memory in the things themselves, but also in all the things that are directly and indirectly referenced from those things and not from anywhere else.

    The memory counted is only that which is directly occupied by the things in question, including any overallocation for mappings, multisets and arrays. Other memory overhead that they give rise to is not counted. This means that if you would count the memory occupied by all the pike accessible things you would get a figure significantly lower than what the OS gives for the pike process.

    Also, if you were to actually free the things, you should not expect the size of the pike process to drop the amount of bytes returned by this function. That since Pike often retains the memory to be reused later.

    However, what you should expect is that if you actually free the things and then later allocates some more things for which this function returns the same size, there should be essentially no increase in the size of the pike process (some increase might occur due to internal fragmentation and memory pooling, but it should be small in general and over time).

    The search for things only referenced from things can handle limited cyclic structures. That is done by doing a "lookahead", i.e. searching through referenced things that apparently have other outside references. You can control how long this lookahead should be through options (see below). If the lookahead is too short to cover the cycles in a structure then a too low value is returned. If the lookahead is made gradually longer then the returned value will eventually become accurate and not increase anymore. If the lookahead is too long then unnecessary time might be spent searching through things that really have external references.

    Objects that are known to be part of cyclic structures are encouraged to have an integer constant or variable `pike_cycle_depth` that specifies the lookahead needed to discover those cycles. When Pike.count_memory visits such objects, it uses that as the lookahead when going through the references emanating from them. Thus, assuming objects adhere to this convention, you should rarely have to specify a lookahead higher than zero to this function.

    Note that `pike_cycle_depth` can also be set to zero to effectively stop the lookahead from continuing through the object. That can be useful to put in objects you know have global references, to speed up the traversal.

  Parameter `options`

    If this is an integer, it specifies the maximum lookahead distance. -1 counts only the memory of the given things , without following any references. 0 extends the count to all their referenced things as long as there are no cycles (except if `pike_cycle_depth` is found in objects - see above). 1 makes it cover cycles of length 1 (e.g. a thing points to itself), 2 handles cycles of length 2 (e.g. where two things point at each other), and so on.

    However, the lookahead is by default blocked by programs, i.e. it never follows references emanating from programs. That since programs seldom are part of dynamic data structures, and they also typically contain numerous references to global data which would add a lot of work to the lookahead search.

    To control the search in more detail, options can be a mapping instead:

    `lookahead : int` | The maximum lookahead distance, as described above. Defaults to 0 if missing.

    `block_arrays : int`

    When any of these are given with a nonzero value, the corresponding type is blocked when lookahead references are followed. They are unblocked if the flag is given with a zero value. Only programs are blocked by default.

    These blocks are only active during the lookahead, so blocked things are still recursed and memory counted if they are given as arguments or only got internal references.

    `block_mappings : int`
    `block_multisets : int`
    `block_objects : int`
    `block_programs : int`
    `block_strings : int` | If positive then strings are always excluded (except any given directly in things ), if negative they are always included. Otherwise they are counted if they have no other refs, but note that since strings are shared they might get refs from other unrelated parts of the program.
    `block_pike_cycle_depth : int` | Do not heed `pike_cycle_depth` values found in objects. This is implicit if the lookahead is negative.
    `return_count : int` | Return the number of things that memory was counted for, instead of the byte count. (This is the same number `internal` contains if `collect_stats` is set.)
    `collect_internals : int` | If this is nonzero then its value is replaced with an array that contains the things that memory was counted for.
    `collect_externals : int` | If set then the value is replaced with an array containing the things that were visited but turned out to have external references (within the limited lookahead).
    `collect_direct_externals : int` | If set then the value is replaced with an array containing the things found during the lookahead that (appears to) have direct external references. This list is a subset of the `collect_externals` list. It is useful if you get unexpected global references to your data structure which you want to track down.
    `collect_stats : int` | If this is nonzero then the mapping is extended with more elements containing statistics from the search; see below.

    When the `collect_stats` flag is set, the mapping is extended with these elements:

    `internal : int` | Number of things that were marked internal and hence memory counted. It includes the things given as arguments.
    `cyclic : int` | Number of things that were marked internal only after resolving cycles.
    `external : int` | Number of things that were visited through the lookahead but were found to be external.
    `visits : int` | Number of times things were visited in total. This figure includes visits to various internal things that aren't visible from the pike level, so it might be larger than what is apparently motivated by the numbers above.
    `revisits : int` | Number of times the same things were revisited. This can occur in the lookahead when a thing is encountered through a shorter path than the one it first got visited through. It also occurs in resolved cycles. Like `visits`, this count can include things that aren't visible from pike.
    `rounds : int` | Number of search rounds. This is usually 1 or 2. More rounds are necessary only when blocked types turn out to be (acyclic) internal, so that they need to be counted and recursed anyway.
    `work_queue_alloc : int` | The number of elements that was allocated to store the work queue which is used to keep track of the things to visit during the lookahead. This is usually bigger than the maximum number of things the queue actually held.
    `size : int` | The memory occupied by the internal things. This is the same as the normal return value, but it's put here too for convenience.

  Parameter `things`

    One or more things to count memory size for. Only things passed by reference are allowed, except for functions which are forbidden because a meaningful size calculation can't be done for them.

    Integers are allowed because they are bignum objects when they become sufficiently large. However, passing an integer that is small enough to fit into the native integer type will return zero.

  Returns

    Returns the number of bytes occupied by the counted things. If the `return_count` option is set then the number of things are returned instead.

  Note

    The result of `Pike.count_memory(0,a,b)` might be larger than the sum of `Pike.count_memory(0,a)` and `Pike.count_memory(0,b)` since `a` and `b` together might reference things that aren't referenced from anywhere else.

  Note

    It's possible that a string that is referenced still isn't counted, because strings are always shared in Pike and the same string might be in use in some unrelated part of the program.

  CLASS Pike.BacktraceFrame

    Method _is_type

      `int(0..1) _is_type(string t)`

    Description

      This object claims to be an array for backward compatibility.

    Method _sprintf

      `string _sprintf(int c, mapping|void opts)`

    Method _sizeof

      `int(3..) _sizeof()`

    Method `[]

      `mixed `[](int index, int|void end_or_none)`

    Description

      The BacktraceFrame object can be indexed as an array.

    Method `[]=

      `mixed `[]=(int index, mixed value)`

  CLASS Pike.MasterCodec

    Description

      This is a bare-bones codec that is used when loading a dumped master.

    See also

      Codec

    Method functionof

      `mixed functionof(mixed symbol)`

    Description

      Look up a function in all_constants() .

    Method objectof

      `mixed objectof(mixed symbol)`

    Description

      Look up an object in all_constants() .

    Method programof

      `mixed programof(mixed symbol)`

    Description

      Look up a program in all_constants() .

    Method decode_object

      `object decode_object(object obj, mixed data)`

    Description

      Calls `obj->_decode(<font face='courier'>data` ).

  CLASS Pike.__Backend

    Description

      Base class for the various backend implementations.

      Implements callback registration functions and defines the main backend APIs.

      `function(Backend:void) Pike.__Backend.before_callback`
      `function(Backend:void) Pike.__Backend.after_callback`

    Description

      If set, these are called just before and after the backend waits for an event.

      If an error is thrown from these callbacks then it is reported using `master()->handle_error()` - it doesn't interrupt the operation of the backend.

    Method get_stats

      `mapping(string:int) get_stats()`

    Description

      Get some statistics about the backend.

    Returns

      Returns a mapping with the follwoing content:

      `"num_call_outs" : int` | The number of active call-outs.
      `"call_out_bytes" : int` | The amount of memory used by the call-outs.

    Method call_out

      `array call_out(function f, float|int delay, mixed ... args)`

    Description

      Make a delayed call to a function.

      call_out() places a call to the function f with the argument args in a queue to be called in about delay seconds.

      If f returns `-1`, no other call out or callback will be called by the backend in this round. I.e. `() will return right away. For the main backend that means it will immediately start another round and check files and call outs anew.

    Returns

      Returns a call_out identifier that identifies this call_out. This value can be sent to eg find_call_out() or remove_call_out() .

    See also

      remove_call_out() , find_call_out() , call_out_info()

    Method _do_call_outs

      `int _do_call_outs()`

    Description

      Do all pending call_outs.

      This function runs all pending call_outs that should have been run if Pike returned to the backend. It should not be used in normal operation.

      As a side-effect, this function sets the value returned by time(1) to the current time.

    Returns

      Zero if no call outs were called, nonzero otherwise.

    See also

      call_out() , find_call_out() , remove_call_out()

    Method find_call_out

      `int find_call_out(function f)`
      `int find_call_out(array id)`

    Description

      Find a call out in the queue.

      This function searches the call out queue. If given a function as argument, it looks for the first call out scheduled to that function.

      The argument can also be a call out id as returned by call_out() , in which case that call_out will be found (Unless it has already been called).

    Returns

      find_call_out() returns the remaining time in seconds before that call_out will be executed. If no call_out is found, zero_type (find_call_out (f)) will return 1.

    See also

      call_out() , remove_call_out() , call_out_info()

    Method remove_call_out

      `int remove_call_out(function f)`
      `int remove_call_out(array id)`

    Description

      Remove a call out from the call out queue.

      This function finds the first call to the function f in the call_out queue and removes it. You can also give a call out id as argument (as returned by call_out() ).

    Returns

      The remaining time in seconds left to that call out will be returned. If no call_out was found, zero_type (remove_call_out (f )) will return 1.

    See also

      call_out_info() , call_out() , find_call_out()

    Method call_out_info

      `array(array) call_out_info()`

    Description

      Get info about all call_outs.

      This function returns an array with one entry for each entry in the call out queue. The first in the queue will be at index 0. Each index contains an array that looks like this:

      Array
      `int time_left` | Time remaining in seconds until the call_out is to be performed.
      `object caller` | The object that scheduled the call_out.
      `function fun` | Function to be called.
      `mixed ... args` | Arguments to the function.

    See also

      call_out() , find_call_out() , remove_call_out()

    Method `()

      `float|int(0..0) `()(void|float|int(0..0) sleep_time)`

    Description

      Perform one pass through the backend.

      Calls any outstanding call-outs and non-blocking I/O callbacks that are registred in this backend object.

    Parameter `sleep_time`

      Wait at most sleep_time seconds. The default when unspecified or the integer `0` is no time limit.

    Returns

      If the backend did call any callbacks or call outs then the time spent in the backend is returned as a float. Otherwise the integer `0` is returned.

    See also

      Pike.DefaultBackend , main()

    Method executing_thread

      `Thread.Thread executing_thread()`
      `int executing_thread()`

    Description

      Return the thread currently executing in the backend. I.e. the thread that has called `() and hasn't exited from that call. Zero is returned if there's no thread in the backend.

      If Pike is compiled without thread support then `1` is returned if we're inside the backend, `0` otherwise.

    Method add_file

      `void add_file(Stdio.File|Stdio.FILE f)`

    Description

      Register a file to be handled by this backend.

    Parameter `f`

      File to register.

      Registers f to be handled by this backend. This simply does `f->set_backend(backend)` where `backend` is this object.

    See also

      Pike.DefaultBackend , main()

    Method id

      `int id()`

    Description

      Return an integer that uniquely identifies this backend. For the default backend that integer is `0`.

  CLASS Pike.PollDeviceBackend

    Description

      Backend implemented with `/dev/poll` (Solaris, OSF/1 and IRIX), `epoll(2)` (Linux) or `kqueue(2)` (MacOS X, FreeBSD, OpenBSD, etc).

    See also

      Backend

    Inherit __Backend

      inherit __Backend : __Backend

    Method `()

      `float|int(0..0) `()(void|float|int(0..0) sleep_time)`

    Description

      Perform one pass through the backend.

      Calls any outstanding call-outs and non-blocking I/O callbacks that are registred in this backend object.

    Parameter `sleep_time`

      Wait at most sleep_time seconds. The default when unspecified or the integer `0` is no time limit.

    Returns

      If the backend did call any callbacks or call outs then the time spent in the backend is returned as a float. Otherwise the integer `0` is returned.

    See also

      Pike.DefaultBackend , main()

  CLASS Pike.PollBackend

    Description

      Backend implemented with `poll(2)` (SVr4, POSIX).

    See also

      Backend

    Inherit __Backend

      inherit __Backend : __Backend

    Method `()

      `float|int(0..0) `()(void|float|int(0..0) sleep_time)`

    Description

      Perform one pass through the backend.

      Calls any outstanding call-outs and non-blocking I/O callbacks that are registred in this backend object.

    Parameter `sleep_time`

      Wait at most sleep_time seconds. The default when unspecified or the integer `0` is no time limit.

    Returns

      If the backend did call any callbacks or call outs then the time spent in the backend is returned as a float. Otherwise the integer `0` is returned.

    See also

      Pike.DefaultBackend , main()

  CLASS Pike.SelectBackend

    Description

      Backend based on the classic `select(2)` system call from BSD.

    Inherit __Backend

      inherit __Backend : __Backend

    Method `()

      `float|int(0..0) `()(void|float|int(0..0) sleep_time)`

    Description

      Perform one pass through the backend.

      Calls any outstanding call-outs and non-blocking I/O callbacks that are registred in this backend object.

    Parameter `sleep_time`

      Wait at most sleep_time seconds. The default when unspecified or the integer `0` is no time limit.

    Returns

      If the backend did call any callbacks or call outs then the time spent in the backend is returned as a float. Otherwise the integer `0` is returned.

    See also

      Pike.DefaultBackend , main()

  CLASS Pike.Encoder

    Description

      Codec for use with encode_value . It understands all the standard references to builtin functions, pike modules, and the main program script.

      The format of the produced identifiers are documented here to allow extension of this class:

      The produced names are either strings or arrays. The string variant specifies the thing to look up according to the first character:

      'c' Look up in all_constants(). 's' Look up in _static_modules. 'r' Look up with resolv(). 'p' Look up in programs. 'o' Look up in programs, then look up the result in objects. 'f' Look up in fc.

      In the array format, the first element is a string as above and the rest specify a series of things to do with the result:

      A string Look up this string in the result. 'm' Get module object in dirnode. 'p' Do object_program(result).

      All lowercase letters and the symbols ':', '/' and '.' are reserved for internal use in both cases where characters are used above.

    Method nameof

      `string|array nameof(mixed what, void|array(object) module_object)`

    Description

      When module_object is set and the name would end with an `object_program` step (i.e. `'p'`), then drop that step so that the name corresponds to the object instead. `<font face='courier'>module_object` [0] will receive the found object.

    Method create

      `void Pike.Encoder(void|mixed encoded)`

    Description

      Creates an encoder instance. If encoded is specified, it's encoded instead of being reverse resolved to a name. That's necessary to encode programs.

  CLASS Pike.Decoder

    Description

      Codec for use with decode_value . This is the decoder corresponding to Encoder . See that one for more details.

    syntax

      `void|string Pike.Decoder.fname`
      `void|int Pike.Decoder.mkobj`
      `void|object Pike.Decoder.handler` `void Pike.Decoder(void|string fname, void|int mkobj, void|object handler)`

    Method decode_object

      `array(mixed) decode_object(object o, mixed data)`

    Description

      Restore the state of an encoded object.

    Parameter `o`

      Object to modify.

    Parameter `data`

      State information from Encoder()->encode_object() .

      The default implementation calls `o->_decode(data)` if the object has an `_decode()`, otherwise if data is an array, returns it to indicate that lfun::create() should be called.

    Note

      This function is called before lfun::create() in the object has been called, but after lfun::__INIT() has been called.

    Returns

      Returns an array to indicate to the caller that lfun::create() should be called with the elements of the array as arguments.

      Returns `0` (zero) to inhibit calling of lfun::create() .

    See also

      Encoder()->encode_object()

  CLASS Pike.Codec

    Description

      Encoder and Decoder rolled into one. This is for mainly compatibility; there's typically no use combining encoding and decoding into the same object.

    Inherit Encoder

      inherit Encoder : Encoder

    Inherit Decoder

      inherit Decoder : Decoder

    Method create

      `void Pike.Codec(void|mixed encoded)`

    Description

      The optional argument is the thing to encode; it's passed on to Encoder .

  Module Pike.Security

    Description

      Pike has an optional internal security system, which can be enabled with the configure-option `--with-security`.

      The security system is based on attaching credential objects (Pike.Security.Creds ) to objects, programs, arrays, mappings or multisets.

      A credential object in essence holds three values:

        `user` -- The owner.

        `allow_bits` -- Run-time access permissions.

        `data_bits` -- Data access permissions.

    Method call_with_creds

      `mixed call_with_creds(Creds creds, mixed func, mixed ... args)`

    Description

      Call with credentials.

      Sets the current credentials to creds , and calls `<font face='courier'>func` (@<font face='courier'>args ). If creds is `0` (zero), the credentials from the current object will be used.

    Note

      The current creds or the current object must have the allow bit BIT_SECURITY set to allow calling with creds other than `0` (zero).

    Method get_current_creds

      `Creds get_current_creds()`

    Description

      Get the current credentials

      Returns the credentials that are currently active. Returns `0` (zero) if no credentials are active.

    See also

      call_with_creds()

    Method get_object_creds

      `Creds get_object_creds(object|program|function|array|mapping|multiset o)`

    Description

      Get the credentials from o .

      Returns `0` if o does not have any credentials.

    Constant BIT_INDEX

      `constant Pike.Security.BIT_INDEX`

    Description

      Allow indexing.

    Constant BIT_SET_INDEX

      `constant Pike.Security.BIT_SET_INDEX`

    Description

      Allow setting of indices.

    Constant BIT_CALL

      `constant Pike.Security.BIT_CALL`

    Description

      Allow calling of functions.

    Constant BIT_SECURITY

      `constant Pike.Security.BIT_SECURITY`

    Description

      Allow usage of security related functions.

    Constant BIT_NOT_SETUID

      `constant Pike.Security.BIT_NOT_SETUID`

    Description

      Don't change active credentials on function call.

    Constant BIT_CONDITIONAL_IO

      `constant Pike.Security.BIT_CONDITIONAL_IO`

    Description

      Allow conditional useage of I/O. The callbacks `valid_open` and `valid_io` will be called in the User object in the current Creds object to determine if the I/O is allowed or not.

    Constant BIT_DESTRUCT

      `constant Pike.Security.BIT_DESTRUCT`

    Description

      Allow use of destruct .

    CLASS Pike.Security.Creds

      Description

        The credentials object.

      Method get_default_creds

        `Creds get_default_creds()`

      Description

        Get the default credentials.

        Returns the default credentials object if it has been set. Returns `0` (zero) if it has not been set.

      See also

        set_default_creds()

      Method set_default_creds

        `void set_default_creds(Creds creds)`

      Description

        Set the default credentials

      Note

        The current creds must have the allow bit BIT_SECURITY set.

      See also

        get_default_creds()

      Method create

        `void Pike.Security.Creds(User user, int allow_bits, int data_bits)`

      Description

        Initialize a new credentials object.

      Parameter `allow_bits`

        Any of the flags BIT_SECURITY and BIT_CONDITIONAL_IO or:ed together.

      Parameter `data_bits`

        Any of the flags BIT_INDEX , BIT_SET_INDEX , BIT_CALL , BIT_NOT_SETUID and BIT_DESTRUCT or:ed together.

      Throws

        Throws an exception if the current creds doesn't have the allow bit BIT_SECURITY set.

      Method get_user

        `object get_user()`

      Description

        Get the user part.

      Method get_allow_bits

        `int get_allow_bits()`

      Description

        Get the allow_bit bitmask.

      Method get_data_bits

        `int get_data_bits()`

      Description

        Get the data_bits bitmask.

      Method apply

        `void apply(object|program|function|array|mapping|multiset o)`

      Description

        Set the credentials for o to this credentials object.

      Note

        To perform this operation the current credentials needs to have the bit BIT_SECURITY set, or have the same user as the old credentials and not change the user by performing the operation.

    CLASS Pike.Security.User

      Description

        Virtual class for User objects, used in Creds objects.

      Method valid_open

        `int(0..3)|string valid_open(string type, object current, string filename, string flags, int access)`

      Description

        This callback gets called when a new file is to be opened (and the Creds object has BIT_CONDITIONAL_IO set).

      Parameter `type`

        The type of file operation requested. Can either be `"read"` or `"write"`.

      Parameter `current`

        The current object, i.e. the Fd object the user is trying to open.

      Parameter `filename`

        The file name requested.

      Parameter `flags`

        The flag string passed to open, e.g. `"cwt"`.

      Parameter `access`

        The access flags requested for the file, e.g. `0666`.

      Returns

        The function can either return a string, which means that the user is allowed to open a file, but the returned file should be opened instead, or it can return an integer. The integers are intepreted as follows.

        `0` | The user was not allowed to open the file. ERRNO will be set to EPERM and an exception is thrown.
        `1` | Do nothing, i.e. valid_open has initilized the current object with an open file. This can (natuarally) only be returned if a current object was given, which is not always the case.
        `2` | The user was allowed to open the file and the open code proceeds.
        `3` | The user was not allowed to open the file and an exception is thrown.

      Method valid_io

        `int(0..3)|array valid_io(string fun, string type, mixed ... args)`

      Description

        This callback gets called when I/O operations not performed on file objects are performed.

  Module Pike.DefaultBackend

    Description

      This is the Backend object that files and call_outs are handled by by default.

      This is also the Backend object that will be used if main() returns `-1`.

    See also

      Backend , Stdio.File()->set_nonblocking() , call_out()

Module Sql

  Description

    The SQL module is a unified interface between pike and all its supported databases. The parts of this module that is usuable for all normal uses is the Sql class and the sql_result class.

  Example

        string people_in_group(string group) {
            Sql.Sql db = Sql.Sql("mysql://localhost/testdb");
            return db->query("SELECT name FROM users WHERE "
                             "group=%s", group)->name * ",";
         }

  Variable NULL

    `Val.Null Sql.NULL`

  Deprecated
  See also

    Val.null

  CLASS Sql.Null

    Description

      This class is used to implement the SQL NULL value.

    Note

      There's typically only one object of this class: Sql.NULL , but some databases (eg Oracle) have multiple types of NULL, in which case they all inherit this class.

    Deprecated
    See also

      Val.Null , Val.null , Sql.NULL

    Method encode_json

      `string encode_json()`

    Description

      Defined for use with Standards.JSON.encode , so that it formats NULL as `null`.

  CLASS Sql.mysqls

    Description

      Implements SQL-urls for `mysqls://[user[:password]@][hostname][:port][/database]`

      Sets the connection to SSL-mode, and sets the default configuration file to `"/etc/my.cnf"`.

    FIXME

      Ought to load a suitable default configuration file for Win32 too.

    Note

      This connection method only exists if the Mysql-module has been compiled with SSL-support.

    Inherit mysql

      inherit Sql.mysql : mysql

  CLASS Sql.Sql

    Description

      This class encapsulates a connection to an SQL server. It is a generic interface on top of the DB server specific implementations. That doesn't mean that there aren't plenty of server specific characteristics that still shine through, though.

      This class also serves as an interface guideline for the DB server specific connection classes.

      ## Untyped and typed mode

      The query results are returned in different ways depending on the query functions used: The `..typed_query` functions select typed mode, while the other query functions uses the older untyped mode.

      In untyped mode, all values except SQL NULL are returned as strings in their display representation, and SQL NULL is returned as zero.

      In typed mode, values are returned in pike native form where it works well. That means at least that SQL integer fields are returned as pike integers, floats as floats, SQL NULL as Val.null , and of course strings still as strings. The representation of other SQL types depend on the capabilities of the server specific backends. It's also possible that floats in some cases are represented in other ways if too much precision is lost in the conversion to pike floats.

    Note

      For historical reasons, there may be server specific backends that operate differently from what is described here, e.g. some that return a bit of typed data in untyped mode.

    Note

      Typed operation was not supported at all prior to Pike 7.8.363, and may not be supported for all databases.

    Variable master_sql

      `object Sql.Sql.master_sql`

    Description

      Server specific connection object used for the actual SQL queries.

    Variable case_convert

      `int(0..1) Sql.Sql.case_convert`

    Description

      Convert all field names in mappings to lower_case. Only relevant to databases which only implement big_query(), and use upper/mixed-case fieldnames (eg Oracle).

      `0` | No (default)
      `1` | Yes

    Method quote

      `string quote(string s)`

    Description

      Quote a string s so that it can safely be put in a query.

      All input that is used in SQL-querys should be quoted to prevent SQL injections.

      Consider this harmfull code:

      string my_input = "rob' OR name!='rob"; string my_query = "DELETE FROM tblUsers WHERE name='"+my_input+"'"; my_db->query(my_query);

    This type of problems can be avoided by quoting `my_input`. `my_input` would then probably read something like rob\' OR name!=\'rob

    Usually this is done - not by calling quote explicitly - but through using a sprintf like syntax

        string my_input = "rob' OR name!='rob";
           my_db->query("DELETE FROM tblUsers WHERE name=%s",my_input);

  Method encode_time

    `string encode_time(int t, int|void is_utc)`

  Description

    Converts a system time value to an appropriately formatted time spec for the database.

  Parameter `t`

    Time to encode.

  Parameter `is_utc`

    If nonzero then time is taken as a "full" unix time spec (where the date part is ignored), otherwise it's converted as a seconds-since-midnight value.

  Method decode_time

    `int decode_time(string t, int|void want_utc)`

  Description

    Converts a database time spec to a system time value.

  Parameter `t`

    Time spec to decode.

  Parameter `want_utc`

    Take the date part from this system time value. If zero, a seconds-since-midnight value is returned.

  Method encode_date

    `string encode_date(int t)`

  Description

    Converts a system time value to an appropriately formatted date-only spec for the database.

  Parameter `t`

    Time to encode.

  Method decode_date

    `int decode_date(string d)`

  Description

    Converts a database date-only spec to a system time value.

  Parameter `d`

    Date spec to decode.

  Method encode_datetime

    `string encode_datetime(int t)`

  Description

    Converts a system time value to an appropriately formatted date and time spec for the database.

  Parameter `t`

    Time to encode.

  Method decode_datetime

    `int decode_datetime(string datetime)`

  Description

    Converts a database date and time spec to a system time value.

  Parameter `datetime`

    Date and time spec to decode.

  Method create

    `void Sql.Sql(string host)`
    `void Sql.Sql(string host, string db)`
    `void Sql.Sql(string host, mapping(string:int|string) options)`
    `void Sql.Sql(string host, string db, string user)`
    `void Sql.Sql(string host, string db, string user, string password)`
    `void Sql.Sql(string host, string db, string user, string password, mapping(string:int|string) options)`
    `void Sql.Sql(object host)`
    `void Sql.Sql(object host, string db)`

  Description

    Create a new generic SQL object.

  Parameter `host`

    `object` | Use this object to access the SQL-database.

    `string`

    Connect to the server specified. The string should be on the format: `dbtype://[user[:password]@]hostname[:port][/database]` Use the dbtype protocol to connect to the database server on the specified host. If the hostname is `""` then the port can be a file name to access through a UNIX-domain socket or similar, e g `"mysql://root@:/tmp/mysql.sock/"`.

    There is a special dbtype `"mysqls"` which works like `"mysql"` but sets the `CLIENT_SSL` option and loads the `/etc/my.cnf` config file to find the SSL parameters. The same function can be achieved using the `"mysql"` dbtype.

    `int(0..0)` | Access through a UNIX-domain socket or similar.

  Parameter `db`

    Select this database.

  Parameter `user`

    User name to access the database as.

  Parameter `password`

    Password to access the database.

  Parameter `options`

    Optional mapping of options. See the SQL-database documentation for the supported options. (eg Mysql.mysql()->create() ).

  Note

    In versions of Pike prior to 7.2 it was possible to leave out the dbtype, but that has been deprecated, since it never worked well.

  Note

    Support for options was added in Pike 7.3.

  Method is_open

    `int is_open()`

  Description

    Returns true if the connection seems to be open.

  Note

    This function only checks that there's an open connection, and that the other end hasn't closed it yet. No data is sent over the connection.

    For a more reliable check of whether the connection is alive, please use ping() .

  See also

    ping()

  Method ping

    `int ping()`

  Description

    Check whether the connection is alive.

  Returns

    Returns one of the following:

    `0` | Everything ok.
    `1` | The connection reconnected automatically.
    `-1` | The server has gone away, and the connection is dead.

  See also

    is_open()

  Method set_charset

    `void set_charset(string charset)`

  Description

    Changes the charset that the connection uses for queries and returned text strings.

  Parameter `charset`

    The charset to use. The valid values and their meanings depends on the database brand. However, the special value `"unicode"` (if supported) selects a mode where the query and result strings are unencoded (and possibly wide) unicode strings.

  Throws

    An error is thrown if the connection doesn't support the specified charset, or doesn't support charsets being set this way at all.

  Note

    See the `set_charset` functions for each database connection type for further details about the effects on the connection.

  See also

    get_charset , Sql.mysql.set_charset

  Method get_charset

    `string get_charset()`

  Description

    Returns the (database dependent) name of the charset used for (at least) query strings. Returns zero if the connection doesn't support charsets this way (typically means that a call to set_charset will throw an error).

  See also

    set_charset , Sql.mysql.get_charset

  Method error

    `int|string error()`

  Description

    Return last error message.

  Method select_db

    `void select_db(string db)`

  Description

    Select database to access.

  Method compile_query

    `string|object compile_query(string q)`

  Description

    Compiles the query (if possible). Otherwise returns it as is. The resulting object can be used multiple times to the query functions.

  Parameter `q`

    SQL-query to compile.

  See also

    query , typed_query , big_query , big_typed_query , streaming_query , streaming_typed_query

  Variable zero

    `protected ZeroWrapper Sql.Sql.zero`

  Description

    Instance of Zerowrapper used by handle_extraargs() .

  Method handle_extraargs

    `array(string|mapping(string|int:mixed)) handle_extraargs(string query, array(mixed) extraargs)`

  Description

    Handle sprintf -based quoted arguments

  Parameter `query`

    The query as sent to one of the query functions.

  Parameter `extraargs`

    The arguments following the query.

  Returns

    Returns an array with two elements:

    Array
    `string 0` | The query altered to use bindings-syntax.
    `mapping(string|int:mixed) 1` | A bindings mapping.

  Method query

    `array(mapping(string:string)) query(object|string q, mixed ... extraargs)`

  Description

    Sends an SQL query synchronously to the underlying SQL-server and returns the results in untyped mode.

  Parameter `q`

    Query to send to the SQL-server. This can either be a string with the query, or a previously compiled query (see compile_query() ).

  Parameter `extraargs`

    This parameter, if specified, can be in two forms:

    1. A mapping containing bindings of variables used in the query. A variable is identified by a colon (:) followed by a name or number. Each index in the mapping corresponds to one such variable, and the value for that index is substituted (quoted) into the query wherever the variable is used.

    res = query("SELECT foo FROM bar WHERE gazonk=:baz", ([":baz":"value"]));

  Binary values (BLOBs) may need to be placed in multisets.

  - Arguments as you would use in sprintf. They are automatically quoted.

        res = query("select foo from bar where gazonk=%s","value");

Returns

  Returns one of the following on success:

  `array(mapping(string:string))` | The result as an array of mappings indexed on the name of the columns. The values are either strings with the display representations or zero for the SQL NULL value.
  `zero` | The value `0` (zero) if the query didn't return any result (eg `INSERT` or similar).

Throws

  Throws an exception if the query fails.

See also

  typed_query , big_query , streaming_query

Method typed_query

  `array(mapping(string:mixed)) typed_query(object|string q, mixed ... extraargs)`

Description

  Sends an SQL query synchronously to the underlying SQL-server and returns the results in typed mode.

  For the arguments, please see the query() function.

Returns

  Returns one of the following on success:

  `array(mapping(string:mixed))` | The result as an array of mappings indexed on the name of the columns. The values have the appropriate native pike types where they fit the SQL data types - see the class doc for details on typed mode.
  `zero` | The value `0` (zero) if the query didn't return any result (eg `INSERT` or similar).

Note

  Typed mode is not supported by all sql databases. If not supported, an error is thrown.

See also

  query , big_typed_query

Method big_query

  `int|object big_query(object|string q, mixed ... extraargs)`

Description

  Sends an SQL query synchronously to the underlying SQL-server and returns the results in untyped mode.

  For the arguments, please see the query() function.

  The result is returned as an Sql.sql_result object in untyped mode. This allows for having some more info about the result as well as processing the result in a streaming fashion, although the result itself wasn't obtained streamingly from the server. Returns `0` if the query didn't return any result (e.g. `INSERT` or similar).

Note

  Despite the name, this function is not only useful for "big" queries. It typically has less overhead than query also for ones that return only a few rows.

See also

  query , streaming_query

Method big_typed_query

  `int|object big_typed_query(object|string q, mixed ... extraargs)`

Description

  Sends an SQL query synchronously to the underlying SQL-server and returns the results in typed mode.

  For the arguments, please see the query() function.

  The result is returned as an Sql.sql_result object in typed mode. This allows for having some more info about the result as well as processing the result in a streaming fashion, although the result itself wasn't obtained streamingly from the server. Returns `0` if the query didn't return any result (e.g. `INSERT` or similar).

Note

  Typed mode is not supported by all sql databases. If not supported, an error is thrown.

Note

  Despite the name, this function is not only useful for "big" queries. It typically has less overhead than typed_query also for ones that return only a few rows.

See also

  query , typed_query , big_query , streaming_query

Method streaming_query

  `int|object streaming_query(object|string q, mixed ... extraargs)`

Description

  Sends an SQL query synchronously to the underlying SQL-server and returns the results streaming in untyped mode.

  For the arguments, please see the query() function.

  The result is returned as a streaming Sql.sql_result object in untyped mode. This allows for having results larger than the available memory, and returning some more info about the result. Returns `0` if the query didn't return any result (e.g. INSERT or similar). For the other arguments, they are the same as for the query() function.

Note

  Streaming operation is not supported by all sql databases. If not supported, this function will fall back to calling big_query() .

See also

  big_query , streaming_typed_query

Method streaming_typed_query

  `int|object streaming_typed_query(object|string q, mixed ... extraargs)`

Description

  Sends an SQL query synchronously to the underlying SQL-server and returns the results streaming in typed mode.

  For the arguments, please see the query() function.

  The result is returned as a streaming Sql.sql_result object in typed mode. This allows for having results larger than the available memory, and returning some more info about the result. Returns `0` if the query didn't return any result (e.g. INSERT or similar).

Note

  Neither streaming operation nor typed results are supported by all sql databases. If not supported, this function will fall back to calling big_typed_query() .

See also

  streaming_query , big_typed_query

Method create_db

  `void create_db(string db)`

Description

  Create a new database.

Parameter `db`

  Name of database to create.

Method drop_db

  `void drop_db(string db)`

Description

  Drop database

Parameter `db`

  Name of database to drop.

Method shutdown

  `void shutdown()`

Description

  Shutdown a database server.

Method reload

  `void reload()`

Description

  Reload the tables.

Method server_info

  `string server_info()`

Description

  Return info about the current SQL-server.

Method host_info

  `string host_info()`

Description

  Return info about the connection to the SQL-server.

Method list_dbs

  `array(string) list_dbs(string|void wild)`

Description

  List available databases on this SQL-server.

Parameter `wild`

  Optional wildcard to match against.

Method list_tables

  `array(string) list_tables(string|void wild)`

Description

  List tables available in the current database.

Parameter `wild`

  Optional wildcard to match against.

Method list_fields

  `array(mapping(string:mixed)) list_fields(string table, string|void wild)`

Description

  List fields available in the specified table

Parameter `table`

  Table to list the fields of.

Parameter `wild`

  Optional wildcard to match against.

CLASS Sql.Sql.ZeroWrapper

  Description

    Wrapper to handle zero.

  See also

    zero

  Method _sprintf

    `string _sprintf(int fmt, mapping(string:mixed) params)`

  Returns

    Returns the following:

    `"NULL"` | If fmt is `'s'`.
    `"ZeroWrapper()"` | If fmt is `'O'`.

    Otherwise it formats a `0` (zero).

CLASS Sql.postgres_result

  Description

    Sql.postgres_result contains the result of a Postgres-query. See Sql.postgres for a description of this program's functions.

  Inherit postgres_result

    inherit Postgres.postgres_result : postgres_result

CLASS Sql.mysql

  Description

    This class encapsulates a connection to a MySQL server, and implements the glue needed to access the Mysql module from the generic SQL module.

    ## Typed mode

    When query results are returned in typed mode, the MySQL data types are represented like this:

    The NULL value

      Returned as Val.null .

    BIT, TINYINT, BOOL, SMALLINT, MEDIUMINT, INT, BIGINT

      Returned as pike integers.

    FLOAT, DOUBLE

      Returned as pike floats.

    DECIMAL

      Returned as pike integers for fields that are declared to contain zero decimals, otherwise returned as Gmp.mpq objects.

    DATE, DATETIME, TIME, YEAR

      Returned as strings in their display representation (see the MySQL manual).

      Calendar objects are not used partly because they always represent a specific point or range in time, which these MySQL types do not.

    TIMESTAMP

      Also returned as strings in the display representation.

      The reason is that it's both more efficient and more robust (wrt time zone interpretations) to convert these to unix timestamps on the MySQL side rather than in the client glue. I.e. use the `UNIX_TIMESTAMP` function in the queries to retrieve them as unix timestamps on integer form.

    String types

      All string types are returned as pike strings. The MySQL glue can handle charset conversions for text strings - see set_charset and set_unicode_decode_mode .

  Inherit mysql

    inherit Mysql.mysql : mysql

  Method set_unicode_encode_mode

    `int(0..1) set_unicode_encode_mode(int enable)`

  Description

    Enables or disables unicode encode mode.

    In this mode, if the server supports UTF-8 and the connection charset is `latin1` (the default) or `unicode` then big_query handles wide unicode queries. Enabled by default.

    Unicode encode mode works as follows: Eight bit strings are sent as `latin1` and wide strings are sent using `utf8`. big_query sends `SET character_set_client` statements as necessary to update the charset on the server side. If the server doesn't support that then it fails, but the wide string query would fail anyway.

    To make this transparent, string literals with introducers (e.g. `_binary 'foo'`) are excluded from the UTF-8 encoding. This means that big_query needs to do some superficial parsing of the query when it is a wide string.

  Returns

    `1` | Unicode encode mode is enabled.
    `0` | Unicode encode mode couldn't be enabled because an incompatible connection charset is set. You need to do `<font face='courier'>set_charset` ("latin1") or `<font face='courier'>set_charset` ("unicode") to enable it.

  Note

    Note that this mode doesn't affect the MySQL system variable `character_set_connection`, i.e. it will still be set to `latin1` by default which means server functions like `UPPER()` won't handle non-`latin1` characters correctly in all cases.

    To fix that, do `<font face='courier'>set_charset` ("unicode"). That will allow unicode encode mode to work while `utf8` is fully enabled at the server side.

    Tip: If you enable `utf8` on the server side, you need to send raw binary strings as `_binary'...'`. Otherwise they will get UTF-8 encoded by the server.

  Note

    When unicode encode mode is enabled and the connection charset is `latin1`, the charset accepted by big_query is not quite Unicode since `latin1` is based on `cp1252`. The differences are in the range `0x80..0x9f` where Unicode has control chars.

    This small discrepancy is not present when the connection charset is `unicode`.

  See also

    set_unicode_decode_mode , set_charset

  Method get_unicode_encode_mode

    `int get_unicode_encode_mode()`

  Description

    Returns nonzero if unicode encode mode is enabled, zero otherwise.

  See also

    set_unicode_encode_mode

  Method set_unicode_decode_mode

    `void set_unicode_decode_mode(int enable)`

  Description

    Enable or disable unicode decode mode.

    In this mode, if the server supports UTF-8 then non-binary text strings in results are automatically decoded to (possibly wide) unicode strings. Not enabled by default.

    The statement "`SET character_set_results = utf8`" is sent to the server to enable the mode. When the mode is disabled, "`SET character_set_results = xxx`" is sent, where `xxx` is the connection charset that get_charset returns.

  Parameter `enable`

    Nonzero enables this feature, zero disables it.

  Throws

    Throws an exception if the server doesn't support this, i.e. if the statement above fails. The MySQL system variable `character_set_results` was added in MySQL 4.1.1.

    An error is also thrown if Pike has been compiled with a MySQL client library older than 4.1.0, which lack the necessary support for this.

  See also

    set_unicode_encode_mode

  Method get_unicode_decode_mode

    `int get_unicode_decode_mode()`

  Description

    Returns nonzero if unicode decode mode is enabled, zero otherwise.

  See also

    set_unicode_decode_mode

  Method set_charset

    `void set_charset(string charset)`

  Description

    Changes the connection charset. Works similar to sending the query `SET NAMES <font face='courier'>charset` but also records the charset on the client side so that various client functions work correctly.

    charset is a MySQL charset name or the special value `"unicode"` (see below). You can use `SHOW CHARACTER SET` to get a list of valid charsets.

    Specifying `"unicode"` as charset is the same as `"utf8"` except that unicode encode and decode modes are enabled too. Briefly, this means that you can send queries as unencoded unicode strings and will get back non-binary text results as unencoded unicode strings. See set_unicode_encode_mode and set_unicode_decode_mode for further details.

  Throws

    Throws an exception if the server doesn't support this, i.e. if the statement `SET NAMES` fails. Support for it was added in MySQL 4.1.0.

  Note

    If charset is `"latin1"` and unicode encode mode is enabled (the default) then big_query can send wide unicode queries transparently if the server supports UTF-8. See set_unicode_encode_mode .

  Note

    If unicode decode mode is already enabled (see set_unicode_decode_mode ) then this function won't affect the result charset (i.e. the MySQL system variable `character_set_results`).

    Actually, a query `SET character_set_results = utf8` will be sent immediately after setting the charset as above if unicode decode mode is enabled and charset isn't `"utf8"`.

  Note

    You should always use either this function or the `"mysql_charset_name"` option to create to set the connection charset, or more specifically the charset that the server expects queries to have (i.e. the MySQL system variable `character_set_client`). Otherwise big_query might not work correctly.

    Afterwards you may change the system variable `character_set_connection`, and also `character_set_results` if unicode decode mode isn't enabled.

  Note

    The MySQL `latin1` charset is close to Windows `cp1252`. The difference from ISO-8859-1 is a bunch of printable chars in the range `0x80..0x9f` (which contains control chars in ISO-8859-1). For instance, the euro currency sign is `0x80`.

    You can use the `mysql-latin1` encoding in the Locale.Charset module to do conversions, or just use the special `"unicode"` charset instead.

  See also

    get_charset , set_unicode_encode_mode , set_unicode_decode_mode

  Method get_charset

    `string get_charset()`

  Description

    Returns the MySQL name for the current connection charset.

    Returns `"unicode"` if unicode encode mode is enabled and UTF-8 is used on the server side (i.e. in `character_set_connection`).

  Note

    In servers with full charset support (i.e. MySQL 4.1.0 or later), this corresponds to the MySQL system variable `character_set_client` (with one exception - see next note) and thus controls the charset in which queries are sent. The charset used for text strings in results might be something else (and typically is if unicode decode mode is enabled; see set_unicode_decode_mode ).

  Note

    If the returned charset is `latin1` or `unicode` and unicode encode mode is enabled (the default) then `character_set_client` in the server might be either `latin1` or `utf8`, depending on the last sent query. See set_unicode_encode_mode for more info.

  See also

    set_charset

  Method quote

    `string quote(string s)`

  Description

    Quote a string so that it can safely be put in a query.

  Parameter `s`

    String to quote.

  Method latin1_to_utf8

    `string latin1_to_utf8(string s)`

  Description

    Converts a string in MySQL `latin1` format to UTF-8.

  Method utf8_encode_query

    `string utf8_encode_query(string q, function(string:string) encode_fn)`

  Description

    Encodes the appropriate sections of the query with encode_fn . Everything except strings prefixed by an introducer (i.e. `_something` or `N`) is encoded.

  Method encode_time

    `string encode_time(int time, void|int date)`

  Description

    Converts a system time value to an appropriately formatted time spec for the database.

  Parameter `time`

    Time to encode.

  Parameter `date`

    If nonzero then time is taken as a "full" unix time spec (where the date part is ignored), otherwise it's converted as a seconds-since-midnight value.

  Method encode_date

    `string encode_date(int time)`

  Description

    Converts a system time value to an appropriately formatted date-only spec for the database.

  Parameter `time`

    Time to encode.

  Method encode_datetime

    `string encode_datetime(int time)`

  Description

    Converts a system time value to an appropriately formatted date and time spec for the database.

  Parameter `time`

    Time to encode.

  Method decode_time

    `int decode_time(string timestr, void|int date)`

  Description

    Converts a database time spec to a system time value.

  Parameter `timestr`

    Time spec to decode.

  Parameter `date`

    Take the date part from this system time value. If zero, a seconds-since-midnight value is returned.

  Method decode_date

    `int decode_date(string datestr)`

  Description

    Converts a database date-only spec to a system time value. Assumes 4-digit years.

  Parameter `datestr`

    Date spec to decode.

  Method decode_datetime

    `int decode_datetime(string timestr)`

  Description

    Converts a database date and time spec to a system time value. Can decode strings missing the time part.

  Parameter `datestr`

    Date and time spec to decode.

  Method big_query

    `Mysql.mysql_result big_query(string query, mapping(string|int:mixed)|void bindings, void|string charset)`

  Description

    Sends a query to the server.

  Parameter `query`

    The SQL query.

  Parameter `bindings`

    An optional bindings mapping. See Sql.query for details about this.

  Parameter `charset`

    An optional charset that will be used temporarily while sending query to the server. If necessary, a query

    SET character_set_client=charset

  is sent to the server first, then query is sent as-is, and then the connection charset is restored again (if necessary).

  Primarily useful with charset set to `"latin1"` if unicode encode mode (see set_unicode_encode_mode ) is enabled (the default) and you have some large queries (typically blob inserts) where you want to avoid the query parsing overhead.

Returns

  A Mysql.mysql_result object is returned if the query is of a kind that returns a result. Zero is returned otherwise.

  The individual fields are returned as strings except for `NULL`, which is returned as UNDEFINED .

See also

  Sql.big_query() , big_typed_query() , streaming_query()

Method streaming_query

  `Mysql.mysql_result streaming_query(string query, mapping(string|int:mixed)|void bindings, void|string charset)`

Description

  Makes a streaming SQL query.

  This function sends the SQL query query to the Mysql-server. The result of the query is streamed through the returned Mysql.mysql_result object. Note that the involved database tables are locked until all the results has been read.

  In all other respects, it behaves like big_query .

See also

  big_query() , streaming_typed_query()

Method big_typed_query

  `Mysql.mysql_result big_typed_query(string query, mapping(string|int:mixed)|void bindings, void|string charset)`

Description

  Makes a typed SQL query.

  This function sends the SQL query query to the Mysql-server.

  The types of the result fields depend on the corresponding SQL types. They are mapped as follows:

  `Sql.Null` | The `NULL` value is returned as Sql.NULL .
  `int` | Integer values are returned as `int` values.
  `float` | Floating point values are returned as `float` values.
  `string` | All other SQL field types are returned as `string` values.

  In all other respects, it behaves like big_query .

See also

  big_query() , streaming_typed_query()

Method streaming_typed_query

  `Mysql.mysql_result streaming_typed_query(string query, mapping(string|int:mixed)|void bindings, void|string charset)`

Description

  Makes a streaming typed SQL query.

  This function acts as the combination of streaming_query() and big_typed_query() .

See also

  big_typed_query() , streaming_typed_query()

Method is_keyword

  `int(0..1) is_keyword(string name)`

Description

  Return 1 if the argument name is a mysql keyword that needs to be quoted in a query. The list is currently up-to-date with MySQL 5.1.

CLASS Sql.tds

  Description

    The TDS SQL-protocol.

    This protocol is used by Sybase and Microsoft's SQL-servers.

  Example

        Sql.Sql con = Sql.Sql("tds://user:pass@host/database");

  See also

    Sql.Sql()

  Method tds_error

    `void tds_error(string msg, mixed ... args)`

  Description

    Format and report an error.

  Method insert_id

    `int insert_id()`

  Description

    Fetch the identity of the last insert (if available).

    This performs the query `"SELECT @@identity AS insert_id"`.

  Returns

    Returns the identity of the last insert as an integer if available. Otherwise returns `0` (zero).

  Method server_info

    `string server_info()`

  Description

    Return a string describing the server.

  Method error

    `string error()`

  Description

    Return the last error (or possibly the last warning or informational message).

  Method create

    `void Sql.tds(string|void server, string|void database, string|void user, string|void password, mapping|void options)`

  Description

    Connect to a remote SQL server via the TDS protocol.

  Parameter `server`

    Server to connect to.

  Parameter `database`

    Database to connect to.

  Parameter `user`

    User to access as.

    An explicit domain may be specified by preceeding the user name with the domain name and a `'\\'`.

  Parameter `password`

    Password to access with.

    Usually accessed via Sql.Sql() .

  See also

    Sql.Sql()

  ENUM Sql.tds.Token

    Description

      Tokens that may occur in the answers from the server.

  ENUM Sql.tds.EnvType

    Description

      Environment types.

      Used by TDS_ENV_CHANGE_TOKEN

  ENUM Sql.tds.FieldType

    Description

      Field types.

  CLASS Sql.tds.Connection

    Description

      A connection to a TDS server.

    Variable socket

      `Stdio.File Sql.tds.Connection.socket`

    Description

      The actual TCP connection.

    Method send_packet

      `InPacket send_packet(Packet p, int flag, int|void last)`

    Description

      Send a packet to the TDS server.

    Note

      May only be called when the connection is idle.

    Returns

      If last is true an InPacket with the result will be returned.

    CLASS Sql.tds.Connection.InPacket

      Description

        An incoming packet from the TDS server.

    CLASS Sql.tds.Connection.Packet

      Description

        An outgoing packet to the TDS server.

  CLASS Sql.tds.compile_query

    Description

      A compiled query.

    Method create

      `void Sql.tds.compile_query(string query)`

    Description

      Compile a query.

    See also

      big_query()

  CLASS Sql.tds.big_query

    Description

      A query result set.

    Method fetch_row

      `int|array(string|int) fetch_row()`

    Description

      Fetch the next row from the result set.

    Returns

      Returns `0` (zero) if all rows have been returned.

      Otherwise returns an `array(string|int)` with one entry for each field. If the field is `NULL` the entry will be `0` (zero), otherwise the entry will contain a string representing the value.

    Method fetch_fields

      `array(mapping(string:mixed)) fetch_fields()`

    Description

      Fetch a description of the fields in the result.

    Returns

      Returns an array with a mapping for each of the fields in the result.

      The mappings contain the following information:

      - Standard fields:

        `"name" : string` | The name of the field.
        `"table" : string|void` | The name of the table (if available).

      - TDS-specific fields:

        `"nullable" : int(0..1)` | `1` if the field may contain `NULL`.
        `"writeable" : int(0..1)` | `1` if the field may be changed.
        `"identity" : int(0..1)` | `1` if the field is the identity for the row.
        `"column_size" : int` | Width of the field.
        `"timestamp" : int(0..1)` | Time stamp information for last change is available.
        `"column_prec" : int|void` | Precision of the field.
        `"column_scale" : int|void` | Scale exponent of the field.
        `"usertype" : int` | Internal use only.
        `"flags" : int`
        `"column_type" : int`
        `"cardinal_type" : int`
        `"varint_size" : int`

    Method create

      `void Sql.tds.big_query(string|compile_query query)`

    Description

      Execute a query against the database.

    Parameter `query`

      The query to execute. This can either be a string, or a compiled query.

    See also

      compile_query()

CLASS Sql.msql

  Description

    Implements the glue needed to access the Msql-module from the generic SQL module.

  Inherit msql

    inherit Msql.msql : msql

CLASS Sql.pgsqls

  Description

    Implements SQL-urls for `pgsqls://[user[:password]@][hostname][:port][/database]`

    Sets the connection to SSL-mode, otherwise identical to Sql.pgsql .

  See also

    Sql.pgsql , Sql.Sql

  Inherit pgsql

    inherit Sql.pgsql : pgsql

CLASS Sql.null

  Description

    The NULL Sql handler.

    This is an empty Sql handler typically used to test other functionality of the Sql module.

  Method quote

    `string quote(string s)`

  Returns

    `<font face='courier'>sprintf` ("quote(%q)", s).

  Method query

    `array(mapping(string:mixed)) query(string query, mapping(string:mixed)|void bindings)`

  Returns

    Returns an array with a single element:

    `"query" : string` | The query string before formating.
    `"bindings" : string` | `<font face='courier'>sprintf` ("%O", <font face='courier'>bindings ).
    `"formatted_query" : string` | The formatted query.

CLASS Sql.pgsql

  Description

    This is an interface to the PostgreSQL database server. This module is independent of any external libraries. Note that you do not need to have a PostgreSQL server running on your host to use this module: you can connect to the database over a TCP/IP socket.

    This module replaces the functionality of the older Sql.postgres and Postgres.postgres modules.

    This module supports the following features:

    - PostgreSQL network protocol version 3, authentication methods currently supported are: cleartext and MD5 (recommended).

    - Streaming queries which do not buffer the whole resultset in memory.

    - Automatic binary transfers to and from the database for most common datatypes (amongst others: integer, text and bytea types).

    - Automatic character set conversion and native wide string support. Supports UTF8/Unicode for multibyte characters, and all single-byte character sets supported by the database.

    - SQL-injection protection by allowing just one statement per query and ignoring anything after the first (unquoted) semicolon in the query.

    - COPY support for streaming up- and download.

    - Accurate error messages.

    - Automatic precompilation of complex queries (session cache).

    - Multiple simultaneous queries on the same database connection.

    - Cancelling of long running queries by force or by timeout.

    - Event driven NOTIFY.

    - SSL encrypted connections (optional or forced).

    Check the PostgreSQL documentation for further details.

  Note

    Multiple simultaneous queries on the same database connection is a feature that none of the other database drivers for Pike support. So, although it's efficient, its use will make switching database drivers difficult.

  See also

    Sql.Sql , Sql.postgres , http://www.postgresql.org/docs/

  Method create

    `void Sql.pgsql()`
    `void Sql.pgsql(string host, void|string database, void|string user, void|string password, void|mapping(string:mixed) options)`

  Description

    With no arguments, this function initialises (reinitialises if a connection has been set up previously) a connection to the PostgreSQL backend. Since PostgreSQL requires a database to be selected, it will try to connect to the default database. The connection may fail however, for a variety of reasons; in this case the most likely reason is because you don't have sufficient privileges to connect to that database. So use of this particular syntax is discouraged.

  Parameter `host`

    Should either contain `"hostname"` or `"hostname:portname"`. This allows you to specify the TCP/IP port to connect to. If the parameter is `0` or `""`, it will try to connect to localhost, default port.

  Parameter `database`

    Specifies the database to connect to. Not specifying this is only supported if the PostgreSQL backend has a default database configured. If you do not want to connect to any live database, you can use template1 .

  Parameter `options`

    Currently supports at least the following:

    `"reconnect" : int` | Set it to zero to disable automatic reconnects upon losing the connection to the database. Not setting it, or setting it to one, will cause one timed reconnect to take place. Setting it to -1 will cause the system to try and reconnect indefinitely.
    `"use_ssl" : int` | If the database supports and allows SSL connections, the session will be SSL encrypted, if not, the connection will fallback to plain unencrypted.
    `"force_ssl" : int` | If the database supports and allows SSL connections, the session will be SSL encrypted, if not, the connection will abort.
    `"text_query" : int` | Send queries to and retrieve results from the database using text instead of the, generally more efficient, default native binary method. Turning this on will allow multiple statements per query separated by semicolons.
    `"cache_autoprepared_statements" : int` | If set to zero, it disables the automatic statement prepare and cache logic; caching prepared statements can be problematic when stored procedures and tables are redefined which leave stale references in the already cached prepared statements.
    `"client_encoding" : string` | Character encoding for the client side, it defaults to using the default encoding specified by the database, e.g. UTF8 or SQL_ASCII .
    `"standard_conforming_strings" : string` | When on, backslashes in strings must not be escaped any longer, quote() automatically adjusts quoting strategy accordingly.
    `"escape_string_warning" : string` | When on, a warning is issued if a backslash (\) appears in an ordinary string literal and standard_conforming_strings is off, defaults to on

    For the numerous other options please check the PostgreSQL manual.

  Note

    You need to have a database selected before using the sql-object, otherwise you'll get exceptions when you try to query it. Also notice that this function can raise exceptions if the db server doesn't respond, if the database doesn't exist or is not accessible by you.

  See also

    Postgres.postgres , Sql.Sql , select_db() , http://www.postgresql.org/search/?u=%2Fdocs%2Fcurrent%2F&q=client+connection+defaults

  Method error

    `string error(void|int clear)`

  Returns

    The textual description of the last server-related error. Returns `0` if no error has occurred yet. It is not cleared upon reading (can be invoked multiple times, will return the same result until a new error occurs).

    During the execution of a statement, this function accumulates all non-error messages (notices, warnings, etc.). If a statement does not generate any errors, this function will return all collected messages from the last statement.

  Note

    The string returned is not newline-terminated.

  Parameter `clear`

    To clear the error, set it to `1`.

  See also

    big_query()

  Method host_info

    `string host_info()`

  Description

    This function returns a string describing what host are we talking to, and how (TCP/IP or UNIX sockets).

  See also

    server_info()

  Method is_open

    `int is_open()`

  Description

    Returns true if the connection seems to be open.

  Note

    This function only checks that there's an open connection, and that the other end hasn't closed it yet. No data is sent over the connection.

    For a more reliable check of whether the connection is alive, please use ping() .

  See also

    ping()

  Method ping

    `int ping()`

  Description

    Check whether the connection is alive.

  Returns

    Returns one of the following:

    `0` | Everything ok.
    `1` | The connection reconnected automatically.
    `-1` | The server has gone away, and the connection is dead.

  See also

    is_open()

  Method cancelquery

    `void cancelquery()`

  Description

    Cancels the currently running query.

  See also

    reload() , resync()

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method set_charset

    `void set_charset(string charset)`

  Description

    Changes the connection charset. When set to UTF8 , the query, parameters and results can be Pike-native wide strings.

  Parameter `charset`

    A PostgreSQL charset name.

  See also

    get_charset() , create() , http://www.postgresql.org/search/?u=%2Fdocs%2Fcurrent%2F&q=character+sets

  Method get_charset

    `string get_charset()`

  Returns

    The PostgreSQL name for the current connection charset.

  See also

    set_charset() , getruntimeparameters() , http://www.postgresql.org/search/?u=%2Fdocs%2Fcurrent%2F&q=character+sets

  Method getruntimeparameters

    `mapping(string:string) getruntimeparameters()`

  Returns

    Currently active runtimeparameters for the open session; these are initialised by the options parameter during session creation, and then processed and returned by the server. Common values are:

    `"client_encoding" : string` | Character encoding for the client side, e.g. UTF8 or SQL_ASCII .
    `"server_encoding" : string` | Character encoding for the server side as determined when the database was created, e.g. `"UTF8"` or `"SQL_ASCII"`.
    `"DateStyle" : string` | Date parsing/display, e.g. `"ISO, DMY"`.
    `"TimeZone" : string` | Default timezone used by the database, e.g. `"localtime"`.
    `"standard_conforming_strings" : string` | When on, backslashes in strings must not be escaped any longer.
    `"session_authorization" : string` | Displays the authorisationrole which the current session runs under.
    `"is_superuser" : string` | Indicates if the current authorisationrole has database-superuser privileges.
    `"integer_datetimes" : string` | Reports wether the database supports 64-bit-integer dates and times.
    `"server_version" : string` | Shows the server version, e.g. `"8.3.3"`.

    The values can be changed during a session using SET commands to the database. For other runtimeparameters check the PostgreSQL documentation.

  See also

    http://www.postgresql.org/search/?u=%2Fdocs%2Fcurrent%2F&q=client+connection+defaults

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method getstatistics

    `mapping(string:mixed) getstatistics()`

  Returns

    A set of statistics for the current session:

    `"warnings_dropped" : int` | Number of warnings/notices generated by the database but not collected by the application by using error() after the statements that generated them.
    `"skipped_describe_count" : int` | Number of times the driver skipped asking the database to describe the statement parameters because it was already cached.
    `"used_prepared_statements" : int` | Numer of times prepared statements were used from cache instead of reparsing in the current session.
    `"current_prepared_statements" : int` | Cache size of currently prepared statements.
    `"current_prepared_statement_hits" : int` | Sum of the number hits on statements in the current statement cache.
    `"prepared_portal_count" : int` | Total number of prepared portals generated.
    `"prepared_statement_count" : int` | Total number of prepared statements generated.
    `"portals_opened_count" : int` | Total number of portals opened, i.e. number of statements issued to the database.
    `"blocked_count" : int` | Number of times the driver had to (briefly) wait for the database to send additional data.
    `"bytes_received" : int` | Total number of bytes received from the database so far.
    `"messages_received" : int` | Total number of messages received from the database (one SQL-statement requires multiple messages to be exchanged).
    `"bytes_sent" : int` | Total number of bytes sent to the database so far.
    `"packets_sent" : int` | Total number of packets sent to the database (one packet usually contains multiple messages).
    `"reconnect_count" : int` | Number of times the connection to the database has been lost.
    `"portals_in_flight" : int` | Currently still open portals, i.e. running statements.

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method setcachedepth

    `int setcachedepth(void|int newdepth)`

  Parameter `newdepth`

    Sets the new cachedepth for automatic caching of prepared statements.

  Returns

    The previous cachedepth.

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method settimeout

    `int settimeout(void|int newtimeout)`

  Parameter `newtimeout`

    Sets the new timeout for long running queries.

  Returns

    The previous timeout.

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method setportalbuffersize

    `int setportalbuffersize(void|int newportalbuffersize)`

  Parameter `newportalbuffersize`

    Sets the new portalbuffersize for buffering partially concurrent queries.

  Returns

    The previous portalbuffersize.

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method setfetchlimit

    `int setfetchlimit(void|int newfetchlimit)`

  Parameter `newfetchlimit`

    Sets the new fetchlimit to interleave queries.

  Returns

    The previous fetchlimit.

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method close

    `void close()`

  Description

    Closes the connection to the database, any running queries are terminated instantly.

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method reload

    `void reload()`

  Description

    For PostgreSQL this function performs the same function as resync() .

  See also

    resync() , cancelquery()

  Method resync

    `void resync()`

  Description

    Resyncs the database session; typically used to make sure the session is not still in a dangling transaction.

    If called while queries/portals are still in-flight, this function is a no-op.

    If called while the connection is in idle state, the function is lightweight and briefly touches base with the database server to make sure client and server are in sync.

    If issued while inside a transaction, it will rollback the transaction, close all open cursors, drop all temporary tables and reset all session variables to their default values.

  See also

    cancelquery() , reload()

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method select_db

    `void select_db(string dbname)`

  Description

    This function allows you to connect to a database. Due to restrictions of the Postgres frontend-backend protocol, you always have to be connected to a database, so in fact this function just allows you to connect to a different database on the same server.

  Note

    This function can raise exceptions if something goes wrong (backend process not running, insufficient privileges...)

  See also

    create()

  Method set_notify_callback

    `void set_notify_callback(string condition, void|function(int:void) notify_cb, void|int selfnotify, mixed ... args)`

  Description

    With PostgreSQL you can LISTEN to NOTIFY events. This function allows you to detect and handle such events.

  Parameter `condition`

    Name of the notification event we're listening to. A special case is the empty string, which matches all events, and can be used as fallback function which is called only when the specific condition is not handled. Another special case is _reconnect which gets called whenever the connection unexpectedly drops and reconnects to the database.

  Parameter `notify_cb`

    Function to be called on receiving a notification-event of condition condition . The callback function is invoked with `void notify_cb(pid,condition,extrainfo, .. args);` pid is the process id of the database session that originated the event. condition contains the current condition. extrainfo contains optional extra information specified by the database. The rest of the arguments to notify_cb are passed verbatim from args . The callback function must return no value.

  Parameter `selfnotify`

    Normally notify events generated by your own session are ignored. If you want to receive those as well, set selfnotify to one.

  Parameter `args`

    Extra arguments to pass to notify_cb .

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method quote

    `string quote(string s)`

  Returns

    The given string, but escapes/quotes all contained magic characters according to the quoting rules of the current session for non-binary arguments in textual SQL-queries.

  Note

    Quoting must not be done for parameters passed in bindings.

  See also

    big_query() , quotebinary() , create()

  Method quotebinary

    `string quotebinary(string s)`

  Returns

    The given string, but escapes/quotes all contained magic characters for binary (bytea) arguments in textual SQL-queries.

  Note

    Quoting must not be done for parameters passed in bindings.

  See also

    big_query() , quote()

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method create_db

    `void create_db(string db)`

  Description

    This function creates a new database (assuming we have sufficient privileges to do this).

  Parameter `db`

    Name of the new database.

  See also

    drop_db()

  Method drop_db

    `void drop_db(string db)`

  Description

    This function destroys a database and all the data it contains (assuming we have sufficient privileges to do so). It is not possible to delete the database you're currently connected to. You can connect to database template1 to avoid connecting to any live database.

  Parameter `db`

    Name of the database to be deleted.

  See also

    create_db()

  Method server_info

    `string server_info()`

  Returns

    A string describing the server we are talking to. It has the form `"servername/serverversion"` (like the HTTP protocol description) and is most useful in conjunction with the generic SQL-server module.

  See also

    host_info()

  Method list_dbs

    `array(string) list_dbs(void|string glob)`

  Returns

    An array of the databases available on the server.

  Parameter `glob`

    If specified, list only those databases matching it.

  Method list_tables

    `array(string) list_tables(void|string glob)`

  Returns

    An array containing the names of all the tables and views in the path in the currently selected database.

  Parameter `glob`

    If specified, list only the tables with matching names.

  Method list_fields

    `array(mapping(string:mixed)) list_fields(void|string table, void|string glob)`

  Returns

    A mapping, indexed on the column name, of mappings describing the attributes of a table of the current database. The currently defined fields are:

    `"schema" : string` | Schema the table belongs to
    `"table" : string` | Name of the table
    `"kind" : string` | Type of table
    `"owner" : string` | Tableowner
    `"rowcount" : int` | Estimated rowcount of the table
    `"datasize" : int` | Estimated total datasize of the table in bytes
    `"indexsize" : int` | Estimated total indexsize of the table in bytes
    `"name" : string` | Name of the column
    `"type" : string` | A textual description of the internal (to the server) column type-name
    `"typeoid" : int` | The OID of the internal (to the server) column type
    `"length" : string` | Size of the columndatatype
    `"default" : mixed` | Default value for the column
    `"is_shared" : int` | If the table has any indices
    `"has_index" : int`
    `"has_primarykey" : int` | If the table has a primary key

  Parameter `glob`

    If specified, list only the tables with matching names. Setting it to `*` will include system columns in the list.

  Method status_commit

    `string status_commit()`

  Returns

    The current commitstatus of the connection. Returns either one of:

    `idle`
    `intransaction`
    `infailedtransaction`

  Note

    This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

  Method big_query

    `Sql.pgsql_util.pgsql_result big_query(string query)`
    `Sql.pgsql_util.pgsql_result big_query(string query, mapping bindings)`

  Description

    This is the only provided interface which allows you to query the database. If you wish to use the simpler Sql.Sql()->query() function, you need to use the Sql.Sql generic SQL-object.

    Bindings are supported natively straight across the network. Special bindings supported are:

    `":_cache" : int` | Forces caching on or off for the query at hand.
    `":_text" : int` | Forces text mode in communication with the database for queries on or off for the query at hand. Potentially more efficient than the default binary method for simple queries with small or no result sets. Note that this mode causes all but the first query result of a list of semicolon separated statements to be discarded.

  Returns

    A Sql.pgsql_util.pgsql_result object (which conforms to the Sql.sql_result standard interface for accessing data). It is recommended to use Sql.Sql()->query() for simpler queries (because it is easier to handle, but stores all the result in memory), and Sql.Sql()->big_query() for queries you expect to return huge amounts of data (it's harder to handle, but fetches results on demand).

  Note

    This function can raise exceptions.

  Note

    This function supports multiple simultaneous queries (portals) on a single database connection. This is a feature not commonly supported by other database backends.

  Note

    This function, by default, does not support multiple queries in one querystring. I.e. it allows for but does not require a trailing semicolon, but it simply ignores any commands after the first unquoted semicolon. This can be viewed as a limited protection against SQL-injection attacks. To make it support multiple queries in one querystring, use the :_text option.

  See also

    big_typed_query() , Sql.Sql , Sql.sql_result , Sql.Sql()->query() , Sql.pgsql_util.pgsql_result

  Method streaming_query

    `object streaming_query(string q, void|mapping(string|int:mixed) bindings)`

  Description

    This is an alias for big_query() , since big_query() already supports streaming of multiple simultaneous queries through the same connection.

  See also

    big_query() , big_typed_query() , Sql.Sql , Sql.sql_result

  Method big_typed_query

    `object big_typed_query(string q, void|mapping(string|int:mixed) bindings)`

  Description

    This function returns an object that allows streaming and typed results.

  See also

    big_query() , Sql.Sql , Sql.sql_result

CLASS Sql.sql_result

  Description

    Implements the generic result of the SQL-interface. Used for return results from SQL.sql->big_query().

  Variable master_res

    `mixed Sql.sql_result.master_res`

  Description

    The actual result.

  Variable index

    `int Sql.sql_result.index`

  Description

    This is the number of the current row. The actual semantics differs between different databases.

  Method create

    `void Sql.sql_result(mixed res)`

  Description

    Create a new Sql.sql_result object

  Parameter `res`

    Result to use as base.

  Method num_rows

    `int num_rows()`

  Description

    Returns the number of rows in the result.

  Method num_fields

    `int num_fields()`

  Description

    Returns the number of fields in the result.

  Method eof

    `int eof()`

  Description

    Returns non-zero if there are no more rows.

  Method fetch_fields

    `array(mapping(string:mixed)) fetch_fields()`

  Description

    Return information about the available fields.

  Method seek

    `void seek(int skip)`

  Description

    Skip past a number of rows.

  Parameter `skip`

    Number of rows to skip.

  Method fetch_row

    `int|array(string|int|float) fetch_row()`

  Description

    Fetch the next row from the result.

  Returns

    Returns an array with one element per field in the same order as reported by fetch_fields() . See the Sql.Sql class documentation for more details on how different data types are represented.

  Method fetch_json_result

    `string fetch_json_result()`

  Description

    Fetch remaining result as `JSON`-encoded data.

CLASS Sql.postgres

  Description

    This is an interface to the Postgres (Postgres95, pgsql) database server. This module may or may not be available on your Pike, depending whether the appropriate include and library files could be found at compile-time. Note that you do not need to have a Postgres server running on your host to use this module: you can connect to the database over a TCP/IP socket.

  Note

    This driver has been deprecated. You should use the more advanced driver Sql.pgsql to access PostgreSQL databases instead.

  Note

    Also note that this module uses blocking I/O to connect to the server. It is thread-safe, and so it can be used in a multithread environment.

    The behavior of the Postgres C API also depends on certain environment variables defined in the environment of the Pike interpreter; some notice and warning notifications might are dumped on stderr.

    `"PGHOST"` | Sets the name of the default host to connect to. It defaults to `"localhost"`.
    `"PGOPTIONS"` | Sets some extra flags for the frontend-backend connection. do not set unless you're sure of what you're doing.
    `"PGPORT"` | Sets the default port to connect to, otherwise it will use compile-time defaults (that is: the time you compiled the postgres library, not the Pike driver).
    `"PGTTY"` | Sets the file to be used for Postgres frontend debugging. Do not use, unless you're sure of what you're doing.
    `"PGDATABASE"` | Sets the default database to connect to.
    `"PGREALM"` | Sets the default realm for Kerberos authentication. I never used this, so I can't help you.

    Refer to the Postgres documentation for further details.

  See also

    Sql.pgsql , Sql.Sql , Postgres.postgres , Sql.postgres_result

  Inherit mo

    inherit Postgres.postgres : mo

  Method select_db

    `void select_db(string dbname)`

  Description

    This function allows you to connect to a database. Due to restrictions of the Postgres frontend-backend protocol, you always have to be connected to a database, so in fact this function just allows you to connect to a different database on the same server.

  Note

    This function can raise exceptions if something goes wrong (backend process not running, not enough permissions..)

  See also

    create

  Method error

    `string error()`

  Description

    This function returns the textual description of the last server-related error. Returns `0` if no error has occurred yet. It is not cleared upon reading (can be invoked multiple times, will return the same result until a new error occurs).

  See also

    big_query

  Method host_info

    `string host_info()`

  Description

    This function returns a string describing what host are we talking to, and how (TCP/IP or UNIX sockets).

  Method reset

    `void reset()`

  Description

    This function resets the connection to the backend. Can be used for a variety of reasons, for example to detect the status of a connection.

  Note

    This function is Postgres-specific, and thus it is not available through the generic SQL-interface.

  Variable version

    `string Sql.postgres.version`

  Description

    Should you need to report a bug to the author, please submit along with the report the driver version number, as returned by this call.

  Method create

    `void Sql.postgres()`
    `void Sql.postgres(string host, void|string database, void|string user, void|string password, void|mapping options)`

  Description

    With no arguments, this function initializes (reinitializes if a connection had been previously set up) a connection to the Postgres backend. Since Postgres requires a database to be selected, it will try to connect to the default database. The connection may fail however for a variety of reasons, in this case the most likely of all is because you don't have enough authority to connect to that database. So use of this particular syntax is discouraged.

    The host argument can have the syntax `"hostname"` or `"hostname:portname"`. This allows to specify the TCP/IP port to connect to. If it is `0` or `""`, it will try to connect to localhost, default port.

    The database argument specifies the database to connect to. If `0` or `""`, it will try to connect to the specified database.

    The username and password arguments are silently ignored, since the Postgres C API doesn't allow to connect to the server as any user different than the user running the interface.

  Note

    You need to have a database selected before using the sql-object, otherwise you'll get exceptions when you try to query it. Also notice that this function can raise exceptions if the db server doesn't respond, if the database doesn't exist or is not accessible by you.

    You don't need bothering about syncronizing the connection to the database: it is automatically closed (and the database is sync-ed) when the object is destroyed.

  See also

    Sql.pgsql , Postgres.postgres , Sql.Sql , postgres->select_db

  Method set_notify_callback

    `void set_notify_callback()`
    `void set_notify_callback(function f)`
    `void set_notify_callback(function f, int|float poll_delay)`

  Description

    With Postgres you can associate events and notifications to tables. This function allows you to detect and handle such events.

    With no arguments, resets and removes any callback you might have put previously, and any polling cycle.

    With one argument, sets the notification callback (there can be only one for each sqlobject).

    With two arguments, sets a notification callback and sets a polling cycle.

    The polling cycle is necessary because of the way notifications are delivered, that is piggyback with a query result. This means that if you don't do any query, you'll receive no notification. The polling cycle starts a call_out cycle which will do an empty query when the specified interval expires, so that pending notifications may be delivered.

    The callback function must return no value, and takes a string argument, which will be the name of the table on which the notification event has occurred. In future versions, support for user-specified arguments will be added.

  Note

    The polling cycle can be run only if your process is in "event-driven mode" (that is, if 'main' has returned a negative number).

    This function is Postgres-specific, and thus it is not available through the generic SQL-interface.

  FIXME

    An integer can be passed as first argument, but it's effect is not documented.

  Method create_db

    `void create_db(string db)`

  Description

    This function creates a new database with the given name (assuming we have enough permissions to do this).

  See also

    drop_db

  Method drop_db

    `void drop_db(string db)`

  Description

    This function destroys a database and all the data it contains (assuming we have enough permissions to do so).

  See also

    create_db

  Method server_info

    `string server_info()`

  Description

    This function returns a string describing the server we are talking to. It has the form `"servername/serverversion"` (like the HTTP protocol description) and is most useful in conjunction with the generic SQL-server module.

  Method list_dbs

    `array(string) list_dbs(void|string glob)`

  Description

    Lists all the databases available on the server. If glob is specified, lists only those databases matching it.

  Method list_tables

    `array(string) list_tables(void|string glob)`

  Description

    Returns an array containing the names of all the tables in the currently selected database. If a glob is specified, it will return only those tables whose name matches it.

  Method list_fields

    `array(mapping(string:mixed)) list_fields(string table, void|string wild)`

  Description

    Returns a mapping, indexed on the column name, of mappings describing the attributes of a table of the current database. If a glob is specified, will return descriptions only of the columns matching it.

    The currently defined fields are:

    `"has_rules" : int` |
    `"is_shared" : int` |
    `"owner" : string` | The textual representation of a Postgres uid.
    `"length" : string` |
    `"text" : string` | A textual description of the internal (to the server) type-name
    `"default" : mixed` |
    `"expires" : string` | The "relexpires" attribute for the table. Obsolescent; modern versions of Postgres don't seem to use this feature, so don't count on this field to contain any useful value.

  Method big_query

    `int|object big_query(object|string q, mapping(string|int:mixed)|void bindings)`

  Description

    This is the only provided interface which allows you to query the database. If you wish to use the simpler "query" function, you need to use the Sql.Sql generic SQL-object.

    It returns a postgres_result object (which conforms to the Sql.sql_result standard interface for accessing data). I recommend using query() for simpler queries (because it is easier to handle, but stores all the result in memory), and big_query() for queries you expect to return huge amounts of data (it's harder to handle, but fetches results on demand).

  Note

    This function can raise exceptions.

  See also

    Sql.Sql , Sql.sql_result

  Method streaming_query

    `int|object streaming_query(object|string q, mapping(string|int:mixed)|void bindings)`

  Description

    This is an alias for big_query() , since big_query() already supports streaming.

  See also

    big_query , Sql.Sql , Sql.sql_result

  Inherit pgsql

    inherit Sql.pgsql : pgsql

  Description

    Maps SQL-urls for `postgres://[user[:password]@][hostname][:port][/database]` onto `pgsql://[user[:password]@][hostname][:port][/database]`

    The reason this happens, is because Pike was compiled without libpq support, therefore Pike falls back to the faster, smaller memory footprint, more advanced and native PostgreSQL driver called Sql.pgsql .

  See also

    Sql.pgsql , Sql.Sql

CLASS Sql.sqlite

  Description

    Low-level interface to SQLite3 databases.

    This class should typically not be accessed directly, but instead via Sql.Sql() with the scheme `"sqlite://"`.

  Method insert_id

    `int insert_id()`

  Description

    Returns the value of the `ROWID` (aka `OID`, aka `_ROWID_`, or declared `INTEGER PRIMARY KEY`) column for the most recent successful `INSERT` operation, or `0` (zero) if no `INSERT` operations have been performed on the connection yet.

  CLASS Sql.sqlite.ResObj

    Description

      Result object from big_query() .

Module Sql.pgsql_util

  Description

    Some pgsql utility functions

  CLASS Sql.pgsql_util.pgsql_result

    Description

      The result object returned by Sql.pgsql()->big_query() , except for the noted differences it behaves the same as Sql.sql_result .

    See also

      Sql.sql_result , Sql.pgsql , Sql.Sql , Sql.pgsql()->big_query()

    Method status_command_complete

      `string status_command_complete()`

    Description

      Returns the command-complete status for this query.

    See also

      affected_rows()

    Note

      This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

    Method affected_rows

      `int affected_rows()`

    Description

      Returns the number of affected rows by this query.

    See also

      status_command_complete()

    Note

      This function is PostgreSQL-specific, and thus it is not available through the generic SQL-interface.

    Method num_fields

      `int num_fields()`

    See also

      Sql.sql_result()->num_fields()

    Method num_rows

      `int num_rows()`

    See also

      Sql.sql_result()->num_rows()

    Method eof

      `int eof()`

    See also

      Sql.sql_result()->eof()

    Method fetch_fields

      `array(mapping(string:mixed)) fetch_fields()`

    See also

      Sql.sql_result()->fetch_fields()

    Method fetch_row

      `array(mixed) fetch_row()`
      `void fetch_row(string|array(string) copydatasend)`

    Returns

      One result row at a time.

      When using COPY FROM STDOUT, this method returns one row at a time as a single string containing the entire row.

    Parameter `copydatasend`

      When using COPY FROM STDIN, this method accepts a string or an array of strings to be processed by the COPY command; when sending the amount of data sent per call does not have to hit row or column boundaries.

      The COPY FROM STDIN sequence needs to be completed by either explicitly or implicitly destroying the result object, or by passing a zero argument to this method.

    See also

      eof()

Module Sql.sql_util

  Description

    Some SQL utility functions

  Method quote

    `string quote(string s)`

  Description

    Quote a string so that it can safely be put in a query.

  Parameter `s`

    String to quote.

  Method fallback

    `void fallback()`

  Description

    Throw an error in case an unimplemented function is called.

  Method emulate_bindings

    `string emulate_bindings(string query, mapping(string|int:mixed)|void bindings, void|object driver)`

  Description

    Build a raw SQL query, given the cooked query and the variable bindings It's meant to be used as an emulation engine for those drivers not providing such a behaviour directly (i.e. Oracle). The raw query can contain some variables (identified by prefixing a colon to a name or a number (i.e. ":var" or ":2"). They will be replaced by the corresponding value in the mapping.

  Parameter `query`

    The query.

  Parameter `bindings`

    Optional mapping containing the variable bindings. Make sure that no confusion is possible in the query. If necessary, change the variables' names.

  CLASS Sql.sql_util.UnicodeWrapper

    Description

      Result object wrapper performing utf8 decoding of all fields.

    syntax

      `protected object Sql.sql_util.UnicodeWrapper.master_result` `void Sql.sql_util.UnicodeWrapper(object master_result)`

    Method num_rows

      `int num_rows()`

    Description

      Returns the number of rows in the result.

    Method num_fields

      `int num_fields()`

    Description

      Returns the number of fields in the result.

    Method eof

      `int(0..1) eof()`

    Description

      Returns `1` if there are no more rows in the result.

    Variable field_info

      `protected array(int|mapping(string:mixed)) Sql.sql_util.UnicodeWrapper.field_info`

    Description

      Cached fetch_fields() result.

    Method fetch_fields

      `array(int|mapping(string:mixed)) fetch_fields()`

    Description

      Returns Information about the fields in the result.

      The following fields are converted from UTF8 if present:

      `"name" : string` | The name of the field. Always present.
      `"table" : string` | The table the field is from. Not present from all databases.
      `"default" : string` | The default value for the column. Not available from all databases.

    Method seek

      `void seek(int rows)`

    Description

      Skip ahead the specified number of rows.

    Method fetch_row

      `int|array(string) fetch_row()`

    Description

      Fetch the next row from the result.

      All strings in the result are decoded from UTF8.

    Method fetch_json_result

      `int|string fetch_json_result()`

    Description

      JSON is always utf8 default, do nothing.

  CLASS Sql.sql_util.MySQLUnicodeWrapper

    Description

      Result wrapper for MySQL that performs UTF-8 decoding of all nonbinary fields. Useful if the result charset of the connection has been set to UTF-8.

    Note

      There's normally no need to use this class directly. It's used automatically when Mysql.set_unicode_decode_mode is activated.

    Inherit UnicodeWrapper

      inherit UnicodeWrapper : UnicodeWrapper

Module DefaultCompilerEnvironment

  Description

    The CompilerEnvironment object that is used for loading C-modules and by predef::compile() .

  Note

    predef::compile() is essentially an alias for the CompilerEnvironment()->compile() in this object.

  See also

    CompilerEnvironment , predef::compile()

Module Process

  Method set_forkd_default

    `void set_forkd_default(int(0..1) mode)`

  Description

    Set the default value for the `"forkd"` modifier to Process .

  Note

    The default default value is `0` (zero).

  See also

    get_forkd_default() , Process()->create()

  Method get_forkd_default

    `int(0..1) get_forkd_default()`

  Description

    Get the default value for the `"forkd"` modifier to Process .

  Note

    The default default value is `0` (zero).

  See also

    set_forkd_default() , Process()->create()

  Method spawn_pike

    `Process spawn_pike(array(string) argv, void|mapping(string:mixed) options)`

  Description

    Spawn a new pike process similar to the current.

  Parameter `argv`

    Arguments for the new process.

  Parameter `options`

    Process creation options. See Process.Process for details. May also specify "add_predefines", "add_program_path", or "add_include_path" in order to include these components in command path (module path is included by default.)

  See also

    Process.Process

  Method run

    `mapping run(string|array(string) cmd, void|mapping modifiers)`

  Description

    Easy and lazy way of using Process.Process that runs a process and returns a mapping with the output and exit code without having to make sure you read nonblocking yourself.

  Parameter `args`

    Either a command line array, as the command_args argument to create_process() , or a string that will be splitted into a command line array by calling split_quoted_string() in an operating system dependant mode.

  Parameter `modifiers`

    It takes all the modifiers Process.Process accepts, with the exception of stdout and stderr. Since the point of this function is to handle those you can not supply your own.

    If `modifiers->stdin` is set to a string it will automaticly be converted to a pipe that is fed to stdin of the started process.

  See also

    Process.Process create_process

  Returns

    `"stdout" : string` | Everything the process wrote on stdout.
    `"stderr" : string` | Everything the process wrote on stderr.
    `"exitcode" : int` | The process' exitcode.

  Note

    As the entire output of stderr and stdout is stored in the returned mapping it could potentially grow until memory runs out. It is therefor adviceable to set up rlimits if the output has a potential to be very large.

  Example

        Process.run( ({ "ls", "-l" }) );
           Process.run( ({ "ls", "-l" }), ([ "cwd":"/etc" ]) );
           Process.run( "ls -l" );
           Process.run( "awk -F: '{print $2}'", ([ "stdin":"foo:2\nbar:17\n" ]) );

  Method exec

    `int exec(string file, string ... foo)`

  Method search_path

    `string search_path(string command)`

  Method sh_quote

    `string sh_quote(string s)`

  Method split_quoted_string

    `array(string) split_quoted_string(string s, int(0..1)|void nt_mode)`

  Description

    Splits the given string into a list of arguments, according to common (i.e. `/bin/sh`-based) command line quoting rules:

    - Sequences of whitespace, i.e. space, tab or newline, are treated as argument separators by default.

    - Single or double quotes (`'` or `"`) can be used around an argument to avoid whitespace splitting inside it. If such quoted strings are used next to each other then they get concatenated to one argument; e.g. `a"b"'c'` becomes a single argument `abc`.

    - Backslash (`\`) can be used in front of one of the space or quote characters mentioned above to treat them literally. E.g. `x\ y` is a single argument with a space in the middle, and `x\"y` is a single argument with a double quote in the middle.

    - A backslash can also be used to quote itself; i.e. `\\` becomes `\`.

    - Backslashes in front of other characters are removed by default. However, if the optional nt_mode flag is set then they are retained as-is, to work better with Windows style paths.

    - Backslashes are treated literally inside quoted strings, with the exception that `\"` is treated as a literal `"` inside a `"`-quoted string. It's therefore possible to include a literal `"` in a `"`-quoted string, as opposed to `'`-quoted strings which cannot contain a `'`.

  Method spawn

    `Process spawn(string command, void|Stdio.Stream stdin, void|Stdio.Stream stdout, void|Stdio.Stream stderr, )`

  Description

    Spawns a process that executes command as a command shell statement ("`/bin/sh -c <font face='courier'>command` " for Unix, "`cmd /c <font face='courier'>command` " for Windows).

  Parameter `stdin`
  Parameter `stdout`
  Parameter `stderr`

    Stream objects to use as standard input, standard output and standard error, respectively, for the created process. The corresponding streams for this process are used for those that are left out.

  Returns

    Returns a Process.Process object for the created process.

  See also

    system , popen

  Method popen

    `string popen(string command)`

  Description

    Executes command as a shell statement ("`/bin/sh -c <font face='courier'>command` " for Unix, "`cmd /c <font face='courier'>command` " for Windows), waits until it has finished and returns the result as a string.

  See also

    system , spawn

  Method popen

    `Stdio.FILE popen(string command, string mode)`

  Description

    Open a "process" for reading or writing. The command is executed as a shell statement ("`/bin/sh -c <font face='courier'>command` " for Unix, "`cmd /c <font face='courier'>command` " for Windows). The parameter mode should be one of the following letters:

    `"r"` | Open for reading. Data written by the process to stdout is available for read.
    `"w"` | Open for writing. Data written to the file is available to the process on stdin.

  See also

    system , spawn

  Method system

    `int system(string command, void|Stdio.Stream stdin, void|Stdio.Stream stdout, void|Stdio.Stream stderr)`

  Description

    Executes command as a shell statement ("`/bin/sh -c <font face='courier'>command` " for Unix, "`cmd /c <font face='courier'>command` " for Windows), waits until it has finished and returns its return value.

  Parameter `stdin`
  Parameter `stdout`
  Parameter `stderr`

    Stream objects to use as standard input, standard output and standard error, respectively, for the created process. The corresponding streams for this process are used for those that are left out.

  See also

    spawn , popen

  CLASS Process.create_process

    Description

      This is the recommended and most portable way to start processes in Pike. The process object is a pike abstraction of the running system process, with methods for various process housekeeping.

    See also

      Process

    Method wait

      `int wait()`

    Description

      Waits for the process to end.

    Returns

      `0..` | The exit code of the process.
      `-1` | The process was killed by a signal.
      `-2` | The process is stopped.

    See also

      TraceProcess()->wait()

    Method status

      `int(-1..2) status()`

    Description

      Returns the status of the process:

      `-1` | Unknown
      `0` | Running
      `1` | Stopped
      `2` | Exited

    Note

      Prior to Pike 7.5 the value 1 was returned for exited processes.

    Method last_signal

      `int(0..) last_signal()`

    Description

      Returns the last signal that was sent to the process.

    Method pid

      `int pid()`

    Description

      Returns the process identifier of the process.

    Method set_priority

      `int set_priority(string priority)`

    Description

      Sets the priority of the process. priority is one of the strings

      "realtime"
      "highest"
      "higher"
      "high"
      "low"
      "lowest"

    Constant limit_value

      `constant Process.create_process.limit_value`

    Description

      Each limit_value may be either of:

      integer

        sets current limit, max is left as it is.

      mapping

        ([ "hard":int, "soft":int ]) Both values are optional, hard <= soft.

      array

        ({ hard, soft }), both can be set to the string "unlimited". A value of -1 means 'keep the old value'.

      string

        The string "unlimited" sets both the hard and soft limit to unlimited

    Method create

      `void Process.create_process(array(string) command_args, void|mapping modifiers)`

    Parameter `command_args`

      The command name and its command-line arguments. You do not have to worry about quoting them; pike does this for you.

    Parameter `modifiers`

      This optional mapping can can contain zero or more of the following parameters:

      `"callback" : function(Process.Process:void)` | Function called when the created process changes state.
      `"cwd" : string` | Execute the command in another directory than the current directory of this process. Please note that if the command is given is a relative path, it will be relative to this directory rather than the current directory of this process.
      `"chroot" : string` | Chroot to this directory before executing the command.
      `"stdin" : Stdio.File` | These parameters allows you to change the standard input, output and error streams of the newly created process. This is particularly useful in combination with Stdio.File.pipe .
      `"stdout" : Stdio.File`
      `"stderr" : Stdio.File`
      `"env" : mapping(string:string)` | This mapping will become the environment variables for the created process. Normally you will want to only add or change variables which can be achived by getting the environment mapping for this process with getenv . See the examples section.

      `"uid" : int|string`

      This parameter changes which user the new process will execute as. Note that the current process must be running as UID 0 to use this option. The uid can be given either as an integer as a string containing the login name of that user.

      The "gid" and "groups" for the new process will be set to the right values for that user unless overriden by options below.

      (See setuid and getpwuid for more info.)

      `"gid" : int|string` | This parameter changes the primary group for the new process. When the new process creates files, they will will be created with this group. The group can either be given as an int or a string containing the name of the group. (See setuid and getgrgid for more info.)
      `"setsid" : int(0..1)|Stdio.File` | Set this to `1` to create a new session group. It is also possible to set it to a File object, in which case a new session group will be created with this file as the controlling terminal.
      `"setgroups" : array(int|string)` | This parameter allows you to the set the list of groups that the new process belongs to. It is recommended that if you use this parameter you supply at least one and no more than 16 groups. (Some system only support up to 8...) The groups can be given as gids or as strings with the group names.
      `"noinitgroups" : int(0..1)` | This parameter overrides a behaviour of the "uid" parameter. If this parameter is used, the gid and groups of the new process will be inherited from the current process rather than changed to the approperiate values for that uid.
      `"priority" : string` | This sets the priority of the new process, see set_priority for more info.
      `"nice" : int` | This sets the nice level of the new process; the lower the number, the higher the priority of the process. Note that only UID 0 may use negative numbers.
      `"keep_signals" : int(0..1)` | This prevents Pike from restoring all signal handlers to their default values for the new process. Useful to ignore certain signals in the new process.
      `"fds" : array(Stdio.File|int(0..0))` | This parameter allows you to map files to filedescriptors 3 and up. The file `fds[0]` will be remapped to fd 3 in the new process, etc.

      `"rlimit" : mapping(string:limit_value)`

      There are two values for each limit, the soft limit and the hard limit. Processes that do not have UID 0 may not raise the hard limit, and the soft limit may never be increased over the hard limit. The indices of the mapping indicate what limit to impose, and the values dictate what the limit should be. (See also System.setrlimit )

      `"core" : limit_value` | maximum core file size in bytes
      `"cpu" : limit_value` | maximum amount of cpu time used by the process in seconds
      `"data" : limit_value` | maximum heap (brk, malloc) size in bytes
      `"fsize" : limit_value` | maximum size of files created by the process in bytes
      `"map_mem" : limit_value` | maximum size of the process's mapped address space (mmap() and heap size) in bytes
      `"mem" : limit_value` | maximum size of the process's total amount of available memory (mmap, heap and stack size) in bytes
      `"nofile" : limit_value` | maximum number of file descriptors the process may create
      `"stack" : limit_value` | maximum stack size in bytes

    Example

          Process.create_process(({ "/usr/bin/env" }),
                                  (["env" : getenv() + (["TERM":"vt100"]) ]));

    Example

          //! Spawn a new process with the args @[args] and optionally a
           //! standard input if you provide such a @[Stdio.File] object.
           //! @returns
           //!   Returns the new process and a pipe from which you can read
           //!   its output.
           array(Process.Process|Stdio.File) spawn(Stdio.File|void stdin, string ... args)
           {
             Stdio.File stdout = Stdio.File();
             mapping opts = ([ "stdout" : stdout->pipe() ]);
             if( stdin )
              opts->stdin = stdin;
             return ({ Process.create_process( args, opts ), stdout });
           }

    Note

      All parameters that accept both string or int input can be noticeably slower using a string instead of an integer; if maximum performance is an issue, please use integers.

    Note

      The modifiers `"callback"`, `"fds"`, `"uid"`, `"gid"`, `"nice"`, `"noinitgroups"`, `"setgroups"`, `"keep_signals"` and `"rlimit"` only exist on unix.

    Note

      Support for `"callback"` was added in Pike 7.7.

    Method kill

      `int kill(int signal)`

    Returns

      `1` | Success
      `0` | Failure. errno is set to EINVAL, EPERM or ESRCH.

    Note

      This function is only available on platforms that support signals.

    See also

      predef::kill()

  CLASS Process.TraceProcess

    Description

      Class that enables tracing of processes.

      The new process will be started in stopped state. Use cont() to let it start executing.

    Note

      This class currently only exists on systems that implement `ptrace()`.

    Inherit create_process

      inherit create_process : create_process

    Method wait

      `int wait()`

    Description

      Waits for the process to stop.

    Returns

      `0..` | The exit code of the process.
      `-1` | The process was killed by a signal.
      `-2` | The process has stopped.

    See also

      create_process::wait()

    Method cont

      `void cont(int|void signal)`

    Description

      Allow a traced process to continue.

    Parameter `signal`

      Deliver this signal to the process.

    Note

      This function may only be called for stopped processes.

    See also

      wait()

    Method exit

      `void exit()`

    Description

      Cause the traced process to exit.

    Note

      This function may only be called for stopped processes.

    See also

      cont() , wait()

    CLASS Process.TraceProcess.Registers

      Description

        Interface to the current register contents of a stopped process.

      See also

        TraceProcess

      Method `[]

        `int `[](int regno)`

      Description

        Get the contents of register regno .

  CLASS Process.ForkdEncoder

    Description

      Encoder for data to be sent to Tools.Standalone.forkd .

    See also

      ForkdDecoder

    syntax

      `Stdio.File Process.ForkdEncoder.remote_fd` `void Process.ForkdEncoder(Stdio.File remote_fd)`

  CLASS Process.ForkdDecoder

    Description

      Decoder for data received by Tools.Standalone.forkd .

    See also

      ForkdEncoder

    syntax

      `array(Stdio.Fd) Process.ForkdDecoder.fds` `void Process.ForkdDecoder(array(Stdio.Fd) fds)`

  CLASS Process.Process

    Description

      Slightly polished version of create_process .

      In addition to the features supported by create_process , it also supports:

      - Callbacks on timeout and process termination.

      - Using Tools.Standalone.forkd via RPC to spawn the new process.

    See also

      create_process , Tools.Standalone.forkd

    Inherit create_process

      inherit create_process : create_process

    Description

      Based on create_process .

    Method create

      `void Process.Process(string|array(string) command_args, void|mapping(string:mixed) modifiers)`

    Parameter `command_args`

      Either a command line array, as the command_args argument to create_process() , or a string that will be splitted into a command line array by calling split_quoted_string() in an operating system dependant mode.

    Parameter `modifiers`

      In addition to the modifiers that create_process accepts, this object also accepts

      `"read_callback" : function(Process:void)` | This callback is called when there is data to be read from the process.
      `"timeout_callback" : function(Process:void)` | This callback is called if the process times out.
      `"timeout" : int` | The time it takes for the process to time out. Default is 15 seconds.
      `"forkd" : int(0..1)` | Use Tools.Standalone.forkd to actually spawn the process.

    Note

      The default value for the `"forkd"` modifier may be set via set_forkd_default() .

    See also

      create_process , create_process()->create() , split_quoted_string() , Tools.Standalone.forkd , set_forkd_default() , get_forkd_default()

  CLASS Process.Spawn

    Method create

      `void Process.Spawn(string cmd, void|array(string) args, void|mapping(string:string) env, string|void cwd, void|array(Stdio.File|void) ownpipes, void|array(Stdio.File|void) fds_to_close)`

    Method kill

      `int kill(int signal)`

    Method wait

      `int wait()`

Module Thread

  Method all_threads

    `array(Thread.Thread) all_threads()`

  Description

    This function returns an array with the thread ids of all threads.

  See also

    Thread()

  Method thread_set_concurrency

    `void thread_set_concurrency(int concurrency)`

  FIXME

    Document this function

  Method this_thread

    `Thread.Thread this_thread()`

  Description

    This function returns the object that identifies this thread.

  See also

    Thread()

  Inherit Thread

    inherit Thread : Thread

  CLASS Thread.Thread

    Method create

      `void Thread.Thread(function(mixed ... :void) f, mixed ... args)`

    Description

      This function creates a new thread which will run simultaneously to the rest of the program. The new thread will call the function f with the arguments args . When f returns the thread will cease to exist.

      All Pike functions are 'thread safe' meaning that running a function at the same time from different threads will not corrupt any internal data in the Pike process.

    Returns

      The returned value will be the same as the return value of this_thread() for the new thread.

    Note

      This function is only available on systems with POSIX or UNIX or WIN32 threads support.

    See also

      Mutex , Condition , this_thread()

    Method backtrace

      `array(mixed) backtrace()`

    Description

      Returns the current call stack for the thread.

    Returns

      The result has the same format as for predef::backtrace() .

    See also

      predef::backtrace()

    Method status

      `int status()`

    Description

      Returns the status of the thread.

    Returns

      `Thread.THREAD_NOT_STARTED`
      `Thread.THREAD_RUNNING`
      `Thread.THREAD_EXITED`

    Method _sprintf

      `string _sprintf(int c)`

    Description

      Returns a string identifying the thread.

    Method id_number

      `int id_number()`

    Description

      Returns an id number identifying the thread.

    Note

      This function was added in Pike 7.2.204.

    Method wait

      `mixed wait()`

    Description

      Waits for the thread to complete, and then returns the value returned from the thread function.

    Method interrupt

      `void interrupt()`
      `void interrupt(string msg)`

    Description

      Interrupt the thread with the message msg .

    FIXME

      The argument msg is currently ignored.

    Note

      Interrupts are asynchronous, and are currently not queued.

    Method kill

      `void kill()`

    Description

      Interrupt the thread, and terminate it.

    Note

      Interrupts are asynchronous, and are currently not queued.

  CLASS Thread.Mutex

    Description

      Mutex is a class that implements mutual exclusion locks. Mutex locks are used to prevent multiple threads from simultaneously execute sections of code which access or change shared data. The basic operations for a mutex is locking and unlocking. If a thread attempts to lock an already locked mutex the thread will sleep until the mutex is unlocked.

    Note

      This class is simulated when Pike is compiled without thread support, so it's always available.

      In POSIX threads, mutex locks can only be unlocked by the same thread that locked them. In Pike any thread can unlock a locked mutex.

    Method lock

      `MutexKey lock()`
      `MutexKey lock(int type)`

    Description

      This function attempts to lock the mutex. If the mutex is already locked by a different thread the current thread will sleep until the mutex is unlocked. The value returned is the 'key' to the lock. When the key is destructed or has no more references the mutex will automatically be unlocked.

      The type argument specifies what lock() should do if the mutex is already locked by this thread:

      `0` | Throw an error.
      `1` | Sleep until the mutex is unlocked. Useful if some other thread will unlock it.
      `2` | Return zero. This allows recursion within a locked region of code, but in conjunction with other locks it easily leads to unspecified locking order and therefore a risk for deadlocks.

    Note

      If the mutex is destructed while it's locked or while threads are waiting on it, it will continue to exist internally until the last thread has stopped waiting and the last MutexKey has disappeared, but further calls to the functions in this class will fail as is usual for destructed objects.

    Note

      Pike 7.4 and earlier destructed any outstanding lock when the mutex was destructed, but threads waiting in lock still got functioning locks as discussed above. This is inconsistent no matter how you look at it, so it was changed in 7.6. The old behavior is retained in compatibility mode for applications that explicitly destruct mutexes to unlock them.

    See also

      trylock()

    Method trylock

      `MutexKey trylock()`
      `MutexKey trylock(int type)`

    Description

      This function performs the same operation as lock() , but if the mutex is already locked, it will return zero instead of sleeping until it's unlocked.

    See also

      lock()

    Method current_locking_thread

      `Thread.Thread current_locking_thread()`

    Description

      This mutex method returns the object that identifies the thread that has locked the mutex. 0 is returned if the mutex isn't locked.

    See also

      Thread()

    Method current_locking_key

      `Thread.MutexKey current_locking_key()`

    Description

      This mutex method returns the key object currently governing the lock on this mutex. 0 is returned if the mutex isn't locked.

    See also

      Thread()

  CLASS Thread.MutexKey

    Description

      Objects of this class are returned by Mutex()->lock() and Mutex()->trylock() . They are also passed as arguments to Condition()->wait() .

      As long as they are held, the corresponding mutex will be locked.

      The corresponding mutex will be unlocked when the object is destructed (eg by not having any references left).

    See also

      Mutex , Condition

  CLASS Thread.Condition

    Description

      Implementation of condition variables.

      Condition variables are used by threaded programs to wait for events happening in other threads.

    Note

      Condition variables are only available on systems with thread support. The Condition class is not simulated otherwise, since that can't be done accurately without continuations.

    See also

      Mutex

    Method wait

      `void wait(Thread.MutexKey mutex_key)`
      `void wait(Thread.MutexKey mutex_key, int(0..)|float seconds)`
      `void wait(Thread.MutexKey mutex_key, int(0..) seconds, int(0..999999999) nanos)`

    Description

      Wait for condition.

      This function makes the current thread sleep until the condition variable is signalled or the timeout is reached.

    Parameter `mutex_key`

      A Thread.MutexKey object for a Thread.Mutex . It will be unlocked atomically before waiting for the signal and then relocked atomically when the signal is received or the timeout is reached.

    Parameter `seconds`

      Seconds to wait before the timeout is reached.

    Parameter `nanos`

      Nano (1/1000000000) seconds to wait before the timeout is reached. This value is added to the number of seconds specified by seconds .

      A timeout of zero seconds disables the timeout.

      The thread that sends the signal should have the mutex locked while sending it. Otherwise it's impossible to avoid races where signals are sent while the listener(s) haven't arrived to the wait calls yet.

    Note

      The support for timeouts was added in Pike 7.8.121, which was after the first public release of Pike 7.8.

    Note

      Note that the timeout is approximate (best effort), and may be exceeded if eg the mutex is busy after the timeout.

    Note

      In Pike 7.2 and earlier it was possible to call wait() without arguments. This possibility was removed in later versions since it unavoidably leads to programs with races and/or deadlocks.

    Note

      Note also that any threads waiting on the condition will be woken up when it gets destructed.

    See also

      Mutex->lock()

    Method signal

      `void signal()`

    Description

      signal() wakes up one of the threads currently waiting for the condition.

    Note

      Sometimes more than one thread is woken up.

    See also

      broadcast()

    Method broadcast

      `void broadcast()`

    Description

      broadcast() wakes up all threads currently waiting for this condition.

    See also

      signal()

  CLASS Thread.Local

    Description

      Thread local variable storage.

      This class allows you to have variables which are separate for each thread that uses it. It has two methods: get() and set() . A value stored in an instance of Local can only be retrieved by that same thread.

    Note

      This class is simulated when Pike is compiled without thread support, so it's always available.

    Method get

      `mixed get()`

    Description

      Get the thread local value.

      This returns the value prevoiusly stored in the Local object by the set() method by this thread.

    See also

      set()

    Method set

      `mixed set(mixed value)`

    Description

      Set the thread local value.

      This sets the value returned by the get method.

      Calling this method does not affect the value returned by get() when it's called by another thread (ie multiple values can be stored at the same time, but only one value per thread).

    Returns

      This function returns its argument.

    Note

      Note that the value set can only be retreived by the same thread.

    See also

      get()

  CLASS Thread.Fifo

    Description

      Fifo implements a fixed length first-in, first-out queue. A fifo is a queue of values and is often used as a stream of data between two threads.

    See also

      Queue

    Inherit r_cond

      inherit Condition : r_cond

    Inherit w_cond

      inherit Condition : w_cond

    Inherit lock

      inherit Mutex : lock

    Method size

      `int size()`

    Description

      This function returns the number of elements currently in the fifo.

    See also

      read() , write()

    Method read

      `mixed read()`

    Description

      This function retrieves a value from the fifo. Values will be returned in the order they were written. If there are no values present in the fifo the current thread will sleep until some other thread writes one.

    See also

      try_read() , read_array() , write()

    Method try_read

      `mixed try_read()`

    Description

      This function retrieves a value from the fifo if there is any there. Values will be returned in the order they were written. If there are no values present in the fifo then UNDEFINED will be returned.

    See also

      read()

    Method read_array

      `array read_array()`

    Description

      This function returns all values in the fifo as an array. The values in the array will be in the order they were written. If there are no values present in the fifo the current thread will sleep until some other thread writes one.

    See also

      read() , try_read_array()

    Method try_read_array

      `array try_read_array()`

    Description

      This function returns all values in the fifo as an array but doesn't wait if there are no values there. The values in the array will be in the order they were written.

    See also

      read_array()

    Method write

      `int write(mixed value)`

    Description

      Append a value to the end of the fifo. If there is no more room in the fifo the current thread will sleep until space is available. The number of items in the queue after the write is returned.

    See also

      read()

    Method try_write

      `int try_write(mixed value)`

    Description

      Append a value to the end of the fifo. If there is no more room in the fifo then zero will be returned, otherwise the number of items in the fifo after the write is returned.

    See also

      read()

    Method create

      `void Thread.Fifo()`
      `void Thread.Fifo(int size)`

    Description

      Create a fifo. If the optional size argument is present it sets how many values can be written to the fifo without blocking. The default size is 128.

  CLASS Thread.Queue

    Description

      Queue implements a queue, or a pipeline. The main difference between Queue and Fifo is that Queue will never block in write(), only allocate more memory.

    See also

      Fifo

    Inherit r_cond

      inherit Condition : r_cond

    Inherit lock

      inherit Mutex : lock

    Method size

      `int size()`

    Description

      This function returns the number of elements currently in the queue.

    See also

      read() , write()

    Method read

      `mixed read()`

    Description

      This function retrieves a value from the queue. Values will be returned in the order they were written. If there are no values present in the queue the current thread will sleep until some other thread writes one.

    See also

      try_read() , write()

    Method try_read

      `mixed try_read()`

    Description

      This function retrieves a value from the queue if there is any there. Values will be returned in the order they were written. If there are no values present in the fifo then UNDEFINED will be returned.

    See also

      write()

    Method read_array

      `array read_array()`

    Description

      This function returns all values in the queue as an array. The values in the array will be in the order they were written. If there are no values present in the queue the current thread will sleep until some other thread writes one.

    See also

      read() , try_read_array()

    Method try_read_array

      `array try_read_array()`

    Description

      This function returns all values in the queue as an array but doesn't wait if there are no values there. The values in the array will be in the order they were written.

    See also

      read_array()

    Method peek_array

      `array peek_array()`

    Description

      Returns a snapshot of all the values in the queue, in the order they were written. The values are still left in the queue, so if other threads are reading from it, the returned value should be considered stale already on return.

    Method write

      `int write(mixed value)`

    Description

      This function puts a value last in the queue. If the queue is too small to hold the value it will be expanded to make room. The number of items in the queue after the write is returned.

    See also

      read()

Module Error

  Method mkerror

    `object mkerror(mixed error)`

  Description

    Returns an Error object for any argument it receives. If the argument already is an Error object or is empty, it does nothing.

  CLASS Error.Generic

    Description

      Class for exception objects for errors of unspecified type.

    Variable error_message

      `string Error.Generic.error_message`

    Description

      The error message. It always ends with a newline (`'\n'`) character and it might be more than one line.

      Code that catches and rethrows errors may extend this with more error information.

    Variable error_backtrace

      `array(backtrace_frame|array(mixed)) Error.Generic.error_backtrace`

    Description

      The backtrace as returned by backtrace where the error occurred.

      Code that catches and rethrows errors should ensure that this remains the same in the rethrown error.

    Method cast

      `array cast(string type)`

    Description

      Cast operator.

    Note

      The only supported type to cast to is `"array"`, which generates an old-style error `({<font face='courier'>message` (), <font face='courier'>backtrace ()}).

    Method `[]

      `array|string `[](int(0..1) index)`

    Description

      Index operator.

      Simulates an array

      Array
      `string msg` | Error message as returned by message .
      `array backtrace` | Backtrace as returned by backtrace .

    Note

      The error message is always terminated with a newline.

    See also

      backtrace()

    Method describe

      `string describe()`

    Description

      Return a readable error report that includes the backtrace.

    Method message

      `string message()`

    Description

      Return a readable message describing the error. Normally simply returns error_message .

      If you override this function then you should ensure that error_message is included in the returned message, since there might be code that catches your error objects, extends error_message with more info, and rethrows the error.

    Method backtrace

      `array backtrace()`

    Description

      Return the backtrace where the error occurred. Normally simply returns error_backtrace .

    See also

      predef::backtrace()

    Method _sprintf

      `string _sprintf()`

    Method _is_type

      `int(0..1) _is_type(string t)`

    Description

      Claims that the error object is an array, for compatibility with old style error handling code.

    Method create

      `void Error.Generic(string message, void|array(backtrace_frame|array(mixed)) backtrace)`

Module Geography

  CLASS Geography.Position

    Description

      This class contains a geographical position, ie a point on the earths surface. The resulting position object implements comparision methods (__hash, `==, `< and `>) so that you can compare and sort positions as well as using them as index in mappings. Comparision is made primary on latidue and secondly on longitude. It does not currently take the ellipsoid into account.

      It is possible to cast a position into an array, which will yield ({ float latitude, float longitude }), as well as into a string.

    Variable lat

      `float Geography.Position.lat`

    Description

      Latitude (N--S) of the position, in degrees. Positive number is north, negative number is south.

    Variable long

      `float Geography.Position.long`

    Description

      Longitude (W--E) of the position, in degrees. Positive number is east, negative number is west.

    Variable alt

      `float Geography.Position.alt`

    Description

      Altitud of the position, in meters. Positive numbers is up. Zero is the shell of the current ellipsoid.

    Method create

      `void Geography.Position(float lat, float long, void|float alt)`
      `void Geography.Position(string lat, string long)`
      `void Geography.Position(string both)`

    Description

      Constructor for this class. If fed with strings, it will perform a dwim scan on the strings. If they fails to be understood, there will be an exception.

    Method latitude
    Method longitude

      `string latitude(void|int n)`
      `string longitude(void|int n)`

    Description

      Returns the nicely formatted latitude or longitude.

      `0` | "17°42.19'N" / "42°22.2'W"
      `1` | "17.703°N" / "42.37°W"
      `2` | "17°42.18'N" / "42°22.2'W"
      `3` | "17°42'10.4"N" / "42°22'12"W"
      `-1` | "17.703" / "-42.37"

    Method standard_grid

      `string standard_grid()`

    Description

      Returns the standard map grid system for the current position. Can either be "UPS" or "UTM".

    Variable polar_radius

      `float Geography.Position.polar_radius`

    Description

      The polar radius is how many meters the earth radius is at the poles (north-south direction).

    Variable equatorial_radius

      `float Geography.Position.equatorial_radius`

    Description

      The equatorial radius is how many meters the earth radius is at the equator (east-west direction).

    Method flattening

      `float flattening()`

    Description

      Returns the flattening factor for the selected earth approximation ellipsoid.

    Method eccentricity_squared

      `float eccentricity_squared()`

    Description

      Returns the first eccentricity squared for the selected earth approximation ellipsoid.

    Constant ellipsoids

      `constant Geography.Position.ellipsoids`

    Description

      A mapping with reference ellipsoids, which can be fed to the UTM converter. The mapping maps the name of the ellipsoid to an array where the first element is a float describing the equatorial radius and the second element is a float describing the polar radius.

    Method set_ellipsoid

      `int(0..1) set_ellipsoid(string name)`
      `int(0..1) set_ellipsoid(float equatorial_radius, float polar_radius)`

    Description

      Sets the equatorial and polar radius to the provided values. A name can also be provided, in which case the radius will be looked up in the ellipsoid mapping. The function returns 1 upon success, 0 on failure.

      `"Airy 1830"`
      `"ATS77"`
      `"Australian National"`
      `"Bessel 1841"`
      `"Bessel 1841 Namibia"`
      `"Clarke 1866"`
      `"Clarke 1880"`
      `"Everest"`
      `"Everest 1830"`
      `"Everest 1848"`
      `"Everest 1856"`
      `"Everest 1869"`
      `"Everest Pakistan"`
      `"Fisher 1960"`
      `"Fisher 1968"`
      `"G R S 1967"`
      `"G R S 1975"`
      `"G R S 1980"`
      `"Helmert 1906"`
      `"Hough 1956"`
      `"Indonesian 1974"`
      `"Krassovsky 1940"`
      `"Mercury"`
      `"Modified Airy"`
      `"Modified Fisher 1960"`
      `"New International 1967"`
      `"SGS 85"`
      `"South American 1969"`
      `"Sphere"`
      `"WGS 60"`
      `"WGS 66"`
      `"WGS 72"`
      `"WGS 84"`

    Note

      The longitude and lattitude are not converted to the new ellipsoid.

    Method UTM_zone_number

      `int UTM_zone_number()`

    Description

      Returns the UTM zone number for the current longitude, with correction for the Svalbard deviations.

    Method UTM_zone_designator

      `string UTM_zone_designator()`

    Description

      Returns the UTM letter designator for the current latitude. Returns "Z" if latitude is outside the UTM limits of 84N to 80S.

    Method UTM_offset

      `array(float) UTM_offset()`

    Description

      Returns the offset within the present UTM cell. The result will be returned in an array of floats, containing easting and northing.

    Method UTM

      `string UTM()`

    Description

      Returns the current UTM coordinates position. An example output is "32T 442063.562 5247479.500" where the parts are zone number + zone designator, easting and northing.

    Method set_from_UTM

      `void set_from_UTM(int zone_number, string zone_designator, float UTME, float UTMN)`

    Description

      Sets the longitude and lattitude from the given UTM coordinates.

    Method GEOREF

      `string GEOREF()`

    Description

      Gives the full GEOREF position for the current position, e.g. "LDJA0511".

    Method RT38

      `array(float) RT38()`

    Method set_from_RT38

      `void set_from_RT38(int|float|string x_n, int|float|string y_e)`

    Description

      Sets the longitude and lattitude from the given RT38 coordinates.

    Method approx_height

      `float approx_height()`

    Description

      Returns a very crude approximation of where the ground level is at the current position, compared against the ellipsoid shell. WGS-84 is assumed, but the approximation is so bad that it doesn't matter which of the standard ellipsoids is used.

    Method ECEF

      `array(float) ECEF()`

    Description

      Returns the current position as Earth Centered Earth Fixed Cartesian Coordinates.

    Returns

      ({ X, Y, Z })

    Method __hash

      `int __hash()`

    Method `==

      `int `==(object pos)`

    Method `<

      `int `<(object pos)`

    Method `>

      `int `>(object pos)`

    Method _sprintf

      `string _sprintf(int|void t)`

    Method euclidian_distance

      `float euclidian_distance(this_program p)`

    Description

      Calculate the euclidian distance between two Geography.Position. Result is in meter. This uses the ECEF function.

  CLASS Geography.PositionRT38

    Description

      Create a Position object from a RT38 coordinate

    Inherit Position

      inherit .Position : Position

  Module Geography.Countries

    Variable countries

      `array(Country) Geography.Countries.countries`

    Description

      All known countries.

    Method from_domain

      `Country from_domain(string domain)`

    Description

      Look up a country from a domain name. Returns zero if the domain doesn't map to a country. Note that there are some valid domains that don't:

      INT

        International

      MIL

        US Military

      NET

        Network

      ORG

        Non-Profit Organization

      ARPA

        Old style Arpanet

      NATO

        Nato field

      And that US has five domains, Great Britain and france two: <dl compact> <dt>EDU <dd>US Educational <dt>MIL <dd>US Military <dt>GOV <dd>US Government <dt>UM <dd>US Minor Outlying Islands <dt>US <dd>US <dt>GB <dd>Great Britain (UK) <dt>UK <dd>United Kingdom <dt>FR <dd>France <dt>FX <dd>France, Metropolitan <dt>There's also three domains that for convinience maps to US: <dt>NET <dd>Network <dt>ORG <dd>Organization <dt>COM <dd>Commercial </dl>

    Method from_domain

      `Country from_domain(string name)`

    Description

      Look up a country from its name or aka. The search is case-insensitive but regards whitespace and interpunctation.

    Method continents

      `mapping(string:array(Country)) continents()`

    Description

      Gives back a mapping from continent name to an array of the countries on that continent.

      The continents are:

              	  "Europe"
              	  "Africa"
              	  "Asia"
              	  "North America"
              	  "South America"
              	  "Oceania"
          	  "Antarctica"

    Note

      Some countries are considered to be on more than one continent.

    Method `[]
    Method `->

      `mixed `[](string what)`
      `mixed `->(string what)`

    Description

      Convenience functions for getting a country the name-space way; it looks up whatever it is in the name- and domain-space and returns that country if possible:

      > Geography.Countries.se; Result: Country(Sweden) > Geography.Countries.djibouti; Result: Country(Djibouti) > Geography.Countries.com; Result: Country(United States) > Geography.Countries.wallis_and_futuna_islands->iso2; Result: "WF"

  CLASS Geography.Countries.Country

    Description

      Country

    Variable iso2

      `string Geography.Countries.Country.iso2`

    Description

      ISO 2-character code aka domain name

    Variable fips10

      `string Geography.Countries.Country.fips10`

    Description

      FIPS 10-character code; "Federal Information Processing Standards 10-3" etc, used by some goverments in the US.

      `string Geography.Countries.Country.name`
      `array(string) Geography.Countries.Country.aka`

    Description

      Country name and as-known-as, if any

    Variable former

      `int Geography.Countries.Country.former`

    Description

      Flag that is set if this country doesn't exist anymore. (eg USSR.)

    Method continent

      `string continent()`

    Description

      Returns the continent of the country.

    Note

      Some countries are geographically in more then one continent; any of the continents might be returned then, but probably the continent in which the capital is resident - Europe for Russia, for instance.

    Method cast

      `string cast("string")`

    Description

      It is possible to cast a country to a string, which will be the same as performing `country->name;`.

Module SSL

  CLASS SSL.packet

    Description

      SSL Record Layer. Handle formatting and parsing of packets.

  CLASS SSL.connection

    Description

      SSL packet layer. SSL.connection inherits SSL.handshake, and in addition to the state in the handshake super class, it contains the current read and write states, packet queues. This object is responsible for receiving and sending packets, processing handshake packets, and providing a clear text packages for some application.

    Inherit handshake

      inherit .handshake : handshake

    Inherit alert

      inherit ADT.Queue : alert

    Inherit urgent

      inherit ADT.Queue : urgent

    Inherit application

      inherit ADT.Queue : application

    Method set_alert_callback

      `void set_alert_callback(function(object:void) callback)`

    Description

      Called with alert object, sequence number of bad packet, and raw data as arguments, if a bad packet is received.

      Can be used to support a fallback redirect https->http.

    Method recv_packet

      `object recv_packet(string data)`

    Description

      Low-level receive handler. Returns a packet, an alert, or zero if more data is needed to get a complete packet.

    Method send_packet

      `void send_packet(object packet, int|void priority)`

    Description

      Queues a packet for write. Handshake and and change cipher must use the same priority, so must application data and close_notifies.

    Method to_write

      `string|int to_write()`

    Description

      Extracts data from the packet queues. Returns a string of data to be written, "" if there are no pending packets, 1 of the connection is being closed politely, and -1 if the connection died unexpectedly.

      This function is intended to be called from an i/o write callback.

    Method send_close

      `void send_close()`

    Description

      Initiate close.

    Method send_streaming_data

      `int send_streaming_data(string data)`

    Description

      Send an application data packet. If the data block is too large then as much as possible of the beginning of it is sent. The size of the sent data is returned.

    Method got_data

      `string|int got_data(string|int s)`

    Description

      Main receive handler. Returns a string of received application data, or 1 if a close was received, or -1 if an error occurred.

      This function is intended to be called from an i/o read callback.

  CLASS SSL.context

    Description

      Keeps the state that is shared by all SSL-connections for one server (or one port). It includes policy configuration, a server certificate, the server's private key(s), etc. It also includes the session cache.

    Variable rsa

      `Crypto.RSA SSL.context.rsa`

    Description

      The server's private key

    Variable client_rsa

      `Crypto.RSA SSL.context.client_rsa`

    Description

      The client's private key (used with client certificate authentication)

    Variable client_certificates

      `array(array(string)) SSL.context.client_certificates`

    Description

      An array of certificate chains a client may present to a server when client certificate authentication is requested.

    Variable client_certificate_selector

      `function(.context:array(string)) SSL.context.client_certificate_selector`

    Description

      A function which will select an acceptable client certificate for presentation to a remote server. This function will receive the SSL context, an array of acceptable certificate types, and a list of DNs of acceptable certificate authorities. This function should return an array of strings containing a certificate chain, with the client certificate first, (and the root certificate last, if applicable.)

    Variable auth_level

      `int SSL.context.auth_level`

    Description

      Policy for client authentication. One of SSL.Constants.AUTHLEVEL_none , SSL.Constants.AUTHLEVEL_ask and SSL.Constants.AUTHLEVEL_require .

    Method set_authorities

      `void set_authorities(array(string) a)`

    Description

      Array of authorities that are accepted for client certificates. The server will only accept connections from clients whose certificate is signed by one of these authorities. The string is a DER-encoded certificate, which typically must be decoded using MIME.decode_base64 or Tools.PEM.Msg first.

      Note that it is presumed that the issuer will also be trusted by the server. See trusted_issuers for details on specifying trusted issuers.

      If empty, the server will accept any client certificate whose issuer is trusted by the server.

    Variable require_trust

      `int SSL.context.require_trust`

    Description

      When set, require the chain to be known, even if the root is self signed.

      Note that if set, and certificates are set to be verified, trusted issuers must be provided, or no connections will be accepted.

    Method get_authorities

      `array(string) get_authorities()`

    Description

      Get the list of allowed authorities. See set_authorities .

    Method set_trusted_issuers

      `void set_trusted_issuers(array(array(string)) i)`

    Description

      Sets the list of trusted certificate issuers.

    Parameter `a`

      An array of certificate chains whose root is self signed (ie a root issuer), and whose final certificate is an issuer that we trust. The root of the certificate should be first certificate in the chain. The string is a DER-encoded certificate, which typically must be decoded using MIME.decode_base64 or Tools.PEM.Msg first.

      If this array is left empty, and the context is set to verify certificates, a certificate chain must have a root that is self signed.

    Method get_trusted_issuers

      `array(array(string)) get_trusted_issuers()`

    Description

      Get the list of trusted issuers. See set_trusted_issuers .

    Variable verify_certificates

      `int SSL.context.verify_certificates`

    Description

      Determines whether certificates presented by the peer are verified, or just accepted as being valid.

      `Crypto.RSA SSL.context.long_rsa`
      `Crypto.RSA SSL.context.short_rsa`

    Description

      Temporary, non-certified, private keys, used with a server_key_exchange message. The rules are as follows:

      If the negotiated cipher_suite has the "exportable" property, and short_rsa is not zero, send a server_key_exchange message with the (public part of) the short_rsa key.

      If the negotiated cipher_suite does not have the exportable property, and long_rsa is not zero, send a server_key_exchange message with the (public part of) the long_rsa key.

      Otherwise, dont send any server_key_exchange message.

    Variable dsa

      `Crypto.DSA SSL.context.dsa`

    Description

      Servers dsa key.

    Variable dh_params

      `.Cipher.DHParameters SSL.context.dh_params`

    Description

      Parameters for dh keyexchange.

    Variable random

      `function(int:string) SSL.context.random`

    Description

      Used to generate random cookies for the hello-message. If we use the RSA keyexchange method, and this is a server, this random number generator is not used for generating the master_secret.

    Variable certificates

      `array(string) SSL.context.certificates`

    Description

      The server's certificate, or a chain of X509.v3 certificates, with the server's certificate first and root certificate last.

    Variable preferred_auth_methods

      `array(int) SSL.context.preferred_auth_methods`

    Description

      For client authentication. Used only if auth_level is AUTH_ask or AUTH_require.

    Variable preferred_suites

      `array(int) SSL.context.preferred_suites`

    Description

      Cipher suites we want the server to support, best first.

    Method rsa_mode

      `void rsa_mode()`

    Description

      Set preferred_suites to RSA based methods.

    Method dhe_dss_mode

      `void dhe_dss_mode()`

    Description

      Set preferred_suites to DSS based methods.

    Variable preferred_compressors

      `array(int) SSL.context.preferred_compressors`

    Description

      Always ({ COMPRESSION_null })

    Variable use_cache

      `int SSL.context.use_cache`

    Description

      Non-zero to enable cahing of sessions

    Variable session_lifetime

      `int SSL.context.session_lifetime`

    Description

      Sessions are removed from the cache when they are older than this limit (in seconds). Sessions are also removed from the cache if a connection using the session dies unexpectedly.

    Variable max_sessions

      `int SSL.context.max_sessions`

    Description

      Maximum number of sessions to keep in the cache.

    Method lookup_session

      `.session lookup_session(string id)`

    Description

      Lookup a session identifier in the cache. Returns the corresponding session, or zero if it is not found or caching is disabled.

    Method new_session

      `.session new_session()`

    Description

      Create a new session.

    Method record_session

      `void record_session(.session s)`

    Description

      Add a session to the cache (if caching is enabled).

    Method purge_session

      `void purge_session(.session s)`

    Description

      Remove a session from the cache.

  CLASS SSL.handshake

    Description

      SSL.handshake keeps the state relevant for SSL handshaking. This includes a pointer to a context object (which doesn't change), various buffers, a pointer to a session object (reuse or created as appropriate), and pending read and write states being negotiated.

      Each connection will have two sets or read and write state: The current read and write states used for encryption, and pending read and write states to be taken into use when the current keyexchange handshake is finished.

      `array(int) SSL.handshake.client_cert_types`
      `array(string) SSL.handshake.client_cert_distinguished_names`

    Description

      A few storage variables for client certificate handling on the client side.

      `string SSL.handshake.client_random`
      `string SSL.handshake.server_random`

    Description

      Random cookies, sent and received with the hello-messages.

    Method handle_handshake

      `int(-1..1) handle_handshake(int type, string data, string raw)`

    Description

      Do handshake processing. Type is one of HANDSHAKE_*, data is the contents of the packet, and raw is the raw packet received (needed for supporting SSLv2 hello messages).

      This function returns 0 if hadshake is in progress, 1 if handshake is finished, and -1 if a fatal error occurred. It uses the send_packet() function to transmit packets.

  CLASS SSL.https

    Description

      Dummy HTTPS server

    Inherit sslport

      inherit SSL.sslport : sslport

  CLASS SSL.state

    Description

      A connection switches from one set of state objects to another, one or more times during its lifetime. Each state object handles a one-way stream of packets, and operates in either decryption or encryption mode.

    Variable session

      `object SSL.state.session`

    Description

      Information about the used algorithms.

    Variable mac

      `.Cipher.MACAlgorithm SSL.state.mac`

    Description

      Message Authentication Code

    Variable crypt

      `.Cipher.CipherAlgorithm SSL.state.crypt`

    Description

      Encryption or decryption object.

    Variable seq_num

      `Gmp.mpz SSL.state.seq_num`

    Description

      64-bit sequence number.

    Method decrypt_packet

      `Alert|.packet decrypt_packet(.packet packet, int version)`

    Description

      Destructively decrypts a packet (including inflating and MAC-verification, if needed). On success, returns the decrypted packet. On failure, returns an alert packet. These cases are distinguished by looking at the is_alert attribute of the returned packet.

    Method encrypt_packet

      `Alert|.packet encrypt_packet(.packet packet, int version)`

    Description

      Encrypts a packet (including deflating and MAC-generation).

  CLASS SSL.sslport

    Description

      Interface similar to Stdio.Port.

    Inherit socket

      inherit Stdio.Port : socket

    Inherit context

      inherit .context : context

    Inherit accept_queue

      inherit ADT.Queue : accept_queue

  CLASS SSL.session

    Description

      The most important information in a session object is a choice of encryption algorithms and a "master secret" created by keyexchange with a client. Each connection can either do a full key exchange to established a new session, or reuse a previously established session. That is why we have the session abstraction and the session cache. Each session is used by one or more connections, in sequence or simultaneously.

      It is also possible to change to a new session in the middle of a connection.

    Variable identity

      `string SSL.session.identity`

    Description

      Identifies the session to the server

    Variable compression_algorithm

      `int SSL.session.compression_algorithm`

    Description

      Always COMPRESSION_null.

    Variable cipher_suite

      `int SSL.session.cipher_suite`

    Description

      Constant defining a choice of keyexchange, encryption and mac algorithm.

    Variable cipher_spec

      `.Cipher.CipherSpec SSL.session.cipher_spec`

    Description

      Information about the encryption method derived from the cipher_suite.

    Variable ke_method

      `int SSL.session.ke_method`

    Description

      Key exchange method, also derived from the cipher_suite.

    Variable master_secret

      `string SSL.session.master_secret`

    Description

      48 byte secret shared between the client and the server. Used for deriving the actual keys.

    Variable cert_data

      `mapping SSL.session.cert_data`

    Description

      information about the certificate in use by the peer, such as issuing authority, and verification status.

    Variable peer_certificate_chain

      `array(string) SSL.session.peer_certificate_chain`

    Description

      the peer certificate chain

    Variable certificate_chain

      `array(string) SSL.session.certificate_chain`

    Description

      our certificate chain

    Method set_cipher_suite

      `void set_cipher_suite(int suite, int version)`

    Description

      Sets the proper authentication method and cipher specification for the given cipher suite and verison .

    Method set_compression_method

      `void set_compression_method(int compr)`

    Description

      Sets the compression method. Currently only COMPRESSION_null is supported.

    Method generate_keys

      `array(string) generate_keys(string client_random, string server_random, array(int) version)`

    Description

      Generates keys appropriate for the SSL version given in version , based on the client_random and server_random .

    Returns

      Array
      `string 0` | Client write MAC secret
      `string 1` | Server write MAC secret
      `string 2` | Client write key
      `string 3` | Server write key
      `string 4` | Client write IV
      `string 5` | Server write IV

    Method new_server_states

      `array(.state) new_server_states(string client_random, string server_random, array(int) version)`

    Description

      Computes a new set of encryption states, derived from the client_random, server_random and master_secret strings.

    Returns

      Array
      `SSL.state read_state` | Read state
      `SSL.state write_state` | Write state

    Method new_client_states

      `array(.state) new_client_states(string client_random, string server_random, array(int) version)`

    Description

      Computes a new set of encryption states, derived from the client_random, server_random and master_secret strings.

    Returns

      Array
      `SSL.state read_state` | Read state
      `SSL.state write_state` | Write state

  CLASS SSL.sslfile

    Description

      Interface similar to Stdio.File .

      - Handles blocking and nonblocking mode.

      - Handles callback mode in an arbitrary backend (also in blocking mode).

      - Read and write operations might each do both reading and writing. In callback mode that means that installing either a read or a write callback might install both internally. It also means that reading in one thread while writing in another doesn't work.

      - Callback changing operations like set_blocking and set_nonblocking aren't atomic.

      - Apart from the above, thread safety/atomicity characteristics are retained.

      - Blocking characterstics are retained for all functions.

      - is_open , connection init (create ) and close (close ) can do both reading and writing.

      - destroy attempts to close the stream properly by sending the close packet, but since it can't do blocking I/O it's not certain that it will succeed. The stream should therefore always be closed with an explicit close call.

      - Abrupt remote close without the proper handshake gets the errno System.EPIPE .

      - Objects do not contain cyclic references, so they are closed and destructed timely when dropped.

    Method create

      `void SSL.sslfile(Stdio.File stream, SSL.context ctx, int|void is_client, int|void is_blocking)`

    Description

      Create a connection over stream , which should be an open socket or pipe. ctx is the SSL context. If is_client is set then a client-side connection is started, server-side otherwise. If is_blocking is set then the stream is initially set in blocking mode, nonblocking mode otherwise.

      The backend used by stream is taken over and restored after the connection is closed (see close ). The callbacks and id in stream are overwritten.

    Method get_peer_certificate_info

      `mapping get_peer_certificate_info()`

    Description

      returns peer certificate information, if any.

    Method get_peer_certificates

      `array get_peer_certificates()`

    Description

      returns the peer certificate chain, if any.

    Method close

      `int close(void|string how, void|int clean_close, void|int dont_throw)`

    Description

      Close the connection. Both the read and write ends are always closed - the argument how is only for Stdio.File compatibility and must be either `"rw"` or `0`.

      If clean_close is set then close messages are exchanged to shut down the SSL connection but not the underlying stream. It may then continue to be used for other communication afterwards. The default is to send a close message and then close the stream without waiting for a response.

      I/O errors are normally thrown, but that can be turned off with dont_throw . In that case errno is set instead and 0 is returned. 1 is always returned otherwise. It's not an error to close an already closed connection.

    Note

      In nonblocking mode the stream might not be closed right away and the backend might be used for a while afterwards. This means that if there's an I/O problem it might not be signalled immediately by close .

    Note

      I/O errors from both reading and writing might occur in blocking mode.

    Note

      If a clean close is requested and data following the close message is received at the same time, then this object will read it and has no way to undo that. That data can be retrieved with read afterwards.

    Method shutdown

      `Stdio.File shutdown()`

    Description

      Shut down the SSL connection without sending any more packets. The underlying stream is returned if the connection isn't shut down already and if a nonclean close hasn't been requested.

    Method destroy

      `void destroy()`

    Description

      Try to close down the connection properly since it's customary to close files just by dropping them. No guarantee can be made that the close packet gets sent successfully though, because we can't risk blocking I/O here. You should call close explicitly.

    Method read

      `string read(void|int length, void|int(0..1) not_all)`

    Description

      Read some (decrypted) data from the connection. Works like Stdio.File.read .

    Note

      I/O errors from both reading and writing might occur in blocking mode.

    Method write

      `int write(string|array(string) data, mixed ... args)`

    Description

      Write some (unencrypted) data to the connection. Works like Stdio.File.write except that this function often buffers some data internally, so there's no guarantee that all the consumed data has been successfully written to the stream in nonblocking mode. It keeps the internal buffering to a minimum, however.

    Note

      This function returns zero if attempts are made to write data during the handshake phase and the mode is nonblocking.

    Note

      I/O errors from both reading and writing might occur in blocking mode.

    Method renegotiate

      `int renegotiate()`

    Description

      Renegotiate the connection by starting a new handshake. Note that the accept callback will be called again when the handshake is finished.

      Returns zero if there are any I/O errors. errno() will give the details.

    Note

      The read buffer is not cleared - a `read()` afterwards will return data from both before and after the renegotiation.

    Bugs

      Data in the write queue in nonblocking mode is not properly written before resetting the connection. Do a blocking `write("")` first to avoid problems with that.

    Method set_callbacks

      `void set_callbacks(void|function(mixed:int) read, void|function(mixed:int) write, void|function(mixed:int) close, void|function(mixed:int) read_oob, void|function(mixed:int) write_oob, void|function(void|mixed:int) accept)`

    Description

      Installs all the specified callbacks at once. Use UNDEFINED to keep the current setting for a callback.

      Like set_nonblocking , the callbacks are installed atomically. As opposed to set_nonblocking , this function does not do anything with the stream, and it doesn't even have to be open.

    Bugs

      read_oob and write_oob are currently ignored.

    See also

      set_read_callback , set_write_callback , set_close_callback , aet_accept_callback , query_callbacks

    Method set_nonblocking

      `void set_nonblocking(void|function(void|mixed:int) read, void|function(void|mixed:int) write, void|function(void|mixed:int) close, void|function(void|mixed:int) read_oob, void|function(void|mixed:int) write_oob, void|function(void|mixed:int) accept)`

    Description

      Set the stream in nonblocking mode, installing the specified callbacks. The alert callback isn't touched.

    Note

      Prior to version 7.5.12, this function didn't set the accept callback.

    Bugs

      read_oob and write_oob are currently ignored.

    Method set_nonblocking_keep_callbacks

      `void set_nonblocking_keep_callbacks()`

    Description

      Set nonblocking mode like set_nonblocking , but don't alter any callbacks.

    Method set_blocking

      `void set_blocking()`

    Description

      Set the stream in blocking mode. All but the alert callback are zapped.

    Note

      There might be some data still waiting to be written to the stream. That will be written in the next blocking call, regardless what it is.

    Note

      This function doesn't solve the case when the connection is used nonblocking in some backend thread and another thread switches it to blocking and starts using it. To solve that, put a call out in the backend from the other thread that switches it to blocking, and then wait until that call out has run.

    Note

      Prior to version 7.5.12, this function didn't clear the accept callback.

    Method set_blocking_keep_callbacks

      `void set_blocking_keep_callbacks()`

    Description

      Set blocking mode like set_blocking , but don't alter any callbacks.

    Method errno

      `int errno()`

    Method set_alert_callback

      `void set_alert_callback(function(object:void) alert)`

    Description

      Install a function that will be called when an alert packet is received. It doesn't affect the callback mode - it's called both from backends and from within normal function calls like read and write .

    Note

      This object is part of a cyclic reference whenever this is set, just like setting any other callback.

    Method query_alert_callback

      `function(object:void) query_alert_callback()`

    Method set_accept_callback

      `void set_accept_callback(function(void|object:int) accept)`

    Description

      Install a function that will be called when the handshake is finished and the connection is ready for use.

      The callback function will be called with the sslfile object and the additional id arguments (set with set_id ).

    Note

      Like the read, write and close callbacks, installing this callback implies callback mode, even after the handshake is done.

    Method query_accept_callback

      `function(void|object:int) query_accept_callback()`

    Method set_read_callback

      `void set_read_callback(function(void|mixed:int) read)`

    Description

      Install a function to be called when data is available.

    Method query_read_callback

      `function(void|mixed:int) query_read_callback()`

    Method set_write_callback

      `void set_write_callback(function(void|mixed:int) write)`

    Description

      Install a function to be called when data can be written.

    Method query_write_callback

      `function(void|mixed:int) query_write_callback()`

    Method set_close_callback

      `void set_close_callback(function(void|mixed:int) close)`

    Description

      Install a function to be called when the connection is closed, either normally or due to an error (use errno to retrieve it).

    Method query_close_callback

      `function(void|mixed:int) query_close_callback()`

    Method set_id

      `void set_id(mixed id)`

    Method query_id

      `mixed query_id()`

    Method set_backend

      `void set_backend(Pike.Backend backend)`

    Description

      Set the backend used for the file callbacks.

    Method query_backend

      `Pike.Backend query_backend()`

    Description

      Return the backend used for the file callbacks.

    Method query_address

      `string query_address(int|void arg)`

    Method is_open

      `int is_open()`

    Description

      Return nonzero if the stream currently is open, zero otherwise. This function does nonblocking I/O to check for a close packet in the input buffer.

    Method query_stream

      `Stdio.File query_stream()`

    Description

      Return the underlying stream.

    Note

      Avoid any temptation to do `destruct(sslfile_obj->query_stream())`. That almost certainly creates more problems than it solves.

    Method query_connection

      `SSL.connection query_connection()`

    Description

      Return the SSL connection object.

    Method query_context

      `SSL.context query_context()`

    Description

      Return the SSL context object.

  CLASS SSL.alert

    Description

      Alert package.

    Inherit packet

      inherit .packet : packet

    Method create

      `void SSL.alert(int level, int description, int version, string|void message, mixed|void trace)`

  Module SSL.Constants

    Description

      Protocol constants

    ENUM SSL.Constants.KeyExchangeType

      Description

        Key exchange methods.

      Constant KE_rsa

        `constant SSL.Constants.KE_rsa`

      Description

        Rivest-Shamir-Adelman

      Constant KE_dh

        `constant SSL.Constants.KE_dh`

      Description

        Diffie-Hellman

    ENUM SSL.Constants.CompressionType

      Description

        Compression methods.

      Constant COMPRESSION_null

        `constant SSL.Constants.COMPRESSION_null`

      Description

        No compression.

  Module SSL.Cipher

    Description

      Encryption and MAC algorithms used in SSL.

    Method prf

      `string prf(string secret, string label, string seed, int len)`

    Method rsa_sign

      `ADT.struct rsa_sign(object context, string cookie, ADT.struct struct)`

    Method rsa_verify

      `int(0..1) rsa_verify(object context, string cookie, ADT.struct struct, Gmp.mpz signature)`

    Method dsa_sign

      `ADT.struct dsa_sign(object context, string cookie, ADT.struct struct)`

    Method anon_sign

      `ADT.struct anon_sign(object context, string cookie, ADT.struct struct)`

    CLASS SSL.Cipher.CipherAlgorithm

      Description

        Cipher algorithm interface.

      Method set_encrypt_key
      Method set_decrypt_key

        `this_program set_encrypt_key(string)`
        `this_program set_decrypt_key(string)`

      Description

        Set the key used for encryption/decryption, and enter encryption mode.

      Method block_size

        `int(0..) block_size()`

      Description

        Return the block size for this crypto.

    CLASS SSL.Cipher.MACAlgorithm

      Description

        Message Authentication Code interface.

    CLASS SSL.Cipher.CipherSpec

      Description

        Cipher specification.

    CLASS SSL.Cipher.MACsha

      Description

        MAC using SHA.

      Method hash_raw

        `string hash_raw(string data)`

      Method hash

        `string hash(object packet, Gmp.mpz seq_num)`

      Method hash_master

        `string hash_master(string data, string|void s)`

      Method create

        `void SSL.Cipher.MACsha(string|void s)`

    CLASS SSL.Cipher.MACmd5

      Description

        MAC using MD5.

      Inherit MACsha

        inherit MACsha : MACsha

    CLASS SSL.Cipher.MAChmac_sha

      Method hash

        `string hash(object packet, Gmp.mpz seq_num)`

      Method create

        `void SSL.Cipher.MAChmac_sha(string|void s)`

    CLASS SSL.Cipher.MAChmac_md5

      Inherit MAChmac_sha

        inherit MAChmac_sha : MAChmac_sha

      Method create

        `void SSL.Cipher.MAChmac_md5(string|void s)`

    CLASS SSL.Cipher.DES

      Inherit CBC

        inherit Crypto.CBC : CBC

    CLASS SSL.Cipher.DES3

      Inherit CBC

        inherit Crypto.CBC : CBC

    CLASS SSL.Cipher.DHParameters

      Description

        Diffie-Hellman parameters.

        `Gmp.mpz SSL.Cipher.DHParameters.p`
        `Gmp.mpz SSL.Cipher.DHParameters.g`
        `Gmp.mpz SSL.Cipher.DHParameters.order`

Module Languages

  Module Languages.PLIS

    Description

      PLIS, Permuted Lisp. A Lisp language somewhat similar to scheme.

    Method init_specials

      `void init_specials(Environment environment)`

    Description

      Adds the special functions quote, set!, setq, while, define, defmacro, lambda, if, and, or, begin and catch to the environment .

    Method init_functions

      `void init_functions(Environment environment)`

    Description

      Adds the functions +, *, -, =, <, >, concat, read-string, eval, apply, global-environment, var, cdr, null?, setcar!, setcdr!, cons and list to the environment .

    Method default_environment

      `Environment default_environment()`

    Description

      Creates a new environment on which it runs init_functions, init_specials and the following boot code.

      (begin (defmacro (cddr x) (list (quote cdr) (list (quote cdr) x))) (defmacro (cadr x) (list (quote car) (list (quote cdr) x))) (defmacro (cdar x) (list (quote cdr) (list (quote car) x))) (defmacro (caar x) (list (quote car) (list (quote car) x)))

      (defmacro (when cond . body) (list (quote if) cond (cons (quote begin) body)))

      (define (map fun list) (if (null? list) (quote ()) (cons (fun (car list)) (map fun (cdr list)))))

      (defmacro (let decl . body) (cons (cons (quote lambda) (cons (map car decl) body)) (map cadr decl))))

  Method main

    `void main()`

  Description

    Instantiates a copy of the default environment and starts an interactive main loop that connects to standard I/O. The main loop is as follows:

    (begin (define (loop) (let ((line (read-line \"PLIS: \"))) (if line (let ((res (catch (eval (read-string line) (global-environment))))) (display res) (loop))))) (loop))

Module GLUE

  Description

    GL Universal Environment

  Method get_drivers

    `array(string) get_drivers()`

  Description

    Returns the name of the available drivers.

  See also

    init

  Method add_reinit_callback

    `void add_reinit_callback(function(void:void) f)`

  Description

    Add a callback that will be called every time the resolution is about to change.

  See also

    remove_reinit_callback

  Method remove_reinit_callback

    `void remove_reinit_callback(function(void:void) f)`

  Description

    Removes a reinitialization callback.

  See also

    add_reinit_callback

  Method has_extension

    `int(0..1) has_extension(string ext)`

  Description

    Checks if the GL extension ext is currently supported.

  Method get_screen_mode

    `int(0..1) get_screen_mode()`

  Description

    Returns 1 if in fullscreen mode, otherwise 0.

  See also

    toggle_fullscreen

  Method toggle_fullscreen

    `void toggle_fullscreen(void|int(0..1) _fullscreen)`

  Description

    Toggles between fullscreen and window mode. If a screen mode is provided, that mode will be assumed.

  See also

    get_screen_mode

  Method get_gl_flags

    `int get_gl_flags()`

  Description

    Returns the GL flags currently used.

  See also

    set_gl_flags

  Method set_gl_flags

    `void set_gl_flags(int _gl_flags)`

  Description

    Sets the GL flags.

  See also

    get_gl_flags

  Method get_depth

    `int get_depth()`

  Description

    Returns the current color depth.

  See also

    set_depth

  Method set_depth

    `void set_depth(int _depth)`

  Description

    Sets the color depth.

  See also

    get_depth

  Method xsize
  Method ysize

    `int xsize()`
    `int ysize()`

  Description

    Returns the screen width/height.

  See also

    set_resolution

  Method set_resolution

    `void set_resolution(int w, int h)`

  Description

    Sets the resolution to w xh pixels.

  See also

    xsize , ysize

  Method get_aspect

    `float get_aspect()`

  Description

    Returns the screen aspect.

  See also

    set_aspect

  Method set_aspect

    `void set_aspect(float asp)`
    `void set_aspect(int w, int h)`

  Description

    Set the aspect of the draw area. Does nothing if the provided aspect is equal to the one currently used.

  See also

    get_aspect

  Method set_screen_rotation

    `void set_screen_rotation(float deg)`

  Description

    Rotates the drawing area deg degrees. Useful e.g. when drawing for tilted monitors.

  Method mirror_screen

    `void mirror_screen(string how)`

  Description

    Mirrors the screen in x and/or y axis. Useful e.g. when drawing for backlight projection.

  Parameter `how`

    A string that contains the mirror axis, e.g. `"x"` or `"xy"`.

  Method init

    `void init(void|mapping(string:mixed) options)`

  Description

    Initializes GLUE and loads a driver from a list of drivers. If a driver fails to load or initialize, the next driver is tried.

  Throws

    driver_names not listed in the result from get_drivers will cause an error to be thrown.

  Parameter `options`

    `"driver_names" : string|array(string)` | The name of a driver or a list of drivers to try, in given order. If no driver name is given, the list given by get_drivers is used.
    `"event_callback" : function(.Events.Event:void)` | This callback is called with a Events.Event object whenever an event is trapped by the driver. If no event callback is given, a callback that calls `exit(0)` on Escape and Exit events is used.
    `"resize_callback" : function(float:void)` | This callback is called with the aspect whenever the drawing area is resized, either by an event or explicitly by the program.
    `"fullscreen" : int(0..1)` | Set fullscreen/window mode. 1 is fullscreen, 0 is window. Defaults to fullscreen.
    `"resolution" : array(int)` | Sets the resolution of the drawing area. Defaults to ({ 800, 600 }).
    `"aspect" : float` | Sets the aspect of the drawing area. Defaults to 1.333333 (4:3).
    `"depth" : int` | Sets the color depth of the drawing area. Defaults to 32.
    `"title" : string` | Sets the window title to this string.
    `"icon_title" : string` | Sets the icon title to this string.
    `"fast_mipmap" : int(0..1)` | Use GL_NEAREST_MIMAP_NEAREST instead of GL_LINEAR_MIPMAP_LINEAR, which also is the default.
    `"rotation" : float` | The rotation in z-axis of the drawing field.
    `"mirror" : string` | Mirroring in x and/or y axis.

  See also

    get_drivers

  Method swap_buffers

    `void swap_buffers()`

  Description

    Swap the drawing buffer and the viewing buffer.

  Method show_cursor

    `void show_cursor()`

  Description

    Show the mouse cursor.

  Method hide_cursor

    `void hide_cursor()`

  Description

    Hide the mouse cursor.

  Method allocate_light

    `int allocate_light()`

  Description

    Allocate a hardwareaccelerated lightsource from OpenGL.

  Returns

    an id which may be added to the GL.GL_LIGHT0 constant.

  See also

    free_light

  Method free_light

    `void free_light(int l)`

  Description

    Call this function to free a lightsource that has been allocated with allocate_light .

  Parameter `l`

    Id which has been allocated using allocate_light .

  See also

    allocate_light

  Method pushpop_depth

    `int(0..) pushpop_depth()`

  Description

    Returns the PushPop depth, i.e. the number of pushes awaiting corresponding pops.

  Method PushPop

    `void PushPop(function f)`

  Description

    Performs function f between GL.glPushMatrix and GL.glPopMatrix calls.

  Example

        PushPop() {
             GL.glTranslate( 0.01, -0.9, 0.0 );
             write_text( "Press esc to quit" );
           };

  Method get_all_lists

    `array(List) get_all_lists()`

  Description

    Returns all defined lists. Only available on Windows.

  Method only_dynlists

    `int(0..1) only_dynlists()`

  Description

    Returns `1` if all defined lists are DynList lists.

  Method make_texture

    `BaseTexture make_texture(mapping|Image.Image image, string|void name)`

  Description

    Create a texture. Mainly here for symetry with make_rect_texture

  See also

    Texture , make_rect_texture

  Method make_rect_texture

    `BaseTexture make_rect_texture(mapping|Image.Image image, string|void name)`

  Description

    Create a texture with the specified image as contents. Will try to use the TEXTURE_RECTANGLE_NV extension if available, otherwise normal textures will be used (like make_texture ).

  See also

    make_texture

  Method get_all_textures

    `array(BaseTexture) get_all_textures()`

  Description

    Returns a list of all current textures.

  Method get_texture_mem_usage

    `int get_texture_mem_usage()`

  Description

    Returns the number of bytes used by the textures.

  Method draw_line

    `void draw_line(float x0, float y0, float x1, float y1, Image.Color.Color c, void|float a)`
    `void draw_line(float x0, float y0, float z0, float x1, float y1, float z1, Image.Color.Color c, void|float a)`

  Method draw_obox

    `void draw_obox(float x0, float y0, float x1, float y1, array(Image.Color.Color)|Image.Color.Color c, void|array(float)|float a)`

  Description

    Draw a box outline around the specified coordinates. c is either a single color, in which case it will be used for all corners, or an array of four colors, which will be used for each corner.

    a is similar to c , but is the alpha values for each coordinate.

  Method draw_box

    `void draw_box(float x0, float y0, float x1, float y1, array(Image.Color.Color)|Image.Color.Color c, void|array(float)|float a)`

  Description

    Draw a box at the specified coordinates. c is either a single color, in which case it will be used for all corners, or an array of four colors, which will be used for each corner.

    a is similar to c , but is the alpha values for each coordinate.

  Method draw_polygon

    `void draw_polygon(array(float) coords, Image.Color.Color c, float a)`

  Method debug_stuff

    `mapping(string:mixed) debug_stuff()`

  Description

    Returns some internal states for debug purposes. The actual content may change.

  CLASS GLUE.List

    Description

      A display list abstraction. Automatically allocates a display list id upon creation and correctly deallocate it upon destruction.

    See also

      DynList

    Method create

      `void GLUE.List(void|function f)`

    Description

      When creating a new list, the list code can be compiled upon creation by supplying a function f that performs the GL operations.

    See also

      call

    Example

          List list = List() {
             // GL code
           };

    Method destroy

      `void destroy()`

    Description

      Deletes this list and frees the list id from the id pool.

    Method get_id

      `int get_id()`

    Description

      Returns this lists' id.

    Method `>

      `int(0..1) `>(mixed x)`

    Description

      List objects can be sorted according to list id.

    See also

      get_id

    Method begin

      `void begin(int(0..1)|void run)`

    Description

      Start defining the list. If run is provided, the list will be executed as it is compiled (GL.GL_COMPILE_AND_EXECUTE ).

    See also

      end , compile

    Method end

      `void end()`

    Description

      Finish the list definition.

    See also

      begin , compile

    Method compile

      `void compile(function f)`

    Description

      Compile a list be executing the list code f . Exceptions in f will be thrown after GL.glEndList has been called.

    See also

      begin

    Method call

      `void call()`

    Description

      Execute the commands in the list.

  CLASS GLUE.DynList

    Description

      A displaylist that is generated on demand.

    Note

      On Windows lists needs to be regenerated when the video driver mode is changed. Thus the DynList is to prefer over List , since regeneration is done automatically upon video mode change.

    Inherit List

      inherit List : List

    Method modeswitch

      `void modeswitch()`

    Description

      Called by videodriver when a video mode change occurs.

    Method set_generator

      `void set_generator(function _generator)`

    Description

      Sets a function which can generate a displaylist. Hint: Use implicit lambda...

    Method init

      `void init()`

    Description

      Generates the displaylist, ie calls the function set in set_generator . Called only when the display list needs to be generated.

    Method call

      `void call()`

    Description

      Call the displaylist, ie draw it.

    Method create

      `void GLUE.DynList(function|void f)`

    Description

      Create a new DynList object and optionally set a function that can generate the displaylist

    Parameter `f`

      Function which contains the GL commands that generates the displaylist.

  CLASS GLUE.BaseTexture

    Description

      The texture base class. Using e.g. Texture might be more convenient.

      `int GLUE.BaseTexture.t_width`
      `int GLUE.BaseTexture.t_height`

    Description

      Texture dimensions

      `int GLUE.BaseTexture.i_width`
      `int GLUE.BaseTexture.i_height`

    Description

      Image dimensions

      `float GLUE.BaseTexture.width_u`
      `float GLUE.BaseTexture.height_u`

    Description

      Utilization in percent.

    Variable texture_type

      `int GLUE.BaseTexture.texture_type`

    Description

      The texture type, e.g. GL.GL_TEXTURE_2D .

    Variable debug

      `string GLUE.BaseTexture.debug`

    Description

      A string to identify the texture.

    Method construct

      `void construct(int width, int height, int _alpha, mapping|void imgs, int(0..3)|void flags, int|void _mode, string|void debug_text)`

    Description

      Construct a new texture. Processes _alpha , _mode and debug_text and calls resize .

    Parameter `_alpha`

      The alpha mode the texture is operating in.

      `0` | RGB
      `1` | RGBA
      `2` | ALPHA
      `3` | LUM
      `4` | LUM+ALPHA

    Parameter `_mode`

      The mode the texture is operating in. Autoselected wrt _alpha if `0`.

    Parameter `debug_text`

      A string that can be used to identify this texture.

    Method create

      `void GLUE.BaseTexture(mixed ... args)`

    Description

      Calls construct with args .

    Method destroy

      `void destroy()`

    Description

      Properly deallocates the texture.

    Method resize

      `void resize(int width, int height, mapping|void imgs, int(0..3)|void flags, int(0..1)|void nocreate)`

    Description

      Resizes/creates a texture to meet the dimensions width and height . If nocreate isn't given, create_texture is called to actually perform the resize/creation.

    See also

      construct

    Method create_texture

      `void create_texture(mapping|void imgs, int(0..3)|void flags, int|void width, int|void height)`

    Description

      Actually creates the texture.

    Parameter `imgs`

      If zero, a black texture with the dimensions width * height will be generated. Otherwise imgs should be a mapping as follows.

      `"image" : Image.Image` | The actual image to be used as texture. It will be cropped/padded to meet the dimensions given in width and height .
      `"alpha" : Image.Image` | Optional image to be used as alpha channel, depending on the alpha value given to create /construct .

    Parameter `flags`

      If `1`, the texture will be mipmapped. If bit 1 (`2`) is set, texture will not be wrapped but clamped.

    Parameter `width`
    Parameter `height`

      The dimensions of the texture. If omitted the dimensions of the images in imgs will be used.

    See also

      resize

    Method make_mipmap

      `void make_mipmap(mapping imgs, int|void imode, int|void dx, int|void dy)`

    Description

      Renders a mipmap of the image/partial image imgs .

    Parameter `imgs`

      Image data mapping to feed GL.glTexImage2D or GL.glTexSubImage2D .

    Parameter `imode`

      Internal format to feed GL.glTexImage2D , or UNDEFINED for partial images.

    Parameter `dx`
    Parameter `dy`

      Xoffs, yoffs to feed GL.glTexSubImage2D for partial images.

    See also

      create_texture

    Method clear

      `void clear()`

    Description

      Clears the texture.

    Method paste

      `void paste(Image.Image i, Image.Image a, int x, int y)`

    Description

      Paste the image i with alpha channel a at coordinates x and y in the current texture.

    Method _sizeof

      `int _sizeof()`

    Description

      Returns the size of memory allocated by the texture.

    Method get_id

      `int get_id()`

    Description

      Returns the id of this texture.

    Method `>

      `int(0..1) `>(mixed x)`

    Description

      Textures can be sorted according to texture id.

    Method draw

      `void draw(float x, float y, float z, float w, float h)`

    Description

      Draw the texture at x ,y ,z with dimensions w *h .

    Method draw_region

      `void draw_region(float x, float y, float z, float w, float h, float s0, float q0, float ss, float qs)`

    Description

      Draw texture region s0 ,q0 - ss ,qs at x ,y ,z with dimensions w *h .

    Method use

      `void use()`

    Description

      Use the generated texture (GL.glBindTexture ).

    Method coords

      `void coords(float x, float y)`

    Description

      Sets the texture coordinates to x *width,y *height.

    Method set_image_data

      `void set_image_data(Image.Image|mapping(string:mixed) data, int(0..1)|void no_resize)`

    Description

      Set the contents (and size) of the texture from the supplied data. The data is identical to what would normally be sent as the last argument to glTex[Sub]Image2D() or an Image.Image object.

      If no_resize is specified, it is assumed that the data will fit in the texture, otherwise the parts that extend beyond it will be discarded.

    Parameter `data`

      Besides being an Image.Image object, data can be either of two types of mappins. First it can be a mapping with Image data.

      `"rgb" : Image.Image` | Texture image data.
      `"alpha" : Image.Image` | Optional alpha channel.
      `"luminance" : Image.Image` | Optional luminance channel.

      Second it can be a mapping pointing out a shared memory segment.

      `"mem" : System.Memory` | The shared memory segment.
      `"mem_w" : int` | The width and height of the memory segment.
      `"mem_h" : int`
      `"mem_format" : int` | The format of the memory segment, e.g. GL.GL_RGB .
      `"mem_type" : int` | The low level format of the memory segment, e.g. GL.GL_UNSIGNED_BYTE .

  CLASS GLUE.RectangleTexture

    Description

      Uses the NVidia RECT texture extension for non-power-of-two textures.

    Inherit BaseTexture

      inherit BaseTexture : BaseTexture

  CLASS GLUE.BaseDWIM

    Description

      A mixin class with a dwim create function.

    Method create

      `void GLUE.BaseDWIM(mixed ... args)`

    Description

      This create function has the following heuristic:

      If a mapping is encountered, the following information will be attempted to be extracted.

      `"image" : Image.Image` | The texture image.
      `"xsize" : int` | The image dimensions. If not provided, the dimensions of the `"image"` member will be used.
      `"ysize" : int`
      `"height" : int`
      `"width" : int`
      `"alpha" : int` | The alpha mode.
      `"mipmap" : int(0..1)` | Should the texture be mipmapped or not.
      `"clamp" : int(0..1)` | Should the texture be clamped or not.
      `"mode" : int` | The texture mode.
      `"debug" : string` | The debug name associated with this texture.

      If an object is encountered in the argument list, the first object will be used as texture image and the second as texture alpha.

      If a string is encountered in the argument list, it will be used as debug name associated with this texture.

      Once all mappings, strings and objects are removed from the argument list, the remaining integers will be interpreted as width, height, alpha, mipmap and mode, unless there is only one argument. In that case it will be interpreted as the alpha mode.

  CLASS GLUE.Texture

    Description

      Convenience version of the Texture class.

    Inherit BaseTexture

      inherit BaseTexture : BaseTexture

    Description

      Texture base

    Inherit BaseDWIM

      inherit BaseDWIM : BaseDWIM

    Description

      Convenience methods

  CLASS GLUE.RectangleDWIMTexture

    Description

      Convenience version of the RectangleTexture class.

    Inherit RectangleTexture

      inherit RectangleTexture : RectangleTexture

    Description

      Texture base

    Inherit BaseDWIM

      inherit BaseDWIM : BaseDWIM

    Description

      Convenience methods

  CLASS GLUE.Region

    Description

      A rectangle. Used by the text routines to avoid drawing outside the current region.

    syntax

      `float GLUE.Region.x`
      `float GLUE.Region.y`
      `float GLUE.Region.w`
      `float GLUE.Region.h` `void GLUE.Region(float x, float y, float w, float h)`

    Constant is_region

      `constant GLUE.Region.is_region`

    Description

      All region objects have this constant.

    Method move

      `void move(float xp, float yp)`

    Description

      Move the region xp units right and yp units down.

    Method resize

      `void resize(float xs, float ys)`

    Description

      Make the region xs units wider and ys units higher.

    Method outside

      `int(0..1) outside(Region R)`

    Description

      Returns 1 if the region R is fully outside this region.

    Method inside

      `int(0..1) inside(Region R)`

    Description

      Returns 1 if the region R is fully inside this region.

    Method `&

      `Region `&(mixed R)`

    Description

      Creates a new region with the intersection of this region and R .

  CLASS GLUE.Font

    Description

      A font.

    Method create

      `void GLUE.Font(Image.Fonts.Font f, float|void _scale_width, float|void _scale_spacing)`

    Method get_character

      `array(int|BaseTexture|Region) get_character(int c)`

    Description

      Returns the advance (in pixels), the texture and the texture coordinates for the specified character, or 0 if it's nonprintable.

    Note

      If the font->write call fails, the backtrace will be written to stderr.

    Method text_extents

      `array(float) text_extents(string text, float h)`

    Description

      Get the width and height of the area that the string text in size h would cover.

    Method write_now

      `array(float) write_now(string text, float h, void|float|Region roi, string|void align)`

    Description

      Write the text in size [h], possibly restricted by region roi . Return the width and height of the resulting text area. If roi is a float, `Region(0.0, 0.0, roi, 10000.0)` will be used.

    Method write

      `array(List|float) write(string text, float h, void|float|Region roi, string|void align)`

    Description

      Create a display list that writes text.

    Parameter `text`

      The text to write.

    Parameter `h`

      The font height

    Parameter `roi`

      The region, if supplied, to restrict writing to.

    Parameter `align`

      The text justification; "left" (default), "center" or "right".

    CLASS GLUE.Font.Character

      Description

        A character to draw.

      Inherit Region

        inherit Region : Region

      Variable pos

        `Region GLUE.Font.Character.pos`

      Description

        Character position in texture txt .

      Variable txt

        `BaseTexture GLUE.Font.Character.txt`

      Description

        Texture holding the character.

      Variable slice

        `Region GLUE.Font.Character.slice`

      Description

        Slice of character to be shown.

      Method set_data

        `void set_data(Region _pos, BaseTexture _txt, void|Region _slice)`

      Description

        Set character to be region _slice of region _pos of texture _txt .

      Method draw

        `void draw()`

      Description

        Draw the character using the texture txt with the texture-coordinates indicated in pos , possible cropped with slice .

  CLASS GLUE.SquareMesh

    Description

      A mesh of squares.

    Method recalculate

      `void recalculate()`

    Description

      Recalculate the mesh.

    Method surface_normal

      `Math.Matrix surface_normal(int x, int y)`

    Description

      Return the normal for the surface at coordinates x,y. Used internally.

    Method set_texture

      `void set_texture(BaseTexture tex)`

    Description

      Set a texture to be mapped on the mesh.

    Method draw

      `void draw()`

    Description

      Draw the mesh.

    Method set_lighting

      `void set_lighting(int(0..1) do_lighting)`

    Description

      Indicate whether or not lighting is used. If it is, the normals of each vertex will be calculated as well as the coordinates.

    Method set_size

      `void set_size(int x, int y)`

    Description

      Set the size of the mesh

    Method create

      `void GLUE.SquareMesh(function(float:Math.Matrix) calculator)`

    Description

      The calculator will be called for each corner and should return a 1x3 matrix describing the coordinates for the given spot om the surface.

  Module GLUE.Events

    Description

      GLUE Event abstraction.

    Constant _SHFT

      `constant GLUE.Events._SHFT`

    Description

      Integer constant representing shift.

    Constant _CTRL

      `constant GLUE.Events._CTRL`

    Description

      Integer constant representing control.

    Constant _ALT

      `constant GLUE.Events._ALT`

    Description

      Integer constant representing alternate.

    Constant KNOWN_MODIFIERS

      `constant GLUE.Events.KNOWN_MODIFIERS`

    Description

      Integer constant with the union of all known modifiers, i.e. `_SHFT | _CTRL | _ALT`.

    Method CTRL

      `Event CTRL(int|Event X)`
      `array(Event) CTRL(array(int|Event) X)`

    Description

      Adds the _CTRL modifier to an Event , key or array of Events and/or keys.

    Method SHFT

      `Event SHFT(int|Event X)`
      `array(Event) SHFT(array(int|Event) X)`

    Description

      Adds the _SHFT modifier to an Event , key or array of Events and/or keys.

    Method ALT

      `Event ALT(int|Event X)`
      `array(Event) ALT(array(int|Event) X)`

    Description

      Adds the _ALT modifier to an Event , key or array of Events and/or keys.

      `constant GLUE.Events.BACKSPACE`
      `constant GLUE.Events.DELETE`
      `constant GLUE.Events.TAB`
      `constant GLUE.Events.F1`
      `constant GLUE.Events.F2`
      `constant GLUE.Events.F3`
      `constant GLUE.Events.F4`
      `constant GLUE.Events.F5`
      `constant GLUE.Events.F6`
      `constant GLUE.Events.F7`
      `constant GLUE.Events.F8`
      `constant GLUE.Events.F9`
      `constant GLUE.Events.F10`
      `constant GLUE.Events.F11`
      `constant GLUE.Events.F12`
      `constant GLUE.Events.ESCAPE`
      `constant GLUE.Events.UP`
      `constant GLUE.Events.DOWN`
      `constant GLUE.Events.LEFT`
      `constant GLUE.Events.RIGHT`
      `constant GLUE.Events.PGUP`
      `constant GLUE.Events.PGDWN`
      `constant GLUE.Events.ENTER`
      `constant GLUE.Events.SPACE`
      `constant GLUE.Events.HOME`
      `constant GLUE.Events.END`
      `constant GLUE.Events.PAUSE`
      `constant GLUE.Events.INSERT`
      `constant GLUE.Events.SCROLL_LOCK`
      `constant GLUE.Events.SYS_REQ`
      `constant GLUE.Events.PRINT_SCRN`
      `constant GLUE.Events.CAPSLOCK`
      `constant GLUE.Events.MENU`
      `constant GLUE.Events.NUMLOCK`
      `constant GLUE.Events.A`
      `constant GLUE.Events.B`
      `constant GLUE.Events.C`
      `constant GLUE.Events.D`
      `constant GLUE.Events.E`
      `constant GLUE.Events.F`
      `constant GLUE.Events.G`
      `constant GLUE.Events.H`
      `constant GLUE.Events.I`
      `constant GLUE.Events.J`
      `constant GLUE.Events.K`
      `constant GLUE.Events.L`
      `constant GLUE.Events.M`
      `constant GLUE.Events.N`
      `constant GLUE.Events.O`
      `constant GLUE.Events.P`
      `constant GLUE.Events.Q`
      `constant GLUE.Events.R`
      `constant GLUE.Events.S`
      `constant GLUE.Events.T`
      `constant GLUE.Events.U`
      `constant GLUE.Events.V`
      `constant GLUE.Events.W`
      `constant GLUE.Events.X`
      `constant GLUE.Events.Y`
      `constant GLUE.Events.Z`

    Description

      Numeric constant representing a key.

      `constant GLUE.Events.BUTTON_1`
      `constant GLUE.Events.BUTTON_2`
      `constant GLUE.Events.BUTTON_3`
      `constant GLUE.Events.BUTTON_4`
      `constant GLUE.Events.BUTTON_5`

    Description

      Numeric constant representing a mouse button.

      `constant GLUE.Events.MOUSE_UP`
      `constant GLUE.Events.MOUSE_DOWN`
      `constant GLUE.Events.MOUSE_LEFT`
      `constant GLUE.Events.MOUSE_RIGHT`
      `constant GLUE.Events.MOUSE_ABS`

    Description

      Numeric constant representing a mouse movement.

      `constant GLUE.Events.LSHIFT`
      `constant GLUE.Events.RSHIFT`
      `constant GLUE.Events.LCTRL`
      `constant GLUE.Events.RCTRL`
      `constant GLUE.Events.LALT`
      `constant GLUE.Events.RALT`

    Description

      Numeric constant representing a modifier key.

    Constant MODIFIERS

      `constant GLUE.Events.MODIFIERS`

    Description

      Mapping that maps a modifier key to any of the symbolic modifiers _SHFT , _CTRL and _ALT .

    Constant EXIT

      `constant GLUE.Events.EXIT`

    Description

      Numeric constant representing an exit event.

    Constant key_names

      `constant GLUE.Events.key_names`

    Description

      Mapping that maps key identifiers with a printable name, e.g. LSHIFT to `"Left shift"`.

    Method is_modifier

      `int(0..1) is_modifier(int k)`

    Description

      Returns `1` if the key code k is a modifier key, e.g. LSHIFT or RSHIFT .

    CLASS GLUE.Events.Event

      Description

        Contains an event.

      Method dup

        `this_program dup()`

      Description

        Returns a copy of this Event object.

      Variable pressure

        `float GLUE.Events.Event.pressure`

      Description

        The pressure of the key stroke. A value between 0.0 and 1.0. Unknown values are represented as 0.

      Variable press

        `int(0..1) GLUE.Events.Event.press`

      Description

        Press event or release event.

      Method create

        `void GLUE.Events.Event(int|void _key, int(0..1)|void _press, string|void _data, int|void _modifiers, float|void pressure)`

Module Cache

  CLASS Cache.cache

    Description

      This module serves as a front-end to different kinds of caching systems. It uses two helper objects to actually store data, and to determine expiration policies. Mechanisms to allow for distributed caching systems will be added in time, or at least that is the plan.

    Method lookup

      `mixed lookup(string key)`

    Description

      Looks in the cache for an element with the given key and, if available, returns it. Returns 0 if the element is not available

    Method alookup

      `void alookup(string key, function(string:void) callback, int|float timeout, mixed ... args)`

    Description

      Asynchronously look the cache up. The callback will be given as arguments the key, the value, and then any user-supplied arguments. If the timeout (in seconds) expires before any data could be retrieved, the callback is called anyways, with 0 as value.

    Method store

      `void store(string key, mixed value, void|int max_life, void|float preciousness, void|multiset(string) dependants)`

    Description

      Sets some value in the cache. Notice that the actual set operation might even not happen at all if the set data doesn't make sense. For instance, storing an object or a program in an SQL-based backend will not be done, and no error will be given about the operation not being performed.

      Notice that while max_life will most likely be respected (objects will be garbage-collected at pre-determined intervals anyways), the preciousness . is to be seen as advisory only for the garbage collector If some data was stored with the same key, it gets returned. Also notice that max_life is relative and in seconds. dependants are not fully implemented yet. They are implemented after a request by Martin Stjerrholm, and their purpose is to have some weak form of referential integrity. Simply speaking, they are a list of keys which (if present) will be deleted when the stored entry is deleted (either forcibly or not). They must be handled by the storage manager.

    Method delete

      `void delete(string key, void|int(0..1) hard)`

    Description

      Forcibly removes some key. If the 'hard' parameter is supplied and true, deleted objects will also have their lfun::destroy method called upon removal by some backends (i.e. memory)

    Method start_cleanup_cycle

      `void start_cleanup_cycle()`

    Method async_cleanup_cache

      `void async_cleanup_cache()`

    Method threaded_cleanup_cycle

      `void threaded_cleanup_cycle()`

    Method create

      `void Cache.cache(Cache.Storage.Base storage_mgr, Cache.Policy.Base policy_mgr, void|int cleanup_cycle_delay)`

    Description

      Creates a new cache object. Required are a storage manager, and an expiration policy object.

  Module Cache.Policy

    CLASS Cache.Policy.Base

      Description

        Base class for cache expiration policies.

      Method expire

        `void expire(Cache.Storage.Base storage)`

      Description

        Expire callback.

        This function is called to expire parts of storage .

      Note

        All Storage.Policy classes must MUST implement this method.

    CLASS Cache.Policy.Timed

      Description

        An access-time-based expiration policy manager.

      Inherit Base

        inherit Cache.Policy.Base : Base

  Module Cache.Storage

    CLASS Cache.Storage.Base

      Description

        Base class for cache storage managers.

        All Cache.Storage managers must provide these methods.

      Method first
      Method next

        `int(0..0)|string first()`
        `int(0..0)|string next()`

      Description

        These two functions are an iterator over the cache. There is an internal cursor, which is reset by each call to first() . Subsequent calls to next() will iterate over all the contents of the cache.

        These functions are not meant to be exported to the user, but are solely for the policy managers' benefit.

      Method set

        `void set(string key, mixed value, void|int max_life, void|float preciousness, void|multiset(string) dependants)`

      Description

        Data-object creation is performed here if necessary, or in get() depending on the backend.

        This allows the storage managers to have their own data class implementation.

      Method get

        `int(0..0)|Cache.Data get(string key, void|int(0..1) notouch)`

      Description

        Fetch some data from the cache synchronously.

      Note

        Be careful, as with some storage managers it might block the calling thread for some time.

      Method aget

        `void aget(string key, function(string:void) callback, mixed ... extra_callback_args)`

      Description

        Fetch some data from the cache asynchronously.

        callback() will get as first argument key , and as second argument `0` (cache miss) or an Cache.Data object, plus any additional argument that the user may have supplied.

      Method delete

        `mixed delete(string key, void|int(0..1) hard)`

      Description

        Delete the entry specified by key from the cache (if present).

        If hard is `1`, some backends may force a destruct() on the deleted value.

        Dependants (if present) are automatically deleted.

      Returns

        Returns the deleted entry.

Module Calendar_I

  Description

    This module exist only for backwards compatibility issues with earlier Pike releases. Use the Calendar module instead.

    This code can be used to simulate the old calendar for now (it might be removed in later Pike's):

    This module has been totally rewritten in Pike 7.1+. To be forward compatible the lazy way, you can do something like this, though:

    #if constant(Calendar.II) #define Calendar Calendar_I #endif ... import Calendar or whatever ...

  This module implements calendar calculations, and base classes for time units.

CLASS Calendar_I._TimeUnit

  Description

    Base class for units of time.

  Method lesser

    `array(string) lesser()`

  Description

    Gives a list of methods to get lesser (shorter) time units. ie, for a month, this gives back `({"day"})` and the method `day(mixed n)` gives back that day object. The method `days()` gives back a list of possible argument values to the method `day`. Concurrently, `Array.map(o->days(),o->day)` gives a list of day objects in the object `o`.

    Ie:

        	  array(string) lesser()    - gives back a list of possible xxx's.
        	  object xxxs()             - gives back a list of possible n's.
        	  object xxx(mixed n)       - gives back xxx n
        	  object xxx(object(Xxx) o) - gives back the corresponing xxx

    The list of n's (as returned from xxxs) are always in order.

    There are two n's with special meaning, 0 and -1. 0 always gives the first xxx, equal to `my_obj->xxx(my_obj->xxxs()[0])`, and -1 gives the last, equal to `my_obj->xxx(my_obj->xxxs()[-1])`.

    To get all xxxs in the object, do something like `Array.map(my_obj->xxxs(),my_obj->xxx)`.

    xxx(object) may return zero, if there was no correspondning xxx.

  Method greater

    `array(string) greater()`

  Description

    Gives a list of methods to get greater (longer) time units from this object. For a month, this gives back `({"year"})`, thus the method `month->year()` gives the year object.

  Method next
  Method prev
  Method `+
  Method `-

    `object next()`
    `object prev()`
    `object `+(int n)`
    `object `-(int n)`
    `object `-(object x)`

  Description

    next() and prev() give the logical next and previous object. The `+() operator gives that logical relative object, ie `my_day+14` gives 14 days ahead. `-() works the same way, but can also take an object of the same type and give the difference as an integer.

Module Calendar_I.Stardate

  Description

    time unit: TNGDate

  CLASS Calendar_I.Stardate.TNGDate

    Description

      Implements ST:TNG stardates. Can be used as create argument to Day.

    Inherit _TimeUnit

      inherit Calendar_I._TimeUnit : _TimeUnit

Module Calendar_I.Gregorian

  Description

    time units: Year , Month , Week , Day

  Method parse

    `object parse(string fmt, string arg)`

  Description

    Parse a date, create relevant object fmt is in the format "abc%xdef..." where abc and def is matched, and %x is one of those time units: %Y absolute year %y year (70-99 is 1970-1999, 0-69 is 2000-2069) %M month (number, name or short name) (needs %y) %W week (needs %y) %D date (needs %y, %m) %a day (needs %y) %e weekday (needs %y, %w) %h hour (needs %d, %D or %W) %m minute (needs %h) %s second (needs %s)

  Method datetime

    `mapping(string:int) datetime(int|void unix_time, int|void skip_extra)`

  Description

    Replacement for localtime.

  Method datetime_name

    `string datetime_name(int|void unix_time)`

  Description

    Replacement for ctime.

  Method datetime_short_name

    `string datetime_short_name(int|void unix_time)`

  Description

    Replacement for ctime.

  CLASS Calendar_I.Gregorian.Year

    Description

      A Calendar_I.time_unit

      Lesser units: Month , Week , Day Greater units: none

    Inherit _TimeUnit

      inherit _TimeUnit : _TimeUnit

Module Web

  CLASS Web.RDF

    Description

      Represents an RDF domain which can contain any number of complete statements.

    Variable rdf_Statement

      `RDFResource Web.RDF.rdf_Statement`

    Description

      Statement resource.

    Variable rdf_predicate

      `RDFResource Web.RDF.rdf_predicate`

    Description

      predicate resource.

    Variable rdf_subject

      `RDFResource Web.RDF.rdf_subject`

    Description

      subject resource.

    Variable rdf_object

      `RDFResource Web.RDF.rdf_object`

    Description

      object resource.

    Variable rdf_type

      `RDFResource Web.RDF.rdf_type`

    Description

      type resource.

    Variable rdf_Seq

      `RDFResource Web.RDF.rdf_Seq`

    Description

      Seq resource.

    Variable rdf_first

      `RDFResource Web.RDF.rdf_first`

    Description

      first resource.

    Variable rdf_rest

      `RDFResource Web.RDF.rdf_rest`

    Description

      rest resource.

    Variable rdf_nil

      `RDFResource Web.RDF.rdf_nil`

    Description

      nil resource.

    Method add_statement

      `this_program add_statement(Resource|string|multiset(string) subj, Resource|string|multiset(string) pred, Resource|string|multiset(string) obj)`

    Description

      Adds a statement to the RDF set. If any argument is a string, it will be converted into a LiteralResource . If any argument is a multiset with one string in it, it will be converted into a URIResource .

    Throws

      Throws an exception if any argument couldn't be converted into a Resouce object.

    Method has_statement

      `int(0..1) has_statement(Resource subj, Resource pred, Resource obj)`

    Description

      Returns 1 if the RDF domain contains the relation {subj, pred, obj}, otherwise 0.

    Method remove_statement

      `int(0..1) remove_statement(Resource subj, Resource pred, Resource obj)`

    Description

      Removes the relation from the RDF set. Returns 1 if the relation did exist in the RDF set.

    Method reify_low

      `Resource reify_low(Resource subj, Resource pred, Resource obj)`

    Description

      Reifies the statement `{ pred, subj, obj }` and returns the resource that denotes the reified statement. There will not be any check to see if the unreified statement is already in the domain, making it possible to define the relation twice. The original statement will not be removed.

    Returns

      The subject of the reified statement.

    Method get_reify

      `Resource get_reify(Resource subj, Resource pred, Resource obj)`

    Description

      Returns a resource that is the subject of the reified statement {subj, pred, obj}, if such a resource exists in the RDF domain.

    Method reify

      `Resource reify(Resource subj, Resource pred, Resource obj)`

    Description

      Returns the result of get_reify , if any. Otherwise calls reify_low followed by remove_statement of the provided statement {subj, pred, obj}.

    Returns

      The subject of the reified statement.

    Method dereify

      `int(0..1) dereify(Resource r)`

    Description

      Turns the reified statement r into a normal statement, if possible.

    Returns

      1 for success, 0 for failure.

    Method dereify_all

      `int(0..) dereify_all()`

    Description

      Dereifies as many statements as possible. Returns the number of dereified statements.

    Method get_properties

      `array(Resource) get_properties()`

    Description

      Returns all properties in the domain, e.g. all resources that has been used as predicates.

    Method get_subject_map

      `mapping(Resource:mapping(Resource:array(Resource))) get_subject_map()`

    Description

      Returns a mapping with all the domains subject resources as indices and a mapping with that subjects predicates and objects as value.

    Method get_resource

      `URIResource get_resource(string uri)`

    Description

      Returns an RDF resource with the given URI as identifier, or zero.

    Method make_resource

      `URIResource make_resource(string uri)`

    Description

      Returns an RDF resource with the given URI as identifier, or if no such resrouce exists, creates it and returns it.

    Method find_statements

      `array(array(Resource)) find_statements(Resource|int(0..0) subj, Resource|int(0..0) pred, Resource|int(0..0) obj)`

    Description

      Returns an array with the statements that matches the given subject subj , predicate pred and object obj . Any and all of the resources may be zero to disregard from matching that part of the statement, i.e. find_statements(0,0,0) returns all statements in the domain.

    Returns

      An array with arrays of three elements.

      Array
      `Resource 0` | The subject of the statement
      `Resource 1` | The predicate of the statement
      `Resource 2` | The object of the statement

    Method is_subject

      `int(0..1) is_subject(Resource r)`

    Description

      Returns `1` if resource r is used as a subject, otherwise `0`.

    Method is_predicate

      `int(0..1) is_predicate(Resource r)`

    Description

      Returns `1` if resource r is used as a predicate, otherwise `0`.

    Method is_object

      `int(0..1) is_object(Resource r)`

    Description

      Returns `1` if resource r is used as an object, otherwise `0`.

    Method get_3_tuples

      `string get_3_tuples()`

    Description

      Returns a 3-tuple serialization of all the statements in the RDF set.

    Method get_n_triples

      `string get_n_triples()`

    Description

      Returns an N-triples serialization of all the statements in the RDF set.

    Method parse_n_triples

      `int parse_n_triples(string in)`

    Description

      Parses an N-triples string and adds the found statements to the RDF set. Returns the number of added relations.

    Throws

      The parser will throw errors on invalid N-triple input.

    Method decode_n_triple_string

      `string decode_n_triple_string(string in)`

    Description

      Decodes a string that has been encoded for N-triples serialization.

    Bugs

      Doesn't correctly decode backslashes that has been encoded with with \u- or \U-notation.

    Method encode_n_triple_string

      `string encode_n_triple_string(string in)`

    Description

      Encodes a string for use as tring in N-triples serialization.

    Method parse_xml

      `Web.RDF parse_xml(string|Parser.XML.NSTree.NSNode in, void|string base)`

    Description

      Adds the statements represented by the string or tree in to the RDF domain. If in is a tree the in-node should be the `RDF` node of the XML serialization. RDF documents take its default namespace from the URI of the document, so if the RDF document relies such ingenious mechanisms, pass the document URI in the base variable.

    Method get_xml

      `string get_xml(void|int no_optimize)`

    Description

      Serialize the RDF domain as an XML string.

    Parameter `no_optimize`

      If set, the XML serializer will refrain from doing most (size) optimizations of the output.

    Method _sizeof

      `int _sizeof()`

    Description

      Returns the number of statements in the RDF domain.

    Method `|

      `Web.RDF `|(Web.RDF x)`

    Description

      Modifies the current object to create a union of the current object and the object x .

    CLASS Web.RDF.Resource

      Description

        Instances of this class represents resources as defined in RDF: All things being described by RDF expressions are called resources. A resource may be an entire Web page; such as the HTML document "http://www.w3.org/Overview.html" for example. A resource may be a part of a Web page; e.g. a specific HTML or XML element within the document source. A resource may also be a whole collection of pages; e.g. an entire Web site. A resource may also be an object that is not directly accessible via the Web; e.g. a printed book. This general resource is anonymous and has no URI or literal id.

      Note

        Resources instantiated from this class should not be used in other RDF domain objects.

      See also

        URIResource , LiteralResource

      Method get_n_triple_name

        `string get_n_triple_name()`

      Description

        Returns the nodes' N-triple serialized ID.

      Method get_3_tuple_name

        `string get_3_tuple_name()`

      Description

        Returns the nodes' 3-tuple serialized ID.

    CLASS Web.RDF.LiteralResource

      Description

        Resource identified by literal.

      Inherit Resource

        inherit Resource : Resource

      Variable datatype

        `string Web.RDF.LiteralResource.datatype`

      Description

        Used to contain rdf:datatype value.

      Method create

        `void Web.RDF.LiteralResource(string literal)`

      Description

        The resource will be identified by literal .

      Method get_xml

        `string get_xml()`

      Description

        Returns the literal as an XML string.

      Method get_literal

        `string get_literal()`

      Description

        Returns the literal string.

    CLASS Web.RDF.URIResource

      Description

        Resource identified by URI.

      Inherit Resource

        inherit Resource : Resource

      Method create

        `void Web.RDF.URIResource(string uri)`

      Description

        Creates an URI resource with the uri as identifier.

      Throws

        Throws an error if another resource with the same URI already exists in the RDF domain.

      Method get_uri

        `string get_uri()`

      Description

        Returns the URI the resource references to.

      Method get_qname

        `string get_qname(void|string ns)`

      Description

        Returns the qualifying name, or zero.

      Method get_namespace

        `string get_namespace()`

      Description

        Returns the namespace this resource URI references to.

    CLASS Web.RDF.RDFResource

      Description

        Resource used for RDF-technical reasons like reification.

      Inherit URIResource

        inherit URIResource : URIResource

      Method create

        `void Web.RDF.RDFResource(string rdf_id)`

      Description

        The resource will be identified by the identifier rdf_id

      Method get_qname

        `string get_qname(void|string ns)`

      Description

        Returns the qualifying name.

  CLASS Web.OWL

    Description

      Represents an RDF tuple set from an OWL perspective.

    Inherit RDFS

      inherit .RDFS : RDFS

  Module Web.CGI

    CLASS Web.CGI.Request

      Description

        Retrieves information about a CGI request from the environment and creates an object with the request information easily formatted.

      Variable variables

        `mapping(string:array(string)) Web.CGI.Request.variables`

      Variable misc

        `mapping(string:int|string|array(string)) Web.CGI.Request.misc`

        `string Web.CGI.Request.query`
        `string Web.CGI.Request.rest_query`

      Variable data

        `string Web.CGI.Request.data`

      Variable prestate

        `multiset(string) Web.CGI.Request.prestate`

      Description

        If used with Roxen or Caudium webservers, this field will be populated with "prestate" information.

      Variable config

        `multiset(string) Web.CGI.Request.config`

      Description

        If used with Roxen or Caudium webservers, this field will be populated with "config" information.

      Variable supports

        `multiset(string) Web.CGI.Request.supports`

      Description

        If used with Roxen or Caudium webservers, this field will be populated with "supports" information.

        `string Web.CGI.Request.remoteaddr`
        `string Web.CGI.Request.remotehost`

      Variable client

        `array(string) Web.CGI.Request.client`

      Variable referer

        `array(string) Web.CGI.Request.referer`

      Variable pragma

        `multiset(string) Web.CGI.Request.pragma`

      Variable cookies

        `mapping(string:string) Web.CGI.Request.cookies`

      Variable prot

        `string Web.CGI.Request.prot`

      Variable method

        `string Web.CGI.Request.method`

      Method create

        `void Web.CGI.Request()`

      Description

        creates the request object. To use, create a Request object while running in a CGI environment. Environment variables will be parsed and inserted in the appropriate fields of the resulting object.

  Module Web.Crawler

    Description

      This module implements a generic web crawler.

      Features:

        Fully asynchronous operation (Several hundred simultaneous requests)

        Supports the /robots.txt exclusion standard

        Extensible

          URI Queues

          Allow/Deny rules

        Configurable

          Number of concurrent fetchers

          Bits per second (bandwidth throttling)

          Number of concurrent fetchers per host

          Delay between fetches from the same host

        Supports HTTP and HTTPS

    CLASS Web.Crawler.Stats

      Description

        Statistics.

      syntax

        `int Web.Crawler.Stats.window_width`
        `int Web.Crawler.Stats.granularity` `void Web.Crawler.Stats(int window_width, int granularity)`

      Method bytes_read_callback

        `void bytes_read_callback(Standards.URI uri, int num_bytes_read)`

      Description

        This callback is called when data has arrived for a presently crawled URI, but no more often than once a second.

      Method close_callback

        `void close_callback(Standards.URI uri)`

      Description

        This callback is called whenever the crawling of a URI is finished or fails.

    CLASS Web.Crawler.Policy

      Description

        The crawler policy object.

      Variable max_concurrent_fetchers

        `int Web.Crawler.Policy.max_concurrent_fetchers`

      Description

        Maximum number of fetchers. Defaults to 100.

      Variable max_bits_per_second_total

        `int Web.Crawler.Policy.max_bits_per_second_total`

      Description

        Maximum number of bits per second. Defaults to off (0).

      Variable max_bits_per_second_per_host

        `int Web.Crawler.Policy.max_bits_per_second_per_host`

      Description

        Maximum number of bits per second, per host. Defaults to off (0).

      Variable bandwidth_throttling_floating_window_width

        `int Web.Crawler.Policy.bandwidth_throttling_floating_window_width`

      Description

        Bandwidth throttling floating window width. Defaults to 30.

      Variable max_concurrent_fetchers_per_host

        `int Web.Crawler.Policy.max_concurrent_fetchers_per_host`

      Description

        Maximum concurrent fetchers per host. Defaults to 1.

      Variable min_delay_per_host

        `int Web.Crawler.Policy.min_delay_per_host`

      Description

        Minimum delay per host. Defaults to 0.

    CLASS Web.Crawler.Queue

      Description

        A crawler queue. Does not need to be reentrant safe. The Crawler always runs in just one thread.

      Method get

        `int|Standards.URI get()`

      Description

        Get the next URI to index. Returns -1 if there are no URIs to index at the time of the function call, with respect to bandwidth throttling and other limits. Returns 0 if there are no more URIs to index.

      Method put

        `void put(string|array(string)|Standards.URI|array(Standards.URI) uri)`

      Description

        Put one or several URIs in the queue. Any URIs that were already present in the queue are silently disregarded.

    CLASS Web.Crawler.Rule

      Description

        Abstract rule class.

      Method check

        `int check(string|Standards.URI uri)`

    CLASS Web.Crawler.GlobRule

      Description

        A rule that uses glob expressions

      Parameter `pattern`

        a glob pattern that the rule will match against.

      Example

            GlobRule("http://pike.ida.liu.se/*.xml");

      Inherit Rule

        inherit Rule : Rule

      syntax

        `string Web.Crawler.GlobRule.pattern` `void Web.Crawler.GlobRule(string pattern)`

    CLASS Web.Crawler.RegexpRule

      Description

        A rule that uses Regexp expressions

      Inherit Rule

        inherit Rule : Rule

      Method create

        `void Web.Crawler.RegexpRule(string re)`

      Parameter `re`

        a string describing the Regexp expression

    CLASS Web.Crawler.RuleSet

      Description

        A set of rules

      Method add_rule

        `void add_rule(Rule rule)`

      Description

        add a rule to the ruleset

      Method remove_rule

        `void remove_rule(Rule rule)`

      Description

        remove a rule from the ruleset

    CLASS Web.Crawler.MySQLQueue

      Inherit Queue

        inherit Queue : Queue

      Method create

        `void Web.Crawler.MySQLQueue(Stats _stats, Policy _policy, string _host, string _table, void|RuleSet _allow, void|RuleSet _deny)`

    CLASS Web.Crawler.MemoryQueue

      Description

        Memory queue

      Inherit Queue

        inherit Queue : Queue

      Method create

        `void Web.Crawler.MemoryQueue(Stats _stats, Policy _policy, RuleSet _allow, RuleSet _deny)`

      Method get

        `int|Standards.URI get()`

      Description

        Get the next URI to index. Returns -1 if there are no URIs to index at the time of the function call, with respect to bandwidth throttling, outstanding requests and other limits. Returns 0 if there are no more URIs to index.

      Method put

        `void put(string|array(string)|Standards.URI|array(Standards.URI) uri)`

      Description

        Put one or several URIs in the queue. Any URIs that were already present in the queue are silently disregarded.

    CLASS Web.Crawler.ComplexQueue

      Inherit Queue

        inherit Queue : Queue

      syntax

        `Stats Web.Crawler.ComplexQueue.stats`
        `Policy Web.Crawler.ComplexQueue.policy` `void Web.Crawler.ComplexQueue(Stats stats, Policy policy)`

    CLASS Web.Crawler.Crawler

      Method create

        `void Web.Crawler.Crawler(Queue _queue, function _page_cb, function _error_cb, function _done_cb, function _prepare_cb, string|array(string)|Standards.URI|array(Standards.URI) start_uri, mixed ... _args)`

      Parameter `_page_cb`

        function called when a page is retreived. Arguments are: Standards.URI uri, mixed data, mapping headers, mixed ... args. should return an array containing additional links found within data that will be analyzed for insertion into the crawler queue (assuming they are allowed by the allow/deny rulesets.

      Parameter `_error_cb`

        function called when an error is received from a server. Arguments are: Standards.URI real_uri, int status_code, mapping headers, mixed ... args. Returns void.

      Parameter `_done_cb`

        function called when crawl is complete. Accepts mixed ... args and returns void.

      Parameter `_prepare_cb`

        argument called before a uri is retrieved. may be used to alter the request. Argument is Standards.URI uri. Returns array with element 0 of Standards.URI uri, element 1 is a header mapping for the outgoing request.

      Parameter `start_uri`

        location to start the crawl from.

      Parameter `_args`

        optional arguments sent as the last argument to the callback functions.

  Module Web.RSS

    Description

      Represents a RSS (RDF Site Summary) file.

    Method parse_xml

      `Index parse_xml(string|Parser.XML.Tree.Node n, void|string base)`

    Description

      Returns an Index object, populated with the rss information given in the rss file n .

    CLASS Web.RSS.Thing

      Description

        The base class for the RSS resources.

      Method create

        `void Web.RSS.Thing(string about, mapping attributes)`
        `void Web.RSS.Thing(.RDF.Resource me)`

      Description

        Creates an RSS resource.

      Method get_id

        `.RDF.Resource get_id()`

      Description

        Returns the RDF.Resource that identifies this RSS resource.

    CLASS Web.RSS.Image

      Description

        Represents an RSS image resource.

      Inherit Thing

        inherit Thing : Thing

        `string Web.RSS.Image.title`
        `string Web.RSS.Image.url`
        `string Web.RSS.Image.link`

    CLASS Web.RSS.Item

      Description

        Represents an RSS item resource.

      Inherit Thing

        inherit Thing : Thing

        `string Web.RSS.Item.title`
        `string Web.RSS.Item.link`
        `string Web.RSS.Item.description`

    CLASS Web.RSS.Textinput

      Description

        Represents an RSS textinput resource.

      Inherit Thing

        inherit Thing : Thing

        `string Web.RSS.Textinput.title`
        `string Web.RSS.Textinput.description`
        `string Web.RSS.Textinput.name`
        `string Web.RSS.Textinput.link`

    CLASS Web.RSS.Channel

      Description

        Represents an RSS channel.

      Inherit Thing

        inherit Thing : Thing

        `string Web.RSS.Channel.title`
        `string Web.RSS.Channel.link`
        `string Web.RSS.Channel.description`
        `string|Standards.URI Web.RSS.Channel.image`
        `string|Standards.URI Web.RSS.Channel.textinput`
        `array(Item) Web.RSS.Channel.items`

      Method add_item

        `void add_item(Item i)`

      Description

        Adds the Item i to the Channel .

      Method remove_item

        `void remove_item(Item i)`

      Description

        Removes the Item i from the Channel .

    CLASS Web.RSS.Index

      Description

        Represents the top level of an RSS index.

      Variable rdf

        `.RDF Web.RSS.Index.rdf`

      Description

        The underlying RDF representation of the RSS index.

      Variable channels

        `array(Channel) Web.RSS.Index.channels`

      Description

        The RSS channels.

      Variable images

        `array(Image) Web.RSS.Index.images`

      Description

        The RSS images.

      Variable items

        `array(Item) Web.RSS.Index.items`

      Description

        The RSS items.

      Variable textinputs

        `array(Textinput) Web.RSS.Index.textinputs`

      Description

        The RSS textinputs.

      Method create

        `void Web.RSS.Index(.RDF|void _rdf)`

Module Remote

  CLASS Remote.Call

    Method `()

      `mixed `()(mixed ... args)`

    Method sync

      `mixed sync(mixed ... args)`

    Method async

      `void async(mixed ... args)`

    Method exists

      `int exists()`

    Method is_async

      `int is_async()`

    Method set_async

      `void set_async(int a)`

    Method create

      `void Remote.Call(string objectid, string name, object connection, object context, int async)`

  CLASS Remote.Connection

    Method create

      `void Remote.Connection(void|int nice, void|int max_call_threads)`

    Parameter `nice`

      If set, no errors will be thrown.

    Method connect

      `int connect(string host, int port, void|int timeout)`

    Description

      This function is called by clients to connect to a server.

    Method error_message

      `string error_message()`

    Description

      Returns an error message for the last error, in case connect returns zero. Returns zero if the last connect call was successful.

    Method start_server

      `void start_server(object c, object cx)`

    Description

      This function is called by servers when they have got a connection from a client. The first argument is the connection file object, and the second argument is the context to be used.

    Method add_close_callback

      `void add_close_callback(function f, mixed ... args)`

    Description

      Add a function that is called when the connection is closed.

    Method remove_close_callback

      `void remove_close_callback(array f)`

    Description

      Remove a function that is called when the connection is closed.

    Method close

      `void close()`

    Description

      Closes the connection nicely, after waiting in outstanding calls in both directions.

    Method call_sync

      `mixed call_sync(array data)`

    Description

      Make a call and wait for the result

    Method call_async

      `void call_async(array data)`

    Description

      Make a call but don't wait for the result

    Method get_named_object

      `object get_named_object(string name)`

    Description

      Get a named object provided by the server.

  CLASS Remote.Context

    Method id_for

      `string id_for(mixed thing)`

    Method object_for

      `object object_for(string id)`

    Method function_for

      `object function_for(string id)`

    Method encode

      `array encode(mixed val)`

    Method decode

      `mixed decode(array a)`

    Method encode_call

      `array encode_call(object|string o, string|function f, array args, int type)`

    Method decode_call

      `function|object decode_call(array data)`

    Method decode_existp

      `int decode_existp(array data)`

    Method add

      `void add(object o, string id)`

    Method describe

      `string describe(array data)`

    Method set_server_context

      `void set_server_context(object ctx, object cn)`

    Method create

      `void Remote.Context(string b, object|void cn)`

  CLASS Remote.Obj

    Method get_function

      `mixed get_function(string f)`

    Method `[]

      `mixed `[](string f)`

    Method `->

      `mixed `->(string f)`

    Method exists

      `int exists()`

    Method create

      `void Remote.Obj(string id, object connection, object context)`

Module Debug

  Method pp_memory_usage

    `string pp_memory_usage()`

  Description

    Returns a pretty printed version of the output from memory_usage .

  Method count_objects

    `mapping(string:int) count_objects()`

  Description

    Returns the number of objects of every kind in memory.

  Method verify_internals

    `void verify_internals()`

  Description

    Perform sanity checks.

    This function goes through most of the internal Pike structures and generates a fatal error if one of them is found to be out of order. It is only used for debugging.

  Note

    This function does a more thorough check if the Pike runtime has been compiled with RTL debug.

  Method debug

    `int debug(int(0..) level)`

  Description

    Set the run-time debug level.

  Returns

    The old debug level will be returned.

  Note

    This function is only available if the Pike runtime has been compiled with RTL debug.

  Method optimizer_debug

    `int optimizer_debug(int(0..) level)`

  Description

    Set the optimizer debug level.

  Returns

    The old optimizer debug level will be returned.

  Note

    This function is only available if the Pike runtime has been compiled with RTL debug.

  Method assembler_debug

    `int assembler_debug(int(0..) level)`

  Description

    Set the assembler debug level.

  Returns

    The old assembler debug level will be returned.

  Note

    This function is only available if the Pike runtime has been compiled with RTL debug.

  Method dump_program_tables

    `void dump_program_tables(program p, int|void indent)`

  Description

    Dumps the internal tables for the program p on stderr.

  Parameter `p`

    Program to dump.

  Parameter `indent`

    Number of spaces to indent the output.

  Note

    In Pike 7.8.308 and earlier indent wasn't supported.

  Method compiler_trace

    `int compiler_trace(int(0..) level)`

  Description

    Set the compiler trace level.

  Returns

    The old compiler trace level will be returned.

  Note

    This function is only available if the Pike runtime has been compiled with RTL debug.

  Method memory_usage

    `mapping(string:int) memory_usage()`

  Description

    Check memory usage.

    This function is mostly intended for debugging. It delivers a mapping with information about how many arrays/mappings/strings etc. there are currently allocated and how much memory they use.

    The entries in the mapping are typically paired, with one named `"num_" + SYMBOL + "s"` containing a count, and the other named `SYMBOL + "_bytes"` containing a best effort approximation of the size in bytes.

  Note

    Exactly what fields this function returns is version dependant.

  See also

    _verify_internals()

  Method reset_dmalloc

    `void reset_dmalloc()`

  Note

    Only available when compiled with dmalloc.

  Method dmalloc_set_name

    `void dmalloc_set_name(string filename, int linenumber)`

  Note

    Only available when compiled with dmalloc.

  Method list_open_fds

    `void list_open_fds()`

  Note

    Only available when compiled with dmalloc.

  Method dump_dmalloc_locations

    `void dump_dmalloc_locations(string|array|mapping|multiset|function|object|program|type(mixed) o)`

  Note

    Only available when compiled with dmalloc.

  Method locate_references

    `void locate_references(string|array|mapping|multiset|function|object|program|type(mixed) o)`

  Description

    This function is mostly intended for debugging. It will search through all data structures in Pike looking for o and print the locations on stderr. o can be anything but `int` or `float`.

  Note

    This function only exists if the Pike runtime has been compiled with RTL debug.

  Method describe

    `mixed describe(mixed x)`

  Description

    Prints out a description of the thing x to standard error. The description contains various internal info associated with x .

  Note

    This function only exists if the Pike runtime has been compiled with RTL debug.

  Method gc_set_watch

    `void gc_set_watch(array|multiset|mapping|object|function|program|string x)`

  Description

    Sets a watch on the given thing, so that the gc will print a message whenever it's encountered. Intended to be used together with breakpoints to debug the garbage collector.

  Note

    This function only exists if the Pike runtime has been compiled with RTL debug.

  Method dump_backlog

    `void dump_backlog()`

  Description

    Dumps the 1024 latest executed opcodes, along with the source code lines, to standard error. The backlog is only collected on debug level 1 or higher, set with _debug or with the `-d` argument on the command line.

  Note

    This function only exists if the Pike runtime has been compiled with RTL debug.

  Method describe_program

    `array(array(int|string|type(mixed))) describe_program(program p)`

  Description

    Debug function for showing the symbol table of a program.

  Returns

    Returns an array of arrays with the following information for each symbol in p :

    Array
    `int modifiers` | Bitfield with the modifiers for the symbol.
    `string symbol_name` | Name of the symbol.
    `type(mixed) value_type` | Value type for the symbol.
    `int symbol_type` | Type of symbol.
    `int symbol_offset` | Offset into the code or data area for the symbol.
    `int inherit_offset` | Offset in the inherit table to the inherit containing the symbol.
    `int inherit_level` | Depth in the inherit tree for the inherit containing the symbol.

  Note

    The API for this function is not fixed, and has changed since Pike 7.6. In particular it would make sense to return an array of objects instead, and more information about the symbols might be added.

  Method gc_status

    `mapping(string:int|float) gc_status()`

  Description

    Get statistics from the garbage collector.

  Returns

    A mapping with the following content will be returned:

    `"num_objects" : int` | Number of arrays, mappings, multisets, objects and programs.
    `"num_allocs" : int` | Number of memory allocations since the last gc run.
    `"alloc_threshold" : int` | Threshold for "num_allocs" when another automatic gc run is scheduled.
    `"projected_garbage" : float` | Estimation of the current amount of garbage.
    `"objects_alloced" : int` | Decaying average over the number of allocated objects between gc runs.
    `"objects_freed" : int` | Decaying average over the number of freed objects in each gc run.
    `"last_garbage_ratio" : float` | Garbage ratio in the last gc run.
    `"non_gc_time" : int` | Decaying average over the interval between gc runs, measured in real time nanoseconds.
    `"gc_time" : int` | Decaying average over the length of the gc runs, measured in real time nanoseconds.

    `"last_garbage_strategy" : string`

    The garbage accumulation goal that the gc aimed for when setting "alloc_threshold" in the last run. The value is either "garbage_ratio_low", "garbage_ratio_high" or "garbage_max_interval". The first two correspond to the gc parameters with the same names in Pike.gc_parameters , and the last is the minimum gc time limit specified through the "min_gc_time_ratio" parameter to Pike.gc_parameters .

    `"last_gc" : int` | Time when the garbage-collector last ran.
    `"total_gc_cpu_time" : int` | The total amount of CPU time that has been consumed in implicit GC runs, in nanoseconds. 0 on systems where Pike lacks support for CPU time measurement.
    `"total_gc_real_time" : int` | The total amount of real time that has been spent in implicit GC runs, in nanoseconds.

  See also

    gc() , Pike.gc_parameters() , Pike.implicit_gc_real_time

  CLASS Debug.Tracer

    Description

      A class that when instatiated will turn on trace, and when it's destroyed will turn it off again.

    Method create

      `void Debug.Tracer(int level)`

    Description

      Sets the level of debug trace to level .

  CLASS Debug.Wrapper

    Description

      This wrapper can be placed around another object to get printouts about what is happening to it. Only a few LFUNs are currently supported.

    Example

          > object x=Debug.Wrapper(Crypto.MD5());
            Debug.Wrapper is proxying ___Nettle.MD5_State()
            > x->name();
            ___Nettle.MD5_State()->name
            (1) Result: "md5"
            > !x;
            !___Nettle.MD5_State()
            (2) Result: 0

    Method create

      `void Debug.Wrapper(object x)`

    Method `!

      `int(0..1) `!()`

    Method `[]

      `mixed `[](mixed x, void|mixed y)`

    Method `->

      `mixed `->(mixed x)`

    Method _indices

      `array _indices()`

    Method _values

      `array _values()`

    Method _sizeof

      `int _sizeof()`

    Method _sprintf

      `string _sprintf(int c, mapping(string:mixed)|void attrs)`

  CLASS Debug.Subject

    Description

      This is a probe subject which you can send in somewhere to get probed (not to be confused with a probe object, which does some active probing). All calls to LFUNs will be printed to stderr. It is possible to name the subject by passing a string as the first and only argument when creating the subject object.

    Example

          > object s = Debug.Subject();
           create()
           > random(s);
           _random()
           (1) Result: 0
           > abs(s);
           `<(0)
           _sprintf(79, ([ "indent":2 ]))
           (2) Result: Debug.Subject
           > abs(class { inherit Debug.Subject; int `<(mixed ... args) { return 1; } }());
           create()
           `-()
           destroy()
           (3) Result: 0
           > pow(s,2);
           `[]("pow")
           Attempt to call the NULL-value
           Unknown program: 0(2)

Module Filesystem

  Method parse_mode

    `int parse_mode(int old, int|string mode)`

  Description

    FIXME: Document this function

  Method get_filesystem

    `program get_filesystem(string what)`

  Description

    FIXME: Document this function

  Method `()

    `function `()(void|string path)`

  Description

    FIXME: Document this function

  CLASS Filesystem.Stat

    Description

      Describes the stat of a file

    Method isfifo
    Method ischr
    Method isdir
    Method isblk
    Method isreg
    Method islnk
    Method issock
    Method isdoor

      `int(0..1) isfifo()`
      `int(0..1) ischr()`
      `int(0..1) isdir()`
      `int(0..1) isblk()`
      `int(0..1) isreg()`
      `int(0..1) islnk()`
      `int(0..1) issock()`
      `int(0..1) isdoor()`

    Description
      fifo

        Is the file a FIFO?

      chr

        Is the file a character device?

      dir

        Is the file (?) a directory?

      blk

        Is the file a block device?

      reg

        Is the file a regular file?

      lnk

        Is the file a link to some other file or directory?

      sock

        Is the file a socket?

      door

        FIXME: Document this function.

    Returns

      1 if the file is of a specific type 0 if the file is not.

    See also

      [set_type]

    Method set_type

      `void set_type(string x)`

    Description

      Set a type for the stat-object.

    Note

      This call doesnot change the filetype in the underlaying filesystem.

    Parameter `x`

      Type to set. Type is one of the following:

      - fifo, chr, dir, blk, reg, lnk, sock and door
    See also

      [isfifo], [ischr], [isdir], [isblk], [isreg], [islnk], [issock], [isdoor]

    Method attach_statarray

      `void attach_statarray(array(int) a)`

    Description

      Fills the stat-object with data from a Stdio.File.stat() call.

    Method open

      `Stdio.File open(string mode)`

    Description

      Open the stated file within the filesystem

    Returns

      a [Stdio.File] object

    See also

      [Stdio.File]

    Method cd

      `object cd()`

    Description

      Change to the stated directory.

    Returns

      the directory if the stated object was a directory, 0 otherwise.

    Method nice_date

      `string nice_date()`

    Description

      Returns the date of the stated object as cleartext.

  CLASS Filesystem.Base

    Description

      Baseclass that can be extended to create new filesystems. Is used by the Tar and System filesystem classes.

    Method cd

      `Base cd(string|void directory)`

    Description

      Change directory within the filesystem. Returns a new filesystem object with the given directory as cwd.

    Method cwd

      `string cwd()`

    Description

      Returns the current working directory within the filesystem.

    Method chroot

      `Base chroot(void|string directory)`

    Description

      Change the root of the filesystem.

    Method stat

      `Stat stat(string file, int|void lstat)`

    Description

      Return a stat-object for a file or a directory within the filesystem.

    Method get_dir

      `array(string) get_dir(void|string directory, void|string|array glob)`

    Description

      Returns an array of all files and directories within a given directory.

    Parameter `directory`

      Directory where the search should be made within the filesystem. CWD is assumed if none (or 0) is given.

    Parameter `glob`

      Return only files and dirs matching the glob (if given).

    See also

      [get_stats]

    Method get_stats

      `array(Stat) get_stats(void|string directory, void|string|array glob)`

    Description

      Returns stat-objects for the files and directories matching the given glob within the given directory.

    See also

      [get_dir]

    Method open

      `Stdio.File open(string filename, string mode)`

    Description

      Open a file within the filesystem

    Returns

      A Stdio.File object.

    Method apply

      `int apply()`

    Description

      FIXME: Document this function

    Method chmod

      `void chmod(string filename, int|string mode)`

    Description

      Change mode of a file or directory.

    Method chown

      `void chown(string filename, int|object owner, int|object group)`

    Description

      Change ownership of the file or directory

    Method mkdir

      `int mkdir(string directory, void|int|string mode)`

    Description

      Create a new directory

    Method rm

      `int rm(string filename)`

    Description

      Remove a file from the filesystem.

    Method find

      `array find(void|function(Stat:int) mask, mixed ... extra)`

    Description

      FIXME: Document this function

  CLASS Filesystem.Traversion

    Description

      Iterator object that traverses a directory tree and returns files as values and paths as indices. Example that uses the iterator to create a really simple sort of make:

    Example

          object i=Filesystem.Traversion(".");
             foreach(i; string dir; string file) {
             	if(!has_suffix(file, ".c")) continue;
               file = dir+file;
               string ofile = file;
             	ofile[-1]='o';
             	object s=file_stat(ofile);
             	if(s && i->stat()->mtime<s->mtime) continue;
             	// compile file
             }

    Method progress

      `float progress(void|float share)`

    Description

      Returns the current progress of the traversion as a value between 0.0 and 1.0. Note that this value isn't based on the number of files, but the directory structure.

    Method create

      `void Filesystem.Traversion(string path, void|int(0..1) symlink, void|int(0..1) ignore_errors, void|function(array:array) sort_fun)`

    Parameter `path`

      The root path from which to traverse.

    Parameter `symlink`

      Don't traverse symlink directories.

    Parameter `ignore_errors`

      Ignore directories that can not be accessed.

    Parameter `sort_fun`

      Sort function to be applied to directory entries before traversing. Can also be a filter function.

    Method stat

      `Stdio.Stat stat()`

    Description

      Returns the stat for the current index-value-pair.

  CLASS Filesystem.System

    Description

      Implements an abstraction of the normal filesystem.

    Inherit Base

      inherit Filesystem.Base : Base

    Method create

      `void Filesystem.System(void|string directory, void|string root, void|int fast, void|Filesystem.Base parent)`

    Description

      Instanciate a new object representing the filesystem.

    Parameter `directory`

      The directory (in the real filesystem) that should become the root of the filesystemobject.

    Parameter `root`

      Internal

    Parameter `fast`

      Internal

    Parameter `parent`

      Internal

  Module Filesystem.Tar

    Method create

      `void Filesystem.Tar(string filename, void|Filesystem.Base parent, void|object file)`

    Description

      Filesystem which can be used to mount a Tar file.

    Parameter `filename`

      The tar file to mount.

    Parameter `parent`

      The parent filesystem. If non is given, the normal system filesystem is assumed. This allows mounting a TAR-file within a tarfile.

    Parameter `file`

      If specified, this should be an open file descriptor. This object could e.g. be a Stdio.File , Gz.File or Bz2.File object.

    CLASS Filesystem.Tar._Tar

      Description

        Low-level Tar Filesystem.

      Method extract

        `void extract(string src_dir, string dest_dir, void|string|function(string:int|string) filter, void|int flags)`

      Description

        Extracts files from the tar file in sequential order.

      Parameter `src_dir`

        The root directory in the tar file system to extract.

      Parameter `dest_dir`

        The root directory in the real file system that will receive the contents of src_dir . It is assumed to exist and be writable.

      Parameter `filter`

        A filter for the entries under src_dir to extract. If it's a string then it's taken as a glob pattern which is matched against the path below src_dir . That path always begins with a `/`. For directory entries it ends with a `/` too, otherwise not.

        If it's a function then it's called for every entry under src_dir , and those where it returns nonzero are extracted. The function receives the path part below src_dir as the first argument, which is the same as in the glob case above, and the stat struct as the second. If the function returns a string, it's taken as the path below dest_dir where this entry should be extracted (any missing directories are created automatically).

        If filter is zero, then everything below src_dir is extracted.

      Parameter `flags`

        Bitfield of flags to control the extraction:

        `Filesystem.Tar.EXTRACT_SKIP_MODE` | Don't set any permission bits from the tar records.
        `Filesystem.Tar.EXTRACT_SKIP_EXT_MODE` | Don't set set-user-ID, set-group-ID, or sticky bits from the tar records.
        `Filesystem.Tar.EXTRACT_SKIP_MTIME` | Don't set mtime from the tar records.
        `Filesystem.Tar.EXTRACT_CHOWN` | Set owning user and group from the tar records.
        `Filesystem.Tar.EXTRACT_ERR_ON_UNKNOWN` | Throw an error if an entry of an unsupported type is encountered. This is ignored otherwise.

        Files and directories are supported on all platforms, and symlinks are supported whereever symlink exists. Other record types are currently not supported.

      Throws

        I/O errors are thrown.

Module Protocols

  Module Protocols.IRC

    CLASS Protocols.IRC.Client

      Method create

        `void Protocols.IRC.Client(string server, void|mapping(string:mixed) options)`

      Parameter `server`

        The IRC server to connect to.

      Parameter `options`

        An optional mapping with additional IRC client options.

        `"port" : int` | Defaults to 6667.
        `"user" : string` | Defaults to `"unknown"` on systems without getpwuid and getuid and to `getpwuid(getuid())[0]` on systems with.
        `"nick" : string` | Defaults to `"Unknown"` on systems without getpwuid and getuid and to `String.capitalize(getpwuid(getuid())[0])` on systems with.
        `"pass" : string` | Server password, if any. Public servers seldom require this.
        `"realname" : string` | Defaults to `"Mr. Anonymous"` on systems without getpwuid and getuid and to `getpwuid(getuid())[4]` on systems with.
        `"host" : string` | Defaults to `"localhost"` on systems without uname and to `uname()->nodename` on systems with.
        `"ping_interval" : int` | Defaults to 120.
        `"ping_timeout" : int` | Defaults to 120.
        `"connection_lost" : function(void:void)` | This function is called when the connection to the IRC server is lost or when a ping isn't answered with a pong within the time set by the `ping_timeout` option. The default behaviour is to complain on stderr and self destruct.
        `"error_notify" : function(mixed ... :void)` | This function is called when a KILL or ERROR command is recieved from the IRC server.
        `"system_notify" : function(string:void)` |
        `"motd_notify" : function(string:void)` |
        `"error_nickinuse" : function(string:)` |
        `"generic_notify" : function(string:)` | The arguments are from, type, to, message and extra.
        `"quit_notify" : function(string:)` | The arguments are who and why.
        `"privmsg_notify" : function(Person:)` | The arguments are originator, message and to.
        `"notice_notify" : function(Person:)` | The arguments are originator, message and to.
        `"nick_notify" : function(Person:)` | The arguments are originator and to.

      Method close

        `void close()`

      Description

        Closes the connection to the server.

    CLASS Protocols.IRC.Person

      Description

        Abstract class for a person.

      Variable nick

        `string Protocols.IRC.Person.nick`

      Description

        User nickname, e.g. `"Mirar"`.

      Variable user

        `string Protocols.IRC.Person.user`

      Description

        User name, e.g. `"mirar"`.

      Variable ip

        `string Protocols.IRC.Person.ip`

      Description

        User domain, e.g. `"mistel.idonex.se"`.

      Variable last_action

        `int Protocols.IRC.Person.last_action`

      Description

        Time of last action, represented as posix time.

    CLASS Protocols.IRC.Channel

      Description

        Abstract class for a IRC channel.

      Variable name

        `string Protocols.IRC.Channel.name`

      Description

        The name of the channel.

  Module Protocols.Bittorrent

    CLASS Protocols.Bittorrent.Generator

      Description

        Generate a .torrent binary string from files in the filesystem

      Example

            // usage: thisprogram [<file/dir>] [<file/dir>...] <target .torrent>
               int main(int ac,array am)
               {
                  Generator g=Generator();
                  foreach (am[1..<1];;string f)
                     g->add(f);
                  string dest=am[-1];
                  if (-1==search(dest,"torrent")) dest+=".torrent";
                  Stdio.write_file(dest,g->digest());
                  return 0;
               }

      Inherit Torrent

        inherit .Torrent : Torrent

      Method create

        `void Protocols.Bittorrent.Generator(void|string base, void|int piece_size)`

      Description

        Create a generator.

      Parameter `base`

        The base filename/path in the torrent.

      Parameter `piece_size`

        The size of the pieces that the SHA hashes are calculated on. Default 262144 and this value should probably be 2^n.

      Method add_announce

        `this_program add_announce(string|array(string) announce_url)`

      Description

        Add one or multiple announcers (trackers). This is needed to get a valid .torrent file. If this is called more then once, more announcers (trackers) will be added with lower priority.

      Method add_file

        `this_program add_file(string path, void|string filename)`

      Description

        Add a file to the torrent. The second argument is what the file will be called in the torrent.

      Method add_directory_tree

        `this_program add_directory_tree(string path, void|string dirbase)`

      Description

        Add a directory tree to the torrent. The second argument is what the directory will be called in the torrent. This will call add_file on all non-directories in the tree.

      Method add

        `this_program add(string path, void|string base)`

      Description

        Add a file, or a directory tree to the torrent. This will call add_directory_tree or add_file.

      Method build_sha1s

        `void build_sha1s(void|function(int:void) progress_callback)`

      Description

        Build the SHA hashes from the files.

      Method digest

        `string digest(void|function(int:void) progress_callback)`

      Description

        Finally make a torrent string out of this information. Will call build_sha1's if the sha1's aren't generated already.

        progress_callback is called with (pos,of) arguments, similar to Torrent.verify_targets .

    CLASS Protocols.Bittorrent.Tracker

      Variable interval

        `int(0..) Protocols.Bittorrent.Tracker.interval`

      Description

        The query interval reported back to clients. Defaults to `1800`.

      Variable dynamic_add_torrents

        `int(0..1) Protocols.Bittorrent.Tracker.dynamic_add_torrents`

      Description

        Allow clients to dynamically add torrents to the tracker.

      Method add_torrent

        `void add_torrent(string id)`

      Description

        Add a torrent to the tracker.

      Parameter `id`

        The info hash of the torrent file.

      Method announce

        `string announce(mapping args, string ip)`

      Description

        Handles HTTP announce queries to the tracker.

      Method scrape

        `string scrape(mapping args)`

      Description

        Returns the result of a scrape query.

    CLASS Protocols.Bittorrent.Peer

      Method is_connectable

        `int is_connectable()`

      Description

        Returns true if we can connect to this peer, when new or disconnected but not fatally.

      Method is_online

        `int is_online()`

      Description

        Returns true if this peer is online and connected.

      Method is_completed

        `int is_completed()`

      Description

        Returns true if this peer is completed, as in has downloaded everything already - and we shouldn't need to upload to get stuff.

      Method is_available

        `int is_available()`

      Description

        Returns true if this peer is available, as in we can use it to download stuff.

      Method is_activated

        `int is_activated()`

      Description

        Returns true if this peer is activated, as in we're downloading from it.

      Method is_strangled

        `int is_strangled()`

      Description

        Returns true if this peer is strangled; as in we don't want to upload more, because we're not getting any back.

      Method is_choked

        `int is_choked()`

      Description

        Returns true if this peer is choking, as in doesn't send more data to us.

      Method downloading_pieces

        `multiset(int) downloading_pieces()`

      Description

        Returns as multiset what this peer is downloading.

      Method connect

        `void connect()`

      Description

        Connect to the peer; this is done async. status/mode will change from `"connecting"` to `"dead"` or to `"connected"` depending on result. Will throw error if already online.

        Upon connect, protocol will be initiated in choked mode. When the protocol is up, status will change to `"online"` (or `"failed"` if the handshake failed).

      Method disconnect

        `void disconnect()`

      Description

        Disconnect a peer. Does nothing if we aren't online. status/mode will change to `"disconnected"`,1 if we were online.

      Method send_have

        `void send_have(int n)`

      Description

        Send a have message to tell I now have piece n. Ignored if not online.

      Method request

        `void request(int piece, int offset, int bytes, function(int:void|mixed) callback)`

      Description

        Called to request a chunk from this peer.

      Method status

        `void status(string type, void|int|string data)`

      Description

        Called whenever there is a status change for this peer. Always called with `"created"` when the object is created.

        Does not need to call inherited function.

    CLASS Protocols.Bittorrent.Port

      Method create

        `void Protocols.Bittorrent.Port(.Torrent _parent)`

      Description

        Bind a port for this Torrent.

    CLASS Protocols.Bittorrent.Torrent

      Description

        Bittorrent peer - download and share. Read more about bittorrent at http://bitconjurer.org/BitTorrent/introduction.html

      Example

            The smallest usable torrent downloader. As first argument,
             it expects a filename to a .torrent file.

        int main(int ac,array am) { // initialize Torrent from file: Protocols.Bittorrent.Torrent t=Protocols.Bittorrent.Torrent(); t->load_metainfo(am[1]);

        // Callback when download status changes: // t->downloads_update_status=...;

        // Callback when pieces status change (when we get new stuff): // t->pieces_update_status=...;

        // Callback when peer status changes (connect, disconnect, choked...): // t->peer_update_status=...;

        // Callback when download is completed: t->download_completed_callback= lambda() { call_out(exit,3600,0); // share for an hour, then exit };

        // Callback to print warnings (same args as sprintf): // t->warning=werror;

        // type of progress function used below: void progress(int n,int of) { /* ... */ };

        // Initiate targets from Torrent, // if target was created, no need to verify: if (t->fix_targets(1,0,progress)==1) t->verify_targets(progress);

        // Open port to listen on, // we want to do this to be able to talk to firewalled peers: t->open_port(6881);

        // Ok, start calling tracker to get peers, // and tell about us: t->start_update_tracker();

        // Finally, start the download: t->start_download();

        return -1; }

    Variable do_we_strangle

      `function(.Peer:int(0..1)) Protocols.Bittorrent.Torrent.do_we_strangle`

    Description

      Function to determine if we should strangle this peer. Default is to allow 100000 bytes of data over the ratio, which is 2:1 per default; upload twice as much as we get.

      Arguments are the peer, bytes in (downloaded) and bytes out (uploaded). Return 1 to strangle and 0 to allow the peer to proceed downloading again.

    Variable pieces_update_status

      `function Protocols.Bittorrent.Torrent.pieces_update_status`

    Description

      If set, called when we got another piece downloaded (no args).

    Variable downloads_update_status

      `function Protocols.Bittorrent.Torrent.downloads_update_status`

    Description

      If set, called when we start to download another piece (no args).

    Variable peer_update_status

      `function Protocols.Bittorrent.Torrent.peer_update_status`

    Description

      If set, called when peer status changes.

    Variable download_completed_callback

      `function Protocols.Bittorrent.Torrent.download_completed_callback`

    Description

      If set, called when download is completed.

    Variable warning

      `function(string:void|mixed) Protocols.Bittorrent.Torrent.warning`

    Description

      Called if there is a protocol error.

    Method load_metainfo

      `void load_metainfo(string filename)`

    Description

      Loads the metainfo from a file.

    Method fix_targets

      `int fix_targets(void|int(-1..2) allocate, void|string base_filename, void|function(int:void) progress_callback)`

    Description

      Opens target datafile(s).

      If all files are created, the verify info will be filled as well, but if it isn't created, a call to verify_target() is necessary after this call.

    Parameter `allocate`

      Determines allocation procedure if the file doesn't exist:

      `0` | Don't allocate.
      `1` | Allocate virtual file size (seek, write end byte).
      `2` | Allocate for real (will call progress_callback(pos,length)).
      `-1` | Means never create a file, only open old files.

    Parameter `my_filename`

      A new base filename to substitute the metainfo base target filename with.

    Returns

      `1` | The (a) file was already there.
      `2` | All target files were created.

    Method verify_targets

      `void verify_targets(void|function(int:void) progress_callback)`

    Description

      Verify the file and fill file_got (necessary after load_info, but needs open_file before this call). [ progress_callback(at chunk,total chunks) ]

    Method open_port

      `void open_port(void|int port)`

    Description

      Open the port we're listening on.

    Method bytes_done

      `int bytes_done()`

    Description

      Calculate the bytes successfully downloaded (full pieces).

    Method bytes_left

      `int bytes_left()`

    Description

      Calculate the bytes left to download.

    Method update_tracker

      `void update_tracker(void|string event, void|int contact)`

    Description

      Contact and update the tracker with current status will fill the peer list.

    Method start_update_tracker

      `void start_update_tracker(void|int interval)`

    Description

      Starts to contact the tracker at regular intervals, giving it the status and recieving more peers to talk to. Will also contact these peers. The default interval is 5 minutes. If given an event, will update tracker with it.

    Method stop_update_tracker

      `void stop_update_tracker(void|string event)`

    Description

      Stops updating the tracker; will send the event as a last event, if set. It will not contact new peers.

    Method contact_peers

      `void contact_peers(void|int n)`

    Description

      Contact all or n peers.

    Method file_got_bitfield

      `string file_got_bitfield()`

    Description

      Returns the file got field as a string bitfield (cached).

    Method start_download

      `void start_download()`

    Description

      Initiate the downloading scheme.

    CLASS Protocols.Bittorrent.Torrent.Target

      Description

        Each bittorrent has one or more target files. This represents one of those.

      syntax

        `string Protocols.Bittorrent.Torrent.Target.base`
        `int Protocols.Bittorrent.Torrent.Target.length`
        `int Protocols.Bittorrent.Torrent.Target.offset`
        `void|array Protocols.Bittorrent.Torrent.Target.path` `void Protocols.Bittorrent.Torrent.Target(string base, int length, int offset, void|array path)`

  Module Protocols.Bittorrent.Bencoding

    Method _decode

      `array(string|int|array|mapping) _decode(string what)`

    Description

      Decodes a Bittorrent bencoded data chunk.

    Returns

      Array
      `string|int|array|mapping data` | The decoded data. UNDEFINED if no data could be decoded.
      `string remainder` | The trailing data that wasn't decoded.

    Method decode

      `string|int|array|mapping decode(string what)`

    Description

      Decodes a Bittorrent bencoded data chunk and ignores the remaining string. Returns UNDEFINED if the data is incomplete.

    Method encode

      `string encode(string|int|array|mapping data)`

    Description

      Encodes a Bittorrent bencoded data chunk.

    Method bits2string

      `string bits2string(array(int(0..1)) v)`

    Description

      Convert an array of `int(0..1)` to a Bittorrent style bitstring. Input will be padded to even bytes.

    Method string2bits

      `array(int(0..1)) string2bits(string s)`

    Description

      Convert a Bittorrent style bitstring to an array of `int(0..1)`.

    Method string2arr

      `array(int) string2arr(string s)`

    Description

      Convert a Bittorrent style bitstring to an array of indices.

  Module Protocols.Bittorrent.PeerID

    Method identify_peer

      `string identify_peer(string peerid)`

    Description

      Decodes the given peerid , returning an identification string for the client software. Assumes the peerid string is exactly 20 characters long.

Module Protocols.LDAP

    `constant Protocols.LDAP.LDAP_SUCCESS`
    `constant Protocols.LDAP.LDAP_OPERATIONS_ERROR`
    `constant Protocols.LDAP.LDAP_PROTOCOL_ERROR`
    `constant Protocols.LDAP.LDAP_TIMELIMIT_EXCEEDED`
    `constant Protocols.LDAP.LDAP_SIZELIMIT_EXCEEDED`
    `constant Protocols.LDAP.LDAP_COMPARE_FALSE`
    `constant Protocols.LDAP.LDAP_COMPARE_TRUE`
    `constant Protocols.LDAP.LDAP_AUTH_METHOD_NOT_SUPPORTED`
    `constant Protocols.LDAP.LDAP_STRONG_AUTH_NOT_SUPPORTED`
    `constant Protocols.LDAP.LDAP_STRONG_AUTH_REQUIRED`
    `constant Protocols.LDAP.LDAP_PARTIAL_RESULTS`
    `constant Protocols.LDAP.LDAP_REFERRAL`
    `constant Protocols.LDAP.LDAP_ADMINLIMIT_EXCEEDED`
    `constant Protocols.LDAP.LDAP_UNAVAILABLE_CRITICAL_EXTENSION`
    `constant Protocols.LDAP.LDAP_CONFIDENTIALITY_REQUIRED`
    `constant Protocols.LDAP.LDAP_SASL_BIND_IN_PROGRESS`
    `constant Protocols.LDAP.LDAP_NO_SUCH_ATTRIBUTE`
    `constant Protocols.LDAP.LDAP_UNDEFINED_TYPE`
    `constant Protocols.LDAP.LDAP_INAPPROPRIATE_MATCHING`
    `constant Protocols.LDAP.LDAP_CONSTRAINT_VIOLATION`
    `constant Protocols.LDAP.LDAP_TYPE_OR_VALUE_EXISTS`
    `constant Protocols.LDAP.LDAP_INVALID_SYNTAX`
    `constant Protocols.LDAP.LDAP_NO_SUCH_OBJECT`
    `constant Protocols.LDAP.LDAP_ALIAS_PROBLEM`
    `constant Protocols.LDAP.LDAP_INVALID_DN_SYNTAX`
    `constant Protocols.LDAP.LDAP_IS_LEAF`
    `constant Protocols.LDAP.LDAP_ALIAS_DEREF_PROBLEM`
    `constant Protocols.LDAP.LDAP_INAPPROPRIATE_AUTH`
    `constant Protocols.LDAP.LDAP_INVALID_CREDENTIALS`
    `constant Protocols.LDAP.LDAP_INSUFFICIENT_ACCESS`
    `constant Protocols.LDAP.LDAP_BUSY`
    `constant Protocols.LDAP.LDAP_UNAVAILABLE`
    `constant Protocols.LDAP.LDAP_UNWILLING_TO_PERFORM`
    `constant Protocols.LDAP.LDAP_LOOP_DETECT`
    `constant Protocols.LDAP.LDAP_SORT_CONTROL_MISSING`
    `constant Protocols.LDAP.LDAP_NAMING_VIOLATION`
    `constant Protocols.LDAP.LDAP_OBJECT_CLASS_VIOLATION`
    `constant Protocols.LDAP.LDAP_NOT_ALLOWED_ON_NONLEAF`
    `constant Protocols.LDAP.LDAP_NOT_ALLOWED_ON_RDN`
    `constant Protocols.LDAP.LDAP_ALREADY_EXISTS`
    `constant Protocols.LDAP.LDAP_NO_OBJECT_CLASS_MODS`
    `constant Protocols.LDAP.LDAP_RESULTS_TOO_LARGE`
    `constant Protocols.LDAP.LDAP_AFFECTS_MULTIPLE_DSAS`
    `constant Protocols.LDAP.LDAP_OTHER`
    `constant Protocols.LDAP.LDAP_SERVER_DOWN`
    `constant Protocols.LDAP.LDAP_LOCAL_ERROR`
    `constant Protocols.LDAP.LDAP_ENCODING_ERROR`
    `constant Protocols.LDAP.LDAP_DECODING_ERROR`
    `constant Protocols.LDAP.LDAP_TIMEOUT`
    `constant Protocols.LDAP.LDAP_AUTH_UNKNOWN`
    `constant Protocols.LDAP.LDAP_FILTER_ERROR`
    `constant Protocols.LDAP.LDAP_USER_CANCELLED`
    `constant Protocols.LDAP.LDAP_PARAM_ERROR`
    `constant Protocols.LDAP.LDAP_NO_MEMORY`
    `constant Protocols.LDAP.LDAP_CONNECT_ERROR`
    `constant Protocols.LDAP.LDAP_NOT_SUPPORTED`
    `constant Protocols.LDAP.LDAP_CONTROL_NOT_FOUND`
    `constant Protocols.LDAP.LDAP_NO_RESULTS_RETURNED`
    `constant Protocols.LDAP.LDAP_MORE_RESULTS_TO_RETURN`
    `constant Protocols.LDAP.LDAP_CLIENT_LOOP`
    `constant Protocols.LDAP.LDAP_REFERRAL_LIMIT_EXCEEDED`

  Description

    LDAP result codes.

  See also

    Protocols.LDAP.client.error_number , Protocols.LDAP.client.result.error_number

  Constant ldap_error_strings

    `constant Protocols.LDAP.ldap_error_strings`

  Description

    Mapping from `LDAP_*` result codes to descriptive strings.

    `constant Protocols.LDAP.SEARCH_LOWER_ATTRS`
    `constant Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY`
    `constant Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS`

  Description

    Bitfield flags given to Protocols.LDAP.client.search :

    SEARCH_LOWER_ATTRS

      Lowercase all attribute values. This makes it easier to match specific attributes in the mappings returned by Protocols.LDAP.client.result.fetch since LDAP attribute names are case insensitive.

    SEARCH_MULTIVAL_ARRAYS_ONLY

      Only use arrays for attribute values where the attribute syntax specify multiple values. I.e. the values for single valued attributes are returned as strings instead of arrays containing one string element.

      If no value is returned for a single valued attribute, e.g. when `attrsonly` is set in the search call, then a zero will be used as value.

      The special `"dn"` value is also returned as a string when this flag is set.

      Note that it's the attribute type descriptions that are used to decide this, not the number of values a particular attribute happens to have in the search result.

    SEARCH_RETURN_DECODE_ERRORS

      Don't throw attribute value decode errors, instead return them in the result from Protocols.LDAP.client.result.fetch in place of the value. I.e. anywhere an attribute value string occurs, you might instead have a Locale.Charset.DecodeError object.

    `constant Protocols.LDAP.SCOPE_BASE`
    `constant Protocols.LDAP.SCOPE_ONE`
    `constant Protocols.LDAP.SCOPE_SUB`

  Description

    Constants for the search scope used with e.g. Protocols.LDAP.client.set_scope .

    SCOPE_BASE

      Return the object specified by the DN.

    SCOPE_ONE

      Return the immediate subobjects of the object specified by the DN.

    SCOPE_SUB

      Return the object specified by the DN and all objects below it (on any level).

    `constant Protocols.LDAP.MODIFY_ADD`
    `constant Protocols.LDAP.MODIFY_DELETE`
    `constant Protocols.LDAP.MODIFY_REPLACE`

  Description

    Constants used in the `attropval` argument to Protocols.LDAP.client.modify .

  Method ldap_encode_string

    `string ldap_encode_string(string str)`

  Description

    Quote characters in the given string as necessary for use as a string literal in filters and various composite LDAP attributes.

    The quoting is compliant with RFCs 2252 (section 4.3) and 2254 (section 4). All characters that can be special in those RFCs are quoted using the `\xx` syntax, but the set might be extended.

  See also

    ldap_decode_string , Protocols.LDAP.client.search

  Method ldap_decode_string

    `string ldap_decode_string(string str)`

  Description

    Decodes all `\xx` escapes in str .

  See also

    ldap_encode_string

  Method encode_dn_value

    `string encode_dn_value(string str)`

  Description

    Encode the given string for use as an attribute value in a distinguished name (on string form).

    The encoding is according to RFC 2253 section 2.4 with the exception that characters above `0x7F` aren't UTF-8 encoded. UTF-8 encoding can always be done afterwards on the complete DN, which also is done internally by the Protocols.LDAP functions when LDAPv3 is used.

  Method canonicalize_dn

    `string canonicalize_dn(string dn, void|int strict)`

  Description

    Returns the given distinguished name on a canonical form, so it reliably can be used in comparisons for equality. This means removing surplus whitespace, lowercasing attributes, normalizing quoting in string attribute values, lowercasing the hex digits in binary attribute values, and sorting the RDN parts separated by "+".

    The returned string follows RFC 2253. The input string may use legacy LDAPv2 syntax and is treated according to section 4 in RFC 2253.

    If strict is set then errors will be thrown if the given DN is syntactically invalid. Otherwise the invalid parts remain untouched in the result.

  Note

    The result is not entirely canonical since no conversion is done from or to hexadecimal BER encodings of the attribute values. It's assumed that the input already has the suitable value encoding depending on the attribute type.

  Note

    No UTF-8 encoding or decoding is done. The function can be used on both encoded and decoded input strings, and the result will be likewise encoded or decoded.

  Constant LDAP_CONTROL_MANAGE_DSA_IT

    `constant Protocols.LDAP.LDAP_CONTROL_MANAGE_DSA_IT`

  Description

    LDAP control: Manage DSA IT LDAPv3 control (RFC 3296): Control to indicate that the operation is intended to manage objects within the DSA (server) Information Tree.

  Constant LDAP_CONTROL_VLVREQUEST

    `constant Protocols.LDAP.LDAP_CONTROL_VLVREQUEST`

  Description

    LDAP control: LDAP Extensions for Scrolling View Browsing of Search Results (internet draft): Control used to request virtual list view support from the server.

  Constant LDAP_CONTROL_VLVRESPONSE

    `constant Protocols.LDAP.LDAP_CONTROL_VLVRESPONSE`

  Description

    LDAP control: LDAP Extensions for Scrolling View Browsing of Search Results (internet draft): Control used to pass virtual list view (VLV) data from the server to the client.

  Constant LDAP_PAGED_RESULT_OID_STRING

    `constant Protocols.LDAP.LDAP_PAGED_RESULT_OID_STRING`

  Description

    LDAP control: Microsoft AD: Control to instruct the server to return the results of a search request in smaller, more manageable packets rather than in one large block.

  Constant LDAP_SERVER_ASQ_OID

    `constant Protocols.LDAP.LDAP_SERVER_ASQ_OID`

  Description

    LDAP control: Microsoft AD: Control to force the query to be based on a specific DN-valued attribute.

  Constant LDAP_SERVER_CROSSDOM_MOVE_TARGET_OID

    `constant Protocols.LDAP.LDAP_SERVER_CROSSDOM_MOVE_TARGET_OID`

  Description

    LDAP control: Microsoft AD: Control used with an extended LDAP rename function to move an LDAP object from one domain to another.

  Constant LDAP_SERVER_DIRSYNC_OID

    `constant Protocols.LDAP.LDAP_SERVER_DIRSYNC_OID`

  Description

    LDAP control: Microsoft AD: Control that enables an application to search the directory for objects changed from a previous state.

  Constant LDAP_SERVER_DOMAIN_SCOPE_OID

    `constant Protocols.LDAP.LDAP_SERVER_DOMAIN_SCOPE_OID`

  Description

    LDAP control: Microsoft AD: Control used to instruct the LDAP server not to generate any referrals when completing a request.

  Constant LDAP_SERVER_EXTENDED_DN_OID

    `constant Protocols.LDAP.LDAP_SERVER_EXTENDED_DN_OID`

  Description

    LDAP control: Microsoft AD: Control to request an extended form of an Active Directory object distinguished name.

  Constant LDAP_SERVER_LAZY_COMMIT_OID

    `constant Protocols.LDAP.LDAP_SERVER_LAZY_COMMIT_OID`

  Description

    LDAP control: Microsoft AD: Control used to instruct the server to return the results of a DS modification command, such as add, delete, or replace, after it has been completed in memory, but before it has been committed to disk.

  Constant LDAP_SERVER_NOTIFICATION_OID

    `constant Protocols.LDAP.LDAP_SERVER_NOTIFICATION_OID`

  Description

    LDAP control: Microsoft AD: Control used with an extended LDAP asynchronous search function to register the client to be notified when changes are made to an object in Active Directory.

  Constant LDAP_SERVER_PERMISSIVE_MODIFY_OID

    `constant Protocols.LDAP.LDAP_SERVER_PERMISSIVE_MODIFY_OID`

  Description

    LDAP control: Microsoft AD: An LDAP modify request will normally fail if it attempts to add an attribute that already exists, or if it attempts to delete an attribute that does not exist. With this control, as long as the attribute to be added has the same value as the existing attribute, then the modify will succeed. With this control, deletion of an attribute that does not exist will also succeed.

  Constant LDAP_SERVER_QUOTA_CONTROL_OID

    `constant Protocols.LDAP.LDAP_SERVER_QUOTA_CONTROL_OID`

  Description

    LDAP control: Microsoft AD: Control used to pass the SID of a security principal, whose quota is being queried, to the server in a LDAP search operation.

  Constant LDAP_SERVER_RESP_SORT_OID

    `constant Protocols.LDAP.LDAP_SERVER_RESP_SORT_OID`

  Description

    LDAP control: Microsoft AD: Control used by the server to indicate the results of a search function initiated using the LDAP_SERVER_SORT_OID control.

  Constant LDAP_SERVER_SD_FLAGS_OID

    `constant Protocols.LDAP.LDAP_SERVER_SD_FLAGS_OID`

  Description

    LDAP control: Microsoft AD: Control used to pass flags to the server to control various security descriptor results.

  Constant LDAP_SERVER_SEARCH_OPTIONS_OID

    `constant Protocols.LDAP.LDAP_SERVER_SEARCH_OPTIONS_OID`

  Description

    LDAP control: Microsoft AD: Control used to pass flags to the server to control various search behaviors.

  Constant LDAP_SERVER_SHOW_DELETED_OID

    `constant Protocols.LDAP.LDAP_SERVER_SHOW_DELETED_OID`

  Description

    LDAP control: Microsoft AD: Control used to specify that the search results include any deleted objects that match the search filter.

  Constant LDAP_SERVER_SORT_OID

    `constant Protocols.LDAP.LDAP_SERVER_SORT_OID`

  Description

    LDAP control: Microsoft AD: Control used to instruct the server to sort the search results before returning them to the client application.

  Constant LDAP_SERVER_TREE_DELETE_OID

    `constant Protocols.LDAP.LDAP_SERVER_TREE_DELETE_OID`

  Description

    LDAP control: Microsoft AD: Control used to delete an entire subtree in the directory.

  Constant LDAP_SERVER_VERIFY_NAME_OID

    `constant Protocols.LDAP.LDAP_SERVER_VERIFY_NAME_OID`

  Description

    LDAP control: Microsoft AD: Control used to instruct the DC accepting the update which DC it should verify with, the existence of any DN attribute values.

    `constant Protocols.LDAP.SYNTAX_ATTR_TYPE_DESCR`
    `constant Protocols.LDAP.SYNTAX_BINARY`
    `constant Protocols.LDAP.SYNTAX_BIT_STRING`
    `constant Protocols.LDAP.SYNTAX_BOOLEAN`
    `constant Protocols.LDAP.SYNTAX_CERT`
    `constant Protocols.LDAP.SYNTAX_CERT_LIST`
    `constant Protocols.LDAP.SYNTAX_CERT_PAIR`
    `constant Protocols.LDAP.SYNTAX_COUNTRY_STR`
    `constant Protocols.LDAP.SYNTAX_DN`
    `constant Protocols.LDAP.SYNTAX_DIRECTORY_STR`
    `constant Protocols.LDAP.SYNTAX_DIT_CONTENT_RULE_DESCR`
    `constant Protocols.LDAP.SYNTAX_FACSIMILE_PHONE_NUM`
    `constant Protocols.LDAP.SYNTAX_FAX`
    `constant Protocols.LDAP.SYNTAX_GENERALIZED_TIME`
    `constant Protocols.LDAP.SYNTAX_IA5_STR`
    `constant Protocols.LDAP.SYNTAX_INT`
    `constant Protocols.LDAP.SYNTAX_JPEG`
    `constant Protocols.LDAP.SYNTAX_MATCHING_RULE_DESCR`
    `constant Protocols.LDAP.SYNTAX_MATCHING_RULE_USE_DESCR`
    `constant Protocols.LDAP.SYNTAX_MHS_OR_ADDR`
    `constant Protocols.LDAP.SYNTAX_NAME_AND_OPTIONAL_UID`
    `constant Protocols.LDAP.SYNTAX_NAME_FORM_DESCR`
    `constant Protocols.LDAP.SYNTAX_NUMERIC_STRING`
    `constant Protocols.LDAP.SYNTAX_OBJECT_CLASS_DESCR`
    `constant Protocols.LDAP.SYNTAX_OID`
    `constant Protocols.LDAP.SYNTAX_OTHER_MAILBOX`
    `constant Protocols.LDAP.SYNTAX_POSTAL_ADDR`
    `constant Protocols.LDAP.SYNTAX_PRESENTATION_ADDR`
    `constant Protocols.LDAP.SYNTAX_PRINTABLE_STR`
    `constant Protocols.LDAP.SYNTAX_PHONE_NUM`
    `constant Protocols.LDAP.SYNTAX_UTC_TIME`
    `constant Protocols.LDAP.SYNTAX_LDAP_SYNTAX_DESCR`
    `constant Protocols.LDAP.SYNTAX_DIT_STRUCTURE_RULE_DESCR`

  Description

    LDAP syntax: Standard syntaxes from RFC 2252.

  Constant SYNTAX_CASE_EXACT_STR

    `constant Protocols.LDAP.SYNTAX_CASE_EXACT_STR`

  Description

    `"caseExactString"` is an alias used in e.g. RFC 2079.

    `constant Protocols.LDAP.SYNTAX_DELIVERY_METHOD`
    `constant Protocols.LDAP.SYNTAX_ENHANCED_GUIDE`
    `constant Protocols.LDAP.SYNTAX_GUIDE`
    `constant Protocols.LDAP.SYNTAX_OCTET_STR`
    `constant Protocols.LDAP.SYNTAX_TELETEX_TERMINAL_ID`
    `constant Protocols.LDAP.SYNTAX_TELETEX_NUM`
    `constant Protocols.LDAP.SYNTAX_SUPPORTED_ALGORITHM`

  Description

    LDAP syntax: Standard syntaxes from RFC 2256.

    `constant Protocols.LDAP.SYNTAX_AD_CASE_IGNORE_STR`
    `constant Protocols.LDAP.SYNTAX_AD_LARGE_INT`
    `constant Protocols.LDAP.SYNTAX_AD_OBJECT_SECURITY_DESCRIPTOR`

  Description

    LDAP syntax: Microsoft AD: Additional syntaxes used in AD. C.f. <http://community.roxen.com/(all)/developers/idocs/drafts/ draft-armijo-ldap-syntax-00.html>.

  Constant mapping

    `constant Protocols.LDAP.mapping`

  Description

    Mapping containing functions to decode charsets in syntaxes where that's necessary. If the syntax is complex in a way that makes the result ambiguous if decoded with a single charset transformation then it should typically not be decoded here.

    These decoders are used on all attribute values returned by Protocols.LDAP.client.result functions.

  Constant mapping

    `constant Protocols.LDAP.mapping`

  Description

    Mapping containing the reverse functions from syntax_decode_fns .

    `constant Protocols.LDAP.GUID_USERS_CONTAINER`
    `constant Protocols.LDAP.GUID_COMPUTERS_CONTAINER`
    `constant Protocols.LDAP.GUID_SYSTEMS_CONTAINER`
    `constant Protocols.LDAP.GUID_DOMAIN_CONTROLLERS_CONTAINER`
    `constant Protocols.LDAP.GUID_INFRASTRUCTURE_CONTAINER`
    `constant Protocols.LDAP.GUID_DELETED_OBJECTS_CONTAINER`
    `constant Protocols.LDAP.GUID_LOSTANDFOUND_CONTAINER`
    `constant Protocols.LDAP.GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER`
    `constant Protocols.LDAP.GUID_PROGRAM_DATA_CONTAINER`
    `constant Protocols.LDAP.GUID_MICROSOFT_PROGRAM_DATA_CONTAINER`
    `constant Protocols.LDAP.GUID_NTDS_QUOTAS_CONTAINER`

  Description

    Constants for Microsoft AD Well-Known Object GUIDs. These are e.g. used in LDAP URLs:

    "ldap://server/<WKGUID=" + Protocols.LDAP.GUID_USERS_CONTAINER + ",dc=my,dc=domain,dc=com>"

Method get_constant_name

  `string get_constant_name(mixed val)`

Description

  If val matches any non-integer constant in this module, its name is returned.

Method parse_ldap_url

  `mapping(string:mixed) parse_ldap_url(string ldap_url)`

Description

  Parses an LDAP URL and returns its fields in a mapping.

Returns

  The returned mapping contains these fields:

  `scheme : string` | The URL scheme, either `"ldap"` or `"ldaps"`.
  `host : string` | Self-explanatory.
  `port : int`
  `basedn : string`
  `attributes : array(string)` | Array containing the attributes. Undefined if none was specified.
  `scope : int` | The scope as one of the `SEARCH_*` constants. Undefined if none was specified.
  `filter : string` | The search filter. Undefined if none was specified.
  `ext : mapping(string:string|int(1..1))` | The extensions. Undefined if none was specified. The mapping values are `1` for extensions without values. Critical extensions are checked and the leading `"!"` do not remain in the mapping indices.
  `url : string` | The original unparsed URL.

See also

  get_parsed_url

Method make_filter

  `object make_filter(string filter, void|int ldap_version)`

Description

  Parses an LDAP filter string into an ASN1 object tree that can be given to Protocols.LDAP.search .

  Using this function instead of giving the filter string directly to the search function has two advantages: This function provides better error reports for syntax errors, and the same object tree can be used repeatedly to avoid reparsing the filter string.

Parameter `filter`

  The filter to parse, according to the syntax specified in RFC 2254. The syntax is extended a bit to allow and ignore whitespace everywhere except inside and next to the filter values.

Parameter `ldap_version`

  LDAP protocol version to make the filter for. This controls what syntaxes are allowed depending on the protocol version. Also, if the protocol is `3` or later then full Unicode string literals are supported. The default is the latest supported version.

Returns

  An ASN1 object tree representing the filter.

Throws

  FilterError is thrown if there's a syntax error in the filter.

Method get_cached_filter

  `object get_cached_filter(string filter, void|int ldap_version)`

Description

  Like make_filter but saves the generated objects for reuse. Useful for filters that reasonably will occur often. The cache is never garbage collected, however.

Throws

  If there's a parse error in the filter then a FilterError is thrown as from make_filter .

Method get_connection

  `object get_connection(string ldap_url, void|string binddn, void|string password, void|int version)`

Description

  Returns a client connection to the specified LDAP URL. If a bind DN is specified (either through a `"bindname"` extension in ldap_url or, if there isn't one, through binddn ) then the connection will be bound using that DN and the optional password. If no bind DN is given then any connection is returned, regardless of the bind DN it is using.

  version may be used to specify the required protocol version in the bind operation. If zero or left out, a bind attempt with the default version (currently `3`) is done with a fallback to `2` if that fails. Also, a cached connection for any version might be returned if version isn't specified.

  As opposed to creating an Protocols.LDAP.client instance directly, this function can return an already established connection for the same URL, provided connections are given back using return_connection when they aren't used anymore.

  A client object with an error condition is returned if there's a bind error, e.g. invalid password.

Method return_connection

  `void return_connection(object conn)`

Description

  Use this to return a connection to the connection pool after you've finished using it. The connection is assumed to be working.

Note

  Ensure that persistent connection settings such as the scope and the base DN are restored to the defaults

Method num_connections

  `int num_connections(string ldap_url)`

Description

  Returns the number of currently stored connections for the given LDAP URL.

CLASS Protocols.LDAP.FilterError

  Description

    Error object thrown by make_filter for parse errors.

  Constant is_ldap_filter_error

    `constant Protocols.LDAP.FilterError.is_ldap_filter_error`

  Description

    Recognition constant.

CLASS Protocols.LDAP.protocol

  Method error_number

    `int error_number()`

  Description

    Returns the error number from the last transaction. If the error is LDAP_SERVER_DOWN then there was a socket error, and the I/O error number can be retrieved using `<font face='courier'>ldapfd` ->errno().

  See also

    error_string , server_error_string

  Method error_string

    `string error_string()`

  Description

    Returns the description of the error from the last transaction. This is the error string from the server, or a standard error message corresponding to the error number if the server didn't provide any description.

    If error_number returns LDAP_SERVER_DOWN then this is the strerror message corresponding to the I/O error for the connection.

  See also

    server_error_string , error_number

  Method server_error_string

    `string server_error_string()`

  Description

    Returns the error string from the server, or zero if the server didn't provide any.

  See also

    error_string , error_number

  Method get_last_io_time

    `int get_last_io_time()`

  Description

    Returns when I/O was made last. Useful to find out whether it's safe to continue using a connection that has been idle for some time.

CLASS Protocols.LDAP.client

  Description

    Contains the client implementation of the LDAP protocol. All of the version 2 protocol features are implemented but only the base parts of the version 3.

  Inherit protocol

    inherit .protocol : protocol

  Variable info

    `mapping Protocols.LDAP.client.info`

  Description

    Several information about code itself and about active connection too

  Method create

    `void Protocols.LDAP.client()`
    `void Protocols.LDAP.client(string url)`
    `void Protocols.LDAP.client(string url, object context)`

  Description

    Create object. The first optional argument can be used later for subsequence operations. The second one can specify TLS context of connection. The default context only allows 128-bit encryption methods, so you may need to provide your own context if your LDAP server supports only export encryption.

  Parameter `url`

    LDAP server URL on the form `"ldap://hostname/basedn?attrlist?scope?ext"`. See RFC 2255. It can also be a mapping as returned by Protocol.LDAP.parse_ldap_url .

  Parameter `context`

    TLS context of connection

  See also

    LDAP.client.bind , LDAP.client.search

  Method reset_options

    `void reset_options()`

  Description

    Resets all connection options, such as the scope and the base DN, to the defaults determined from the LDAP URL when the connection was created.

  Method start_tls

    `int start_tls(void|SSL.context context)`

  Description

    Requests that a SSL/TLS session be negotiated on the connection. If the connection is already secure, this call will fail.

  Parameter `context`

    an optional SSL.context object to provide to the SSL/TLS connection client.

    Returns `1` on success, `0` otherwise.

  Method bind

    `int bind()`
    `int bind(string dn, string password)`
    `int bind(string dn, string password, int version)`

  Description

    Authenticates connection to the direcory.

    First form uses default value previously entered in create.

    Second form uses value from parameters:

  Parameter `dn`

    The distinguished name (DN) of an entry aginst which will be made authentication.

  Parameter `password`

    Password used for authentication.

    Third form allows specify the version of LDAP protocol used by connection to the LDAP server.

  Parameter `version`

    The desired protocol version (current `2` or `3`). Defaults to `3` if zero or left out.

  Returns

    Returns `1` on success, `0` otherwise.

  Note

    Only simple authentication type is implemented. So be warned clear text passwords are sent to the directory server.

  Note

    The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

  Method unbind

    `int unbind()`

  Description

    Unbinds from the directory and close the connection.

  Method delete

    `int delete(string dn)`

  Description

    Deletes entry from the LDAP server.

  Parameter `dn`

    The distinguished name of deleted entry.

  Returns

    Returns `1` on success, `0` otherwise.

  Note

    The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

  Method compare

    `int compare(string dn, string attr, string value)`

  Description

    Compares an attribute value with one in the directory.

  Parameter `dn`

    The distinguished name of the entry.

  Parameter `attr`

    The type (aka name) of the attribute to compare.

  Parameter `value`

    The value to compare with. It's UTF-8 encoded automatically if the attribute syntax specifies that.

  Returns

    Returns `1` if at least one of the values for the attribute in the directory is equal to value , `0` if it didn't match or there was some error (use error_number to find out).

  Note

    This function has changed arguments since version 7.6. From 7.3 to 7.6 it was effectively useless since it always returned true.

  Note

    The equality matching rule for the attribute governs the comparison. There are attributes where the assertion syntax used here isn't the same as the attribute value syntax.

  Method add

    `int add(string dn, mapping(string:array(string)) attrs)`

  Description

    The Add Operation allows a client to request the addition of an entry into the directory

  Parameter `dn`

    The Distinguished Name of the entry to be added.

  Parameter `attrs`

    The mapping of attributes and their values that make up the content of the entry being added. Values that are sent UTF-8 encoded according the the attribute syntaxes are encoded automatically.

  Returns

    Returns `1` on success, `0` otherwise.

  Note

    The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

  Method get_root_dse_attr

    `array(string) get_root_dse_attr(string attr)`

  Description

    Returns the value of an attribute in the root DSE (DSA-Specific Entry) of the bound server. The result is cached. A working connection is assumed.

  Returns

    The return value is an array of the attribute values, which have been UTF-8 decoded where appropriate.

    Don't be destructive on the returned array.

  Note

    This function intentionally does not try to simplify the return values for single-valued attributes (c.f. Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY ). That since (at least) Microsoft AD has a bunch of attributes in the root DSE that they don't bother to provide schema entries for. The return value format wouldn't be reliable if they suddenly change that.

  Method get_supported_controls

    `multiset(string) get_supported_controls()`

  Description

    Returns a multiset containing the controls supported by the server. They are returned as object identifiers on string form. A working connection is assumed.

  See also

    search

  Method make_filter

    `object make_filter(string filter)`

  Description

    Returns the ASN1 object parsed from the given filter. This is a wrapper for Protocols.LDAP.make_filter which parses the filter with the LDAP protocol version currently in use by this connection.

  Throws

    If there's a parse error in the filter then a Protocols.LDAP.FilterError is thrown as from Protocols.LDAP.make_filter .

  Method get_cached_filter

    `object get_cached_filter(string filter)`

  Description

    This is a wrapper for Protocols.LDAP.get_cached_filter which passes the LDAP protocol version currently in use by this connection.

  Throws

    If there's a parse error in the filter then a Protocols.LDAP.FilterError is thrown as from Protocols.LDAP.make_filter .

  Method get_default_filter

    `object get_default_filter()`

  Description

    Returns the ASN1 object parsed from the filter specified in the LDAP URL, or zero if the URL doesn't specify any filter.

  Throws

    If there's a parse error in the filter then a Protocols.LDAP.FilterError is thrown as from Protocols.LDAP.make_filter .

  Method search

    `result|int search(string|object|void filter, array(string)|void attrs, int|void attrsonly, void|mapping(string:array(int|string)) controls, void|int flags)`

  Description

    Search LDAP directory.

  Parameter `filter`

    Search filter to override the one from the LDAP URL. It's either a string with the format specified in RFC 2254, or an object returned by Protocols.LDAP.make_filter .

  Parameter `attrs`

    The array of attribute names which will be returned by server for every entry.

  Parameter `attrsonly`

    This flag causes server return only the attribute types (aka names) but not their values. The values will instead be empty arrays or - if Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY is given - zeroes for single-valued attributes.

  Parameter `controls`

    Extra controls to send in the search query, to modify how the server executes the search in various ways. The value is a mapping with an entry for each control.

    `object_identifier : string`

    The index is the object identifier in string form for the control type. There are constants in Protocols.LDAP for the object identifiers for some known controls.

    The mapping value is an array of two elements:

    Array
    `int 0` | The first element is an integer flag that specifies whether the control is critical or not. If it is nonzero, the server returns an error if it doesn't understand the control. If it is zero, the server ignores it instead.
    `string|int(0..0) 1` | The second element is the string value to pass with the control. It may also be zero to not pass any value at all.

  Parameter `flags`

    Bitfield with flags to control various behavior at the client side of the search operation. See the `Protocol.LDAP.SEARCH_*` constants for details.

  Returns

    Returns object LDAP.client.result on success, `0` otherwise.

  Note

    The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

  See also

    result , result.fetch , read , get_supported_controls , Protocols.LDAP.ldap_encode_string , Protocols.LDAP.make_filter

  Method read

    `mapping(string:string|array(string)) read(string object_name, void|string filter, void|array(string) attrs, void|int attrsonly, void|mapping(string:array(int|string)) controls, void|int flags)`

  Description

    Reads a specified object in the LDAP server. object_name is the distinguished name for the object. The rest of the arguments are the same as to search .

    The default filter and attributes that might have been set in the LDAP URL doesn't affect this call. If filter isn't set then `"(objectClass=*)"` is used.

  Returns

    Returns a mapping of the requested attributes. It has the same form as the response from result.fetch .

  See also

    search

  Method read_attr

    `string|array(string) read_attr(string object_name, string attr, void|string filter, void|mapping(string:array(int|string)) controls)`

  Description

    Reads a specified attribute of a specified object in the LDAP server. object_name is the distinguished name of the object and attr is the attribute. The rest of the arguments are the same as to search .

    The default filter that might have been set in the LDAP URL doesn't affect this call. If filter isn't set then `"(objectClass=*)"` is used.

  Returns

    For single-valued attributes, the value is returned as a string. For multivalued attributes, the value is returned as an array of strings. Returns zero if there was an error.

  See also

    read , get_root_dse_attr

  Method get_protocol_version

    `int get_protocol_version()`

  Description

    Return the LDAP protocol version in use.

  Method set_basedn

    `string set_basedn(string base_dn)`

  Description

    Sets the base DN for searches using search and schema queries using get_attr_type_descr .

  Note

    For compatibility, the old base DN is returned. However, if LDAPv3 is used, the value is UTF-8 encoded. Use get_basedn separately instead.

  Method get_basedn

    `string get_basedn()`

  Description

    Returns the current base DN for searches using search and schema queries using get_attr_type_descr .

  Method get_bound_dn

    `string get_bound_dn()`

  Description

    Returns the bind DN currently in use for the connection. Zero is returned if the connection isn't bound. The empty string is returned if the connection is in use but no bind DN has been given explicitly to bind .

  Method get_bind_password_hash

    `string get_bind_password_hash()`

  Description

    Returns an MD5 hash of the password used for the bind operation, or zero if the connection isn't bound. If no password was given to bind then an empty string was sent as password, and the MD5 hash of that is therefore returned.

  Method set_scope

    `int set_scope(int|string scope)`

  Description

    Sets value of scope for search operation.

  Parameter `scope`

    The value can be one of the `SCOPE_*` constants or a string `"base"`, `"one"` or `"sub"`.

  Returns

    Returns the `SCOPE_*` constant for the old scope.

  Method get_scope

    `string get_scope()`

  Description

    Return the currently set scope as a string `"base"`, `"one"`, or `"sub"`.

  Method set_option

    `int set_option(int opttype, int value)`

  Parameter `option_type`

    LDAP_OPT_xxx

  Parameter `value`

    new value for option

  Method get_option

    `int get_option(int opttype)`

  Parameter `option_type`

    LDAP_OPT_xxx

  Method get_parsed_url

    `mapping(string:mixed) get_parsed_url()`

  Description

    Returns a mapping containing the data parsed from the LDAP URL passed to create . The mapping has the same format as the return value from Protocols.LDAP.parse_ldap_url . Don't be destructive on the returned value.

  Method modifydn

    `int modifydn(string dn, string newrdn, int deleteoldrdn, string|void newsuperior)`

  Description

    The Modify DN Operation allows a client to change the leftmost (least significant) component of the name of an entry in the directory, or to move a subtree of entries to a new location in the directory.

  Parameter `dn`

    DN of source object

  Parameter `newrdn`

    RDN of destination

  Parameter `deleteoldrdn`

    The parameter controls whether the old RDN attribute values are to be retained as attributes of the entry, or deleted from the entry.

  Parameter `newsuperior`

    If present, this is the Distinguished Name of the entry which becomes the immediate superior of the existing entry.

  Returns

    Returns `1` on success, `0` otherwise.

  Note

    The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

  Method modify

    `int modify(string dn, mapping(string:array(int(0..2)|string)) attropval)`

  Description

    The Modify Operation allows a client to request that a modification of an entry be performed on its behalf by a server.

  Parameter `dn`

    The distinguished name of modified entry.

  Parameter `attropval`

    The mapping of attributes with requested operation and attribute's values.

    attropval=([ attribute: ({operation, value1, value2, ...}) ])

  Where operation is one of the following:

  Protocols.LDAP.MODIFY_ADD

    Add values listed to the given attribute, creating the attribute if necessary.

  Protocols.LDAP.MODIFY_DELETE

    Delete values listed from the given attribute, removing the entire attribute if no values are listed, or if all current values of the attribute are listed for deletion.

  Protocols.LDAP.MODIFY_REPLACE

    Replace all existing values of the given attribute with the new values listed, creating the attribute if it did not already exist. A replace with no value will delete the entire attribute if it exists, and is ignored if the attribute does not exist.

  Values that are sent UTF-8 encoded according the the attribute syntaxes are encoded automatically.

Returns

  Returns `1` on success, `0` otherwise.

Note

  The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

Method get_referrals

  `array|int get_referrals()`

Description

  Gets referrals.

Returns

  Returns array of referrals or `0`.

Method parse_url

  `mapping(string:mixed) parse_url(string ldapuri)`

Description

  Compatibility alias for Protocols.LDAP.parse_ldap_url .

Method get_attr_type_descr

  `mapping(string:mixed) get_attr_type_descr(string attr, void|int standard_attrs)`

Description

  Returns the attribute type description for the given attribute, which includes the name, object identifier, syntax, etc (see section 4.2 in RFC 2252 for details).

  This might do a query to the server, but results are cached.

Parameter `attr`

  The name of the attribute. Might also be the object identifier on string form.

Parameter `standard_attrs`

  Flag that controls how the known standard attributes stored in Protocols.LDAP are to be used:

  `0` | Check the known standard attributes first. If the attribute isn't found there, query the server. This is the default.
  `1` | Don't check the known standard attributes, i.e. always use the schema from the server.
  `2` | Only check the known standard attributes. The server is never contacted.

Returns

  Returns a mapping where the indices are the terms that the server has returned and the values are their values on string form (dequoted and converted from UTF-8 as appropriate). Terms without values get `1` as value in the mapping.

  The mapping might contain the following members (all except `"oid"` are optional):

  `"oid" : string` | The object identifier on string form. According to the RFC, this should always be a dotted decimal string. However some LDAP servers, e.g. iPlanet, allows registering attributes without an assigned OID. In such cases this can be some other string. In the case of iPlanet, it uses the attribute name with "-oid" appended (c.f. http://docs.sun.com/source/816-5606-10/scmacfg.htm).
  `"NAME" : string` | Array with one or more names used for the attribute.
  `"DESC" : string` | Description.
  `"OBSOLETE" : string` | Flag.
  `"SUP" : string` | Derived from this other attribute. The value is the name or oid of it. Note that the attribute description from the referenced type always is merged with the current one to make the returned description complete.
  `"EQUALITY" : string` | The value is the name or oid of a matching rule.
  `"ORDERING" : string` | The value is the name or oid of a matching rule.
  `"SUBSTR" : string` | The value is the name or oid of a matching rule.
  `"syntax_oid" : string` | The value is the oid of the syntax (RFC 2252, section 4.3.2). (This is extracted from the `"SYNTAX"` term.)
  `"syntax_len" : string` | Optional suggested minimum upper bound of the number of characters in the attribute (or bytes if the attribute is binary). (This is extracted from the `"SYNTAX"` term.)
  `"SINGLE-VALUE" : string` | Flag. Default multi-valued.
  `"COLLECTIVE" : string` | Flag. Default not collective.
  `"NO-USER-MODIFICATION" : string` | Flag. Default user modifiable.

  `"USAGE" : string`

  The value is any of the following:

  `"userApplications"` | Self-explanatory.
  `"directoryOperation"`
  `"distributedOperation"` | DSA-shared.
  `"dSAOperation"` | DSA-specific, value depends on server.

  There might be more fields for server extensions.

  Zero is returned if the server didn't provide any attribute type description for attr .

Note

  It's the schema applicable at the base DN that is queried.

Note

  LDAPv3 is assumed.

CLASS Protocols.LDAP.client.result

  Description

    Contains the result of a LDAP search.

  See also

    LDAP.client.search , LDAP.client.result.fetch

  Method create

    `object|int Protocols.LDAP.client.result(array(object) entries, int stuff, int flags)`

  Description

    You can't create instances of this object yourself. The only way to create it is via a search of a LDAP server.

  Method error_number

    `int error_number()`

  Description

    Returns the error number in the search result.

  See also

    error_string , server_error_string

  Method error_string

    `string error_string()`

  Description

    Returns the description of the error in the search result. This is the error string from the server, or a standard error message corresponding to the error number if the server didn't provide any description.

  See also

    server_error_string , error_number

  Method server_error_string

    `string server_error_string()`

  Description

    Returns the error string from the server, or zero if the server didn't provide any.

  See also

    error_string , error_number

  Method num_entries

    `int num_entries()`

  Description

    Returns the number of entries.

  See also

    LDAP.client.result.count_entries

  Method count_entries

    `int count_entries()`

  Description

    Returns the number of entries from the current cursor position to the end of the list.

  See also

    LDAP.client.result.first , LDAP.client.result.next

  Method fetch

    `ResultEntry fetch(int|void idx)`

  Description

    Returns the current entry pointed to by the cursor.

  Parameter `index`

    This optional argument can be used for direct access to an entry other than the one currently pointed to by the cursor.

  Returns

    The return value is a mapping describing the entry:

    `attribute : string`

    An attribute in the entry. The value is an array containing the returned attribute value(s) on string form, or a single string if Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY was given to search and the attribute is typed as single valued.

    If Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search then Locale.Charset.DecodeError objects are returned in place of a string whenever an attribute value fails to be decoded.

    `"dn" : string` | This special entry contains the object name of the entry as a distinguished name. This might also be a Locale.Charset.DecodeError if Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search .

    Zero is returned if the cursor is outside the valid range of entries.

  Throws

    Unless Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search , a Locale.Charset.DecodeError is thrown if there is an error decoding the DN or any attribute value.

  Note

    It's undefined whether or not destructive operations on the returned mapping will affect future fetch calls for the same entry.

  Note

    In Pike 7.6 and earlier, the special `"dn"` entry was incorrectly returned in UTF-8 encoded form for LDAPv3 connections.

  See also

    fetch_all

  Method get_dn

    `string|Locale.Charset.DecodeError get_dn()`

  Description

    Returns distinguished name (DN) of the current entry in the result list. Note that this is the same as getting the `"dn"` field from the return value from fetch .

  Note

    In Pike 7.6 and earlier, this field was incorrectly returned in UTF-8 encoded form for LDAPv3 connections.

  Method first

    `void first()`

  Description

    Initialized the result cursor to the first entry in the result list.

  See also

    LDAP.client.result.next

  Method next

    `int next()`

  Description

    Moves the result cursor to the next entry in the result list. Returns number of remained entries in the result list. Returns 0 at the end.

  See also

    LDAP.client.result.next

  Method fetch_all

    `array(ResultEntry) fetch_all()`

  Description

    Convenience function to fetch all entries at once. The cursor isn't affected.

  Returns

    Returns an array where each element is the entry from the result. Don't be destructive on the returned value.

  Throws

    Unless Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search , a Locale.Charset.DecodeError is thrown if there is an error decoding the DN or any attribute value.

  See also

    fetch

Module Protocols.LysKOM

  CLASS Protocols.LysKOM.Connection

    Description

      This class contains nice abstraction for calls into the server. They are named "`call`", "`async_call`" or "`async_cb_call`", depending on how you want the call to be done.

    Method XXX
    Method async_XXX
    Method async_cb_XXX

      `mixed XXX(mixed ... args)`
      `object async_XXX(mixed ... args)`
      `object async_cb_XXX(function callback, mixed ... args)`

    Description

      Do a call to the server. This really clones a Protocols.LysKOM.Request object, and initialises it. `XXX` is to be read as one of the calls in the lyskom protocol. ('-' is replaced with '_'.) (ie, logout, async_login or async_cb_get_conf_stat.)

      The first method is a synchronous call. This will send the command, wait for the server to execute it, and then return the result.

      The last two are asynchronous calls, returning an initialised Protocols.LysKOM.Request object.

      `int Protocols.LysKOM.Connection.protocol_level`
      `string Protocols.LysKOM.Connection.session_software`
      `string Protocols.LysKOM.Connection.software_version`

    Description

      Description of the connected server.

    Method create

      `void Protocols.LysKOM.Connection(string server)`
      `void Protocols.LysKOM.Connection(string server, mapping options)`

    Description

      The options argument is a mapping with the following members:

      `"login" : int|string` | login as this person number (get number from name).
      `"password" : string` | send this login password.
      `"invisible" : int(0..1)` | if set, login invisible.
      `"port" : int(0..65535)` | server port (default is 4894).
      `"whoami" : string` | present as this user (default is from uid/getpwent and hostname).

  CLASS Protocols.LysKOM.Session

    Variable user

      `object Protocols.LysKOM.Session.user`

    Description

      This variable contains the Protocols.LysKOM.Session.Person that is logged in.

    Method create

      `void Protocols.LysKOM.Session(string server)`
      `void Protocols.LysKOM.Session(string server, mapping options)`

    Description

      Initializes the session object, and opens a connection to that server.

      options is a mapping of options:

      `"login" : int|string` | login as this person number (get number from name).
      `"create" : string` | create a new person and login with it.
      `"password" : string` | send this login password.
      `"invisible" : int(0..1)` | if set, login invisible.
      `"port" : int(0..65535)` | server port (default is 4894).
      `"whoami" : string` | present as this user (default is from uid/getpwent and hostname).

    See also

      Connection

    Method text

      `Text text(int no)`

    Description

      Returns the text no .

    Method person

      `Person person(int no)`

    Description

      Returns the Person no .

    Method conference

      `Conference conference(int no)`

    Description

      Returns conference number no .

    Method try_complete_person

      `array(ProtocolTypes.ConfZInfo) try_complete_person(string orig)`

    Description

      Runs a LysKOM completion on the given string, returning an array of confzinfos of the match.

    Method login

      `object login(int user_no, string password)`
      `object login(int user_no, string password, int invisible)`

    Description

      Performs a login. Throws a lyskom error if unsuccessful.

    Returns

      The session object logged in.

    Method create_person

      `object create_person(string name, string password)`

    Description

      Create a person, which will be logged in. returns the new person object

    Method logout

      `this_program logout()`

    Description

      Logouts from the server. returns the called object

    Method create_text

      `object create_text(string subject, string body, mapping options)`
      `object create_text(string subject, string body, mapping options, function callback, mixed ... extra)`

    Description

      Creates a new text.

      if callback is given, the function will be called when the text has been created, with the text as first argument. Otherwise, the new text is returned.

      options is a mapping that may contain:

      `"recpt" : Conference|array(Conference)` | recipient conferences.
      `"cc" : Conference|array(Conference)` | cc-recipient conferences.
      `"bcc" : Conference|array(Conference)` | bcc-recipient conferences*.
      `"comm_to" : Text|array(Text)` | The text(s) to be commented.
      `"foot_to" : Text|array(Text)` | The text(s) to be footnoted.
      `"anonymous" : int(0..1)` | send text anonymously.
      `"aux_items" : array(AuxItemInput)` | AuxItems you want to set for the text*.

    Note

      The items above marked with '*' are only available on protocol 10 servers. A LysKOM error will be thrown if the call fails.

    See also

      Conference.create_text() , Text.comment() , Text.footnote()

    Method send_message

      `object|void send_message(string textstring, mapping options)`

    Description

      Sends a message.

      options is a mapping that may contain:

      `"recpt" : Conference` | recipient conference.

    Method register_async_message_callback

      `void register_async_message_callback(function(int:void) cb)`

    CLASS Protocols.LysKOM.Session.AuxItemInput

      FIXME

        Undocumented

      Inherit AuxItemInput

        inherit ProtocolTypes.AuxItemInput : AuxItemInput

    CLASS Protocols.LysKOM.Session.AuxItems

      FIXME

        Undocumented

    CLASS Protocols.LysKOM.Session.Text

      Description

        All variables in this class is read only.

      FIXME

        Undocumented

      Variable no

        `int Protocols.LysKOM.Session.Text.no`

      Description

        The text number, as spicified to create .

      Variable err

        `object Protocols.LysKOM.Session.Text.err`

      Description

        Undocumented

      Method create

        `void Protocols.LysKOM.Session.Text(string textnumber)`

      Description

        Initializes a Text object.

      Method mark_as_read

        `void mark_as_read()`

      FIXME

        Undocumented.

        `mixed Protocols.LysKOM.Session.Text.prefetch_text`
        `mixed Protocols.LysKOM.Session.Text.prefetch_stat`
        `mixed Protocols.LysKOM.Session.Text.lines`
        `mixed Protocols.LysKOM.Session.Text.characters`
        `mixed Protocols.LysKOM.Session.Text.clear_stat`
        `mixed Protocols.LysKOM.Session.Text.aux_items`

      FIXME

        Undocumented

      Variable text

        `string Protocols.LysKOM.Session.Text.text`

      Description

        The actual text (or body if you wish).

      Variable subject

        `string Protocols.LysKOM.Session.Text.subject`

      Description

        The message subject.

      Variable author

        `string Protocols.LysKOM.Session.Text.author`

      Description

        The author of the text.

      Variable misc

        `mixed Protocols.LysKOM.Session.Text.misc`

      Description

        Misc info, including what conferences the message is posted to.

      FIXME

        Needs a more complete description.

      Variable marks

        `int Protocols.LysKOM.Session.Text.marks`

      Description

        The number of marks on this text.

      Variable creation_time

        `mixed Protocols.LysKOM.Session.Text.creation_time`

      Description

        The time the text was created on the server.

    CLASS Protocols.LysKOM.Session.Membership

      Description

        All variables in this class is read only.

      Variable last_time_read

        `object Protocols.LysKOM.Session.Membership.last_time_read`

      Variable priority

        `int(0..255) Protocols.LysKOM.Session.Membership.priority`

      Variable last_text_read

        `int Protocols.LysKOM.Session.Membership.last_text_read`

      Variable read_texts

        `array(int) Protocols.LysKOM.Session.Membership.read_texts`

      Variable added_at

        `object Protocols.LysKOM.Session.Membership.added_at`

      Variable type

        `multiset(string) Protocols.LysKOM.Session.Membership.type`

      Variable position

        `int Protocols.LysKOM.Session.Membership.position`

      Variable conf

        `object Protocols.LysKOM.Session.Membership.conf`

      Method number_unread

        `int number_unread()`

      Method query_read_texts

        `void query_read_texts()`

      Method unread_texts

        `array(object) unread_texts()`

    CLASS Protocols.LysKOM.Session.Person

      Variable no

        `int Protocols.LysKOM.Session.Person.no`

      Method create

        `void Protocols.LysKOM.Session.Person(int no)`

        `mixed Protocols.LysKOM.Session.Person.prefetch_stat`
        `mixed Protocols.LysKOM.Session.Person.prefetch_conf`
        `mixed Protocols.LysKOM.Session.Person.prefetch_membership`

      FIXME

        Undocumented

        `object Protocols.LysKOM.Session.Person.error`
        `Text Protocols.LysKOM.Session.Person.user_area`
        `mixed Protocols.LysKOM.Session.Person.username`
        `mixed Protocols.LysKOM.Session.Person.privileges`
        `mixed Protocols.LysKOM.Session.Person.flags`
        `mixed Protocols.LysKOM.Session.Person.last_login`
        `mixed Protocols.LysKOM.Session.Person.total_time_present`
        `mixed Protocols.LysKOM.Session.Person.sessions`
        `mixed Protocols.LysKOM.Session.Person.created_lines`
        `mixed Protocols.LysKOM.Session.Person.created_bytes`
        `mixed Protocols.LysKOM.Session.Person.read_texts`
        `mixed Protocols.LysKOM.Session.Person.no_of_text_fetches`
        `mixed Protocols.LysKOM.Session.Person.created_persons`
        `mixed Protocols.LysKOM.Session.Person.created_confs`
        `mixed Protocols.LysKOM.Session.Person.first_created_local_no`
        `mixed Protocols.LysKOM.Session.Person.no_of_created_texts`
        `mixed Protocols.LysKOM.Session.Person.no_of_marks`
        `mixed Protocols.LysKOM.Session.Person.no_of_confs`
        `mixed Protocols.LysKOM.Session.Person.unread`
        `int(0..0) Protocols.LysKOM.Session.Person.clear_membership`
        `mixed Protocols.LysKOM.Session.Person.membership`

      FIXME

        Undocumented

    CLASS Protocols.LysKOM.Session.Conference

      Method create

        `void Protocols.LysKOM.Session.Conference(int no)`

        `mixed Protocols.LysKOM.Session.Conference.prefetch_stat`
        `int Protocols.LysKOM.Session.Conference.no`
        `object Protocols.LysKOM.Session.Conference.error`
        `Text Protocols.LysKOM.Session.Conference.msg_of_day`
        `Conference Protocols.LysKOM.Session.Conference.supervisor`
        `Conference Protocols.LysKOM.Session.Conference.permitted_submitters`
        `Conference Protocols.LysKOM.Session.Conference.super_conf`
        `Person Protocols.LysKOM.Session.Conference.creator`
        `mixed Protocols.LysKOM.Session.Conference.aux_items`
        `mixed Protocols.LysKOM.Session.Conference.name`
        `mixed Protocols.LysKOM.Session.Conference.type`
        `mixed Protocols.LysKOM.Session.Conference.creation_time`
        `mixed Protocols.LysKOM.Session.Conference.last_written`
        `mixed Protocols.LysKOM.Session.Conference.nice`
        `mixed Protocols.LysKOM.Session.Conference.no_of_members`
        `mixed Protocols.LysKOM.Session.Conference.first_local_no`
        `mixed Protocols.LysKOM.Session.Conference.no_of_texts`
        `mixed Protocols.LysKOM.Session.Conference.presentation`

      FIXME

        Undocumented

  Module Protocols.LysKOM.Request

    Description

      This module contains nice abstraction for calls into the server. They are named "`call`", "`async_call`" or "`async_cb_call`", depending on how you want the call to be done.

    CLASS Protocols.LysKOM.Request._Request

      Description

        This is the main request class. All lyskom request classes inherit this class.

      Method async
      Method sync

        `void async(mixed ... args)`
        `mixed sync(mixed ... args)`

      Description

        Initialise an asynchronous or a synchronous call, the latter is also evaluating the result. This calls `indata()` in itself, to get the correct arguments to the lyskom protocol call.

      Method _async
      Method _sync

        `void _async(int call, mixed_data)`
        `mixed _sync(int call, mixed_data)`

      Description

        Initialise an asynchronous or a synchronous call, the latter is also evaluating the result. These are called by async and sync respectively.

      Method _reply
      Method reply

        `mixed _reply(object|array what)`
        `mixed reply(object|array what)`

      Description

        _reply() is called as callback to evaluate the result, and calls reply() in itself to do the real work.

      Method `()

        `mixed `()()`

      Description

        Wait for the call to finish.

      Variable ok

        `int(0..1) Protocols.LysKOM.Request._Request.ok`

      Description

        Tells if the call has executed ok

      Variable error

        `object Protocols.LysKOM.Request._Request.error`

      Description

        How the call failed. The call has completed if `(ok||error)`.

  Module Protocols.LysKOM.ProtocolTypes

    Description

      Data types as defined by the LysKOM protocol specification.

Module Protocols.X

  Module Protocols.X.Extensions

    CLASS Protocols.X.Extensions.extension

      Description

        an abstract class used to provide features for implimenting X11 extensions. Provides no useful functionality on its own.

      Method init

        `int init(object d)`

      Description

        initialize the extension.

      Parameter `d`

        An object of type Protocols.X.Xlib.Display

    CLASS Protocols.X.Extensions.XTEST

      Description

        Provides support for the X11 XTEST extension.

      Inherit extension

        inherit extension : extension

      Method create

        `void Protocols.X.Extensions.XTEST()`

      Description

        Create object.

      Method init

        `int init(object display)`

      Description

        Initialize the XTEST extension. Returns 1 if successful.

      Parameter `display`

        Protocols.X.Display object

      Method XTestFakeInput

        `void XTestFakeInput(string event_type, int detail, int delay, object|void window, int|void xloc, int|void yloc)`

      Description

        Send a synthetic event to an X server.

      Parameter `event_type`

        Type of event to send. Possible values: KeyPress: 2, KeyRelease: 3, ButtonPress: 4, ButtonRelease: 5, MotionNotify: 6

      Parameter `detail`

        Button (for Button events) or Keycode (for Key events) to send

      Parameter `delay`

        Delay before the X server simulates event. 0 indicates zero delay.

      Parameter `window`

        Window object that a motion event occurrs in. If no window is provided, the root window will be used.

      Parameter `xloc`

        For motion events, this is the relative X distance or absolute X coordinates.

      Parameter `yloc`

        For motion events, this is the relative Y distance or absolute Y coordinates.

      Method XTestGrabControl

        `void XTestGrabControl(int impervious)`

      Description

        Cause the executing client to become impervious to server grabs. That is, it can continue to execute requests even if another client grabs the server.

      Parameter `impervious`

        A true (non zero) value causes the client to perform as described above. If false (zero), server returns to the normal state of being susceptible to server grabs.

Module Protocols.SNMP

  Description

    SNMPv1 and v2c

  Constant ERROR_TOOBIG

    `constant Protocols.SNMP.ERROR_TOOBIG`

  Description

    Error tooBig

  Constant ERROR_NOERROR

    `constant Protocols.SNMP.ERROR_NOERROR`

  Description

    Error noError

  Constant ERROR_NOSUCHNAME

    `constant Protocols.SNMP.ERROR_NOSUCHNAME`

  Description

    Error noSuchName

  Constant ERROR_BADVALUE

    `constant Protocols.SNMP.ERROR_BADVALUE`

  Description

    Error badValue

  Constant ERROR_READONLY

    `constant Protocols.SNMP.ERROR_READONLY`

  Description

    Error readOnly

  Constant ERROR_GENERROR

    `constant Protocols.SNMP.ERROR_GENERROR`

  Description

    Error genError

  Constant REQUEST_GET

    `constant Protocols.SNMP.REQUEST_GET`

  Description

    PDU type Get

  Constant REQUEST_GETNEXT

    `constant Protocols.SNMP.REQUEST_GETNEXT`

  Description

    PDU type GetNext

  Constant REQUEST_SET

    `constant Protocols.SNMP.REQUEST_SET`

  Description

    PDU type Set

  Constant REQUEST_GET_RESPONSE

    `constant Protocols.SNMP.REQUEST_GET_RESPONSE`

  Description

    PDU type GetResponse

  Constant REQUEST_TRAP

    `constant Protocols.SNMP.REQUEST_TRAP`

  Description

    PDU type Trap

  CLASS Protocols.SNMP.protocol

    Description

      SNMP protocol implementation for Pike

      RFCs:

      implemented (yet): 1155-7 : v1

      1901-4 : v2/community (Bulk ops aren't implemented!)

      planned: 2742 : agentX

      2570 : v3 description

    Inherit snmp

      inherit Stdio.UDP : snmp

    Variable snmp_version

      `int Protocols.SNMP.protocol.snmp_version`

    Description

      SNMP version

      currently version 1 and 2 are supported.

    Variable snmp_community

      `string Protocols.SNMP.protocol.snmp_community`

    Description

      SNMP community string

      should be set to the appropriate SNMP community before sending a request.

    Note

      Set to "public" by default.

    Method create

      `void Protocols.SNMP.protocol(int|void rem_port, string|void rem_addr, int|void loc_port, string|void loc_addr)`

    Description

      create a new SNMP protocol object

    Parameter `rem_port`
    Parameter `rem_addr`

      remote address and UDP port (optional)

    Parameter `loc_port`
    Parameter `loc_addr`

      local address and UDP port (optional)

    Method readmsg

      `mapping readmsg(int|float|void timeout)`

    Description

      return the whole SNMP message in raw format

    Method decode_asn1_msg

      `mapping decode_asn1_msg(mapping rawd)`

    Description

      decode ASN1 data, if garbaged ignore it

    Method to_pool

      `void to_pool(mapping rawd)`

    Description

      decode raw pdu message and place in message pool

    Method readmsg_from_pool

      `mapping readmsg_from_pool(int msgid)`

    Description

      read decoded message from pool

    Method get_request

      `int get_request(array(string) varlist, string|void rem_addr, int|void rem_port)`

    Description

      GetRequest-PDU call

    Parameter `varlist`

      an array of OIDs to GET

    Parameter `rem_addr`
    Parameter `rem_port`

      remote address an UDP port to send request to (optional)

    Returns

      request ID

    Method get_response

      `int get_response(mapping varlist, mapping origdata, int|void errcode, int|void erridx)`

    Description

      GetResponse-PDU call

    Parameter `varlist`

      a mapping containing data to return

      `oid1 : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oid1

      `oid2 : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oid2

      `oidn : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oidn

    Parameter `origdata`

      original received decoded pdu that this response corresponds to

    Parameter `errcode`

      error code

    Parameter `erridx`

      error index

    Returns

      request ID

    Method get_nextrequest

      `int get_nextrequest(array(string) varlist, string|void rem_addr, int|void rem_port)`

    Description

      GetNextRequest-PDU call

    Parameter `varlist`

      an array of OIDs to GET

    Parameter `rem_addr`
    Parameter `rem_port`

      remote address an UDP port to send request to (optional)

    Returns

      request ID

    Method set_request

      `int set_request(mapping varlist, string|void rem_addr, int|void rem_port)`

    Description

      SetRequest-PDU call

    Parameter `varlist`

      a mapping of OIDs to SET

      `oid1 : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oid1

      `oid2 : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oid2

      `oidn : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oidn

    Parameter `rem_addr`
    Parameter `rem_port`

      remote address an UDP port to send request to (optional)

    Returns

      request ID

    Example

          // set the value of 1.3.6.1.4.1.1882.2.1 to "blah".
             object s=Protocols.SNMP.protocol();
             s->snmp_community="mysetcommunity";
             mapping req=(["1.3.6.1.4.1.1882.2.1": ({"str", "blah"})]);
             int id=s->set_request(req, "172.21.124.32");

    Method trap

      `int trap(mapping varlist, string oid, int type, int spectype, int ticks, string|void locip, string|void remaddr, int|void remport)`

    Description

      send an SNMP-v1 trap

    Parameter `varlist`

      a mapping of OIDs to include in trap

      `oid1 : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oid1

      `oid2 : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oid2

      `oidn : array`

      Array
      `string type` | data type such as tick, oid, gauge, etc
      `mixed data` | data to return for oidn

    Parameter `oid`
    Parameter `type`

      generic trap-type

    Parameter `spectype`

      specific trap-type

    Parameter `ticks`

      uptime

    Parameter `locip`

      originating ip address of the trap

    Parameter `remaddr`
    Parameter `remport`

      address and UDP to send trap to

    Returns

      request id

  CLASS Protocols.SNMP.agent

    Description

      A simple SNMP agent with support for SNMP Get requests

    Inherit "protocol"

      inherit "protocol"

    Method create

      `void Protocols.SNMP.agent(int|void port, string|void addr)`

    Description

      create a new instance of the agent

    Parameter `port`

      the port number to listen for requests on

    Parameter `addr`

      the address to bind to for listening

    Note

      only one agent may be bound to a port at one time the agent does not currently support SMUX or AGENTX or other agent multiplexing protocols.

    Method set_threaded

      `void set_threaded()`

    Description

      Run the agent event loop in a thread, if available.

    Method set_managers_only

      `void set_managers_only(int yesno)`

    Description

      enable manager access limits

    Parameter `yesno`

      1 to allow only managers to submit requests 0 to allow any host to submit requests

      default setting allows all requests from all hosts

    Method set_get_communities

      `void set_get_communities(array communities)`

    Description

      set the valid community strings for Get requests

    Parameter `communities`

      an array of valid Get communities

    Note

      send an empty array to disable Get requests

    Method set_set_communities

      `void set_set_communities(array communities)`

    Description

      set the valid community strings for Set requests

    Parameter `communities`

      an array of valid Set communities

    Note

      send an empty array to disable Set requests

    Method set_managers

      `void set_managers(array managers)`

    Description

      set the valid manager list for requests

    Parameter `managers`

      an array of valid management hosts

    Note

      send an empty array to disable all requests

    Method set_set_oid_callback

      `void set_set_oid_callback(string oid, function cb)`

    Description

      set the Set request callback function for an Object Identifier

    Parameter `oid`

      the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to serve as the handler for all requests for which a handler is specified.

    Parameter `cb`

      the function to call when oid is requested by a manager the function should take 3 arguments: a string containing the requested oid, the desired value, and the body of the request as a mapping. The function should return an array containing 3 elements: The first is a boolean indicating success or failure. If success, the next 2 elements should be the SNMP data type of the result followed by the result itself. If failure, the next 2 elements should be the error-status such as Protocols.SNMP.ERROR_TOOBIG and the second is the error-index, if any.

    Note

      there can be only one callback per object identifier. calling this function more than once with the same oid will result in the new callback replacing the existing one.

    Method clear_set_oid_callback

      `int clear_set_oid_callback(string oid)`

    Description

      clear the Set callback function for an Object Identifier

    Parameter `oid`

      the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to indicate the default handler.

    Returns

      1 if the callback existed, 0 otherwise

    Method get_set_oid_callback

      `void|function get_set_oid_callback(string oid)`

    Description

      get the Set request callback function for an Object Identifier

    Parameter `oid`

      the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to indicate the default handler

    Returns

      the function associated with oid, if any

    Method set_get_oid_callback

      `void set_get_oid_callback(string oid, function cb)`

    Description

      set the Get request callback function for an Object Identifier

    Parameter `oid`

      the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to serve as the handler for all requests for which a handler is specified.

    Parameter `cb`

      the function to call when oid is requested by a manager the function should take 2 arguments: a string containing the requested oid and the body of the request as a mapping. The function should return an array containing 3 elements: The first is a boolean indicating success or failure. If success, the next 2 elements should be the SNMP data type of the result followed by the result itself. If failure, the next 2 elements should be the error-status such as Protocols.SNMP.ERROR_TOOBIG and the second is the error-index, if any.

    Note

      there can be only one callback per object identifier. calling this function more than once with the same oid will result in the new callback replacing the existing one.

    Method clear_get_oid_callback

      `int clear_get_oid_callback(string oid)`

    Description

      clear the Get callback function for an Object Identifier

    Parameter `oid`

      the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to indicate the default handler.

    Returns

      1 if the callback existed, 0 otherwise

    Method get_get_oid_callback

      `void|function get_get_oid_callback(string oid)`

    Description

      get the Get request callback function for an Object Identifier

    Parameter `oid`

      the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to indicate the default handler

    Returns

      the function associated with oid, if any

Module Protocols.XMLRPC

  Description

    This module implements most features of the XML-RPC standard (see http://xml-rpc.org/).

    Translation rules for conversions from Pike datatypes to XML-RPC datatypes:

    Pike `int` is translated to XML-RPC `<int>`. Pike `string` is translated to XML-RPC `<string>`. Pike `float` is translated to XML-RPC `<double>`. Pike `mapping` is translated to XML-RPC `<struct>`. Pike `array` is translated to XML-RPC `<array>`. Pike Calendar object is translated to XML-RPC `<dateTime.iso8601`. Pike `Val.false` and `Val.true` is translated to XML-RPC `<boolean>`.

    Translation rules for conversions from XML-RPC datatypes to Pike datatypes:

    XML-RPC `<i4>` and `<int>` are translated to Pike `int`. XML-RPC `<boolean>` is translated to Pike `Val.true` and `Val.false`. XML-RPC `<string>` and `<base64>` are translated to Pike `string`. XML_RPC `<double>` is translated to Pike `float`. XML-RPC `<struct>` is translated to Pike `mapping`. XML-RPC `<array>` is translated to Pike `array`. XML-RPC `<dateTime.iso8601>` is translated to Pike Calendar object.

  Note

    The XML-RPC `<dateTime.iso8601>` datatype does not assume any time zone, but local time is always used in the conversion to Calendar objects.

  Method decode_call

    `Call decode_call(string xml_input)`

  Description

    Decodes a XML-RPC representation of a function call and returns a Call object.

  See also

    Call

  Method decode_response

    `array|Fault decode_response(string xml_input, int|void boolean)`

  Description

    Decodes a XML-RPC representation of a response and returns an array containing response values, or a Fault object.

  See also

    Fault

  Method encode_call

    `string encode_call(string method_name, array params)`

  Description

    Encodes a function call with the name method_name and the arguments params and returns the XML-RPC string representation.

  Method encode_response

    `string encode_response(array params)`

  Description

    Encodes a response containing the multiple values in params and returns the XML-RPC string representation.

  Method encode_response_fault

    `string encode_response_fault(int fault_code, string fault_string)`

  Description

    Encodes a response fault containing a fault_code and a fault_string and returns the XML-RPC string representation.

  CLASS Protocols.XMLRPC.Call

    Description

      Represents a function call made to a XML-RPC server.

    See also

      decode_call()

    syntax

      `string Protocols.XMLRPC.Call.method_name`
      `array Protocols.XMLRPC.Call.params` `void Protocols.XMLRPC.Call(string method_name, array params)`

    Variable method_name

      `int Protocols.XMLRPC.Call.method_name`

    Description

      Represents `<methodName>` in the XML-RPC standard.

    Variable params

      `array Protocols.XMLRPC.Call.params`

    Description

      Represents `<params>` in the XML-RPC standard where all datatypes have been converted to equivalent or similar datatypes in Pike.

  CLASS Protocols.XMLRPC.Fault

    Description

      Represents a fault response which can be one of the return values from a XML-RPC function call.

    See also

      decode_response()

    syntax

      `int Protocols.XMLRPC.Fault.fault_code`
      `string Protocols.XMLRPC.Fault.fault_string` `void Protocols.XMLRPC.Fault(int fault_code, string fault_string)`

    Variable fault_code

      `int Protocols.XMLRPC.Fault.fault_code`

    Description

      Represents `faultCode` in the XML-RPC standard.

    Variable fault_string

      `int Protocols.XMLRPC.Fault.fault_string`

    Description

      Represents `faultString` in the XML-RPC standard.

  CLASS Protocols.XMLRPC.Client

    Description

      This class implements an XML-RPC client that uses HTTP transport.

      There is an optional boolean flag to get the new behavior of booleans being returned as Val instead of ints.

    Example

             > Protocols.XMLRPC.Client client = Protocols.XMLRPC.Client("http://www.oreillynet.com/meerkat/xml-rpc/server.php");
             Result: Protocols.XMLRPC.Client("http://www.oreillynet.com/meerkat/xml-rpc/server.php");
             > client["system.listMethods"]();
             Result: ({ /* 1 element */
            		    ({ /* 9 elements */
            			"meerkat.getChannels",
            			"meerkat.getCategories",
            			"meerkat.getCategoriesBySubstring",
            			"meerkat.getChannelsByCategory",
            			"meerkat.getChannelsBySubstring",
            			"meerkat.getItems",
            			"system.listMethods",
            			"system.methodHelp",
            			"system.methodSignature"
            		    })
            		})

    syntax

      `string|Standards.URI Protocols.XMLRPC.Client.url`
      `int|void Protocols.XMLRPC.Client.boolean` `void Protocols.XMLRPC.Client(string|Standards.URI url, int|void boolean)`

  CLASS Protocols.XMLRPC.AsyncClient

    Description

      This class implements an XML-RPC client that uses HTTP transport using non blocking sockets.

      There is an optional boolean flag to get the new behavior of booleans being returned Val instead of ints.

    Example

          void data_ok(mixed result)
          {
            write("result=%O\n", result);
          }

          void fail()
          {
            write("fail\n");
          }

          int main(int argc, array argv)
          {
            object async_client = Protocols.XMLRPC.AsyncClient("http://www.oreillynet.com/meerkat/xml-rpc/server.php");
            async_client["system.listMethods"](data_ok, fail);
            return -1;

Module Protocols.HTTP

  Method do_proxied_method

    `.Query do_proxied_method(string|Standards.URI proxy, string user, string password, string method, string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con, void|string data)`

  Description

    Makes an HTTP request through a proxy.

  Parameter `proxy`

    URL for the proxy.

  Parameter `user`
  Parameter `password`

    Proxy authentication credentials.

  Parameter `method`
  Parameter `url`
  Parameter `query_variables`
  Parameter `request_headers`
  Parameter `con`
  Parameter `data`

    The remaining arguments are identical to do_method() .

  See also

    do_method() , do_async_proxied_method()

  Method do_method

    `.Query do_method(string method, string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con, void|string data)`

  Description

    Low level HTTP call method.

  Parameter `method`

    The HTTP method to use, e.g. `"GET"`.

  Parameter `url`

    The URL to perform method on. Should be a complete URL, including protocol, e.g. `"https://pike.ida.liu.se/"`.

  Parameter `query_variables`

    Calls http_encode_query and appends the result to the URL.

  Parameter `request_headers`

    The HTTP headers to be added to the request. By default the headers User-agent, Host and, if needed by the url, Authorization will be added, with generated contents. Providing these headers will override the default. Setting the value to 0 will remove that header from the request.

  Parameter `con`

    Old connection object.

  Parameter `data`

    Data payload to be transmitted in the request.

  See also

    do_sync_method()

  Method do_async_method

    `void do_async_method(string method, string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, Protocols.HTTP.Query con, void|string data)`

  Description

    Low level asynchronous HTTP call method.

  Parameter `method`

    The HTTP method to use, e.g. `"GET"`.

  Parameter `url`

    The URL to perform method on. Should be a complete URL, including protocol, e.g. `"https://pike.ida.liu.se/"`.

  Parameter `query_variables`

    Calls http_encode_query and appends the result to the URL.

  Parameter `request_headers`

    The HTTP headers to be added to the request. By default the headers User-agent, Host and, if needed by the url, Authorization will be added, with generated contents. Providing these headers will override the default. Setting the value to 0 will remove that header from the request.

  Parameter `con`

    Previously initialized connection object. In particular the callbacks must have been set (Query.set_callbacks() ).

  Parameter `data`

    Data payload to be transmitted in the request.

  See also

    do_method() , Query.set_callbacks()

  Method do_async_proxied_method

    `void do_async_proxied_method(string|Standards.URI proxy, string user, string password, string method, string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, Protocols.HTTP.Query con, void|string data)`

  Description

    Low level asynchronous proxied HTTP call method.

    Makes an HTTP request through a proxy.

  Parameter `proxy`

    URL for the proxy.

  Parameter `user`
  Parameter `password`

    Proxy authentication credentials.

  Parameter `method`

    The HTTP method to use, e.g. `"GET"`.

  Parameter `url`

    The URL to perform method on. Should be a complete URL, including protocol, e.g. `"https://pike.lysator.liu.se/"`.

  Parameter `query_variables`

    Calls http_encode_query and appends the result to the URL.

  Parameter `request_headers`

    The HTTP headers to be added to the request. By default the headers User-agent, Host and, if needed by the url, Authorization will be added, with generated contents. Providing these headers will override the default. Setting the value to 0 will remove that header from the request.

  Parameter `con`

    Previously initialized connection object. In particular the callbacks must have been set (Query.set_callbacks() ).

  Parameter `data`

    Data payload to be transmitted in the request.

  See also

    do_async_method() , do_proxied_method() , Query.set_callbacks()

  Method get_url

    `.Query get_url(string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Sends a HTTP GET request to the server in the URL and returns the created and initialized Query object. `0` is returned upon failure. If a query object having `request_headers->Connection=="Keep-Alive"` from a previous request is provided and the already established server connection can be used for the next request, you may gain some performance.

  Method put_url

    `.Query put_url(string|Standards.URI url, void|string file, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Sends a HTTP PUT request to the server in the URL and returns the created and initialized Query object. `0` is returned upon failure. If a query object having `request_headers->Connection=="Keep-Alive"` from a previous request is provided and the already established server connection can be used for the next request, you may gain some performance.

  Method delete_url

    `.Query delete_url(string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Sends a HTTP DELETE request to the server in the URL and returns the created and initialized Query object. `0` is returned upon failure. If a query object having `request_headers->Connection=="Keep-Alive"` from a previous request is provided and the already established server connection can be used for the next request, you may gain some performance.

  Method get_url_nice

    `array(string) get_url_nice(string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Returns an array of `({content_type, data})` after calling the requested server for the information. `0` is returned upon failure. Redirects (HTTP 302) are automatically followed.

  Method get_url_data

    `string get_url_data(string|Standards.URI url, void|mapping(string:int|string|array(string)) query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Returns the returned data after calling the requested server for information through HTTP GET. `0` is returned upon failure. Redirects (HTTP 302) are automatically followed.

  Method post_url

    `.Query post_url(string|Standards.URI url, mapping(string:int|string|array(string))|string query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Similar to get_url , except that query variables is sent as a POST request instead of a GET request. If query_variables is a simple string, it is assumed to contain the verbatim body of the POST request; Content-Type must be properly specified manually, in this case.

  Method post_url_nice

    `array(string) post_url_nice(string|Standards.URI url, mapping(string:int|string|array(string))|string query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Similar to get_url_nice , except that query variables is sent as a POST request instead of a GET request.

  Method post_url_data

    `string post_url_data(string|Standards.URI url, mapping(string:int|string|array(string))|string query_variables, void|mapping(string:string|array(string)) request_headers, void|Protocols.HTTP.Query con)`

  Description

    Similar to get_url_data , except that query variables is sent as a POST request instead of a GET request.

  Method http_encode_query

    `string http_encode_query(mapping(string:int|string|array(string)) variables)`

  Description

    Encodes a query mapping to a string; this protects odd - in http perspective - characters like '&' and '#' and control characters, and packs the result together in a HTTP query string.

    Example:

        	> Protocols.HTTP.http_encode_query( (["anna":"eva","lilith":"blue"]) );
             Result: "lilith=blue&anna=eva"
             > Protocols.HTTP.http_encode_query( (["&amp;":"&","'=\"":"\0\0\0"]) );
             Result: "%26amp%3b=%26&%27%3d%22=%00%00%00"

  Method percent_encode

    `string percent_encode(string s)`

  Description

    Encodes the given string using `%XX` encoding, except that URI unreserved chars are not encoded. The unreserved chars are `A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, and `~` (see RFC 2396 section 2.3).

    8-bit chars are encoded straight, and wider chars are not allowed. That means this encoding is applicable if s is a binary octet string. If it is a character string then uri_encode should be used instead.

    It is also slightly faster than uri_encode if s is known to contain only US-ASCII.

  Method percent_decode

    `string percent_decode(string s)`

  Description

    Decodes URI-style `%XX` encoded chars in the given string.

  See also

    percent_encode , uri_decode

  Bugs

    This function currently does not accept wide string input, which is necessary to work as the reverse of iri_encode .

  Method uri_encode

    `string uri_encode(string s)`

  Description

    Encodes the given string using `%XX` encoding to be used as a component part in a URI. This means that all URI reserved and excluded characters are encoded, i.e. everything except `A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, and `~` (see RFC 2396 section 2.3).

    8-bit chars and wider are encoded using UTF-8 followed by percent-encoding. This follows RFC 3986 section 2.5, the IRI-to-URI conversion method in the IRI standard (RFC 3987) and appendix B.2 in the HTML 4.01 standard. It should work regardless of the charset used in the XML document the URI might be inserted into.

  See also

    uri_decode , uri_encode_invalids , iri_encode

  Method uri_encode_invalids

    `string uri_encode_invalids(string s)`

  Description

    Encodes all "dangerous" chars in the given string using `%XX` encoding, so that it can be included as a URI in an HTTP message or header field. This includes control chars, space and various delimiter chars except those in the URI `reserved` set (RFC 2396 section 2.2).

    Since this function doesn't touch the URI `reserved` chars nor the escape char `%`, it can be used on a complete formatted URI or IRI.

    8-bit chars and wider are encoded using UTF-8 followed by percent-encoding. This follows RFC 3986 section 2.5, the IRI standard (RFC 3987) and appendix B.2 in the HTML 4.01 standard.

  Note

    The characters in the URI `reserved` set are: `:`, `/`, `?`, `#`, `[`, `]`, `@`, `!`, `$`, `&`, `'`, `(`, `)`, `*`, `+`, `,`, `;`, `=`. In addition, this function doesn't touch the escape char `%`.

  See also

    uri_decode , uri_encode

  Method uri_decode

    `string uri_decode(string s)`

  Description

    Decodes URI-style `%XX` encoded chars in the given string, and then UTF-8 decodes the result. This is the reverse of uri_encode and uri_encode_invalids .

  See also

    uri_encode , uri_encode_invalids

  Method iri_encode

    `string iri_encode(string s)`

  Description

    Encodes the given string using `%XX` encoding to be used as a component part in an IRI (Internationalized Resource Identifier, see RFC 3987). This means that all chars outside the IRI `iunreserved` set are encoded, i.e. this function encodes equivalently to uri_encode except that all 8-bit and wider characters are left as-is.

  Bugs

    This function currently does not encode chars in the Unicode private ranges, although that is strictly speaking required in some but not all IRI components. That could change if it turns out to be a problem.

  See also

    percent_decode , uri_encode

  Method uri_normalize

    `string uri_normalize(string s)`

  Description

    Normalizes the URI-style `%XX` encoded string s by decoding all URI `unreserved` chars, i.e. US-ASCII digits, letters, `-`, `.`, `_`, and `~`.

    Since only unreserved chars are decoded, the result is always semantically equivalent to the input. It's therefore safe to use this on a complete formatted URI.

  See also

    uri_decode , uri_encode , iri_normalize

  Method iri_normalize

    `string iri_normalize(string s)`

  Description

    Normalizes the IRI-style UTF-8 and `%XX` encoded string s by decoding all IRI `unreserved` chars, i.e. everything except the URI `reserved` chars and control chars.

    Since only unreserved chars are decoded, the result is always semantically equivalent to the input. It's therefore safe to use this on a complete formatted IRI.

  See also

    iri_decode , uri_normalize

  Method quoted_string_encode

    `string quoted_string_encode(string s)`

  Description

    Encodes the given string quoted to be used as content inside a `quoted-string` according to RFC 2616 section 2.2. The returned string does not include the surrounding `"` chars.

  Note

    The `quoted-string` quoting rules in RFC 2616 have several problems:

    - Quoting is inconsistent since `"` is quoted as `\"`, but `\` does not need to be quoted. This is resolved in the HTTP bis update to mandate quoting of `\` too, which this function performs.

    - Many characters are not quoted sufficiently to make the result safe to use in an HTTP header, so this quoting is not enough if s contains NUL, CR, LF, or any 8-bit or wider character.

  See also

    quoted_string_decode

  Method quoted_string_decode

    `string quoted_string_decode(string s)`

  Description

    Decodes the given string which has been encoded as a `quoted-string` according to RFC 2616 section 2.2. s is assumed to not include the surrounding `"` chars.

  See also

    quoted_string_encode

  Method http_encode_string

    `__deprecated__ string http_encode_string(string in)`

  Description

    This is a deprecated alias for uri_encode , for compatibility with Pike 7.6 and earlier.

    In 7.6 this function didn't handle 8-bit and wider chars correctly. It encoded 8-bit chars directly to `%XX` escapes, and it used nonstandard `%uXXXX` escapes for 16-bit chars.

    That is considered a bug, and hence the function is changed. If you need the old buggy encoding then use the 7.6 compatibility version (`#pike 7.6`).

  Deprecated

  Method http_encode_cookie

    `__deprecated__ string http_encode_cookie(string f)`

  Description

    This function used to claim that it encodes the specified string according to the HTTP cookie standard. If fact it does not - it applies URI-style (i.e. `%XX`) encoding on some of the characters that cannot occur literally in cookie values. There exist some web servers (read Roxen and forks) that usually perform a corresponding nonstandard decoding of %-style escapes in cookie values in received requests.

    This function is deprecated. The function quoted_string_encode performs encoding according to the standard, but it is not safe to use with arbitrary chars. Thus URI-style encoding using uri_encode or percent_encode is normally a good choice, if you can use uri_decode /percent_decode at the decoding end.

  Deprecated

  Method unentity

    `__deprecated__ string unentity(string s)`

  Description

    Helper function for replacing HTML entities with the corresponding unicode characters.

  Deprecated

  CLASS Protocols.HTTP.Query

    Description

      Open and execute an HTTP query.

    Example

          HTTP.Query o=HTTP.Query();
           void ok()
           {
              write("ok...\n");
              write("%O\n", o->headers);
              exit(0);
           }
           void fail()
           {
              write("fail\n");
              exit(0);
           }
           int main()
           {
              o->set_callbacks(ok, fail);
              o->async_request("pike.ida.liu.se", 80, "HEAD / HTTP/1.0");
              return -1;
           }

    Variable errno

      `int Protocols.HTTP.Query.errno`

    Description

      Errno copied from the connection.

    Variable ok

      `int Protocols.HTTP.Query.ok`

    Description

      Tells if the connection is successfull.

    Variable headers

      `mapping Protocols.HTTP.Query.headers`

    Description

      Headers as a mapping. All header names are in lower case, for convinience.

    Variable protocol

      `string Protocols.HTTP.Query.protocol`

    Description

      Protocol string, ie `"HTTP/1.0"`.

      `int Protocols.HTTP.Query.status`
      `string Protocols.HTTP.Query.status_desc`

    Description

      Status number and description (eg `200` and `"ok"`).

      `string Protocols.HTTP.Query.host`
      `int Protocols.HTTP.Query.port`

    Description

      Connected host and port.

      Used to detect whether keep-alive can be used.

    Variable hostname_cache

      `mapping Protocols.HTTP.Query.hostname_cache`

    Description

      Set this to a global mapping if you want to use a cache, prior of calling *request().

    Method set_callbacks
    Method async_request

      `Protocols.HTTP.Query set_callbacks(function request_ok, function request_fail, mixed ... extra)`
      `Protocols.HTTP.Query async_request(string server, int port, string query)`
      `Protocols.HTTP.Query async_request(string server, int port, string query, mapping headers, string|void data)`

    Description

      Setup and run an asynchronous request, otherwise similar to thread_request() .

      request_ok (Protocols.HTTP.Query httpquery,...extra args) will be called when connection is complete, and headers are parsed.

      request_fail (Protocols.HTTP.Query httpquery,...extra args) is called if the connection fails.

    Returns

      Returns the called object

    Method thread_request

      `Protocols.HTTP.Query thread_request(string server, int port, string query)`
      `Protocols.HTTP.Query thread_request(string server, int port, string query, mapping headers, void|string data)`

    Description

      Create a new query object and begin the query.

      The query is executed in a background thread; call `() in the object to wait for the request to complete.

      query is the first line sent to the HTTP server; for instance `"GET /index.html HTTP/1.1"`.

      headers will be encoded and sent after the first line, and data will be sent after the headers.

    Returns

      Returns the called object.

    Method `()

      `int `()()`

    Description

      Wait for connection to complete.

    Returns

      Returns `1` on successfull connection, `0` on failure.

    Method data

      `string data(int|void max_length)`

    Description

      Gives back the data as a string.

    Method unicode_data

      `string unicode_data()`

    Description

      Gives back data, but decoded according to the content-type character set.

    See also

      data

    Method downloaded_bytes

      `int downloaded_bytes()`

    Description

      Gives back the number of downloaded bytes.

    Method total_bytes

      `int total_bytes()`

    Description

      Gives back the size of a file if a content-length header is present and parsed at the time of evaluation. Otherwise returns -1.

    Method cast

      `array cast("array")`

    Returns

      Array
      `mapping 0` | Headers
      `string 1` | Data
      `string 2` | Protocol
      `int 3` | Status
      `string 4` | Status description

    Method cast

      `mapping cast("mapping")`

    Returns

      The header mapping ORed with the following mapping.

      `"protocol" : string` | The protocol.
      `"status" : int` | The status code.
      `"status_desc" : string` | The status description.
      `"data" : string` | The returned data.

    Method cast

      `string cast("string")`

    Description

      Gives back the answer as a string.

    Method file

      `Protocols.HTTP.Query.PseudoFile file()`
      `Protocols.HTTP.Query.PseudoFile file(mapping newheaders, void|mapping removeheaders)`

    Description

      Gives back a pseudo-file object, with the methods `read()` and `close()`. This could be used to copy the file to disc at a proper tempo.

      newheaders , removeheaders is applied as: `(oldheaders|newheaders))-removeheaders` Make sure all new and remove-header indices are lower case.

    See also

      datafile()

    Method datafile

      `Protocols.HTTP.Query.PseudoFile datafile()`

    Description

      Gives back a pseudo-file object, with the methods `read()` and `close()`. This could be used to copy the file to disc at a proper tempo.

      datafile() doesn't give the complete request, just the data.

    See also

      file()

    Method close

      `void close()`

    Description

      Close all associated file descriptors.

    Method async_fetch

      `void async_fetch(function callback, mixed ... extra)`

    Description

      Fetch all data in background.

    See also

      timed_async_fetch() , async_request() , set_callbacks()

    Method timed_async_fetch

      `void timed_async_fetch(function(object:void) ok_callback, function(object:void) fail_callback, mixed ... extra)`

    Description

      Like async_fetch() , except with a timeout and a corresponding fail callback function.

    See also

      async_fetch() , async_request() , set_callbacks()

  CLASS Protocols.HTTP.Session

    Variable follow_redirects

      `int Protocols.HTTP.Session.follow_redirects`

    Description

      The number of redirects to follow, if any. This is the default to the created Request objects.

      A redirect automatically turns into a GET request, and all header, query, post or put information is dropped.

      Default is 20 redirects. A negative number will mean infinity.

    Bugs

      Loops will currently not be detected, only the limit works to stop loops.

    See also

      Request.follow_redirects

    Variable default_headers

      `mapping Protocols.HTTP.Session.default_headers`

    Description

      Default HTTP headers.

    Method set_http_cookie

      `void set_http_cookie(string cookie, Standards.URI at)`

    Description

      Parse and set a cookie received in the HTTP protocol. The cookie will be checked against current security levels et al.

    Method set_cookie

      `void set_cookie(Cookie cookie, Standards.URI who)`

    Description

      Set a cookie. The cookie will be checked against current security levels et al, using the parameter who . If who is zero, no security checks will be performed.

    Method encode_cookies
    Method decode_cookies

      `string encode_cookies()`
      `void decode_cookies(string data, void no_clear)`

    Description

      Dump all cookies to a string and read them back. This is useful to store cookies in between sessions (on disk, for instance). decode_cookies will throw an error upon parse failures. Also note, decode_cookies will clear out any previously learned cookies from the Session object, unless no_clear is given and true.

    Method get_cookies

      `array(string) get_cookies(Standards.URI|SessionURL for_url, void|int(0..1) no_delete)`

    Description

      Get the cookies that we should send to this server, for this url. They are presented in the form suitable for HTTP headers (as an array). This will also take in count expiration of cookies, and delete expired cookies from the Session unless no_delete is true.

    Variable hostname_cache

      `mapping Protocols.HTTP.Session.hostname_cache`

    Description

      Cache of hostname to IP lookups. Given to and used by the Query objects.

    Variable time_to_keep_unused_connections

      `int|float Protocols.HTTP.Session.time_to_keep_unused_connections`

    Description

      The time to keep unused connections in seconds. Set to zero to never save any kept-alive connections. (Might be good in a for instance totaly synchroneous script that keeps the backend thread busy and never will get call_outs.) Defaults to 10 seconds.

    Variable maximum_connections_per_server

      `int Protocols.HTTP.Session.maximum_connections_per_server`

    Description

      Maximum number of connections to the same server. Used only by async requests. Defaults to 10 connections.

    Variable maximum_total_connections

      `int Protocols.HTTP.Session.maximum_total_connections`

    Description

      Maximum total number of connections. Limits only async requests, and the number of kept-alive connections (live connections + kept-alive connections <= this number) Defaults to 50 connections.

    Variable maximum_connection_reuse

      `int Protocols.HTTP.Session.maximum_connection_reuse`

    Description

      Maximum times a connection is reused. Defaults to 1000000. <2 means no reuse at all.

    Method give_me_connection

      `Query give_me_connection(Standards.URI url)`

    Description

      Request a Query object suitable to use for the given URL. This may be a reused object from a keep-alive connection.

    Method return_connection

      `void return_connection(Standards.URI url, Query query)`

    Description

      Return a previously used Query object to the keep-alive storage. This function will determine if the given object is suitable to keep or not by checking status and headers.

    Method get_url
    Method post_url
    Method put_url
    Method delete_url

      `Request get_url(URL url, void|mapping query_variables)`
      `Request post_url(URL url, mapping|string query_variables)`
      `Request put_url(URL url, string file, void|mapping query_variables)`
      `Request delete_url(URL url, void|mapping query_variables)`

    Description

      Sends a HTTP GET, POST, PUT or DELETE request to the server in the URL and returns the created and initialized Request object. 0 is returned upon failure.

    Method get_url_nice
    Method get_url_data
    Method post_url_nice
    Method post_url_data

      `array(string) get_url_nice(URL url, mapping query_variables)`
      `string get_url_data(URL url, mapping query_variables)`
      `array(string) post_url_nice(URL url, mapping|string query_variables)`
      `string post_url_data(URL url, mapping|string query_variables)`

    Description

      Returns an array of `({content_type,data})` and just the data string respective, after calling the requested server for the information. `0` is returned upon failure.

      post* is similar to the get_url() class of functions, except that the query variables is sent as a POST request instead of as a GET.

    Method async_get_url
    Method async_put_url
    Method async_delete_url
    Method async_post_url

      `Request async_get_url(URL url, void|mapping query_variables, function callback_headers_ok, function callback_data_ok, function callback_fail, mixed ... callback_arguments)`
      `Request async_put_url(URL url, void|string file, void|mapping query_variables, function callback_headers_ok, function callback_data_ok, function callback_fail, mixed ... callback_arguments)`
      `Request async_delete_url(URL url, void|mapping query_variables, function callback_headers_ok, function callback_data_ok, function callback_fail, mixed ... callback_arguments)`
      `Request async_post_url(URL url, mapping query_variables, function callback_headers_ok, function callback_data_ok, function callback_fail, mixed ... callback_arguments)`

    Description

      Sends a HTTP GET, POST, PUT or DELETE request to the server in the URL asynchroneously, and call the corresponding callbacks when result arrives (or not). The callbacks will receive the created Request object as first argument, then the given callback_arguments , if any.

      callback_headers_ok is called when the HTTP request has received headers.

      callback_data_ok is called when the HTTP request has been received completely, data and all.

      callback_fail is called when the HTTP request has failed, on a TCP/IP or DNS level, or has received a forced timeout.

      The created Request object is returned.

    CLASS Protocols.HTTP.Session.Request

      Description

        Request

      Variable con

        `Query Protocols.HTTP.Session.Request.con`

      Description

        Raw connection object

      Variable url_requested

        `Standards.URI Protocols.HTTP.Session.Request.url_requested`

      Description

        URL requested (set by prepare_method). This will update according to followed redirects.

      Variable follow_redirects

        `int Protocols.HTTP.Session.Request.follow_redirects`

      Description

        Number of redirects to follow; the request will perform another request if the HTTP answer is a 3xx redirect. Default from the parent Session.follow_redirects .

        A redirect automatically turns into a GET request, and all header, query, post or put information is dropped.

      Bugs

        Loops will currently not be detected, only the limit works to stop loops.

      Variable cookie_encountered

        `function(string:mixed) Protocols.HTTP.Session.Request.cookie_encountered`

      Description

        Cookie callback. When a request is performed, the result is checked for cookie changes and additions. If a cookie is encountered, this function is called. Default is to call set_http_cookie in the Session object.

      Method prepare_method

        `array(string|int|mapping) prepare_method(string method, URL url, void|mapping query_variables, void|mapping extra_headers, void|string data)`

      Description

        Prepares the HTTP Query object for the connection, and returns the parameters to use with do_sync , do_async or do_thread .

        This method will also use cookie information from the parent Session , and may reuse connections (keep-alive).

      Method do_sync

        `Request do_sync(array(string|int|mapping) args)`

      Description

        Perform a request synchronously. Get arguments from prepare_method .

      Returns

        0 upon failure, this object upon success

      See also

        prepare_method , do_async , do_thread

      Method do_thread

        `Request do_thread(array(string|int|mapping) args)`

      Description

        Start a request in the background, using a thread. Call wait to wait for the thread to finish. Get arguments from prepare_method .

      Returns

        The called object.

      See also

        prepare_method , do_sync , do_async , wait

      Note

        do_thread does not rerun redirections automatically

      Method wait

        `Request wait()`

      Description

        Wait for the request thread to finish.

      Returns

        0 upon failure, or the called object upon success.

      See also

        do_thread

      Method set_callbacks

        `void set_callbacks(function(mixed ... :mixed) headers, function(mixed ... :mixed) data, function(mixed ... :mixed) fail, mixed ... callback_arguments)`

      Description

        Setup callbacks for async mode, headers will be called when the request got connected, and got data headers; data will be called when the request got the amount of data it's supposed to get and fail is called whenever the request failed.

        Note here that an error message from the server isn't considered a failure, only a failed TCP connection.

      Method do_async

        `Request do_async(array(string|int|mapping) args)`

      Description

        Start a request asyncroneously. It will perform in the background using callbacks (make sure the backend thread is free). Call set_callbacks to setup the callbacks. Get arguments from prepare_method .

      Returns

        The called object.

      See also

        set_callbacks , prepare_method , do_sync , do_thread

      Method destroy

        `void destroy()`

      Description

        destroy is called when an object is destructed. But since this clears the HTTP connection from the Request object, it can also be used to reuse a Request object.

    CLASS Protocols.HTTP.Session.SessionURL

      Description

        Class to store URL+referer

      Inherit URI

        inherit Standards.URI : URI

      Variable referer

        `URL Protocols.HTTP.Session.SessionURL.referer`

      Description

        the referer to this URL

      Method create

        `void Protocols.HTTP.Session.SessionURL(URL uri, URL base_uri, URL _referer)`

      Description

        instantiate a SessionURL object; when fed to Protocols.HTTP.Session calls, will add referer to the HTTP handshaking variables

  Module Protocols.HTTP.Server

    Constant HeaderParser

      `constant Protocols.HTTP.Server.HeaderParser`

    Description

      Fast HTTP header parser.

    Constant http_decode_string

      `constant Protocols.HTTP.Server.http_decode_string`

    Method http_decode_urlencoded_query

      `mapping(string:string|array(string)) http_decode_urlencoded_query(string query, void|mapping dest)`

    Description

      Decodes an URL-encoded query into a mapping.

    Method extension_to_type

      `string extension_to_type(string extension)`

    Description

      Looks up the file extension in a table to return a suitable MIME type.

    Method filename_to_type

      `string filename_to_type(string filename)`

    Description

      Looks up the file extension in a table to return a suitable MIME type.

    Method http_date

      `string http_date(int time)`

    Description

      Makes a time notification suitable for the HTTP protocol.

    Parameter `time`

      The time in seconds since the 00:00:00 UTC, January 1, 1970

    Returns

      The date in the HTTP standard date format. Example : Thu, 03 Aug 2000 05:40:39 GMT

    Method http_decode_date

      `int http_decode_date(string data)`

    Description

      Decode a HTTP date to seconds since 1970 (UTC)

    Returns

      zero (UNDEFINED) if the given string isn't a HTTP date

    CLASS Protocols.HTTP.Server.SSLPort

      Description

        The simplest SSL server possible. Binds a port and calls a callback with Request objects.

      Method create

        `void Protocols.HTTP.Server.SSLPort(function(Request:void) _callback, void|int _portno, void|string _interface, void|string key, void|string|array certificate)`

      Description

        Create a HTTPS (HTTP over SSL) server.

      Parameter `_callback`

        The function run when a request is received. takes one argument of type Request .

      Parameter `_portno`

        The port number to bind to, defaults to 443.

      Parameter `_interface`

        The interface address to bind to.

      Parameter `key`

        An optional SSL secret key, provided in binary format, such as that created by Standards.PKCS.RSA.private_key() .

      Parameter `certificate`

        An optional SSL certificate or chain of certificates with the host certificate first, provided in binary format.

      Method close

        `void close()`

      Description

        Closes the HTTP port.

      Method new_connection

        `void new_connection()`

      Description

        The port accept callback

      CLASS Protocols.HTTP.Server.SSLPort.MySSLPort

        Inherit sslport

          inherit SSL.sslport : sslport

        Method set_default_keycert

          `void set_default_keycert()`

        Method set_key

          `void set_key(string skey)`

        Method set_certificate

          `void set_certificate(string|array(string) certificate)`

    CLASS Protocols.HTTP.Server.Port

      Description

        The simplest server possible. Binds a port and calls a callback with Server.Request objects.

      Method create

        `void Protocols.HTTP.Server.Port(function(.Request:void) callback)`
        `void Protocols.HTTP.Server.Port(function(.Request:void) callback, int portno, void|string interface)`

      Method close

        `void close()`

      Description

        Closes the HTTP port.

    CLASS Protocols.HTTP.Server.Request

      Variable raw

        `string Protocols.HTTP.Server.Request.raw`

      Description

        raw unparsed full request (headers and body)

      Variable body_raw

        `string Protocols.HTTP.Server.Request.body_raw`

      Description

        raw unparsed body of the request (raw minus request line and headers)

      Variable request_raw

        `string Protocols.HTTP.Server.Request.request_raw`

      Description

        full request line (request_type + full_query + protocol )

      Variable request_type

        `string Protocols.HTTP.Server.Request.request_type`

      Description

        HTTP request method, eg. POST, GET, etc.

      Variable full_query

        `string Protocols.HTTP.Server.Request.full_query`

      Description

        full resource requested, including attached GET query

      Variable not_query

        `string Protocols.HTTP.Server.Request.not_query`

      Description

        resource requested minus any attached query

      Variable query

        `string Protocols.HTTP.Server.Request.query`

      Description

        query portion of requested resource, starting after the first "?"

      Variable protocol

        `string Protocols.HTTP.Server.Request.protocol`

      Description

        request protocol and version, eg. HTTP/1.0

      Variable request_headers

        `mapping(string:string|array(string)) Protocols.HTTP.Server.Request.request_headers`

      Description

        all headers included as part of the HTTP request, ie content-type.

      Variable variables

        `mapping(string:string|array(string)) Protocols.HTTP.Server.Request.variables`

      Description

        all variables included as part of a GET or POST request.

      Variable cookies

        `mapping(string:string) Protocols.HTTP.Server.Request.cookies`

      Description

        cookies set by client

      Variable misc

        `mapping Protocols.HTTP.Server.Request.misc`

      Description

        external use only

      Variable send_timeout_delay

        `int Protocols.HTTP.Server.Request.send_timeout_delay`

      Description

        send timeout (no activity for this period with data in send buffer) in seconds, default is 180

      Variable connection_timeout_delay

        `int Protocols.HTTP.Server.Request.connection_timeout_delay`

      Description

        connection timeout, delay until connection is closed while waiting for the correct headers:

      Method response_and_finish

        `void response_and_finish(mapping m, function|void _log_cb)`

      Description

        return a properly formatted response to the HTTP client

      Parameter `m`

        Contains elements for generating a response to the client.

        `"data" : string` | Data to be returned to the client.
        `"file" : object` | File object, the contents of which will be returned to the client.
        `"error" : int` | HTTP error code
        `"length" : int` | length of content returned. If file is provided, size bytes will be returned to client.
        `"modified" : string` | contains optional modification date.
        `"type" : string` | contains optional content-type
        `"extra_heads" : mapping` | contains a mapping of additional headers to be returned to client.
        `"server" : string` | contains the server identification header.

      Method sent_data

        `int sent_data()`

      Description

        Returns the amount of data sent.

Module Protocols.SMTP

  Variable replycodes

    `mapping(int:string) Protocols.SMTP.replycodes`

  Description

    A mapping(int:string) that maps SMTP return codes to english textual messages.

  CLASS Protocols.SMTP.Client

    Inherit Protocol

      inherit Protocol : Protocol

    Method create

      `void Protocols.SMTP.Client()`
      `void Protocols.SMTP.Client(Stdio.File server)`
      `void Protocols.SMTP.Client(string server, void|int port)`

    Description

      Creates an SMTP mail client and connects it to the the server provided. The server parameter may either be a string witht the hostnam of the mail server, or it may be a file object acting as a mail server. If server is a string, than an optional port parameter may be provided. If no port parameter is provided, port 25 is assumed. If no parameters at all is provided the client will look up the mail host by searching for the DNS MX record.

    Throws

      Throws an exception if the client fails to connect to the mail server.

    Method send_message

      `void send_message(string from, array(string) to, string body)`

    Description

      Sends a mail message from from to the mail addresses listed in to with the mail body body . The body should be a correctly formatted mail DATA block, e.g. produced by MIME.Message .

    See also

      simple_mail

    Throws

      If the mail server returns any other return code than 200-399 an exception will be thrown.

    Method simple_mail

      `void simple_mail(string to, string subject, string from, string msg)`

    Description

      Sends an e-mail. Wrapper function that uses send_message .

    Note

      Some important headers are set to: `"Content-Type: text/plain; charset=iso-8859-1"` and `"Content-Transfer-Encoding: 8bit"`. `"Date:"` header isn't used at all.

    Throws

      If the mail server returns any other return code than 200-399 an exception will be thrown.

    Method verify

      `array(int|string) verify(string addr)`

    Description

      Verifies the mail address addr against the mail server.

    Returns

      Array
      `int code` | The numerical return code from the VRFY call.
      `string message` | The textual answer to the VRFY call.

    Note

      Some mail servers does not answer truthfully to verfification queries in order to prevent spammers and others to gain information about the mail addresses present on the mail server.

    Throws

      If the mail server returns any other return code than 200-399 an exception will be thrown.

  CLASS Protocols.SMTP.Configuration

    Description

      Class to store configuration variable for the SMTP server

    Variable maxsize

      `int Protocols.SMTP.Configuration.maxsize`

    Description

      Message max size

    Variable maxrcpt

      `int Protocols.SMTP.Configuration.maxrcpt`

    Description

      Maximum number of recipients (default 1000)

    Variable checkdns

      `int Protocols.SMTP.Configuration.checkdns`

    Description

      Verify sender domain for MX

    Variable checkemail

      `int Protocols.SMTP.Configuration.checkemail`

    Description

      Lamme check email from validity

    Variable givedata

      `int Protocols.SMTP.Configuration.givedata`

    Description

      Give raw data and normal MIME data, if set to yes your cb_data function should take an extra string argument

  CLASS Protocols.SMTP.Connection

    Description

      The low-level class for the SMTP server

    Variable logfunction

      `function(string:mixed) Protocols.SMTP.Connection.logfunction`

    Description

      This function is called whenever the SMTP server logs something. By default the log function is werror .

  CLASS Protocols.SMTP.Server

    Description

      The use of Protocols.SMTP.server is quite easy and allow you to design custom functions to process mail. This module does not handle mail storage nor relaying to other domains. So it is your job to provide mail storage and relay mails to other servers

    Method create

      `void Protocols.SMTP.Server(array(string) _domains, void|int port, void|string ip, function _cb_mailfrom, function _cb_rcptto, function _cb_data)`

    Description

      Create a receiving SMTP server. It implements RFC 2821, 2822 and 1854.

    Parameter `domain`

      Domains name this server relay, you need to provide at least one domain (the first one will be used for MAILER-DAEMON address). if you want to relay everything you can put a '*' after this first domain.

    Parameter `port`

      Port this server listen on

    Parameter `listenip`

      IP on which server listen

    Parameter `cb_mailfrom`

      Mailfrom callback function, this function will be called when a client send a mail from command. This function must take a string as argument (corresponding to the sender's email) and return int corresponding to the SMTP code to output to the client. If you return an array the first element is the SMTP code and the second is the error string to display.

    Parameter `cb_rcptto`

      Same as cb_mailfrom but called when a client sends a rcpt to.

    Parameter `cb_data`

      This function is called each time a client send a data content. It must have the following synopsis: int cb_data(object mime, string sender, array(string) recipients, void|string rawdata) object mime : the mime data object string sender : sender of the mail (from the mailfrom command) array(string) recipients : one or more recipients given by the rcpt to command return : SMTP code to output to the client. If you return an array the first element is the SMTP code and the second is the error string to display.

    Example

          Here is an example of silly program that does nothing except outputing
            informations to stdout.
           int cb_mailfrom(string mail)
           {
             return 250;
           }
           int cb_rcptto(string email)
           {
             // check the user's mailbox here
             return 250;
           }
           int cb_data(object mime, string sender, array(string) recipients)
           {
             write(sprintf("smtpd: mailfrom=%s, to=%s, headers=%O\ndata=%s\n",
             sender, recipients * ", ", mime->headers, mime->getdata()));
             // check the data and deliver the mail here
             if(mime->body_parts)
             {
               foreach(mime->body_parts, object mpart)
                 write("smtpd: mpart data = %O\n", mpart->getdata());
             }
             return 250;
           }
           int main(int argc, array(string) argv)
           {
             Protocols.SMTP.Server(({ "ece.fr" }), 2500, "127.0.0.1",       cb_mailfrom, cb_rcptto, cb_data);
             return -1;
           }

Module Protocols.Ident

  Description

    An implementation of the IDENT protocol, specified in RFC 931.

  Method lookup

    `array(string) lookup(object fd)`

  Throws

    Throws exception upon any error.

  CLASS Protocols.Ident.AsyncLookup

    Method create

      `void Protocols.Ident.AsyncLookup(object fd, function(array(string):void) cb, mixed ... args)`

Module Protocols.IPv6

  Method parse_addr

    `array(int(0..65535)) parse_addr(string addr)`

  Description

    Parses an IPv6 address on the formatted hexadecimal `"x:x:x:x:x:x:x:x"` form, or any of the shorthand varieties (see RFC 2373, section 2.2).

    The address is returned as an 8-element array where each element is the value of the corresponding field. Zero is returned if addr is incorrectly formatted.

  See also

    format_addr_short

  Method format_addr_short

    `string format_addr_short(array(int(0..65535)) bin_addr)`

  Description

    Formats an IPv6 address to the colon-separated hexadecimal form as defined in RFC 2373, section 2.2. bin_addr must be an 8-element array containing the 16-bit fields.

    The returned address is on a canonical shortest form as follows: The longest sequence of zeroes is shortened using `"::"`. If there are several of equal length then the leftmost is shortened. All hexadecimal letters are lower-case. There are no superfluous leading zeroes in the fields.

  See also

    parse_addr

  Method normalize_addr_basic

    `string normalize_addr_basic(string addr)`

  Description

    Normalizes a formatted IPv6 address to a string with eight hexadecimal numbers separated by `":"`. addr is given on the same form, or any of the shorthand varieties as specified in RFC 2373, section 2.2.

    All hexadecimal letters in the returned address are lower-case, and there are no superfluous leading zeroes in the fields.

    Zero is returned if addr is incorrectly formatted.

  See also

    normalize_addr_short

  Method normalize_addr_short

    `string normalize_addr_short(string addr)`

  Description

    Normalizes a formatted IPv6 address to a canonical shortest form. addr is parsed according to the hexadecimal `"x:x:x:x:x:x:x:x"` syntax or any of its shorthand varieties (see RFC 2373, section 2.2).

    The returned address is normalized as follows: The longest sequence of zeroes is shortened using `"::"`. If there are several of equal length then the leftmost is shortened. All hexadecimal letters are lower-case. There are no superfluous leading zeroes in the fields.

    Zero is returned if addr is incorrectly formatted.

  See also

    normalize_addr_basic

Module Protocols.DNS_SD

  CLASS Protocols.DNS_SD.Service

    Description

      This class provides an interface to DNS Service Discovery. The functionality of DNS-SD is described at <http://www.dns-sd.org/>.

      Using the Proctocols.DNS_SD.Service class a Pike program can announce services, for example a web site or a database server, to computers on the local network.

      When registering a service you need to provide the service name. service type, domain and port number. You can also optionally specify a TXT record. The contents of the TXT record varies between different services; for example, a web server can announce a path to a web page, and a printer spooler is able to list printer features such as color support or two-sided printing.

      The service is registered on the network for as long as the instance of the Service class is valid.

    Inherit Service

      inherit _Protocols_DNS_SD.Service : Service

    Method update_txt

      `void update_txt(string|array(string) txt)`

    Description

      Updates the TXT record for the service.

    Parameter `txt`

      A TXT record with service-specific information. It can be given as a plain string or an array of property assignment strings. To remove an existing TXT record you give an empty string as the argument.

    Method create

      `void Protocols.DNS_SD.Service(string name, string service, string domain, int port, void|string|array(string) txt)`

    Description

      Registers a service on the local network.

    Parameter `name`

      User-presentable name of the service.

    Parameter `service`

      Type of service on the form `_type._protocol`. Type is an identifier related to the service type. A list of registered service types can be found at http://http://www.dns-sd.org/ServiceTypes.html/. Protocol is normally `tcp` but `udp` is also a valid choice. For example, a web server would get a service of `_http._tcp`.

    Parameter `domain`

      Domain name. Normally an empty string which the DNS-SD library will translate into `local.`.

    Parameter `port`

      Port number for the service (e.g. 80 for a web site).

    Parameter `txt`

      An optional TXT record with service-specific information. It can be given as a plain string or an array of property assignment strings. The TXT record can be changed later by calling update_txt in the object returned when you register the service.

    Example

          object svc = Protocols.DNS_SD.Service(
                           "Company Intranet Forum",  //  name
                           "_http._tcp",              //  service type
                           "",                        //  domain (default)
                           80,                        //  port
                           ({ "path=/forum/" })       //  TXT record
                         );

Module Protocols.DNS

  Description

    Support for the Domain Name System protocol.

    RFC 1034, RFC 1035 and RFC 2308

  Method async_ip_to_host

    `void async_ip_to_host(string ip, function cb, mixed ... cba)`

  Method async_host_to_ip

    `void async_host_to_ip(string host, function cb, mixed ... cba)`

  Method async_get_mx_all

    `void async_get_mx_all(string host, function cb, mixed ... cba)`

  Method async_get_mx

    `void async_get_mx(string host, function cb, mixed ... cba)`

  Method gethostbyname

    `array gethostbyname(string host)`

  Method gethostbyaddr

    `array gethostbyaddr(string host)`

  Method get_mx

    `string get_mx(string host)`

  Method get_primary_mx

    `string get_primary_mx(string host)`

  ENUM Protocols.DNS.ResourceClass

    Description

      Resource classes

    Constant C_IN

      `constant Protocols.DNS.C_IN`

    Description

      Class Internet

    Constant C_CS

      `constant Protocols.DNS.C_CS`

    Description

      Class CSNET (Obsolete)

    Constant C_CH

      `constant Protocols.DNS.C_CH`

    Description

      Class CHAOS

    Constant C_HS

      `constant Protocols.DNS.C_HS`

    Description

      Class Hesiod

    Constant C_ANY

      `constant Protocols.DNS.C_ANY`

    Description

      Class ANY

  ENUM Protocols.DNS.EntryType

    Description

      Entry types

    Constant T_A

      `constant Protocols.DNS.T_A`

    Description

      Type - host address

    Constant T_NS

      `constant Protocols.DNS.T_NS`

    Description

      Type - authoritative name server

    Constant T_MD

      `constant Protocols.DNS.T_MD`

    Description

      Type - mail destination (Obsolete - use MX)

    Constant T_MF

      `constant Protocols.DNS.T_MF`

    Description

      Type - mail forwarder (Obsolete - use MX)

    Constant T_CNAME

      `constant Protocols.DNS.T_CNAME`

    Description

      Type - canonical name for an alias

    Constant T_SOA

      `constant Protocols.DNS.T_SOA`

    Description

      Type - start of a zone of authority

    Constant T_MB

      `constant Protocols.DNS.T_MB`

    Description

      Type - mailbox domain name (EXPERIMENTAL)

    Constant T_MG

      `constant Protocols.DNS.T_MG`

    Description

      Type - mail group member (EXPERIMENTAL)

    Constant T_MR

      `constant Protocols.DNS.T_MR`

    Description

      Type - mail rename domain name (EXPERIMENTAL)

    Constant T_NULL

      `constant Protocols.DNS.T_NULL`

    Description

      Type - null RR (EXPERIMENTAL)

    Constant T_WKS

      `constant Protocols.DNS.T_WKS`

    Description

      Type - well known service description

    Constant T_PTR

      `constant Protocols.DNS.T_PTR`

    Description

      Type - domain name pointer

    Constant T_HINFO

      `constant Protocols.DNS.T_HINFO`

    Description

      Type - host information

    Constant T_MINFO

      `constant Protocols.DNS.T_MINFO`

    Description

      Type - mailbox or mail list information

    Constant T_MX

      `constant Protocols.DNS.T_MX`

    Description

      Type - mail exchange

    Constant T_TXT

      `constant Protocols.DNS.T_TXT`

    Description

      Type - text strings

    Constant T_AAAA

      `constant Protocols.DNS.T_AAAA`

    Description

      Type - IPv6 address record (RFC 1886, deprecated)

    Constant T_LOC

      `constant Protocols.DNS.T_LOC`

    Description

      Type - Location Record (RFC 1876)

    Constant T_SRV

      `constant Protocols.DNS.T_SRV`

    Description

      Type - Service location record (RFC 2782)

    Constant T_NAPTR

      `constant Protocols.DNS.T_NAPTR`

    Description

      Type - NAPTR (RFC 3403)

    Constant T_A6

      `constant Protocols.DNS.T_A6`

    Description

      Type - IPv6 address record (RFC 2874, incomplete support)

    Constant T_SPF

      `constant Protocols.DNS.T_SPF`

    Description

      Type - SPF - Sender Policy Framework (RFC 4408)

  CLASS Protocols.DNS.protocol

    Description

      Low level DNS protocol

    Method mkquery

      `string mkquery(string|mapping dnameorquery, int|void cl, int|void type)`

    Description

      create a DNS query PDU

    Parameter `dnameorquery`
    Parameter `cl`

      record class such as Protocols.DNS.C_IN

    Parameter `type`

      query type such Protocols.DNS.T_A

    Returns

      data suitable for use with Protocols.DNS.client.do_sync_query

    Example

          // generate a query PDU for a address lookup on the hostname pike.ida.liu.se
           string q=Protocols.DNS.protocol()->mkquery("pike.ida.liu.se", Protocols.DNS.C_IN, Protocols.DNS.T_A);

    Method decode_entries

      `array decode_entries(string s, int num, array(int) next)`

    Description

      Decode a set of entries from an answer.

    Parameter `s`

      Encoded entries.

    Parameter `num`

      Number of entires in s .

    Parameter `next`

      Array with a single element containing the start position in s on entry and the continuation position on return.

    Returns

      Returns an array of mappings describing the decoded entires:

      Array

      `mapping 0..`

      Mapping describing a single entry:

      `"name" : string` | Name the entry concerns.
      `"type" : EntryType` | Type of entry.
      `"cl" : ResourceClass` | Resource class. Typically C_IN .
      `"ttl" : int` | Time to live for the entry in seconds.
      `"len" : int` | Length in bytes of the encoded data section.

      Depending on the type of entry the mapping may contain different additional fields:

      `T_CNAME`

      `"cname" : string`

      `T_PTR`

      `"ptr" : string`

      `T_NS`

      `"ns" : string`

      `T_MX`

      `"preference" : int`
      `"mx" : string`

      `T_HINFO`

      `"cpu" : string`
      `"os" : string`

      `T_SRV`

      RFC 2052 and RFC 2782.

      `"priority" : int`
      `"weight" : int`
      `"port" : int`
      `"target" : string`
      `"service" : string`
      `"proto" : string`
      `"name" : string`

      `T_A`

      `"a" : string` | IPv4-address in dotted-decimal format.

      `T_AAAA`

      `"aaaa" : string` | IPv6-address in colon-separated hexadecimal format.

      `T_LOC`

      `"version" : int` | Version, currently only version `0` (zero) is supported.
      `"size" : int` |
      `"h_perc" : int` |
      `"v_perc" : int` |
      `"lat" : int` |
      `"long" : int` |
      `"alt" : int` |

      `T_SOA`

      `"mname" : string` |
      `"rname" : string` |
      `"serial" : int` |
      `"refresh" : int` |
      `"retry" : int` |
      `"expire" : int` |
      `"minimum" : int` | Note: For historical reasons this entry is named `"minimum"`, but it contains the TTL for negative answers (RFC 2308).

      `T_NAPTR`

      `"order" : int`
      `"preference" : int`
      `"flags" : string`
      `"service" : string`
      `"regexp" : string`
      `"replacement" : string`

      `T_TXT`

      `"txt" : string`

      `T_SPF`

      `"spf" : string`

  CLASS Protocols.DNS.server

    Description

      Base class for implementing a Domain Name Service (DNS) server.

      This class is typically used by inheriting it, and overloading reply_query() and handle_response() .

    Inherit protocol

      inherit protocol : protocol

    Method reply_query

      `mapping reply_query(mapping query, mapping udp_data, function(mapping:void) cb)`

    Description

      Reply to a query (stub).

    Parameter `query`

      Parsed query.

    Parameter `udp_data`

      Raw UDP data.

    Parameter `cb`

      Callback you can call with the result instead of returning it. In that case, return `0` (zero).

      Overload this function to implement the proper lookup.

    Returns

      Returns `0` (zero) on failure, or a result mapping on success:

      `"rcode" : int`

      Array

      `mapping(string:string|int) entry`

      `"name" : string|array(string)`
      `"type" : int`
      `"cl" : int`

      `"an" : array(mapping(string:string|int))|void`
      `"qd" : array|void` |
      `"ns" : array|void` |
      `"ar" : array|void` |

    Method create

      `void Protocols.DNS.server()`
      `void Protocols.DNS.server(int port)`
      `void Protocols.DNS.server(string ip)`
      `void Protocols.DNS.server(string ip, int port)`
      `void Protocols.DNS.server(string ip, int port, string|int ... more)`

    Description

      Open one or more new DNS server ports.

    Parameter `ip`

      The IP to bind to. Defaults to `"::"` or `0` (ie ANY) depending on whether IPv6 support is present or not.

    Parameter `port`

      The port number to bind to. Defaults to `53`.

    Parameter `more`

      Optional further DNS server ports to open. Must be a set of ip , port argument pairs.

  CLASS Protocols.DNS.client

    Description

      Synchronous DNS client.

    Inherit protocol

      inherit protocol : protocol

    Method create

      `void Protocols.DNS.client()`
      `void Protocols.DNS.client(void|string|array server, void|int|array domain)`

    Method do_sync_query

      `mapping do_sync_query(string s)`

    Description

      Perform a synchronous DNS query.

    Parameter `s`

      result of Protocols.DNS.protocol.mkquery

    Returns

      mapping containing query result or 0 on failure/timeout

    Example

          // perform a hostname lookup, results stored in r->an
           object d=Protocols.DNS.client();
           mapping r=d->do_sync_query(d->mkquery("pike.ida.liu.se", C_IN, T_A));

    Method gethostbyname

      `array gethostbyname(string hostname)`

    Description

      Queries the host name from the default or given DNS server. The result is an array with three elements,

    Returns

      An array with the requested information about the specified host.

      Array
      `string hostname` | Hostname.
      `array(string) ip` | IP number(s).
      `array(string) aliases` | DNS name(s).

    Note

      Prior to Pike 7.7 this function only returned IPv4 addresses.

    Method getsrvbyname

      `array getsrvbyname(string service, string protocol, string|void name)`

    Description

      Queries the service record (RFC 2782) from the default or given DNS server. The result is an array of arrays with the following six elements for each record. The array is sorted according to the priority of each record.

      Each element of the array returned represents a service record. Each service record contains the following:

    Returns

      An array with the requested information about the specified service.

      Array
      `int priority` | Priority
      `int weight` | Weight in event of multiple records with same priority.
      `int port` | port number
      `string target` | target dns name

    Method gethostbyaddr

      `array gethostbyaddr(string hostip)`

    Description

      Queries the host name or ip from the default or given DNS server. The result is an array with three elements,

    Returns

      The requested data about the specified host.

      Array
      `string hostip` | The host IP.
      `array(string) ip` | IP number(s).
      `array(string) aliases` | DNS name(s).

    Method get_primary_mx

      `string get_primary_mx(string hostname)`

    Description

      Queries the primary mx for the host.

    Returns

      Returns the hostname of the primary mail exchanger.

  CLASS Protocols.DNS.async_client

    Description

      Asynchronous DNS client.

    Inherit client

      inherit client : client

    Inherit udp

      inherit Stdio.UDP : udp

    Method host_to_ip

      `void host_to_ip(string host, function callback, mixed ... args)`

    Method ip_to_host

      `void ip_to_host(string ip, function callback, mixed ... args)`

    Method get_mx_all

      `void get_mx_all(string host, function callback, mixed ... args)`

    Method get_mx

      `void get_mx(string host, function callback, mixed ... args)`

    Method close

      `void close()`

    Description

      Close the client.

    Note

      All active requests are aborted.

Module Protocols.TELNET

  Description

    Implements TELNET as described by RFC 764 and RFC 854

    Also implements the Q method of TELNET option negotiation as specified by RFC 1143.

  Inherit TelnetCodes

    inherit TelnetCodes : TelnetCodes

  Inherit Telopts

    inherit Telopts : Telopts

  Constant TELQUAL_IS

    `constant Protocols.TELNET.TELQUAL_IS`

  Description

    option is...

  Constant TELQUAL_SEND

    `constant Protocols.TELNET.TELQUAL_SEND`

  Description

    send option

  Constant TELQUAL_INFO

    `constant Protocols.TELNET.TELQUAL_INFO`

  Description

    ENVIRON: informational version of IS

  Constant TELQUAL_REPLY

    `constant Protocols.TELNET.TELQUAL_REPLY`

  Description

    AUTHENTICATION: client version of IS

  Constant TELQUAL_NAME

    `constant Protocols.TELNET.TELQUAL_NAME`

  Description

    AUTHENTICATION: client version of IS

  Constant LFLOW_OFF

    `constant Protocols.TELNET.LFLOW_OFF`

  Description

    Disable remote flow control

  Constant LFLOW_ON

    `constant Protocols.TELNET.LFLOW_ON`

  Description

    Enable remote flow control

  Constant LFLOW_RESTART_ANY

    `constant Protocols.TELNET.LFLOW_RESTART_ANY`

  Description

    Restart output on any char

  Constant LFLOW_RESTART_XON

    `constant Protocols.TELNET.LFLOW_RESTART_XON`

  Description

    Restart output only on XON

  Constant AUTH_WHO_CLIENT

    `constant Protocols.TELNET.AUTH_WHO_CLIENT`

  Description

    Client authenticating server

  Constant AUTH_WHO_SERVER

    `constant Protocols.TELNET.AUTH_WHO_SERVER`

  Description

    Server authenticating client

  CLASS Protocols.TELNET.TelnetCodes

    Description

      Table of IAC-codes.

    Constant IAC

      `constant Protocols.TELNET.TelnetCodes.IAC`

    Description

      interpret as command.

    Constant DONT

      `constant Protocols.TELNET.TelnetCodes.DONT`

    Description

      you are not to use option

    Constant DO

      `constant Protocols.TELNET.TelnetCodes.DO`

    Description

      please, you use option

    Constant WONT

      `constant Protocols.TELNET.TelnetCodes.WONT`

    Description

      I won't use option

    Constant WILL

      `constant Protocols.TELNET.TelnetCodes.WILL`

    Description

      I will use option

    Constant SB

      `constant Protocols.TELNET.TelnetCodes.SB`

    Description

      interpret as subnegotiation

    Constant GA

      `constant Protocols.TELNET.TelnetCodes.GA`

    Description

      you may reverse the line

    Constant EL

      `constant Protocols.TELNET.TelnetCodes.EL`

    Description

      erase the current line

    Constant EC

      `constant Protocols.TELNET.TelnetCodes.EC`

    Description

      erase the current character

    Constant AYT

      `constant Protocols.TELNET.TelnetCodes.AYT`

    Description

      are you there

    Constant AO

      `constant Protocols.TELNET.TelnetCodes.AO`

    Description

      abort output--but let prog finish

    Constant IP

      `constant Protocols.TELNET.TelnetCodes.IP`

    Description

      interrupt process--permanently

    Constant BREAK

      `constant Protocols.TELNET.TelnetCodes.BREAK`

    Description

      break

    Constant DM

      `constant Protocols.TELNET.TelnetCodes.DM`

    Description

      data mark--for connect. cleaning

    Constant NOP

      `constant Protocols.TELNET.TelnetCodes.NOP`

    Description

      nop

    Constant SE

      `constant Protocols.TELNET.TelnetCodes.SE`

    Description

      end sub negotiation

    Constant EOR

      `constant Protocols.TELNET.TelnetCodes.EOR`

    Description

      end of record (transparent mode)

    Constant ABORT

      `constant Protocols.TELNET.TelnetCodes.ABORT`

    Description

      Abort process

    Constant SUSP

      `constant Protocols.TELNET.TelnetCodes.SUSP`

    Description

      Suspend process

    Constant xEOF

      `constant Protocols.TELNET.TelnetCodes.xEOF`

    Description

      End of file: EOF is already used...

    Constant SYNCH

      `constant Protocols.TELNET.TelnetCodes.SYNCH`

    Description

      for telfunc calls

  CLASS Protocols.TELNET.Telopts

    Description

      Table of TELNET options.

    Constant TELOPT_BINARY

      `constant Protocols.TELNET.Telopts.TELOPT_BINARY`

    Description

      8-bit data path

    Constant TELOPT_ECHO

      `constant Protocols.TELNET.Telopts.TELOPT_ECHO`

    Description

      echo

    Constant TELOPT_RCP

      `constant Protocols.TELNET.Telopts.TELOPT_RCP`

    Description

      prepare to reconnect

    Constant TELOPT_SGA

      `constant Protocols.TELNET.Telopts.TELOPT_SGA`

    Description

      suppress go ahead

    Constant TELOPT_NAMS

      `constant Protocols.TELNET.Telopts.TELOPT_NAMS`

    Description

      approximate message size

    Constant TELOPT_STATUS

      `constant Protocols.TELNET.Telopts.TELOPT_STATUS`

    Description

      give status

    Constant TELOPT_TM

      `constant Protocols.TELNET.Telopts.TELOPT_TM`

    Description

      timing mark

    Constant TELOPT_RCTE

      `constant Protocols.TELNET.Telopts.TELOPT_RCTE`

    Description

      remote controlled transmission and echo

    Constant TELOPT_NAOL

      `constant Protocols.TELNET.Telopts.TELOPT_NAOL`

    Description

      negotiate about output line width

    Constant TELOPT_NAOP

      `constant Protocols.TELNET.Telopts.TELOPT_NAOP`

    Description

      negotiate about output page size

    Constant TELOPT_NAOCRD

      `constant Protocols.TELNET.Telopts.TELOPT_NAOCRD`

    Description

      negotiate about CR disposition

    Constant TELOPT_NAOHTS

      `constant Protocols.TELNET.Telopts.TELOPT_NAOHTS`

    Description

      negotiate about horizontal tabstops

    Constant TELOPT_NAOHTD

      `constant Protocols.TELNET.Telopts.TELOPT_NAOHTD`

    Description

      negotiate about horizontal tab disposition

    Constant TELOPT_NAOFFD

      `constant Protocols.TELNET.Telopts.TELOPT_NAOFFD`

    Description

      negotiate about formfeed disposition

    Constant TELOPT_NAOVTS

      `constant Protocols.TELNET.Telopts.TELOPT_NAOVTS`

    Description

      negotiate about vertical tab stops

    Constant TELOPT_NAOVTD

      `constant Protocols.TELNET.Telopts.TELOPT_NAOVTD`

    Description

      negotiate about vertical tab disposition

    Constant TELOPT_NAOLFD

      `constant Protocols.TELNET.Telopts.TELOPT_NAOLFD`

    Description

      negotiate about output LF disposition

    Constant TELOPT_XASCII

      `constant Protocols.TELNET.Telopts.TELOPT_XASCII`

    Description

      extended ascic character set

    Constant TELOPT_LOGOUT

      `constant Protocols.TELNET.Telopts.TELOPT_LOGOUT`

    Description

      force logout

    Constant TELOPT_BM

      `constant Protocols.TELNET.Telopts.TELOPT_BM`

    Description

      byte macro

    Constant TELOPT_DET

      `constant Protocols.TELNET.Telopts.TELOPT_DET`

    Description

      data entry terminal

    Constant TELOPT_SUPDUP

      `constant Protocols.TELNET.Telopts.TELOPT_SUPDUP`

    Description

      supdup protocol

    Constant TELOPT_SUPDUPOUTPUT

      `constant Protocols.TELNET.Telopts.TELOPT_SUPDUPOUTPUT`

    Description

      supdup output

    Constant TELOPT_SNDLOC

      `constant Protocols.TELNET.Telopts.TELOPT_SNDLOC`

    Description

      send location

    Constant TELOPT_TTYPE

      `constant Protocols.TELNET.Telopts.TELOPT_TTYPE`

    Description

      terminal type

    Constant TELOPT_EOR

      `constant Protocols.TELNET.Telopts.TELOPT_EOR`

    Description

      end or record

    Constant TELOPT_TUID

      `constant Protocols.TELNET.Telopts.TELOPT_TUID`

    Description

      TACACS user identification

    Constant TELOPT_OUTMRK

      `constant Protocols.TELNET.Telopts.TELOPT_OUTMRK`

    Description

      output marking

    Constant TELOPT_TTYLOC

      `constant Protocols.TELNET.Telopts.TELOPT_TTYLOC`

    Description

      terminal location number

    Constant TELOPT_3270REGIME

      `constant Protocols.TELNET.Telopts.TELOPT_3270REGIME`

    Description

      3270 regime

    Constant TELOPT_X3PAD

      `constant Protocols.TELNET.Telopts.TELOPT_X3PAD`

    Description

      X.3 PAD

    Constant TELOPT_NAWS

      `constant Protocols.TELNET.Telopts.TELOPT_NAWS`

    Description

      window size

    Constant TELOPT_TSPEED

      `constant Protocols.TELNET.Telopts.TELOPT_TSPEED`

    Description

      terminal speed

    Constant TELOPT_LFLOW

      `constant Protocols.TELNET.Telopts.TELOPT_LFLOW`

    Description

      remote flow control

    Constant TELOPT_LINEMODE

      `constant Protocols.TELNET.Telopts.TELOPT_LINEMODE`

    Description

      Linemode option

    Constant TELOPT_XDISPLOC

      `constant Protocols.TELNET.Telopts.TELOPT_XDISPLOC`

    Description

      X Display Location

    Constant TELOPT_OLD_ENVIRON

      `constant Protocols.TELNET.Telopts.TELOPT_OLD_ENVIRON`

    Description

      Old - Environment variables

    Constant TELOPT_AUTHENTICATION

      `constant Protocols.TELNET.Telopts.TELOPT_AUTHENTICATION`

    Description

      Authenticate

    Constant TELOPT_ENCRYPT

      `constant Protocols.TELNET.Telopts.TELOPT_ENCRYPT`

    Description

      Encryption option

    Constant TELOPT_NEW_ENVIRON

      `constant Protocols.TELNET.Telopts.TELOPT_NEW_ENVIRON`

    Description

      New - Environment variables

    Constant TELOPT_EXOPL

      `constant Protocols.TELNET.Telopts.TELOPT_EXOPL`

    Description

      extended-options-list

  CLASS Protocols.TELNET.protocol

    Description

      Implementation of the TELNET protocol.

    Variable fd

      `protected object Protocols.TELNET.protocol.fd`

    Description

      The connection.

    Variable cb

      `protected mapping Protocols.TELNET.protocol.cb`

    Description

      Mapping containing extra callbacks.

    Variable id

      `protected mixed Protocols.TELNET.protocol.id`

    Description

      Value to send to the callbacks.

    Variable write_cb

      `protected function(mixed|void:string) Protocols.TELNET.protocol.write_cb`

    Description

      Write callback.

    Variable read_cb

      `protected function(mixed:void) Protocols.TELNET.protocol.read_cb`

    Description

      Read callback.

    Variable close_cb

      `protected function(mixed|void:void) Protocols.TELNET.protocol.close_cb`

    Description

      Close callback.

      `protected array(int) Protocols.TELNET.protocol.remote_options`
      `protected array(int) Protocols.TELNET.protocol.local_options`

    Description

      Negotiation states of all WILL/WON'T options. See RFC 1143 for a description of the states.

    Variable to_send

      `protected string Protocols.TELNET.protocol.to_send`

    Description

      Data queued to be sent.

    Variable done

      `protected int Protocols.TELNET.protocol.done`

    Description

      Indicates that connection should be closed

    Variable nonblocking_write

      `protected int Protocols.TELNET.protocol.nonblocking_write`

    Description

      Tells if we have set the nonblocking write callback or not.

    Method enable_write

      `void enable_write()`

    Description

      Turns on the write callback if apropriate.

    Method disable_write

      `void disable_write()`

    Description

      Turns off the write callback if apropriate.

    Method write

      `void write(string s)`

    Description

      Queues data to be sent to the other end of the connection.

    Parameter `s`

      String to send.

    Method write_raw

      `void write_raw(string s)`

    Description

      Queues raw data to be sent to the other end of the connection.

    Parameter `s`

      String with raw telnet data to send.

    Method close

      `void close()`

    Description

      Closes the connetion neatly

    Method send_data

      `void send_data()`

    Description

      Callback called when it is clear to send data over the connection. This function does the actual sending.

    Method send_synch

      `void send_synch()`

    Description

      Sends a TELNET synch command.

    Method send_DO

      `void send_DO(int option)`

    Description

      Starts negotiation to enable a TELNET option.

    Parameter `option`

      The option to enable.

    Method send_DONT

      `void send_DONT(int option)`

    Description

      Starts negotiation to disable a TELNET option.

    Parameter `option`

      The option to disable.

    Variable synch

      `protected int Protocols.TELNET.protocol.synch`

    Description

      Indicates whether we are in synch-mode or not.

    Method got_oob

      `void got_oob(mixed ignored, string s)`

    Description

      Callback called when Out-Of-Band data has been received.

    Parameter `ignored`

      The id from the connection.

    Parameter `s`

      The Out-Of-Band data received.

    Method call_read_cb

      `void call_read_cb(string data)`

    Description

      Calls read_cb() .

      Specifically provided for overloading

    Method got_data

      `void got_data(mixed ignored, string line)`

    Description

      Callback called when normal data has been received. This function also does most of the TELNET protocol parsing.

    Parameter `ignored`

      The id from the connection.

    Parameter `s`

      The received data.

    Method set_read_callback

      `void set_read_callback(function(mixed:void) r_cb)`

    Method query_read_callback

      `function(mixed:void) query_read_callback()`

    Method set_write_callback

      `void set_write_callback(function(mixed|void:string) w_cb)`

    Description

      Sets the callback to be called when it is clear to send.

    Parameter `w_cb`

      The new write callback.

    Method query_write_callback

      `function(mixed|void:string) query_write_callback()`

    Method set_close_callback

      `void set_close_callback(function(mixed|void:void) c_cb)`

    Method query_close_callback

      `function(mixed|void:void) query_close_callback()`

    Method setup

      `void setup()`

    Description

      Called when the initial setup is done.

      Created specifically for overloading

    Method create

      `void Protocols.TELNET.protocol(object f, function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb, mapping callbacks, mixed|void new_id)`

    Description

      Creates a TELNET protocol handler, and sets its callbacks.

    Parameter `f`

      File to use for the connection.

    Parameter `r_cb`

      Function to call when data has arrived.

    Parameter `w_cb`

      Function to call when the send buffer is empty.

    Parameter `c_cb`

      Function to call when the connection is closed.

    Parameter `callbacks`

      Mapping with callbacks for the various TELNET commands.

    Parameter `new_id`

      Value to send to the various callbacks.

    Method set_nonblocking

      `void set_nonblocking(function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb)`

    Description

      Change the asynchronous I/O callbacks.

    Parameter `r_cb`

      Function to call when data has arrived.

    Parameter `w_cb`

      Function to call when the send buffer is empty.

    Parameter `c_cb`

      Function to call when the connection is closed.

    See also

      create()

  CLASS Protocols.TELNET.LineMode

    Description

      Line-oriented TELNET protocol handler.

    Inherit protocol

      inherit protocol : protocol

    Description

      Based on the generic TELNET protocol handler.

    Method setup

      `void setup()`

    Description

      Perform the initial TELNET handshaking for LINEMODE.

  CLASS Protocols.TELNET.Readline

    Description

      Line-oriented TELNET protocol handler with Stdio.Readline support.

      Implements the Stdio.NonblockingStream API.

    Inherit LineMode

      inherit LineMode : LineMode

    Description

      Based on the Line-oriented TELNET protocol handler.

    Variable readline

      `Stdio.Readline Protocols.TELNET.Readline.readline`

    Description

      Stdio.Readline object handling the connection.

    Method tcgetattr

      `mapping(string:int) tcgetattr()`

    Description

      Get current terminal attributes.

      Currently only the following attributes are supported:

      `"columns"` | Number of columns.
      `"rows"` | Number of rows.
      `"ECHO"` | Local character echo on (`1`) or off (`0` (zero)).
      `"ICANON"` | Canonical input on (`1`) or off (`0` (zero)).

    Note

      Using this function currently bypasses the Readline layer.

    See also

      Stdio.File()->tcgetattr()

    Method tcsetattr

      `int tcsetattr(mapping(string:int) options, string|void when)`

    Description

      Set terminal attributes.

      Currently only the following attributes are supported:

      `"ECHO"` | Local character echo on (`1`) or off (`0` (zero)).
      `"ICANON"` | Canonical input on (`1`) or off (`0` (zero)).

    Note

      Using this function currently bypasses the Readline layer.

    See also

      Stdio.File()->tcsetattr()

    Method set_secret

      `void set_secret(int onoff)`

    Description

      Turn on/off echo mode.

    Method message

      `void message(string s, void|int word_wrap)`

    Description

      Write a message.

    Method set_prompt

      `void set_prompt(string s)`

    Description

      Set the readline prompt.

    Method close

      `void close()`

    Description

      Close the connection.

    Method create

      `void Protocols.TELNET.Readline(object f, function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb, mapping callbacks, mixed|void new_id)`

    Description

      Creates a TELNET protocol handler, and sets its callbacks.

    Parameter `f`

      File to use for the connection.

    Parameter `r_cb`

      Function to call when data has arrived.

    Parameter `w_cb`

      Function to call when the send buffer is empty.

    Parameter `c_cb`

      Function to call when the connection is closed.

    Parameter `callbacks`

      Mapping with callbacks for the various TELNET commands.

    Parameter `new_id`

      Value to send to the various callbacks.

    Method set_nonblocking

      `void set_nonblocking(function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb)`

    Description

      Change the asynchronous I/O callbacks.

    Parameter `r_cb`

      Function to call when data has arrived.

    Parameter `w_cb`

      Function to call when the send buffer is empty.

    Parameter `c_cb`

      Function to call when the connection is closed.

    See also

      create()

    Method set_read_callback

      `void set_read_callback(function(mixed:void) r_cb)`

    Method query_read_callback

      `function(mixed:void) query_read_callback()`

    Method set_write_callback

      `void set_write_callback(function(mixed|void:string) w_cb)`

    Method query_write_callback

      `function(mixed|void:string) query_write_callback()`

    Method set_close_callback

      `void set_close_callback(function(mixed|void:void) c_cb)`

    Method query_close_callback

      `function(mixed|void:void) query_close_callback()`

    Method set_blocking

      `void set_blocking()`

    Method write

      `void write(string s)`

    Description

      Queues data to be sent to the other end of the connection.

    Parameter `s`

      String to send.

Module Protocols.Line

  CLASS Protocols.Line.simple

    Description

      Simple nonblocking line-oriented I/O.

    Constant line_separator

      `constant Protocols.Line.simple.line_separator`

    Description

      The sequence separating lines from eachother. "\r\n" by default.

    Variable handle_data

      `function(string:void) Protocols.Line.simple.handle_data`

    Description

      If this variable has been set, multiple lines will be accumulated, until a line with a single `"."` (period) is received. handle_data() will then be called with the accumulated data as the argument.

    Note

      handle_data() is one-shot, ie it will be cleared when it is called.

      The line with the single `"."` (period) will not be in the accumulated data.

    See also

      handle_command()

    Method handle_command

      `void handle_command(string line)`

    Description

      This function will be called once for every line that is received.

      Overload this function as appropriate.

    Note

      It will not be called if handle_data() has been set.

      line will not contain the line separator.

    See also

      handle_data()

    Method send

      `void send(string s)`

    Description

      Queue some data to send.

    See also

      handle_command() , handle_data() , disconnect()

    Method do_timeout

      `void do_timeout()`

    Description

      This function is called when a timeout occurrs.

      Overload this function as appropriate.

      The default action is to shut down the connection immediately.

    See also

      create() , touch_time()

    Method touch_time

      `void touch_time()`

    Description

      Reset the timeout timer.

    See also

      create() , do_timeout()

    Method read_line

      `string read_line()`

    Description

      Read a line from the input.

    Returns

      Returns `0` when more input is needed. Returns the requested line otherwise.

    Note

      The returned line will not contain the line separator.

    See also

      handle_command() , line_separator

    Method read_callback

      `void read_callback(mixed ignored, string data)`

    Description

      Called when data has been received.

      Overload as appropriate.

      Calls the handle callbacks repeatedly until no more lines are available.

    See also

      handle_data() , handle_command() , read_line()

    Variable send_q

      `ADT.Queue Protocols.Line.simple.send_q`

    Description

      Queue of data that is pending to send.

      The elements in the queue are either strings with data to send, or `0` (zero) which is the end of file marker. The connection will be closed when the end of file marker is reached.

    See also

      send() , disconnect()

    Method disconnect

      `void disconnect()`

    Description

      Disconnect the connection.

      Pushes an end of file marker onto the send queue send_q .

    Note

      Note that the actual closing of the connection is delayed until all data in the send queue has been sent.

      No more data will be read from the other end after this function has been called.

    Method close_callback

      `void close_callback()`

    Description

      This function is called when the connection has been closed at the other end.

      Overload this function as appropriate.

      The default action is to shut down the connection on this side as well.

    Method create

      `void Protocols.Line.simple(Stdio.File con, int|void timeout)`

    Description

      Create a simple nonblocking line-based protocol handler.

      con is the connection.

      timeout is an optional timeout in seconds after which the connection will be closed if there has been no data sent or received.

      If timeout is `0` (zero), no timeout will be in effect.

    See also

      touch_time() , do_timeout()

  CLASS Protocols.Line.smtp_style

    Description

      Nonblocking line-oriented I/O with support for sending SMTP-style codes.

    Inherit simple

      inherit simple : simple

    Variable errorcodes

      `mapping(int:string|array(string)) Protocols.Line.smtp_style.errorcodes`

    Description

      Mapping from return-code to error-message.

      Overload this constant as apropriate.

    Method send

      `void send(int(100..999) code, array(string)|string|void lines)`

    Description

      Send an SMTP-style return-code.

      code is an SMTP-style return-code.

      If lines is omitted, errorcodes will be used to lookup an appropriate error-message.

      If lines is a string, it will be split on `"\n"` (newline), and the error-code interspersed as appropriate.

    See also

      errorcodes

  CLASS Protocols.Line.imap_style

    Description

      Nonblocking line-oriented I/O with support for reading literals.

    Inherit simple

      inherit simple : simple

    Variable literal_length

      `int Protocols.Line.imap_style.literal_length`

    Description

      Length in bytes of the literal to read.

    Variable handle_literal

      `function(string:void) Protocols.Line.imap_style.handle_literal`

    Description

      If this variable has been set, literal_length bytes will be accumulated, and this function will be called with the resulting data.

    Note

      handle_literal() is one-shot, ie it will be cleared when it is called.

    Variable handle_line

      `function(string:void) Protocols.Line.imap_style.handle_line`

    Description

      This function will be called once for every line that is received.

    Note

      This API is provided for backward compatibility; overload handle_command() instead.

    See also

      Protocols.Line.simple()->handle_command()

    Method handle_command

      `void handle_command(string line)`

    Description

      Function called once for every received line.

    Method expect_literal

      `void expect_literal(int length, function(string:void) callback)`

    Description

      Enter literal reading mode.

      Sets literal_length and handle_literal() .

    See also

      literal_length , handle_literal()

Module Protocols.NNTP

  CLASS Protocols.NNTP.protocol

    Description

      NNTP protocol

    Inherit sock

      inherit Stdio.FILE : sock

    Method readreturncode

      `int readreturncode()`

    Description

      reads the server result code for last request used internally by command().

    Method read_body_lines

      `array(string) read_body_lines()`

    Description

      reads the message from the server as an array of lines

    Method readreturnbody

      `string readreturnbody()`

    Description

      reads the message from the server

    Method writebody

      `void writebody(string s)`

    Description

      send the body of a message to the server.

    Method command

      `int command(string cmd)`

    Description

      send a command to the server

    Returns

      the result code sent by the server

    Method get_response_message

      `string get_response_message()`

    Description

      gets the result message supplied by the server for the last response

    Method failsafe_command

      `int failsafe_command(string cmd)`

    Description

      send a command and require an ok response (200 series). throws an error if the command result was not success.

    Method do_cmd_with_body

      `string do_cmd_with_body(string cmd)`

    Description

      send a command that should return a message body.

    Returns

      the message body

  CLASS Protocols.NNTP.client

    Description

      An NNTP client

    Inherit protocol

      inherit protocol : protocol

    Method list_groups

      `array(Group) list_groups()`

    Description

      Returns a list of all active groups.

    Variable current_group

      `Group Protocols.NNTP.client.current_group`

    Description

      The current news group.

    Method set_group

      `void set_group(Group o)`

    Description

      Sets the current news group to o .

    Method go_to_group

      `Group go_to_group(string group)`

    Description

      Sets the current group to group .

    Method head

      `string head(void|int|string x)`

    Method body

      `string body(void|int|string x)`

    Method article

      `string article(void|int|string x)`

    Method create

      `void Protocols.NNTP.client(string|void server)`

Module Protocols.OBEX

  Description

    The IrDA® Object Exchange Protocol. OBEX is a protocol for sending and receiving binary objects to mobile devices using transports such as IR and Bluetooth.

  Constant SETPATH_BACKUP

    `constant Protocols.OBEX.SETPATH_BACKUP`

  Description

    A flag for the REQ_SETPATH command indicating that the parent directory should be selected

  Constant SETPATH_NOCREATE

    `constant Protocols.OBEX.SETPATH_NOCREATE`

  Description

    A flag for the REQ_SETPATH command indicating that the selected directory should not be created if it doesn't exist

  Typedef Headers

    `typedef mapping(HeaderIdentifier:string|int|array) Protocols.OBEX.Headers`

  Description

    A set of request or response headers. Each HI can be associated with either a single value (int or string, depending on the HI in question) or an array with multiple such values.

  Method encode_headers

    `string encode_headers(Headers h)`

  Description

    Serialize a set of headers to wire format

  See also

    split_headers()

  Method decode_headers

    `Headers decode_headers(string h)`

  Description

    Deserialize a set of headers from wire format

  Method split_headers

    `array(string) split_headers(string h, int chunklen)`

  Description

    Given a set of headers in wire format, divide them into portions of no more than chunklen octets each (if possible). No individual header definition will be split into two portions.

  ENUM Protocols.OBEX.Request

    Description

      A request opcode, for use with the client.do_request() function.

    Constant REQ_CONNECT

      `constant Protocols.OBEX.REQ_CONNECT`

    Description

      Establish a new OBEX connection

    Constant REQ_DISCONNECT

      `constant Protocols.OBEX.REQ_DISCONNECT`

    Description

      Terminate an OBEX connection

    Constant REQ_PUT

      `constant Protocols.OBEX.REQ_PUT`

    Description

      Send an object to the mobile device

    Constant REQ_GET

      `constant Protocols.OBEX.REQ_GET`

    Description

      Receive an object from the mobile devuce

    Constant REQ_SETPATH

      `constant Protocols.OBEX.REQ_SETPATH`

    Description

      Change the working directory

    Constant REQ_SESSION

      `constant Protocols.OBEX.REQ_SESSION`

    Description

      Manage a session

    Constant REQ_ABORT

      `constant Protocols.OBEX.REQ_ABORT`

    Description

      Abort the request currently being processed

    Constant REQ_FINAL

      `constant Protocols.OBEX.REQ_FINAL`

    Description

      For REQ_PUT and REQ_GET requests, REQ_FINAL must be set for the request block containing the last portion of the headers. Other requests must be sent as a single block and have the REQ_FINAL bit encoded in their request opcode.

  ENUM Protocols.OBEX.HeaderIdentifier

    Description

      An identifier for a request or response header

    Constant HI_COUNT

      `constant Protocols.OBEX.HI_COUNT`

    Description

      Number of objects to transfer (used by REQ_CONNECT )

    Constant HI_NAME

      `constant Protocols.OBEX.HI_NAME`

    Description

      Name of the object (string)

    Constant HI_TYPE

      `constant Protocols.OBEX.HI_TYPE`

    Description

      Type of the object (IANA media type)

    Constant HI_LENGTH

      `constant Protocols.OBEX.HI_LENGTH`

    Description

      Length of the object transferred, in octets

    Constant HI_TIME

      `constant Protocols.OBEX.HI_TIME`

    Description

      ISO 8601 timestamp (string)

    Constant HI_DESCRIPTION

      `constant Protocols.OBEX.HI_DESCRIPTION`

    Description

      Text description of the object

    Constant HI_TARGET

      `constant Protocols.OBEX.HI_TARGET`

    Description

      Name of service that operation is targeted to

    Constant HI_HTTP

      `constant Protocols.OBEX.HI_HTTP`

    Description

      Any HTTP 1.x header

    Constant HI_BODY

      `constant Protocols.OBEX.HI_BODY`

    Description

      A chunk of the object body

    Constant HI_ENDOFBODY

      `constant Protocols.OBEX.HI_ENDOFBODY`

    Description

      The final chunk of the object body

    Constant HI_WHO

      `constant Protocols.OBEX.HI_WHO`

    Description

      Identifies the OBEX application (string)

    Constant HI_CONNID

      `constant Protocols.OBEX.HI_CONNID`

    Description

      An identifier used for OBEX connection multiplexing

    Constant HI_APPPARAM

      `constant Protocols.OBEX.HI_APPPARAM`

    Description

      Extended application request & response information

    Constant HI_AUTHCHALL

      `constant Protocols.OBEX.HI_AUTHCHALL`

    Description

      Authentication digest-challenge

    Constant HI_AUTHRESP

      `constant Protocols.OBEX.HI_AUTHRESP`

    Description

      Authentication digest-response

    Constant HI_CREATORID

      `constant Protocols.OBEX.HI_CREATORID`

    Description

      Indicates the creator of an object

    Constant HI_WANUUID

      `constant Protocols.OBEX.HI_WANUUID`

    Description

      Uniquely identifies the OBEX server

    Constant HI_OBJCLASS

      `constant Protocols.OBEX.HI_OBJCLASS`

    Description

      OBEX object class of object

    Constant HI_SESSPARAM

      `constant Protocols.OBEX.HI_SESSPARAM`

    Description

      Parameters used in session commands/responses

    Constant HI_SESSSEQNR

      `constant Protocols.OBEX.HI_SESSSEQNR`

    Description

      Sequence number used in each OBEX packet for reliability

  CLASS Protocols.OBEX.Client

    Description

      An OBEX client

    See also

      ATclient

    Method low_do_request

      `array(int|string) low_do_request(Request r, string data)`

    Description

      Perform a request/response exchange with the server. No interpretation is preformed of either the request or response data, they are just passed literally.

    Parameter `r`

      Request opcode

    Parameter `data`

      Raw request data

    Returns

      An array with the response information

      Array
      `int returncode` | An HTTP response code
      `string data` | Response data, if any

    See also

      do_request()

    Method do_request

      `array(int|Headers) do_request(Request r, Headers|void headers, string|void extra_req)`

    Description

      Perform a request/response exchange with the server, including processing of headers and request splitting.

    Parameter `r`

      Request opcode

    Parameter `headers`

      Request headers

    Parameter `extra_req`

      Any request data that should appear before the headers, but after the opcode

    Returns

      An array with the response information

      Array
      `int returncode` | An HTTP response code
      `Headers headers` | Response headers

    See also

      low_do_request() , do_abort() , do_put() , do_get() , do_setpath() , do_session()

    Method do_abort

      `array(int|Headers) do_abort(Headers|void headers)`

    Description

      Perform a REQ_ABORT request.

    See also

      do_request()

    Method do_put

      `array(int|Headers) do_put(string|Stdio.Stream data, Headers|void extra_headers)`

    Description

      Perform a REQ_PUT request.

    Parameter `data`

      Body data to send, or a stream to read the data from

    Parameter `extra_headers`

      Any additional headers to send (HI_LENGTH and HI_BODY are generated by this function)

    See also

      do_get() , do_request()

    Method do_get

      `array(int|Headers) do_get(Stdio.Stream data, Headers|void headers)`

    Description

      Perform a REQ_GET request.

    Parameter `data`

      A stream to write the body data to

    Parameter `headers`

      Headers for the request

    Returns

      See do_request() . The Headers do not contain any HI_BODY headers, they are written to the data stream.

    See also

      do_put() , do_request()

    Method do_setpath

      `array(int|Headers) do_setpath(string path, int|void flags, Headers|void extra_headers)`

    Description

      Perform a REQ_SETPATH request.

    Parameter `path`

      The directory to set as current working directory

      `"/"` | Go to the root directory
      `".."` | Go to the parent directory

    Parameter `flags`

      Logical or of zero or more of SETPATH_BACKUP and SETPATH_NOCREATE

    Parameter `extra_headers`

      Any additional request headers (the HI_NAME header is generated by this function)

    See also

      do_request()

    Method do_session

      `array(int|Headers) do_session(Headers|void headers)`

    Description

      Perform a REQ_SESSION request.

    See also

      do_request()

    Method connect

      `int(0..1) connect()`

    Description

      Establish a new connection using the REQ_CONNECT opcode to negotiate transfer parameters

    Returns

      If the connection succeeds, 1 is returned. Otherwise, 0 is returned.

    Method disconnect

      `int(0..1) disconnect()`

    Description

      Terminate a connection using the REQ_DISCONNECT opcode

    Returns

      If the disconnection succeeds, 1 is returned. Otherwise, 0 is returned.

    Method create

      `void Protocols.OBEX.Client(Stdio.Stream _con)`

    Description

      Initialize the client by establishing a connection to the server at the other end of the provided transport stream

    Parameter `_con`

      A stream for writing requests and reading back responses. Typically this is some kind of serial port.

  CLASS Protocols.OBEX.ATClient

    Description

      An extension of the client which uses the AT*EOBEX modem command to enter OBEX mode. Use together with Sony Ericsson data cables.

    Inherit Client

      inherit Client : Client

Module Protocols.LPD

  CLASS Protocols.LPD.client

    Description

      A client for communicating with printers and print spoolers that support the BSD lpd protocol (RFC 1179).

    Method set_job_type

      `int set_job_type(string type)`

    Description

      Set the type of job to be sent to the printer to type. Valid types are: text, postscript and raw.

    Method set_job_name

      `int set_job_name(string name)`

    Description

      Sets the name of the print job to name.

    Method start_queue

      `int start_queue(string queue)`

    Description

      Start the queue queue if not already printing.

    Returns

      Returns 0 if unable to connect, 1 otherwise.

    Method send_job

      `string|int send_job(string queue, string job)`

    Description

      Send print job consisting of data job to printer queue.

    Returns

      Returns 1 if success, 0 otherwise.

    Method delete_job

      `int delete_job(string queue, int|void job)`

    Description

      Delete job job from printer queue.

    Returns

      Returns 1 on success, 0 otherwise.

    Method status

      `string|int status(string queue)`

    Description

      Check the status of queue queue.

    Returns

      Returns 0 on failure, otherwise returns the status response from the printer.

    Method create

      `void Protocols.LPD.client(string|void hostname, int|void portnum)`

    Description

      Create a new LPD client connection.

    Parameter `hostname`

      Contains the hostname or ipaddress of the print host. if not provided, defaults to localhost.

    Parameter `portnum`

      Contains the port the print host is listening on. if not provided, defaults to port 515, the RFC 1179 standard.

Module Protocols.LMTP

  CLASS Protocols.LMTP.Server

    Description

      A LMTP server. It has been fairly well tested against Postfix client. Actually this module is only an extention to the SMTP server.

    Method create

      `void Protocols.LMTP.Server(array(string) _domains, void|int port, void|string ip, function _cb_mailfrom, function _cb_rcptto, function _cb_data)`

    Description

      Create a receiving LMTP server. It implements RFC 2821, 2822, 2033 and 1854.

    Parameter `domain`

      Domains name this server relay, you need to provide at least one domain (the first one will be used for MAILER-DAEMON address). if you want to relay everything you can put a '*' after this first domain.

    Parameter `port`

      Port this server listen on

    Parameter `listenip`

      IP on which server listen

    Parameter `cb_mailfrom`

      Mailfrom callback function, this function will be called when a client send a mail from command. This function must take a string as argument (corresponding to the sender's email) and return int corresponding to the SMTP code to output to the client. If you return an array the first element is the SMTP code and the second is the error string to display.

    Parameter `cb_rcptto`

      Same as cb_mailfrom but called when a client sends a rcpt to.

    Parameter `cb_data`

      This function is called for each recipient in the "rcpt to" command after the client sends the "data" command It must have the following synopsis: int|array cb_data(object mime, string sender, string recipient, void|string rawdata) object mime : the mime data object string sender : sender of the mail (from the mailfrom command) string recipient : one recipient given by one rcpt command. return : SMTP code to output to the client. If you return an array the first element is the SMTP code and the second is the error string to display. Note that to comply with LMTP protocol you must output a code each time this function is called.

    Example

          Here is an example of silly program that does nothing except outputing
            informations to stdout.
           int cb_mailfrom(string mail)
           {
             return 250;
           }
           int cb_rcptto(string email)
           {
             // check the user's mailbox here
             return 250;
           }
           int cb_data(object mime, string sender, string recipient)
           {
             write(sprintf("smtpd: mailfrom=%s, to=%s, headers=%O\ndata=%s\n",
             sender, recipient, mime->headers, mime->getdata()));
             // check the data and deliver the mail here
             if(mime->body_parts)
             {
             {
               foreach(mime->body_parts, object mpart)
                 write(sprintf("smtpd: mpart data = %O\n", mpart->getdata()));
             }
             return 250;
           }
           int main(int argc, array(string) argv)
           {
             Protocols.LMTP.Server(({ "ece.fr" }), 2500, "127.0.0.1",       cb_mailfrom, cb_rcptto, cb_data);
             return -1;
           }

Module Graphics

  Module Graphics.Graph

    Inherit create_pie

      inherit .create_pie : create_pie

    Method check_mapping

      `mapping(string:mixed) check_mapping(mapping(string:mixed) diagram_data, string type)`

    Description

      This function sets all unset elements in diagram_data to its default value as well as performing some simple sanity checks. This function is called from within pie , bars , sumbars , line , norm and graph .

    Method pie

      `Image.Image pie(mapping(string:mixed) diagram_data)`

    FIXME

      Document this function

    Method bars

      `Image.Image bars(mapping(string:mixed) diagram_data)`

    FIXME

      Document this function

    Method sumbars

      `Image.Image sumbars(mapping(string:mixed) diagram_data)`

    FIXME

      Document this function

    Method line

      `Image.Image line(mapping(string:mixed) diagram_data)`

    FIXME

      Document this function

    Method norm

      `Image.Image norm(mapping(string:mixed) diagram_data)`

    FIXME

      Document this function

    Method graph

      `Image.Image graph(mapping(string:mixed) diagram_data)`

    FIXME

      Document this function

    CLASS Graphics.Graph.polyline

      Description

        Graph sub-module providing draw functions.

        $Id: 87dba83c3dd9f9cdce52248e8ae29e619b57c699 $

    CLASS Graphics.Graph.create_pie

      Description

        Graph sub-module for drawing pie-charts.

      Inherit create_bars

        inherit .create_bars : create_bars

    CLASS Graphics.Graph.create_graph

      Description

        Graph sub-module for drawing graphs.

        create_graph draws a graph but there are also some other functions used by create_pie and create_bars .

      Inherit polyline

        inherit .polyline : polyline

    CLASS Graphics.Graph.create_bars

      Description

        Graph sub-module for drawing bars.

      Inherit create_graph

        inherit .create_graph : create_graph

Module GTKSupport

  CLASS GTKSupport.Alert

    Inherit Dialog

      inherit GTK.Dialog : Dialog

    Method ok

      `GTK.Button ok()`

    Description

      Returns the ok Button object.

    Method create

      `void GTKSupport.Alert(string text, string|void title)`

  CLASS GTKSupport.pDrawingArea

    Description

      A Drawing area with backing store. Basically, the only difference from a drawing area widget is that this one never loose it's contents unless you do paint over them.

      It also use quite a significant amount of memory if the backing pixmap has many bitplanes, and the drawing area is large.

    See also

      GTK.DrawingArea

    Inherit DrawingArea

      inherit GTK.DrawingArea : DrawingArea

  CLASS GTKSupport.SClist

    Description

      A Clist with scrollbars. Defines the same interface as Clist .

  Module GTKSupport.MenuFactory

    Method set_menubar_modify_callback

      `void set_menubar_modify_callback(function to)`

    Description

      The function passed as the argument to this function will be called each time the accelerator key mapping is changed by the user with the new mapping as the argument.

    Note

      This function is only used when the menubar is created, once you are done with the menubar creation, the callbacks for that menubar will be fixed.

    Method get_menubar_mapping

      `mapping get_menubar_mapping()`

    Description

      Returns a (flat) mapping `([ path:GTK.MenuItem ])`.

    Note

      This function can only be called after the menubar is created.

    Method PopupMenuFactory

      `array(object) PopupMenuFactory(MenuDef ... definition)`

    Description

      Identical to MenuFactory , but creates popup menus instead.

    Returns

      Array
      `GTK.Menu 0` | GTK.Menu
      `GTK.AccelGroup 1` | GTK.AccelGroup

    Method MenuFactory

      `array(object) MenuFactory(MenuDef ... definition)`

    Description

      This is the function that actually builds the menubar.

    Example

          import GTK.MenuFactory;
           [GTK.MenuBar bar, GTK.AcceleratorTable map] =
            MenuFactory(
              MenuDef( "File/New", new_file, 0, "A-N" ),
              MenuDef( "File/Open", new_file, 1, "A-O" ),
              MenuDef( "File/Save", save_file, 0, "A-S" ),
              MenuDef( "File/<separator>", 0, 0 ),
              MenuDef( "File/Quit", _exit, 0, "A-Q" ),
            );

    Returns

      Array
      `GTK.MenuBar 0` | GTK.MenuBar
      `GTK.AcceleratorTable 1` | GTK.AcceleratorTable

    CLASS GTKSupport.MenuFactory.MenuDef

      Description

        Definition of a menu item.

      Method assign_shortcut

        `void assign_shortcut(string sc)`

      Description

        Sets a new shortcut as the current one.

        The shortcut syntax is: m[m[..]]-key, where m is one or more modifier character, and key is the desired key (NOTE: Key must be in the range 0-255 currently, this will hopefully be fixed by the GTK people in the future)

        The modifiers are:

        `"s"` | Shift
        `"c"` | Control
        `"a"` | Modifier 1 (called alt by the GTK people, that's not true, though)
        `"1"`
        `"g"` | Modifier 2 (called altgr by the GTK people, that's not true, though)
        `"2"`
        `"m"` | Modifier 3 (not mapped by the GTK people, meta on _my_ keyboard)
        `"3"`
        `"h"` | Modifier 4 (not mapped by the GTK people, hyper on _my_ keyboard)
        `"4"`
        `"u"` | Modifier 5 (not mapped by the GTK people, super on _my_ keyboard)
        `"5"`

      Method create

        `void GTKSupport.MenuFactory.MenuDef(string path, function|void cb, mixed|void cbarg, string|void binding, int|void right)`

      Parameter `path`

        Path is the menupath. A submenu will be created for each "Directory" in the path, and menuitems will be created for the "files". There are two special cases: The "file" `"<separator>"` will create a thin line. The "file"-prefix `"<check>"` will make the menuitem a checkmenuitem instead of a normal menuitem.

      Parameter `cb`
      Parameter `cbarg`

        The second and third arguments are the callback function and the first callback function argument. If the callback function argument is an array, the indices of the array will be pushed as arguments. To call the function with an array as the only argument, make an array with the array in. The callback function will be called like `callback( arg, widget )`, or if arg is an array, `callback( arg[0], arg[1], ..., widget )`.

      Parameter `shortcut`

        The fourth argument, shortcut, is the shortcut to bind to this menu item. The shortcut can be changed later on by calling assign_shortcut , or by the user by pressing the desired keycombination over the menu item.

        The shortcut syntax is: m[m[..]]-key, where m is one or more modifier character, and key is the desired key (NOTE: Key must be in the range 0-255 currently, this will hopefully be fixed by the GTK people in the future)

        The modifiers are:

        `"s"` | Shift
        `"c"` | Control
        `"a"` | Modifier 1 (called alt by the GTK people, that's not true, though)
        `"1"`
        `"g"` | Modifier 2 (called altgr by the GTK people, that's not true, though)
        `"2"`
        `"m"` | Modifier 3 (not mapped by the GTK people, meta on _my_ keyboard)
        `"3"`
        `"h"` | Modifier 4 (not mapped by the GTK people, hyper on _my_ keyboard)
        `"4"`
        `"u"` | Modifier 5 (not mapped by the GTK people, super on _my_ keyboard)
        `"5"`

      Parameter `right`

        Currently ignored.

  Module GTKSupport.Util

    Method load_image

      `mapping load_image(string filename, array|void bgcol)`

    Description

      Loads and decodes an image as a GDK.Pixmap .

    Returns

      `"format" : string` | The MIME content type of the image.
      `"alpha" : GDK.Bitmap` | The alpha channel of the image, if any. Otherwise `0`.
      `"img" : GDK.Bitmap` | The decoded image.

    Method decode_image

      `mapping decode_image(string data, mapping|array|void tocolor)`

    Description

      Decodes an image as a GDK.Pixmap .

    Returns

      `"format" : string` | The MIME content type of the image.
      `"alpha" : GDK.Bitmap` | The alpha channel of the image, if any. Otherwise `0`.
      `"img" : GDK.Bitmap` | The decoded image.

Module Calendar

  Constant nulltimerange

    `constant Calendar.nulltimerange = TimeRange`

  Description

    This represents the null time range, which, to differ from the zero time range (the zero-length time range), isn't placed in time. This is the result of for instance `& between two strict non-overlapping timeranges - no time at all.

    It has a constant, `is_nulltimerange`, which is non-zero. ``!` on this timerange is true.

  CLASS Calendar.Ruleset

    Description

      This is the container class for rules.

    Method set_timezone

      `this_program set_timezone(string|Calendar.Rule.Timezone t)`

    Method set_language

      `this_program set_language(string|Calendar.Rule.Language lang)`

    Method set_abbr2zone

      `this_program set_abbr2zone(mapping(string:string) abbr2zone)`

    Description

      Sets the guess-mapping for timezones. Default is the mapping:

      Abbreviation | Interpretation | UTC
      AMT | America/Manaus | UTC-4
      AST | America/Curacao | UTC-4
      CDT | America/Costa_Rica | UTC-5
      CST | America/El Salvador | UTC-6
      EST | America/Panama | UTC-5
      GST | Asia/Dubai | UTC+4
      IST | Asia/Jerusalem | UTC+2
      WST | Australia/Perth | UTC+8

    See also

      YMD.parse

    Method set_rule

      `this_program set_rule(Calendar.Rule.Language|Calendar.Rule.Timezone rule)`

    Method clone

      `this_program clone()`

    Method `==

      `int(0..1) `==(this_program other)`

  CLASS Calendar.TimeRange

    Description

      This is the base class (usually implemented by e.g. Calendar subclasses like Calendar.Second) for any time measurement and calendrar information. It defines all the things you can do with a time range or any time period.

      A TimeRange doubles as both a fixed period in time, and an amount of time. For instance, a week plus a day moves the week-period one day ahead (unaligning it with the week period, and thereby reducing it to just 7 days), no matter when in time the actual day were.

    Method add

      `TimeRange add(int n, void|TimeRange step)`

    Description

      calculates the (promoted) time period n steps away; if no step is given, the step's length is of the same length as the called time period.

      It is not recommended to loop by adding the increment time period to a shorter period; this can cause faults, if the shorter time period doesn't exist in the incremented period. (Like week 53, day 31 of a month or the leap day of a year.)

      Recommended use are like this:

             // loop over the 5th of the next 10 months
             TimeRange month=Month()+1;
             TimeRange orig_day=month()->day(5);
             for (int i=0; i<10; i++)
             {
                month++;
                TimeRange day=month->place(orig_day);
                ...use day...
             }

    Method beginning
    Method end

      `TimeRange beginning()`
      `TimeRange end()`

    Description

      This gives back the zero-sized beginning or end of the called time period.

      rule: `range(t->beginning(),t->end())==t`

    Method calendar

      `Calendar calendar()`

    Description

      Simply gives back the calendar in use, for instance Calendar.ISO or Calendar.Discordian.

    Method strictly_preceeds
    Method preceeds
    Method is_previous_to
    Method overlaps
    Method contains
    Method equals
    Method is_next_to
    Method succeeds
    Method strictly_succeeds

      `int(0..1) strictly_preceeds(TimeRange what)`
      `int(0..1) preceeds(TimeRange what)`
      `int(0..1) is_previous_to(TimeRange what)`
      `int(0..1) overlaps(TimeRange what)`
      `int(0..1) contains(TimeRange what)`
      `int(0..1) equals(TimeRange what)`
      `int(0..1) is_next_to(TimeRange what)`
      `int(0..1) succeeds(TimeRange what)`
      `int(0..1) strictly_succeeds(TimeRange what)`

    Description

      These methods exists to compare two periods of time on the timeline.

                    case            predicates

           <-- past       future ->

           |----A----|              A strictly preceeds B,
                        |----B----| A preceeds B

           |----A----|              A strictly preceeds B, A preceeds B,
                     |----B----|    A is previous to B, A touches B

               |----A----|          A preceeds B,
                     |----B----|    A overlaps B, A touches B

               |-------A-------|    A preceeds B, A ends with B
                     |----B----|    A overlaps B, A contains B, A touches B,

               |-------A-------|    A preceeds B,  A succeeds B,
                   |---B---|        A overlaps B, A contains B, A touches B

                  |----A----|       A overlaps B, A touches B, A contains B
                  |----B----|       A equals B, A starts with B, A ends with B

               |-------A-------|    A succeeds B, A starts with B
               |----B----|          A overlaps B, A contains B, A touches B

                     |----A----|    A succeeds B,
               |----B----|          A overlaps B, A touches B

                     |----A----|    A strictly succeeds B, A succeeds B
           |----B----|              A is next to B, A touches B

                       |----A----|  A strictly succeeds B,
           |----B----|              A succeeds B

    Note

      These methods only check the range of the first to the last time in the period; use of combined time periods (SuperTimeRange s) might not give you the result you want.

    See also

      `&amp;

    Method create

      `void Calendar.TimeRange("unix", int unixtime)`
      `void Calendar.TimeRange("unix", int unixtime, int seconds_len)`

    Description

      Create the timerange from unix time (as given by `time(2)`), with eventually the size of the time range in the same unit, seconds.

    Method create

      `void Calendar.TimeRange("julian", int|float julian_day)`

    Description

      Create the timerange from a julian day, the standardized method of counting days. If the timerange is more then a day, it will at least enclose the day.

    Method create

      `void Calendar.TimeRange(TimeRange from)`

    Description

      Create the timerange from another timerange.

      This is useful when converting objects from one calendar to another. Note that the ruleset will be transferred to the new object, so this method can't be used to convert between timezones or languges - use set_timezone , set_language or set_ruleset to achieve this.

    Note

      The size of the new object may be inexact; a Month object can't comprehend seconds, for instance.

    Method range
    Method space
    Method distance

      `TimeRange range(TimeRange other)`
      `TimeRange space(TimeRange other)`
      `TimeRange distance(TimeRange other)`

    Description

      Derives different time periods in between the called timerange and the parameter timerange.

          >- the past          the future -<
           |--called--|         |--other--|
           >------------ range -----------<
                      >--space--<
           >----- distance -----<

      See also: add, TimeRanges.range, TimeRanges.space, TimeRanges.distance

    Method `/
    Method how_many

      `int `/(TimeRange with)`
      `int how_many(TimeRange with)`

    Description

      This calculates how many instances of the given timerange has passed during the called timerange.

      For instance, to figure out your age, create the timerange of your lifespan, and divide with the instance of a Year .

    Method set_language
    Method language

      `TimeRange set_language(Rule.Language lang)`
      `TimeRange set_language(string lang)`
      `Language language()`

    Description

      Set or get the current language rule.

    Method next
    Method prev

      `TimeRange next()`
      `TimeRange prev()`

    Description

      Next and prev are compatible and convinience functions; `a->next()` is exactly the same as `a+1`; `a=a->next()` is `a++`.

    Method offset_to

      `int offset_to(TimeRange x)`

    Description

      Calculates offset to x; this compares two timeranges and gives the integer offset between the two starting points.

      This is true for suitable a and b: `a+a->offset_to(b)==b`

      By suitable means that a and b are of the same type and size. This is obviously true only if a+n has b as a possible result for any n.

    Method place

      `TimeRange place(TimeRange this)`
      `TimeRange place(TimeRange this, int(0..1) force)`

    Description

      This will place the given timerange in this timerange, for instance, day 37 in the year - `Year(1934)->place(Day(1948 d37)) => Day(1934 d37)`.

    Note

      The rules how to place things in different timeranges can be somewhat 'dwim'.

    Method set_ruleset
    Method ruleset

      `TimeRange set_ruleset(Ruleset r)`
      `TimeRange ruleset(Ruleset r)`

    Description

      Set or get the current ruleset.

    Note

      this may include timezone shanges, and change the time of day.

    Method set_size

      `TimeRange set_size(TimeRange size)`
      `TimeRange set_size(int n, TimeRange size)`

    Description

      Gives back a new (or the same, if the size matches) timerange with the new size. If n are given, the resulting size will be n amounts of the given size.

    Note

      A negative size is not permitted; a zero one are.

    Method set_timezone
    Method timezone

      `TimeRange set_timezone(Timezone tz)`
      `TimeRange set_timezone(string tz)`
      `TimeZone timezone()`

    Description

      Set or get the current timezone (including dst) rule.

    Note

      The time-of-day may very well change when you change timezone.

      To get the time of day for a specified timezone, select the timezone before getting the time of day:

      `Year(2003)->...->set_timezone(TimeZone.CET)->...->hour(14)->...`

    Method `/
    Method split

      `array(TimeRange) `/(int|float n)`
      `array(TimeRange) split(int|float n, object void|TimeRangewith)`

    Description

      This divides the called timerange into n pieces. The returned timerange type is not neccesarily of the same type as the called one. If the optional timerange is specified then the resulting timeranges will be multiples of that range (except for the last one).

      known bugs: These are currently not defined for supertimeranges .

    Method subtract

      `TimeRange subtract(TimeRange what)`

    Description

      This subtracts a period of time from another;

          >- the past          the future -<
          |-------called-------|
               |-------other--------|
          <---->  <- called->subtract(other)

          |-------called-------|
               |---third---|
          <---->           <---> <- called->subtract(third)

    Method `&

      `TimeRange `&(TimeRange with)`

    Description

      Gives the cut on the called time period with another time period. The result is zero if the two periods doesn't overlap.

          >- the past          the future -<
           |-------called-------|
                |-------other--------|
                >----- cut -----<

    Method `*

      `TimeRange `*(int n)`

    Description

      This changes the amount of time in the time period. `t*17` is the same as doing `t->set_size (t,17)`.

    Method `+
    Method `-

      `TimeRange `+(int n)`
      `TimeRange `+(TimeRange offset)`
      `TimeRange `-(int m)`
      `TimeRange `-(TimeRange x)`

    Description

      This calculates the (promoted) time period either n step away or with a given offset. These functions does use add to really do the job:

          t+n         t->add(n)             t is a time period
          t-n         t->add(-n)            offset is a time period
          t+offset    t->add(1,offset)      n is an integer
          t-offset    t->add(-1,offset)
          n+t         t->add(n)
          n-t         illegal
          offset+t    offset->add(1,t)      | note this!
          offset-t    offset->add(-1,t)     |

      Mathematic rules:

          x+(t-x) == t    x is an integer or a time period
          (x+t)-x == t    t is a time period
          (t+x)-x == t
          o-(o-t) == t    o is a time period
          t++ == t+1
          t-- == t-1

    Note

      a-b does not give the distance between the start of a and b. Use the distance () function to calculate that.

      The integer used to `+, `- and add are the number of steps the motion will be. It does never represent any fixed amount of time, like seconds or days.

    Method `<
    Method `>

      `int(0..1) `<(TimeRange compared_to)`
      `int(0..1) `>(TimeRange compared_to)`

    Description

      These operators sorts roughty on the periods place in time. The major use might be to get multiset to work, besides sorting events clearly defined in time.

    Method `==
    Method _equal

      `int(0..1) `==(TimeRange compared_to)`
      `int(0..1) _equal(TimeRange compared_to)`

    Description

      These two overloads the operator ``==` and the result of the `equal` function.

      a`==`b is considered true if the two timeranges are of the same type, have the same rules (language, timezone, etc) and are the same timerange.

      `equal(`a`,`b`)` are considered true if a and b are the same timerange, exactly the same as the equals method.

      The `__hash` method is also present, to make timeranges possible to use as keys in mappings.

      known bugs: _equal is not currently possible to overload, due to weird bugs, so equal uses `== for now.

    Method `^

      `TimeRange `^(TimeRange with)`

    Description

      Gives the exclusive-or on the called time period and another time period, ie the union without the cut. The result is zero if the two periods were the same.

          >- the past          the future -<
           |-------called-------|
                |-------other--------|
           <----|               |---->   - exclusive or

    Method `|

      `TimeRange `|(TimeRange with)`

    Description

      Gives the union on the called time period and another time period.

          >- the past          the future -<
           |-------called-------|
                |-------other--------|
           <----------union---------->

  CLASS Calendar.SuperTimeRange

    Description
      inherits TimeRange

      This class handles the cases where you have a time period with holes. These can be created by the `^` or `|` operators on time ranges.

    Method create

      `void Calendar.SuperTimeRange(array(TimeRange) parts)`

    Description

      A SuperTimeRange must have at least two parts, two time ranges. Otherwise, it's either not a time period at all or a normal time period.

  CLASS Calendar.Calendar

    Description

      This is the base class of the calendars.

    Method now

      `Calendar.TimeRanges.TimeRange now()`

    Description

      Give the zero-length time period of the current time.

  Module Calendar.Badi

    Description

      This is the Badi calendar, used in the Baha'i religion.

    Inherit YMD

      inherit Calendar.YMD : YMD

    Method daystart_offset

      `int daystart_offset()`

    Description

      function method int daystart_offset() Returns the offset to the start of the time range object

    CLASS Calendar.Badi.Vahid

      Inherit YMD

        inherit YMD : YMD

      Method year

        `cYear year(int|string ... yp)`

      Description

        method Year year() method Year year(int n) method Year year(string name) return a year in the vahid by number or name:

        <tt>vahid-&gt;year("Alif")</tt>

  Module Calendar.Stardate

    Description

      This implements TNG stardates.

    Method now

      `cTick now()`

    Description

      Give the zero-length time period of the current time.

    CLASS Calendar.Stardate.cTick

      Inherit TimeRange

        inherit Calendar.TimeRange : TimeRange

      Method create

        `void Calendar.Stardate.cTick(mixed ... args)`
        `void Calendar.Stardate.cTick(int|float date)`
        `void Calendar.Stardate.cTick()`

      Description

        Apart from the standard creation methods (julian day, etc), you can create a stardate from the stardate number. The length of the period will then be zero.

        You can also omit any arguments to create now.

      Bugs

        Since the precision is limited to the float type of Pike you can get non-precise results:

        > Calendar.Second(Calendar.Stardate.Day(Calendar.Year())); Result: Second(Fri 31 Dec 1999 23:59:18 CET - Sun 31 Dec 2000 23:59:18 CET)

    Method tic

      `float tic()`

    Description

      This gives back the start of the stardate period, as a float.

    Method tics

      `float tics()`

    Description

      This gives back the number of stardate tics in the period.

    Method number_of_seconds

      `int number_of_seconds()`

    Description

      This gives back the Gregorian/Earth/ISO number of seconds, for convinience and conversion to other calendars.

    Method number_of_days

      `int number_of_days()`

    Description

      This gives back the Gregorian/Earth/ISO number of days, for convinience and conversion to other calendars.

    Method format_long
    Method format_short
    Method format_vshort

      `string format_long(void|int precision)`
      `string format_short(void|int precision)`
      `string format_vshort(void|int precision)`

    Description

      Format the stardate tick nicely. Precision is the number of decimals. Defaults to 3.

      long | "-322537.312" |
      short | "77463.312" | (w/o >100000-component)
      vshort | "7463.312" | (w/o >10000-component)

Module Calendar.ISO

  Description

    This is the standard western calendar, which is a derivate of the Gregorian calendar, but with weeks that starts on Monday instead of Sunday.

  Inherit Gregorian

    inherit Calendar.Gregorian : Gregorian

Module Calendar.Julian

  Description

    This is the Julian calendar, conjured up by the old Romans when their calendar were just too weird. It was used by the christians as so far as the 18th century in some parts of the world. (Especially the protestantic and orthodox parts.)

  Note

    Don't confuse the julian day with the Julian calendar. The former is just a linear numbering of days, used in the Calendar module as a common unit for absolute time.

  Inherit Gregorian

    inherit Calendar.Gregorian : Gregorian

Module Calendar.Coptic

  Description

    This is the Coptic Orthodox Church calendar, that starts the 11th or 12th September and has 13 months.

  Note

    The (default) names of the months are different then other the emacs calendar; I do not know which ones are used - the difference seem to be only the transcription of the phonetic sounds (B <-> P, etc).

    I do not know for how long back the calendar is valid, either. My sources claim that the calendar is synchronized with the Gregorian calendar, which is odd.

  Inherit Gregorian

    inherit Calendar.Gregorian : Gregorian

Module Calendar.TZnames

  Description

    This module contains listnings of available timezones, in some different ways

  Constant zones

    `constant Calendar.TZnames.zones = mapping(string:array(string))`

  Description

    This constant is a mapping that can be used to loop over to get all the region-based timezones.

    It looks like this:

        ([ "America": ({ "Los_Angeles", "Chicago", [...] }),
           "Europe":  ({ "Stockholm", [...] }),
           [...] }),

    Please note that loading all the timezones can take some time, since they are generated and compiled on the fly.

  Constant abbr2zones

    `constant Calendar.TZnames.abbr2zones = mapping(string:array(string))`

  Description

    This mapping is used to look up abbreviation to the possible regional zones.

    It looks like this:

        ([ "CET": ({ "Europe/Stockholm", [...] }),
           "CST": ({ "America/Chicago", "Australia/Adelaide", [...] }),
           [...] }),

    Note this: Just because it's noted "CST" doesn't mean it's a unique timezone. There is about 7 *different* timezones that uses "CST" as abbreviation; not at the same time, though, so the DWIM routines checks this before it's satisfied. Same with some other timezones.

    For most timezones, there is a number of region timezones that for the given time are equal. This is because region timezones include rules about local summer time shifts and possible historic shifts.

    The YMD.parse functions can handle timezone abbreviations by guessing.

  Method zonenames

    `array(string) zonenames()`

  Description

    This reads the zone.tab file and returns name of all standard timezones, like "Europe/Belgrade".

  Method _zone_tab
  Method zone_tab

    `string _zone_tab()`
    `array(array) zone_tab()`

  Description

    This returns the raw respectively parsed zone tab file from the timezone data files.

    The parsed format is an array of zone tab line arrays,

        ({ string country_code,
           string position,
           string zone_name,
           string comment })

    To convert the position to a Geography.Position, simply feed it to the constructor.

Module Calendar.Discordian

  Description

    The Discordian calendar, as described on page 34 in the fourth edition of Principia Discordia.

    Chaotic enough, it's quite simpler then the Gregorian calendar; weeks are 5 days, and evens up on a year. Months are 73 days.

    The leap day is inserted at the 60th day of the first month (Chaos), giving the first month 74 days. The description of the calendar is a "perpetual date converter from the gregorian to the POEE calendar", so the leap years are the same as the gregorians.

    The Principia calls months "seasons", but for simplicity I call them months in this calendar.

    If anyone know more about how to treat the leap day - now it is inserted in the month and week where it lands, rather then being separated from month and weeks, I'm interested to know.

    - Mirar, Pope of POEE.

  Inherit Gregorian

    inherit Calendar.Gregorian : Gregorian

Module Calendar.YMD

  Description

    base for all Roman-kind of Calendars, ie, one with years, months, weeks and days

  CLASS Calendar.YMD.YMD

    Description
      inherits TimeRange

      Base (virtual) time period of the Roman-kind of calendar.

    Method format_iso_ymd
    Method format_ymd
    Method format_ymd_short
    Method format_ymd_xshort
    Method format_iso_week
    Method format_iso_week_short
    Method format_week
    Method format_week_short
    Method format_month
    Method format_month_short
    Method format_iso_time
    Method format_time
    Method format_time_short
    Method format_time_xshort
    Method format_mtime
    Method format_xtime
    Method format_tod
    Method format_todz
    Method format_xtod
    Method format_mod

      `string format_iso_ymd()`
      `string format_ymd()`
      `string format_ymd_short()`
      `string format_ymd_xshort()`
      `string format_iso_week()`
      `string format_iso_week_short()`
      `string format_week()`
      `string format_week_short()`
      `string format_month()`
      `string format_month_short()`
      `string format_iso_time()`
      `string format_time()`
      `string format_time_short()`
      `string format_time_xshort()`
      `string format_mtime()`
      `string format_xtime()`
      `string format_tod()`
      `string format_todz()`
      `string format_xtod()`
      `string format_mod()`

    Description

      Format the object into nice strings;

          iso_ymd        "2000-06-02 (Jun) -W22-5 (Fri)" [2]
          ext_ymd        "Friday, 2 June 2000" [2]
          ymd            "2000-06-02"
          ymd_short      "20000602"
          ymd_xshort     "000602" [1]
          iso_week       "2000-W22"
          iso_week_short "2000W22"
          week           "2000-w22" [2]
          week_short     "2000w22" [2]
          month          "2000-06"
          month_short    "200006" [1]
          iso_time       "2000-06-02 (Jun) -W22-5 (Fri) 00:00:00 UTC+1" [2]
          ext_time       "Friday, 2 June 2000, 00:00:00" [2]
          ctime          "Fri Jun  2 00:00:00 2000\n" [2] [3]
          http           "Fri, 02 Jun 2000 00:00:00 GMT" [4]
          time           "2000-06-02 00:00:00"
          time_short     "20000602 00:00:00"
          time_xshort    "000602 00:00:00"
          iso_short      "2000-06-02T00:00:00"
          mtime          "2000-06-02 00:00"
          xtime          "2000-06-02 00:00:00.000000"
          tod            "00:00:00"
          tod_short      "000000"
          todz           "00:00:00 CET"
          todz_iso       "00:00:00 UTC+1"
          xtod           "00:00:00.000000"
          mod            "00:00"

      `[1]` note conflict (think 1 February 2003)
      `[2]` language dependent
      `[3]` as from the libc function ctime()
      `[4]` as specified by the HTTP standard; not language dependent.

    Method fraction_no
    Method hour_no
    Method julian_day
    Method leap_year
    Method minute_no
    Method month_day
    Method month_no
    Method second_no
    Method utc_offset
    Method week_day
    Method week_no
    Method year_day
    Method year_no
    Method month_name
    Method month_shortname
    Method month_day_name
    Method week_day_name
    Method week_day_shortname
    Method week_name
    Method year_name
    Method tzname
    Method tzname_iso

      `float fraction_no()`
      `int hour_no()`
      `int julian_day()`
      `int leap_year()`
      `int minute_no()`
      `int month_day()`
      `int month_no()`
      `int second_no()`
      `int utc_offset()`
      `int week_day()`
      `int week_no()`
      `int year_day()`
      `int year_no()`
      `string month_name()`
      `string month_shortname()`
      `string month_day_name()`
      `string week_day_name()`
      `string week_day_shortname()`
      `string week_name()`
      `string year_name()`
      `string tzname()`
      `string tzname_iso()`

    Description

      function method int unix_time() Returns the unix time integer corresponding to the start of the time range object. (An unix time integer is UTC.) function method datetime() This gives back a mapping with the relevant time information (representing the start of the period);

               ([ "year":     int        // year number (2000 AD=2000, 1 BC==0)
                  "month":    int(1..)   // month of year
                  "day":      int(1..)   // day of month
                  "yearday":  int(0..)   // day of year
                  "week":     int(1..)   // week of year
                  "week_day": int(0..)   // day of week
                  "timezone": int        // offset to utc, including dst

                  "unix":     int        // unix time
                  "julian":   int        // julian day
               // for compatibility:
                  "hour":     0          // hour of day, including dst
                  "minute":   0          // minute of hour
                  "second":   0          // second of minute
                  "fraction": 0.0        // fraction of second
               ]);

    Note

      Day of week is compatible with old versions, ie, 0 is sunday, 6 is saturday, so it shouldn't be used to calculate the day of the week with the given week number. Year day is also backwards compatible, ie, one (1) less then from the year_day() function.

      If this function is called in a Week object that begins with the first week of a year, it returns the previous year if that is where the week starts. To keep the representation unambiguous, the returned week number is then one more than the number of weeks in that year.

      E.g. Week(2008,1)->datetime() will return year 2007 and week 53 since the first week of 2008 starts in 2007.

    Method second
    Method minute
    Method seconds
    Method number_of_seconds
    Method minutes
    Method number_of_minutes
    Method hour
    Method hours
    Method number_of_hours

      `Second second()`
      `Second second(int n)`
      `Minute minute(int hour, int minute, int second)`
      `array(Second) seconds()`
      `array(Second) seconds(int first, int last)`
      `int number_of_seconds()`
      `Minute minute()`
      `Minute minute(int n)`
      `Minute minute(int hour, int minute)`
      `array(Minute) minutes()`
      `array(Minute) minutes(int first, int last)`
      `int number_of_minutes()`
      `Hour hour()`
      `Hour hour(int n)`
      `array(Hour) hours()`
      `array(Hour) hours(int first, int last)`
      `int number_of_hours()`

  CLASS Calendar.YMD.Year

    Description
      inherits TimeRange
      inherits YMD

      This is the time period of a year.

    Method create

      `void Calendar.YMD.Year("unix", int unix_time)`
      `void Calendar.YMD.Year("julian", int|float julian_day)`
      `void Calendar.YMD.Year(int year)`
      `void Calendar.YMD.Year(string year)`
      `void Calendar.YMD.Year(TimeRange range)`

    Description

      It's possible to create the standard year by using three different methods; either the normal way - from standard unix time or the julian day, and also, for more practical use, from the year number.

    Method month

      `Month month()`
      `Month month(int n)`
      `Month month(string name)`

    Description

      The Year type overloads the month() method, so it is possible to get a specified month by string:

      `year->month("April")`

      The integer and no argument behavior is inherited from YMD ().

    Method week

      `Week week()`
      `Week week(int n)`
      `Week week(string name)`

    Description

      The Year type overloads the week() method, so it is possible to get a specified week by name:

      `year->week("17")` `year->week("w17")`

      The integer and no argument behavior is inherited from YMD ().

      This is useful, since the first week of a year not always (about half the years, in the ISO calendar) is numbered '1'.

  CLASS Calendar.YMD.Week

    Description

      The Calendar week represents a standard time period of a week. In the Gregorian calendar, the standard week starts on a sunday and ends on a saturday; in the ISO calendar, it starts on a monday and ends on a sunday.

      The week are might not be aligned to the year, and thus the week may cross year borders and the year of the week might not be the same as the year of all the days in the week. The basic rule is that the week year is the year that has the most days in the week, but since week number only is specified in the ISO calendar - and derivates - the week number of most calendars is the week number of most of the days in the ISO calendar, which modifies this rule for the Gregorian calendar; the week number and year is the same as for the ISO calendar, except for the sundays.

      When adding, moving and subtracting months to a week, it falls back to using days.

      When adding, moving or subtracting years, if tries to place the moved week in the resulting year.

    Method create

      `void Calendar.YMD.Week("unix", int unix_time)`
      `void Calendar.YMD.Week("julian", int|float julian_day)`
      `void Calendar.YMD.Week(int year, int week)`

    Description

      It's possible to create the standard week by using three different methods; either the normal way - from standard unix time or the julian day, and also, for more practical use, from year and week number.

      Can be less than 1 for the first week of the year if it begins in the previous year.

    Method create

      `void Calendar.YMD.Week("unix", int unix_time)`
      `void Calendar.YMD.Week("julian", int|float julian_day)`
      `void Calendar.YMD.Week(int year, int month, int day)`
      `void Calendar.YMD.Week(int year, int year_day)`
      `void Calendar.YMD.Week(int julian_day)`

    Description

      It's possible to create the day by using five different methods; either the normal way - from standard unix time or the julian day, and also, for more practical use, from year, month and day, from year and day of year, and from julian day without extra fuzz.

    Method day

      `Day day()`
      `Day day(int n)`
      `Day day(string name)`

    Description

      The Week type overloads the day() method, so it is possible to get a specified weekday by string:

      `week->day("sunday")`

      The integer and no argument behavior is inherited from YMD ().

    Note

      the weekday-from-string routine is language dependent.

  CLASS Calendar.YMD.Hour

    Description
      inherits Time.Hour
      inherits YMD

      global convinience functions

    Method parse

      `TimeRange parse(string fmt, string arg)`

    Description

      parse a date, create relevant object fmt is in the format "abc%xdef..." where abc and def is matched, and %x is one of those time units:

          %Y absolute year
          %y dwim year (70-99 is 1970-1999, 0-69 is 2000-2069)
          %M month (number, name or short name) (needs %y)
          %W week (needs %y)
          %D date (needs %y, %m)
          %d short date (20000304, 000304)
          %a day (needs %y)
          %e weekday (needs %y, %w)
          %h hour (needs %d, %D or %W)
          %m minute (needs %h)
          %s second (needs %m)
          %S seconds since the Epoch (only combines with %f)
          %f fraction of a second (needs %s or %S)
          %t short time (205314, 2053)
          %z zone
          %p "am" or "pm"
          %n empty string (to be put at the end of formats)

    Returns

      0 if format doesn't match data, or the appropriate time object.

    Note

      The zone will be a guess if it doesn't state an exact regional timezone (like "Europe/Stockholm") - most zone abbriviations (like "CET") are used by more then one region with it's own daylight saving rules. Also beware that for instance CST can be up to four different zones, central Australia or America being the most common.

              Abbreviation Interpretation
              AMT          America/Manaus       [UTC-4]
              AST          America/Curacao      [UTC-4]
              CDT          America/Costa_Rica   [UTC-6]
              CST          America/El Salvador  [UTC-6]
              EST          America/Panama       [UTC-5]
              GST          Asia/Dubai           [UTC+4]
              IST          Asia/Jerusalem       [UTC+2]
              WST          Australia/Perth      [UTC+8]

      This mapping is modifiable in the ruleset, see Ruleset.set_abbr2zone . function Day dwim_day(string date) function Day dwim_day(string date,TimeRange context) Tries a number of different formats on the given date (in order):

          parse  format                  as in
              "%y-%M-%D (%M) -W%W-%e (%e)"  "2000-03-20 (Mar) -W12-1 (Mon)"
              "%y-%M-%D"                    "2000-03-20", "00-03-20"
              "%M%/%D/%y"                   "3/20/2000"
              "%D%*[ /]%M%*[ /-,]%y"        "20/3/2000" "20 mar 2000" "20/3 -00"
              "%e%*[ ]%D%*[ /]%M%*[ /-,]%y" "Mon 20 Mar 2000" "Mon 20/3 2000"
              "-%y%*[ /]%D%*[ /]%M"         "-00 20/3" "-00 20 mar"
              "-%y%*[ /]%M%*[ /]%D"         "-00 3/20" "-00 march 20"
              "%y%*[ /]%D%*[ /]%M"          "00 20 mar" "2000 20/3"
              "%y%*[ /]%M%*[ /]%D"          "2000 march 20"
              "%D%.%M.%y"                   "20.3.2000"
              "%D%*[ -/]%M"                 "20/3" "20 mar" "20-03"
              "%M%*[ -/]%D"                 "3/20" "march 20"
              "%M-%D-%y"                    "03-20-2000"
              "%D-%M-%y"                    "20-03-2000"
              "%e%*[- /]%D%*[- /]%M"        "mon 20 march"
              "%e%*[- /]%M%*[- /]%D"        "mon/march/20"
              "%e%*[ -/wv]%W%*[ -/]%y"      "mon w12 -00" "1 w12 2000"
              "%e%*[ -/wv]%W"               "mon w12"
              "%d"                          "20000320", "000320"
              "today"                       "today"
              "last %e"                     "last monday"
              "next %e"                     "next monday"

      Casts exception if it fails to dwim out a day. "dwim" means do-what-i-mean.

      function datetime(int|void unix_time) Replacement for localtime; gives back a mapping:

               ([ "year":     int        // year number (2000 AD=2000, 1 BC==0)
                  "month":    int(1..)   // month of year
                  "day":      int(1..)   // day of month
                  "yearday":  int(1..)   // day of year
                  "week":     int(1..)   // week of year
                  "week_day": int(1..)   // day of week (depending on calendar)
                  "unix":     int        // unix time
                  "julian":   float      // julian day
                  "hour":     int(0..)   // hour of day, including dst
                  "minute":   int(0..59) // minute of hour
                  "second":   int(0..59) // second of minute
                  "fraction": float      // fraction of second
                  "timezone": int        // offset to utc, including dst
               ]);

      This is the same as calling Second ()->datetime ().

      function datetime_name(int|void unix_time) function datetime_short_name(int|void unix_time) Compat functions; same as format_iso and format_iso_short .

      function string format_iso(void|int unix_time) function string format_iso_short(void|int unix_time) function string format_iso_tod(void|int unix_time) function string format_day_iso(void|int unix_time) function string format_day_iso_short(void|int unix_time) Format the object into nice strings;

              iso    "2000-06-02 (Jun) -W22-5 (Fri) 11:57:18 CEST"
              iso_short   "2000-06-02 11:57:18"
              iso_tod     "11:57:18"

Module Calendar.Rule

  CLASS Calendar.Rule.Timezone

    Description

      Contains a time zone.

    Method create

      `void Calendar.Rule.Timezone(int offset, string name)`

    Parameter `offset`

      Offset to UTC, not counting DST.

    Parameter `name`

      The name of the time zone.

    Method tz_ux

      `array tz_ux(int unixtime)`

    FIXME

      This method takes one integer argument, ignores it and returns an array with the UTC offset and the timezone name.

    Method tz_jd

      `array tz_jd(int julian_day)`

    FIXME

      This method takes one integer argument, ignores it and returns an array with the UTC offset and the timezone name.

    Method raw_utc_offset

      `int raw_utc_offset()`

    Description

      Returns the offset to UTC, not counting DST.

Module Calendar.Time

  Description

    Base for time of day in calendars, ie calendars with hours, minutes, seconds

    This module can't be used by itself, but is inherited by other modules (ISO by YMD , for instance).

  CLASS Calendar.Time.TimeofDay

    Description
      inherits TimeRange

      Virtual class used by e.g. Hour.

    Method call_out

      `void call_out(function fun, mixed ...args)`

    Description

      Creates a call_out to this point in time.

    Method create

      `void Calendar.Time.TimeofDay()`
      `void Calendar.Time.TimeofDay(int unixtime)`

    Description

      In addition to the wide range of construction arguments for a normal TimeRange (see TimeRange.create ), a time of day can also be constructed with unixtime as single argument consisting of the unix time - as returned from `time(2)` - of the time unit start.

      It can also be constructed without argument, which then means "now", as in "this minute".

    Method format_iso_ymd
    Method format_ymd
    Method format_ymd_short
    Method format_ymd_xshort
    Method format_iso_week
    Method format_iso_week_short
    Method format_week
    Method format_week_short
    Method format_month
    Method format_month_short
    Method format_iso_time
    Method format_time
    Method format_time_short
    Method format_iso_short
    Method format_time_xshort
    Method format_mtime
    Method format_xtime
    Method format_tod
    Method format_xtod
    Method format_mod
    Method format_nice
    Method format_nicez

      `string format_iso_ymd()`
      `string format_ymd()`
      `string format_ymd_short()`
      `string format_ymd_xshort()`
      `string format_iso_week()`
      `string format_iso_week_short()`
      `string format_week()`
      `string format_week_short()`
      `string format_month()`
      `string format_month_short()`
      `string format_iso_time()`
      `string format_time()`
      `string format_time_short()`
      `string format_iso_short()`
      `string format_time_xshort()`
      `string format_mtime()`
      `string format_xtime()`
      `string format_tod()`
      `string format_xtod()`
      `string format_mod()`
      `string format_nice()`
      `string format_nicez()`

    Description

      Format the object into nice strings;

          iso_ymd        "2000-06-02 (Jun) -W22-5 (Fri)" [2]
          ext_ymd        "Friday, 2 June 2000" [2]
          ymd            "2000-06-02"
          ymd_short      "20000602"
          ymd_xshort     "000602" [1]
          iso_week       "2000-W22"
          iso_week_short "2000W22"
          week           "2000-w22" [2]
          week_short     "2000w22" [2]
          month          "2000-06"
          month_short    "200006" [1]
          iso_time       "2000-06-02 (Jun) -W22-5 (Fri) 20:53:14 UTC+1" [2]
          ext_time       "Friday, 2 June 2000, 20:53:14" [2]
          ctime          "Fri Jun  4 20:53:14 2000\n" [2] [3]
          http           "Fri, 02 Jun 2000 19:53:14 GMT" [4]
          time           "2000-06-02 20:53:14"
          time_short     "20000602 20:53:14"
          time_xshort    "000602 20:53:14"
          iso_short      "20000602T20:53:14"
          mtime          "2000-06-02 20:53"
          xtime          "2000-06-02 20:53:14.000000"
          todz           "20:53:14 CET"
          todz_iso       "20:53:14 UTC+1"
          tod            "20:53:14"
          tod_short      "205314"
          xtod           "20:53:14.000000"
          mod            "20:53"
          nice           "2 Jun 20:53", "2 Jun 2000 20:53:14" [2][5]
          nicez          "2 Jun 20:53 CET" [2][5]
          smtp           "Fri, 2 Jun 2000 20:53:14 +0100" [6]
          commonlog      "02/Jun/2000:20:53:14 +0100" [2]

      `[1]` note conflict (think 1 February 2003)
      `[2]` language dependent
      `[3]` as from the libc function ctime()
      `[4]` as specified by the HTTP standard; this is always in GMT, ie, UTC. The timezone calculations needed will be executed implicitly. It is not language dependent.
      `[5]` adaptive to type and with special cases for yesterday, tomorrow and other years
      `[6]` as seen in Date: headers in mails

    Method hour_no
    Method minute_no
    Method second_no
    Method fraction_no

      `int hour_no()`
      `int minute_no()`
      `int second_no()`
      `float fraction_no()`

    Description

      This gives back the number of the time unit, on this day. Fraction is a float number, 0<=fraction<1. function mapping datetime() This gives back a mapping with the relevant time information (representing the start of the period);

               ([ "year":     int        // year number (2000 AD=2000, 1 BC==0)
                  "month":    int(1..)   // month of year
                  "day":      int(1..)   // day of month
                  "yearday":  int(1..)   // day of year
                  "week":     int(1..)   // week of year
                  "week_day": int(1..)   // day of week (depending on calendar)

                  "hour":     int(0..)   // hour of day, including dst
                  "minute":   int(0..59) // minute of hour
                  "second":   int(0..59) // second of minute
                  "fraction": float      // fraction of second
                  "timezone": int        // offset to utc, including dst

                  "unix":     int        // unix time
                  "julian":   float      // julian day
               ]);

    Method hour
    Method hours
    Method number_of_hours

      `Hour hour()`
      `Hour hour(int n)`
      `array(Hour) hours()`
      `array(Hour) hours(int first, int last)`
      `int number_of_hours()`

    Description

      hour () gives back the timerange representing the first or nth Hour of the called object. Note that hours normally starts to count at zero, so `->hour(2)` gives the third hour within the range.

      An Hour is in the Calendar perspective as any other time range not only 60 minutes, but also one of the (normally) 24 hours of the day, precisely.

      hours () give back an array of all the hours containing the time periods called. With arguments, it will give back a range of those hours, in the same enumeration as the n to hour ().

      number_of_hours () simple counts the number of hours containing the called time period.

      Note: The called object doesn't have to *fill* all the hours it will send back, it's enough if it exist in those hours:

              > object h=Calendar.Time.Hour();
              Result: Hour(265567)
              > h->hours();
              Result: ({ /* 1 element */
                          Hour(265567)
                      })
              > h+=Calendar.Time.Minute();
              Result: Minute(265567:01+60m)
              > h->hours();
              Result: ({ /* 2 elements */
                          Hour(265567),
                          Hour(265568)
                      })

    Method julian_day

      `float julian_day()`

    Description

      This calculates the corresponding julian day, from the time range. Note that the calculated day is the beginning of the period, and is a float - julian day standard says .00 is midday, 12:00 pm.

    Note

      Normal pike (ie, 32 bit) floats (without --with-double-precision) has a limit of about 7 digits, and since we are about julian day 2500000, the precision on time of day is very limited.

    Method minute
    Method minutes
    Method number_of_minutes

      `Minute minute()`
      `Minute minute(int n)`
      `array(Minute) minutes()`
      `array(Minute) minutes(int first, int last)`
      `int number_of_minutes()`

    Description

      minute () gives back the timerange representing the first or nth Minute of the called object. Note that minutes normally starts to count at zero, so `->minute(2)` gives the third minute within the range.

      An Minute is in the Calendar perspective as any other time range not only 60 seconds, but also one of the (normally) 60 minutes of the Hour , precisely.

      minutes () give back an array of all the minutes containing the time periods called. With arguments, it will give back a range of those minutes, in the same enumeration as the n to minute ().

      number_of_minutes () simple counts the number of minutes containing the called time period.

    Method move_seconds
    Method move_ns

      `TimeRange move_seconds(int seconds)`
      `TimeRange move_ns(int nanoseconds)`

    Description

      These two methods gives back the time range called moved the specified amount of time, with the length intact.

      The motion is relative to the original position in time; 10 seconds ahead of 10:42:32 is 10:42:42, etc.

    Method second
    Method seconds
    Method number_of_seconds

      `Second second()`
      `Second second(int n)`
      `array(Second) seconds()`
      `array(Second) seconds(int first, int last)`
      `int number_of_seconds()`

    Description

      second () gives back the timerange representing the first or nth Second of the called object. Note that seconds normally starts to count at zero, so `->second(2)` gives the third second within the range.

      seconds () give back an array of all the seconds containing the time periods called. With arguments, it will give back a range of those seconds, in the same enumeration as the n to second ().

      number_of_seconds () simple counts the number of seconds containing the called time period.

    Method set_size_seconds
    Method set_size_ns

      `TimeRange set_size_seconds(int seconds)`
      `TimeRange set_size_ns(int nanoseconds)`

    Description

      These two methods allows the time range to be edited by size of specific units.

    Method unix_time

      `int unix_time()`

    Description

      This calculates the corresponding unix time, - as returned from `time(2)` - from the time range. Note that the calculated unix time is the beginning of the period.

  CLASS Calendar.Time.SuperTimeRange

    Method second
    Method seconds
    Method number_of_seconds
    Method minute
    Method minutes
    Method number_of_minutes
    Method hour
    Method hours
    Method number_of_hours

      `Second second()`
      `Second second(int n)`
      `array(Second) seconds()`
      `array(Second) seconds(int first, int last)`
      `int number_of_seconds()`
      `Minute minute()`
      `Minute minute(int n)`
      `array(Minute) minutes()`
      `array(Minute) minutes(int first, int last)`
      `int number_of_minutes()`
      `Hour hour()`
      `Hour hour(int n)`
      `array(Hour) hours()`
      `array(Hour) hours(int first, int last)`
      `int number_of_hours()`

    Description

      Similar to TimeofDay , the Time::SuperTimeRange has a number of methods for digging out time parts of the range. Since a SuperTimeRange is a bit more complex - the major reason for its existance it that it contains holes, this calculation is a bit more advanced too.

      If a range contains the seconds, say, 1..2 and 4..5, the third second (number 2, since we start from 0) in the range would be number 4, like this:

          no   means this second
          0    1
          1    2
          2    4      <- second three is missing,
          3    5         as we don't have it in the example range

      number_of_seconds () will in this example therefore also report 4, not 5, even if the time from start of the range to the end of the range is 5 seconds.

  CLASS Calendar.Time.Fraction

    Description
      inherits TimeofDay

      A Fraction is a part of a second, and/or a time period with higher resolution then a second.

      It contains everything that is possible to do with a Second , and also some methods of grabbing the time period with higher resolution.

    Note

      Internally, the fraction time period is measured in nanoseconds. A shorter or more precise time period then in nanoseconds is not possible within the current Fraction class.

    Method create

      `void Calendar.Time.Fraction()`
      `void Calendar.Time.Fraction("unix", int|float unixtime)`
      `void Calendar.Time.Fraction("unix", int|float unixtime, int|float len)`
      `void Calendar.Time.Fraction(int y, int m, int d, int h, int m, int s, int ns)`

    Description

      It is possible to create a Fraction in three ways, either "now" with no arguments or from a unix time (as from `time(2)`), or the convenience way from ymd-hms integers.

      If created from unix time, both the start of the period and the size of the period can be given in floats, both representing seconds. Note that the default float precision in pike is rather low (same as 'float' in C, the 32 bit floating point precision, normally about 7 digits), so beware that the resolution might bite you. (Internally in a Fraction, the representation is an integer.)

      If created without explicit length, the fraction will always be of zero length.

    Method now

      `TimeofDay now()`

    Description

      Give the zero-length time period of the current time.

    Method set_ruleset
    Method ruleset

      `Calendar set_ruleset(Ruleset r)`
      `Ruleset ruleset()`

    Description

      Set or read the ruleset for the calendar. set_ruleset returns a new calendar object, but with the new ruleset.

    Method set_timezone
    Method timezone

      `Calendar set_timezone(Timezone tz)`
      `Calendar set_timezone(string|Timezone tz)`
      `TimeZone timezone()`

    Description

      Set or get the current timezone (including dst) rule. set_timezone returns a new calendar object, as the called calendar but with another set of rules.

      Example:

          > Calendar.now();
          Result: Fraction(Fri 2 Jun 2000 18:03:22.010300 CET)
          > Calendar.set_timezone(Calendar.Timezone.UTC)->now();
          Result: Fraction(Fri 2 Jun 2000 16:03:02.323912 UTC)

Module Calendar.Austrian

  Description

    Same as the ISO calendar, but with austrian as the default language.

    This calendar exist only for backwards compatible purposes.

  Inherit ISO

    inherit Calendar.ISO : ISO

Module Calendar.Timezone

  Description

    This module contains all the predefined timezones. Index it with whatever timezone you want to use.

    Example: `Calendar.Calendar my_cal= Calendar.ISO->set_timezone(Calendar.Timezone["Europe/Stockholm"]);`

    A simpler way of selecting timezones might be to just give the string to set_timezone ; it indexes by itself:

    `Calendar.Calendar my_cal= Calendar.ISO->set_timezone("Europe/Stockholm");`

  Note

    Do not confuse this module with Ruleset.Timezone , which is the base class of a timezone object.

    `"CET"` and some other standard abbreviations work too, but not all of them (due to more then one country using them).

    Do not call set_timezone too often, but remember the result if possible. It might take some time to initialize a timezone object.

    There are about 504 timezones with 127 different daylight saving rules. Most of them historic.

    The timezone information comes from ftp://elsie.nci.nih.gov/pub/ and are not made up from scratch. Timezone bugs may be reported to the timezone mailing list, tz@elsie.nci.nih.gov, preferable with a `cc` to mirar+pike@mirar.org. /Mirar

  See also

    TZnames

  Constant locale

    `constant Calendar.Timezone.locale = Rule.Timezone`

  Description

    This contains the local timezone, found from various parts of the system, if possible.

  Constant localtime

    `constant Calendar.Timezone.localtime = Rule.Timezone`

  Description

    This is a special timezone, that uses localtime () and tzname to find out what current offset and timezone string to use.

    locale uses this if there is no other way of finding a better timezone to use.

    This timezone is limited by localtime and libc to the range of `time_t`, which is a MAXINT on most systems - 13 Dec 1901 20:45:52 to 19 Jan 2038 3:14:07, UTC.

Module Calendar.Event

  CLASS Calendar.Event.Event

    Description

      Event is an abstract class, defining what methods an Event need to have.

    Constant is_event

      `constant Calendar.Event.Event.is_event`

    Description

      This constant may be used to identify an event object.

    Method next
    Method previous

      `Calendar.TimeRanges.TimeRange next(void|Calendar.TimeRanges.TimeRange from, void|int(0..1) including)`
      `Calendar.TimeRanges.TimeRange previous(void|Calendar.TimeRanges.TimeRange from, void|int(0..1) including)`

    Description

      This calculates the next or previous occurance of the event, from the given timerange's start, including any event occuring at the start if that flag is set.

      It returns zero if there is no next event.

      These methods are virtual in the base class.

    Method scan

      `array(Calendar.TimeRanges.TimeRange) scan(Calendar.TimeRanges.TimeRange in)`

    Description

      This calculates the eventual events that is contained or overlapped by the given timerange. scan uses next , if not overloaded.

    Example

          Calendar.Event.Easter()->scan(Calendar.Year(2000))
               => ({ Day(Sun 23 Apr 2000) })

    Note

      scan can return an array of overlapping timeranges.

      This method must use `in->calendar_object->`type to create the returned timeranges, and must keep the ruleset.

    Method scan_events

      `mapping(Calendar.TimeRanges.TimeRange:Event) scan_events(Calendar.TimeRanges.TimeRange in)`

    Description

      Returns a mapping with time ranges mapped to events.

    Method `|
    Method ``|

      `SuperEvent `|(Event ... with)`
      `SuperEvent ``|(Event with)`

    Description

      Joins several events into one SuperEvent .

    Method describe

      `string describe()`

    Description

      Returns a description of the event.

  CLASS Calendar.Event.NullEvent

    Description

      A non-event.

    Inherit Event

      inherit Event : Event

    Constant is_nullevent

      `constant Calendar.Event.NullEvent.is_nullevent`

    Description

      This constant may be used to identify a NullEvent.

  CLASS Calendar.Event.Day_Event

    Description

      Day_Event is an abstract class, extending Event for events that are single days, using julian day numbers for the calculations.

    Inherit Event

      inherit Event : Event

    Constant is_day_event

      `constant Calendar.Event.Day_Event.is_day_event`

    Description

      This constant may be used to identify Day_Event objects.

    Constant NODAY

      `constant Calendar.Event.Day_Event.NODAY`

    Description

      Returned from scan_jd if the even searched for did not exist.

    Method scan_jd

      `int scan_jd(Calendar.Calendar realm, int jd, int(-1..-1)|int(1..1) direction)`

    Description

      These methods has to be defined, and is what really does some work. It should return the next or previos julian day (>jd) when the event occurs, or the constant NODAY if it doesn't.

    Parameter `direction`

      `1` | Forward (next),
      `-1` | Backward (previous).

    Method next

      `Calendar.TimeRanges.TimeRange next(void|Calendar.TimeRanges.TimeRange from, void|int(0..1) including)`

    Description

      Uses the virtual method scan_jd .

    See also

      Event.next

    Method previous

      `Calendar.TimeRanges.TimeRange previous(void|Calendar.TimeRanges.TimeRange from, void|int(0..1) including)`

    Description

      Uses the virtual method scan_jd .

    See also

      Event.previous

  CLASS Calendar.Event.Nameday

    Description

      This is created by the Namedays classes to represent an event for a name.

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Constant is_nameday

      `constant Calendar.Event.Nameday.is_nameday`

    Description

      This constant may be used to identify Nameday objects.

  CLASS Calendar.Event.Namedays

    Description

      This contains a ruleset about namedays.

    Inherit Event

      inherit Event : Event

    Constant is_namedays

      `constant Calendar.Event.Namedays.is_namedays`

    Description

      This constant may be used to identify Namedays .

    Method names

      `array(string) names(Calendar.TimeRanges.TimeRange t)`

    Description

      Gives back an array of names that occur during the time period, in no particular order.

    Method namedays

      `mapping(Calendar.TimeRanges.TimeRange:array(string)) namedays(Calendar.TimeRanges.TimeRange t)`

    Description

      Gives back an table of days with names that occur during the time period. Note that days without names will not appear in the returned mapping.

  CLASS Calendar.Event.SuperNamedays

    Description

      Container for merged Namedays objects.

    Inherit Event

      inherit Event : Event

  CLASS Calendar.Event.Gregorian_Fixed

    Description

      A set date of year, counting leap day in February, used for the Gregorian fixed events in the events list.

    See also

      Julian_Fixed

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Constant is_fixed

      `constant Calendar.Event.Gregorian_Fixed.is_fixed`

    Description

      This constant may be used to identify Gregorian_Fixed objects.

    Method create

      `void Calendar.Event.Gregorian_Fixed(string id, string name, int(1..31) month_day, int(1..12) month, int extra)`

  CLASS Calendar.Event.Julian_Fixed

    Description

      A set date of year, counting leap day in February, used for the Gregorian fixed events in the events list.

    See also

      Gregorian_Fixed

    Inherit Gregorian_Fixed

      inherit Gregorian_Fixed : Gregorian_Fixed

    Constant is_julian_fixed

      `constant Calendar.Event.Julian_Fixed.is_julian_fixed`

    Description

      This constant may be used to identify Julian_Fixed objects.

  CLASS Calendar.Event.Date

    Description

      This class represents the event of a given gregorian date. For instance, `Event.Date(12,10)->next(Day())` finds the next 12 of October.

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Method create

      `void Calendar.Event.Date(int(1..31) month_day, int(1..12) month)`

    Description

      The event is created by a given month day and a month number (1=January, 12=December).

  CLASS Calendar.Event.Date_Weekday

    Description

      This class represents the event that a given gregorian date appears a given weekday. For instance, `Event.Date_Weekday(12,10,5)->next(Day())` finds the next 12 of October that is a friday.

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Method create

      `void Calendar.Event.Date_Weekday(int month_day, int month, int weekday)`

    Description

      The event is created by a given month day, a month number (1=January, 12=December), and a weekday number (1=Monday, 7=Sunday).

    Note

      The week day numbers used are the same as the day of week in the ISO calendar - the Gregorian calendar has 1=Sunday, 7=Saturday.

  CLASS Calendar.Event.Monthday_Weekday

    Description

      This class represents the event that a given gregorian day of month appears a given weekday. For instance, `Event.Monthday_Weekday(13,5)->next(Day())` finds the next friday the 13th.

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Method create

      `void Calendar.Event.Monthday_Weekday(int month_day, int weekday)`

    Description

      The event is created by a given month day, and a weekday number (1=Monday, 7=Sunday).

    Note

      The week day numbers used are the same as the day of week in the ISO calendar - the Gregorian calendar has 1=Sunday, 7=Saturday.

  CLASS Calendar.Event.Weekday

    Description

      This class represents any given weekday. For instance, `Event.Weekday(5)->next(Day())` finds the next friday.

      These are also available as the pre-defined events Events.monday , Events.tuesday , Events.wednesday , Events.thursday , Events.friday , Events.saturday and Events.sunday .

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Method create

      `void Calendar.Event.Weekday(int weekday, void|string id)`

    Description

      The event is created by a given weekday number (1=Monday, 7=Sunday).

    Note

      The week day numbers used are the same as the day of week in the ISO calendar - the Gregorian calendar has 1=Sunday, 7=Saturday.

  CLASS Calendar.Event.Easter

    Description

      This class represents an easter.

    Inherit Day_Event

      inherit Day_Event : Day_Event

    Method create

      `void Calendar.Event.Easter(void|int shift)`

    Description

      shift is the year to shift from old to new style easter calculation. Default is 1582.

    Method easter_yd

      `int easter_yd(int y, int yjd, int leap)`

    Description

      Calculates the year day for the easter.

  CLASS Calendar.Event.Easter_Relative

    Description

      This class represents an easter relative event.

    Inherit Easter

      inherit Easter : Easter

    Method create

      `void Calendar.Event.Easter_Relative(string id, string name, int offset)`

  CLASS Calendar.Event.Orthodox_Easter_Relative

    Description

      This class represents an orthodox easter relative event.

    Inherit Easter_Relative

      inherit Easter_Relative : Easter_Relative

    Method create

      `void Calendar.Event.Orthodox_Easter_Relative(string id, string name, int offset)`

  CLASS Calendar.Event.Monthday_Weekday_Relative

    Description

      This class represents a monthday weekday relative event or n:th special weekday event, e.g. "fourth sunday before 24 dec" => md=24,mn=12,wd=7,n=-4

    Inherit Gregorian_Fixed

      inherit Gregorian_Fixed : Gregorian_Fixed

    Method create

      `void Calendar.Event.Monthday_Weekday_Relative(string id, string name, int(1..31) md, int(1..12) mn, int(1..7) _wd, int _n, void|int(0..1) _inclusive)`

  CLASS Calendar.Event.SuperEvent

    Description

      This class holds any number of events, and adds the functionality of event flags.

    Note

      Scanning (scan_events,next,etc) will drop flag information. Dig out what you need with holidays et al first.

    Inherit Event

      inherit Event : Event

    Method filter_flag
    Method holidays
    Method flagdays

      `SuperEvent filter_flag(string flag)`
      `SuperEvent holidays()`
      `SuperEvent flagdays()`

    Description

      Filter out the events that has a certain flag set. Holidays (flag "h") are the days that are marked red in the calendar (non-working days), Flagdays (flag "f") are the days that the flag should be visible in (only some countries).

  CLASS Calendar.Event.TZShift_Event

    Description

      Event containing information about when a timezone is changed.

    Inherit Event

      inherit Event : Event

    Method scan_shift

      `Calendar.TimeRanges.TimeRange scan_shift(Calendar.Rule.Timezone tz, Calendar.TimeRanges.TimeRange from, int direction, int including)`

    Method scan_history

      `Calendar.TimeRanges.TimeRange scan_history(Calendar.Rule.Timezone tz, Calendar.TimeRanges.TimeRange from, int direction, int(0..1) including)`

    Method scan_rule

      `Calendar.TimeRanges.TimeRange scan_rule(Calendar.Rule.Timezone tz, Calendar.TimeRanges.TimeRange from, int direction, int including)`

Module Calendar.Gregorian

  Description

    This is the standard conservative christian calendar, used regularly in some countries - USA, for instance - and which derivate - the ISO calendar - is used in most of Europe.

  Inherit YMD

    inherit Calendar.YMD : YMD

Module Calendar.Swedish

  Description

    Same as the ISO calendar, but with Swedish as the default language.

    This calendar exist only for backwards compatible purposes.

  Inherit ISO

    inherit Calendar.ISO : ISO

Module Calendar.Islamic

  Description

    This is the islamic calendar. Due to some sources, they decide the first day of the new months on a month-to-month basis (sightings of the new moon), so it's probably not that accurate. If someone can confirm (or deny) accuracy better than that, please contact me so I can change this statement.

    It's vaugely based on rules presented in algorithms by Dershowitz, Reingold and Clamen, 'Calendrical Calculations'. It is the same that's used in Emacs calendar mode.

  Bugs

    I have currently no idea how the arabic countries count the week. Follow the same rules as ISO for now... The time is also suspicious; the day really starts at sunset and not midnight, the hours of the day is not correct. Also don't know what to call years before 1 - go for "BH"; positive years are "AH", anno Hegirac.

  Inherit YMD

    inherit Calendar.YMD : YMD

Module Audio

  Module Audio.Format

    Description

      Audio data format handling

    Note

      API remains marked "unstable".

    CLASS Audio.Format.ANY

      Method read_file

        `this_program read_file(string filename, int|void nocheck)`

      Description

        Reads data from file

      See also

        read_streamed

      Method read_streamed

        `this_program read_streamed(string filename, int|void nocheck)`

      Description

        Reads data from stream

        Ie. for packetized data source the beggining of data is searched.

      See also

        read_file

      Method read_string

        `this_program read_string(string data, int|void nocheck)`

      Description

        Reads data from string

      Method get_frame

        `string get_frame()`

      Description

        Returns frame for current position and moves cursor forward.

      Note

        The operation is destructive. Ie. current data cursor is moved over.

      See also

        get_data , get_sample

      Method get_sample

        `mapping get_sample()`

      Description

        Returns sample for current position and moves cursor forward.

      Note

        The operation is destructive. Ie. current data cursor is moved over.

      See also

        get_frame , get_data

      Method get_data

        `string get_data()`

      Description

        Returns data only.

      Note

        The operation is destructive. Ie. current data cursor is moved over.

      See also

        get_frame , get_sample

      Method check_format

        `int check_format()`

      Description

        Check if data are correctly formated.

      Method get_map

        `mapping get_map()`

    CLASS Audio.Format.MP3

      Description

        A MP3 file parser with ID3 tag support.

      Inherit ANY

        inherit .module.ANY : ANY

      Method get_frame

        `mapping|int get_frame()`

      Description

        Gets next frame from file

        Frame is represented by the following mapping. It contains from parsed frame headers and frame data itself.

        ([ "bitrate": int "copyright": int(0..1), "data": frame_data, "emphasis": emphasis, "extension": "channels":0, "id":1, "layer":3, "original": int(0..1), "padding": int(0..1), "private": int(0..1), "sampling": int ])

  Module Audio.Codec

    CLASS Audio.Codec.decoder

      Description

        Decoder object.

      Note

        It needs _Ffmpeg.ffmpeg module for real work.

      Method create

        `void Audio.Codec.decoder(string|void codecname, object|void _codec)`

      Description

        Creates decoder object

      Parameter `codecnum`

        Some of supported codec, like _Ffmpeg.CODEC_ID_*

      Parameter `_codec`

        The low level object will be used for decoder. By default _Ffmpeg.ffmpeg object will be used.

      Note

        Until additional library is implemented the second parameter _codec hasn't effect.

      See also

        _Ffmpeg.ffmpeg , _Ffmpeg.CODEC_ID_MP2

      Method from_file

        `this_program from_file(Audio.Format.ANY file)`

      Description

        Set codec type from file

        It uses Audio.Format.ANY 's method get_map() to determine which codec should be used.

      Parameter `file`

        The object Audio.Format.ANY .

      Method decode

        `mapping|int decode(int|void partial)`

      Description

        Decodes audio data

      Parameter `partial`

        Only one frame will be decoded per call.

      Returns

        If successfull a mapping with decoded data and byte number of used input data is returned, `0` otherwise.

      Method get_status

        `mapping get_status()`

      Description

        Returns decoder status

Module Tools

  CLASS Tools.PV

    Description

      Display a image on the screen. Requires GTK.

    Inherit Window

      inherit GTK.Window : Window

    Typedef PVImage

      `typedef Standards.URI|string|Image.Image|Image.Layer|array(Image.Layer) Tools.PV.PVImage`

    Description

      The image types accepted. If the image is a string, it is assumed to be a filename of a image that can be loaded with Image.load. This includes URLs.

    Method set_alpha_mode

      `void set_alpha_mode(AlphaMode m)`

    Description

      Set the alpha combining mode. m is one of Squares , Solid , None and AlphaOnly .

    Method set_alpha_colors

      `void set_alpha_colors(Image.Color.Color c1, Image.Color.Color|void c2)`

    Description

      Set the colors used for the alpha combination. c2 is only used for the Squares alpha mode.

    See also

      set_alpha_mode()

    Method get_as_image

      `Image.Image get_as_image(PVImage i)`

    Description

      Return the current image as a Image object, with the alpha combining done.

    Method set_image

      `void set_image(PVImage i)`

    Description

      Change the image.

    Method scale

      `void scale(float factor)`

    Description

      Scale the image before display with the specified factor.

    Method save

      `void save(string filename, string|void format)`

    Description

      Write the image to a file. If no format is specified, PNG is used. The alpha combination is done on the image before it's saved.

    ENUM Tools.PV.AlphaMode

      Description

        The alpha combination modes.

        Use set_alpha_mode() to change the mode.

      Constant Squares

        `constant Tools.PV.Squares`

      Description

        Checkerboard pattern (default).

      Constant Solid

        `constant Tools.PV.Solid`

      Description

        Solid color.

      Constant None

        `constant Tools.PV.None`

      Description

        Ignore alpha.

      Constant AlphaOnly

        `constant Tools.PV.AlphaOnly`

      Description

        Only show the alpha channel (if any).

  Module Tools.Shoot

    Method _shoot

      `void _shoot(string id)`

    Description

      This function is called in the spawned pike, to perform the test but also to write some important data to stdout. id is the current test.

    CLASS Tools.Shoot.ExecTest

      Description

        The test call/result class. Instantiated with a test id and the test object itself.

      syntax

        `string Tools.Shoot.ExecTest.id`
        `Test Tools.Shoot.ExecTest.test` `void Tools.Shoot.ExecTest(string id, Test test)`

      Method run

        `int(0..1) run(int maximum_seconds, int maximum_runs, void|int silent)`

      Description

        This function runs the actual test, by spawning off a new pike and call it until at least one of these conditions: maximum_seconds has passed, or the number of runs is at least maximum_runs.

    CLASS Tools.Shoot.Test

      Constant name

        `constant Tools.Shoot.Test.name`

      Description

        The name of the test.

      Method perform

        `void perform()`

      Description

        perform() is the function called in the tests, when it returns the test is complete.

  Module Tools.Legal

    Module Tools.Legal.License

      Method get_text

        `string get_text()`

      Description

        Returns all the licenses as a string, suitable for saving as a file.

    Module Tools.Legal.Copyright

      Description

        Contains functions and information to store and present copyright information about Pike and it's components.

      Method add

        `void add(string what, array(string) holders)`

      Description

        Adds a copyright message for the copyright holders for the component what .

      Throws

        An error is thrown if the copyrighted component what is already in the list of copyrights.

      Method get_latest_pike

        `string get_latest_pike()`

      Description

        Return the latest copyright holder of Pike.

      Method get_all

        `mapping(string:array(string)) get_all()`

      Description

        Returns a mapping containing all the stored copyrights. The mapping maps component name to an array of copyright holders.

      Method get_text

        `string get_text()`

      Description

        Returns the copyrights as a string, suitable for saving as a file.

  Module Tools.AutoDoc

    CLASS Tools.AutoDoc.SourcePosition

      Description

        Class used to keep track of where in the source a piece of documentation originated.

      Variable filename

        `string Tools.AutoDoc.SourcePosition.filename`

        `int Tools.AutoDoc.SourcePosition.firstline`
        `int Tools.AutoDoc.SourcePosition.lastline`

      Description

        Range of lines.

      Method create

        `void Tools.AutoDoc.SourcePosition(string filename, int firstline, int|void lastline)`

      Method copy

        `SourcePosition copy()`

      Returns

        Returns a copy of the current object.

      Method xml

        `string xml()`

      Returns

        Returns a string with an XML-fragment describing the source position.

    CLASS Tools.AutoDoc.AutoDocError

      Description

        Base class for errors generated by the autodoc extraction system.

      Variable position

        `SourcePosition Tools.AutoDoc.AutoDocError.position`

      Variable part

        `string Tools.AutoDoc.AutoDocError.part`

      Description

        Which part of the autodoc system.

      Variable message

        `string Tools.AutoDoc.AutoDocError.message`

      Description

        Error message.

      Method create

        `void Tools.AutoDoc.AutoDocError(SourcePosition position, string part, string message)`

    CLASS Tools.AutoDoc.PikeParser

      Description

        A very special purpose Pike parser that can parse some selected elements of the Pike language...

      Inherit PikeObjects

        inherit .PikeObjects : PikeObjects

      Constant EOF

        `constant Tools.AutoDoc.PikeParser.EOF`

      Description

        The end of file marker.

      Method skip

        `void skip(multiset(string)|string tokens)`

      Description

        Skip the next token if it is a member of the tokens set.

      Note

        The newline token (`"\n"`) is not skipped implicitly by this function.

      See also

        readToken() , peekToken() , eat() , skipUntil()

      Method skipBlock

        `void skipBlock()`

      Description

        Skip passed a matched pair of parenthesis, brackets or braces.

      Method skipUntil

        `void skipUntil(multiset(string)|string tokens)`

      Description

        Skip tokens until one of tokens is the next to read.

      Note

        The newline token (`"\n"`) is not skipped implicitly by this function.

      See also

        skip()

      Method skipNewlines

        `void skipNewlines()`

      Description

        Skip past any newlines.

      Variable currentPosition

        `SourcePosition Tools.AutoDoc.PikeParser.currentPosition`

      Description

        The current position in the source.

      Constant WITH_NL

        `constant Tools.AutoDoc.PikeParser.WITH_NL`

      Description

        Newline indicator flag value.

      Method lookAhead

        `string lookAhead(int offset, int|void with_newlines)`

      Description

        Peek offset tokens ahead, skipping newlines, unless with_newlines is set.

      See also

        peekToken()

      Method peekToken

        `string peekToken(int|void with_newlines)`

      Description

        Peek at the next token in the stream without advancing.

      Parameter `with_newlines`

        If set will return `"\n"` tokens, these will otherwise silently be skipped.

      Returns

        Returns the next token.

      See also

        readToken() , lookAhead()

      Method getReadDocComments

        `int getReadDocComments()`

      Returns

        Returns the number of documentation comments that have been returned by readToken() .

      Method readToken

        `string readToken(int|void with_newlines)`

      Description

        Read the next token from the stream and advance.

      Parameter `with_newlines`

        If set will return `"\n"` tokens, these will otherwise silently be skipped.

      Returns

        Returns the next token.

      See also

        peekToken()

      Method eat

        `string eat(multiset(string)|string token)`

      Description

        Consume one token, error if not (one of) the expected in token .

      Method eatIdentifier

        `string eatIdentifier(void|int allowScopePrefix)`

      Description

        Expect an identifier.

      Note

        Also `::ident`, `scope::ident`.

      Note

        This function also converts old-style getters and setters into new-style.

      Method parseOrType

        `Type parseOrType()`

      Description

        Parse a union type.

      Method parseMapping

        `MappingType parseMapping()`

      Description

        Parse a mapping type.

      Method parseArray

        `ArrayType parseArray()`

      Description

        Parse an array type.

      Method parseMultiset

        `MultisetType parseMultiset()`

      Description

        Parse a multiset type.

      Method parseFunction

        `FunctionType parseFunction()`

      Description

        Parse a function type.

      Method parseInt

        `IntType parseInt()`

      Description

        Parse an integer type.

      Method parseString

        `StringType parseString()`

      Description

        Parse a string type.

      Method parseIdents

        `string|void parseIdents()`

      Description

        Parse a '.'-separated identitifer string.

      Note

        Also parses stuff preceded by `"scope::"` or `"::"`

      Method parseArgList

        `array parseArgList(int|void allowLiterals)`

      Description

        Parse the list of arguments in a function declaration.

      Parameter `allowLiterals`

        If allowLiterals != 0 then you can write a literal or Pike idents as an argument, like:

        void convert("jpeg", Image image, float quality)

      For a literal arg, the argname[] string contains the literal and the corresponding argtypes element is 0

    Note

      Expects that the arglist is followed by a ")".

    Method parseModifiers

      `array(string) parseModifiers()`

    Description

      Parse a set of modifiers from the token stream.

    Method parseLiteral

      `void|string parseLiteral()`

    Description

      Parse the next literal constant (if any) from the token stream.

    Method eatLiteral

      `string eatLiteral()`

    Description

      Expect a literal constant.

    See also

      parseLiteral()

    Method parseDecl

      `PikeObject|array(PikeObject) parseDecl(mapping|void args)`

    Description

      Parse the next Pike declaration from the token stream.

    Note

      parseDecl() reads ONLY THE HEAD, NOT the `";"` or `"{" .. "}"` !!!

    Method tokenize

      `array(array(string)|array(int)) tokenize(string s, int line)`

    Description

      Tokenize a string of Pike code.

    Method setTokens

      `void setTokens(array(string) t, array(int) p)`

    Method create

      `void Tools.AutoDoc.PikeParser(string|void s, string|SourcePosition|void _filename, int|void line)`

  Module Tools.AutoDoc.ProcessXML

    Inherit Tree

      inherit Parser.XML.Tree : Tree

    Inherit "module.pmod"

      inherit "module.pmod"

    Method extractXML

      `string extractXML(string filename, int|void pikeMode, string|void type, string|void name, array(string)|void parentModules)`

    Description

      This function extracts documentation from a file. The parameters type , name , and parentModules are used only when pikeMode != 0 and no C-style doc comments are present.

    Parameter `filename`

      The file to extract from.

    Parameter `pikeMode`

      Non-zero if it is a Pike file. If the file contains style doc comments, C-mode is used despite pikeMode != 0.

    Parameter `type`

      `"class"`, `"module"` or `"namespace"`.

    Parameter `name`

      The name of the class/module/namespace.

    Parameter `parentModules`

      The ancestors of the class/module/namespace.

    Example

          // To extract doc for Foo.Bar.Ippa:
             string xml = extractXML("lib/modules/Foo.pmod/Bar.pmod/Ippa.pike", 1,
               "class", "Ippa", ({ "Foo", "Bar" }));

    Method moveImages

      `string moveImages(string docXMLFile, string imageSourceDir, string imageDestDir, int|void quiet)`

    Description

      Copy all images to canonical files in a flat directory.

    Parameter `docXMLFile`

      The contents of the XML file. The XML file is the result of extraction from a single C or Pike file, for example the result of calling extractXML .

    Parameter `imageSourceDir`

      The directory that is the base of the relative paths to images. This should be the directory of the source file that was the input to extract the XML file.

    Parameter `imageDestDir`

      The directory where the images should be copied.

    Parameter `quiet`

      Quiet operation.

    Returns

      The XML file contents (with decorated <image>-tags)

    Method mergeTrees

      `void mergeTrees(SimpleNode dest, SimpleNode source)`

    Description

      Puts all children of source into the tree dest , in their right place module-hierarchically. Used to merge the results of extractions of different Pike and C files.

    Parameter `source`
    Parameter `dest`

      The nodes source and dest are `<class>`, `<module>`, `<namespace>` or `<autodoc>` nodes that are identical in the sense that they represent the same module, class or namespace. Typically they both represent `<autodoc>` nodes.

    Note

      After calling this method, any `<class>` or `<module>` nodes that have been marked with @appears or @belongs, are still in the wrong place in the tree, so handleAppears() (or postProcess() ) must be called on the whole documentation tree to relocate them once the tree has been fully merged.

    Method handleAppears

      `void handleAppears(SimpleNode root)`

    Description

      Take care of all the @appears and @belongs directives everywhere, and rearranges the nodes in the tree accordingly

    Parameter `root`

      The root (`<autodoc>`) node of the documentation tree.

    Method postProcess

      `void postProcess(SimpleNode root)`

    Description

      Perform the last steps on a completed documentation tree.

    Parameter `root`

      Root `<autodoc>` node of the completed documentation tree.

      Calls handleAppears() , cleanUndocumented() and resolveRefs() in turn.

    See also

      handleAppears() , cleanUndocumented() , resolveRefs()

  Module Tools.AutoDoc.PikeExtractor

    Inherit DocParser

      inherit .DocParser : DocParser

    Method extractNamespace

      `NameSpace extractNamespace(string s, void|string filename, void|string namespaceName)`

    Description

      Extract documentation for a Pike namespace.

    See also

      extractModule() , extractClass()

    Method extractModule

      `Module extractModule(string s, void|string filename, void|string moduleName)`

    Description

      Extract documentation for a Pike module.

    See also

      extractNamespace() , extractClass()

    Method extractClass

      `Class extractClass(string s, void|string filename, void|string className)`

    Description

      Extract documentation for a Pike class (aka program).

    See also

      extractNamespace() , extractModule()

  Module Tools.AutoDoc.PikeObjects

    Description

      This module contains classes to represent Pike objects such as classes, modules, methods, variables ... The classes can produce XML representations of themselves.

    Inherit "module.pmod"

      inherit "module.pmod"

    Inherit Tree

      inherit Parser.XML.Tree : Tree

    Variable EmptyDoc

      `protected Documentation Tools.AutoDoc.PikeObjects.EmptyDoc`

    Description

      The empty Documentation .

    CLASS Tools.AutoDoc.PikeObjects.Type

      Description

        The base class for representing types.

      syntax

        `string Tools.AutoDoc.PikeObjects.Type.name` `void Tools.AutoDoc.PikeObjects.Type(string name)`

      Method print

        `string print()`

      Returns

        Returns a string with a Pike-syntax representation of the type.

      Method xml

        `string xml()`

      Returns

        Returns a string with an XML representation of the type.

    CLASS Tools.AutoDoc.PikeObjects.ArrayType

      Description

        The class for representing array types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable valuetype

        `Type Tools.AutoDoc.PikeObjects.ArrayType.valuetype`

      Description

        The Type of the array elements.

      Method create

        `void Tools.AutoDoc.PikeObjects.ArrayType()`

    CLASS Tools.AutoDoc.PikeObjects.ProgramType

      Description

        The class for representing program (aka class) types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable classname

        `string Tools.AutoDoc.PikeObjects.ProgramType.classname`

      Description

        The name of the class (if any).

      Method create

        `void Tools.AutoDoc.PikeObjects.ProgramType()`

    CLASS Tools.AutoDoc.PikeObjects.FloatType

      Description

        The class for representing the float type.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Method create

        `void Tools.AutoDoc.PikeObjects.FloatType()`

    CLASS Tools.AutoDoc.PikeObjects.IntType

      Description

        The class for representing integer types.

      See also

        Type

      Inherit Type

        inherit Type : Type

        `string Tools.AutoDoc.PikeObjects.IntType.min`
        `string Tools.AutoDoc.PikeObjects.IntType.max`

      Description

        The minimum and maximum range limits for the integer type.

      Method create

        `void Tools.AutoDoc.PikeObjects.IntType()`

    CLASS Tools.AutoDoc.PikeObjects.StringType

      Description

        The class for representing string types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable min

        `string Tools.AutoDoc.PikeObjects.StringType.min`

      Description

        The minimum value for characters in the string.

      Variable max

        `string Tools.AutoDoc.PikeObjects.StringType.max`

      Description

        The maximum value for characters in the string.

      Method create

        `void Tools.AutoDoc.PikeObjects.StringType()`

    CLASS Tools.AutoDoc.PikeObjects.MixedType

      Description

        The class for representing the mixed type.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Method create

        `void Tools.AutoDoc.PikeObjects.MixedType()`

    CLASS Tools.AutoDoc.PikeObjects.FunctionType

      Description

        The class for representing function types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable argtypes

        `array(Type) Tools.AutoDoc.PikeObjects.FunctionType.argtypes`

      Description

        An array with types for the arguments to the function.

      Variable returntype

        `Type Tools.AutoDoc.PikeObjects.FunctionType.returntype`

      Description

        The type for the return value of the function.

      Method create

        `void Tools.AutoDoc.PikeObjects.FunctionType()`

    CLASS Tools.AutoDoc.PikeObjects.MappingType

      Description

        The class for representing mapping types.

      See also

        Type

      Inherit Type

        inherit Type : Type

        `Type Tools.AutoDoc.PikeObjects.MappingType.indextype`
        `Type Tools.AutoDoc.PikeObjects.MappingType.valuetype`

      Description

        The types for the indices and values of the mapping.

      Method create

        `void Tools.AutoDoc.PikeObjects.MappingType()`

    CLASS Tools.AutoDoc.PikeObjects.MultisetType

      Description

        The class for representing multiset types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable indextype

        `Type Tools.AutoDoc.PikeObjects.MultisetType.indextype`

      Description

        The type for the indices of the multiset.

      Method create

        `void Tools.AutoDoc.PikeObjects.MultisetType()`

    CLASS Tools.AutoDoc.PikeObjects.ObjectType

      Description

        The class for representing object types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable classname

        `string Tools.AutoDoc.PikeObjects.ObjectType.classname`

      Description

        The name of the class for the object.

      Method create

        `void Tools.AutoDoc.PikeObjects.ObjectType()`

    CLASS Tools.AutoDoc.PikeObjects.TypeType

      Description

        The class for representing type types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable subtype

        `Type Tools.AutoDoc.PikeObjects.TypeType.subtype`

      Description

        The subtype of the type.

      Method create

        `void Tools.AutoDoc.PikeObjects.TypeType()`

    CLASS Tools.AutoDoc.PikeObjects.VoidType

      Description

        The class for representing the void type.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Method create

        `void Tools.AutoDoc.PikeObjects.VoidType()`

    CLASS Tools.AutoDoc.PikeObjects.ZeroType

      Description

        The class for representing the zero type.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Method create

        `void Tools.AutoDoc.PikeObjects.ZeroType()`

    CLASS Tools.AutoDoc.PikeObjects.OrType

      Description

        The class for representing union types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable types

        `array(Type) Tools.AutoDoc.PikeObjects.OrType.types`

      Description

        An array with the types that are member of the union.

      Method create

        `void Tools.AutoDoc.PikeObjects.OrType()`

    CLASS Tools.AutoDoc.PikeObjects.VarargsType

      Description

        The class for representing varargs types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable type

        `Type Tools.AutoDoc.PikeObjects.VarargsType.type`

      Description

        The type that is varargs.

      Method create

        `void Tools.AutoDoc.PikeObjects.VarargsType(Type t)`

    CLASS Tools.AutoDoc.PikeObjects.AttributeType

      Description

        The class for representing attributed types.

      See also

        Type

      Inherit Type

        inherit Type : Type

      Variable attribute

        `string Tools.AutoDoc.PikeObjects.AttributeType.attribute`

      Description

        The name of the attribute.

      Variable subtype

        `Type Tools.AutoDoc.PikeObjects.AttributeType.subtype`

      Description

        The type that is attributed.

      Variable prefix

        `int Tools.AutoDoc.PikeObjects.AttributeType.prefix`

      Description

        Flag indicating:

        `0` | The attribute is on the type.
        `1` | The attribute is a prefix and acts as a modifier. This is only used for functions.

      Method create

        `void Tools.AutoDoc.PikeObjects.AttributeType()`

    CLASS Tools.AutoDoc.PikeObjects.Documentation

      Description

        The base class for documentation strings.

      See also

        DocGroup

      syntax

        `string|void Tools.AutoDoc.PikeObjects.Documentation.text`
        `string|void Tools.AutoDoc.PikeObjects.Documentation.xml`
        `SourcePosition|void Tools.AutoDoc.PikeObjects.Documentation.position` `void Tools.AutoDoc.PikeObjects.Documentation(string|void text, string|void xml, SourcePosition|void position)`

    CLASS Tools.AutoDoc.PikeObjects.DocGroup

      Description

        A class associating a piece of Documentation with a set of PikeObject s.

      Variable objects

        `array(PikeObject) Tools.AutoDoc.PikeObjects.DocGroup.objects`

      Description

        The set of PikeObject s that are documented.

      Variable documentation

        `Documentation Tools.AutoDoc.PikeObjects.DocGroup.documentation`

      Description

        The Documentation for the objects .

      Method create

        `void Tools.AutoDoc.PikeObjects.DocGroup(array(PikeObject) objs, Documentation doc)`

        `string Tools.AutoDoc.PikeObjects.DocGroup.appears`
        `string Tools.AutoDoc.PikeObjects.DocGroup.belongs`

      Description

        Relocation information.

      Method xml

        `string xml()`

      Returns

        Returns a string with an XML representation of the documentation.

    CLASS Tools.AutoDoc.PikeObjects.PikeObject

      Description

        Base class for representing a documentable Pike lexical entity.

        This class is inherited by classes for representing classes, functions, variables, etc.

      See also

        Inherit , Import , Class , Module , NameSpace , AutoDoc , Modifier , Method , Constant , Typedef , EnumConstant , Enum , Variable

      Variable modifiers

        `array(string) Tools.AutoDoc.PikeObjects.PikeObject.modifiers`

      Description

        The set of modifiers affecting this entity.

      Variable name

        `string Tools.AutoDoc.PikeObjects.PikeObject.name`

      Description

        The name of the entity.

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.PikeObject.objtype`

      Description

        The object type identifier.

      Variable position

        `SourcePosition Tools.AutoDoc.PikeObjects.PikeObject.position`

      Description

        The source position where the entity was found.

        `string Tools.AutoDoc.PikeObjects.PikeObject.appears`
        `string Tools.AutoDoc.PikeObjects.PikeObject.belongs`

      Description

        Relocation information.

      Variable squeezedInDoc

        `Documentation Tools.AutoDoc.PikeObjects.PikeObject.squeezedInDoc`

      Method xml

        `string xml()`

      Returns

        Returns a string with an XML representation of the entity.

      Method print

        `string print()`

      Returns

        Returns a string with a Pike syntax representation of the entity.

    CLASS Tools.AutoDoc.PikeObjects.Inherit

      Description

        Representation of an inherit.

      Inherit PikeObject

        inherit PikeObject : PikeObject

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.Inherit.objtype`

      Variable classname

        `string Tools.AutoDoc.PikeObjects.Inherit.classname`

      Description

        Name of the class that is inherited.

    CLASS Tools.AutoDoc.PikeObjects.Import

      Description

        Representation of an import.

      Inherit Inherit

        inherit Inherit : Inherit

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.Import.objtype`

    CLASS Tools.AutoDoc.PikeObjects._Class_or_Module

      Description

        Base class for representing classes, modules and namespaces.

      See also

        Class , Module , NameSpace , AutoDoc , Modifier

      Inherit PikeObject

        inherit PikeObject : PikeObject

      Variable documentation

        `Documentation Tools.AutoDoc.PikeObjects._Class_or_Module.documentation`

      Note

        The documentation appears as a child of the <class> or <module>

      Variable inherits

        `array(Inherit|Import) Tools.AutoDoc.PikeObjects._Class_or_Module.inherits`

      Description

        Inherit s and Import s that affect the symbol lookup for the entity.

      Variable children

        `array(_Class_or_Module) Tools.AutoDoc.PikeObjects._Class_or_Module.children`

      Description

        Entities that are children to this entity.

      Variable docGroups

        `array(DocGroup) Tools.AutoDoc.PikeObjects._Class_or_Module.docGroups`

      Description

        Documented entities that are children to this entity.

      Method containsDoc

        `int containsDoc()`

      Returns

        Returns `1` if there is any documentation at all for this entity.

      Method AddInherit

        `void AddInherit(PikeObject p)`

      Description

        Adds p to the set of inherits .

      Method AddChild

        `void AddChild(_Class_or_Module c)`

      Description

        Adds c to the set of children .

      Method findChild

        `PikeObject findChild(string name)`

      Returns

        Returns the first child with the name name if any.

      Method findObject

        `DocGroup findObject(string name)`

      Returns

        Returns the first DocGroup that documents an entity with the name name if any.

      Method AddGroup

        `void AddGroup(DocGroup d)`

      Description

        Adds d to the set of docGroups .

    CLASS Tools.AutoDoc.PikeObjects.Class

      Description

        Represents a class.

      Inherit _Class_or_Module

        inherit _Class_or_Module : _Class_or_Module

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.Class.objtype`

    CLASS Tools.AutoDoc.PikeObjects.Module

      Description

        Represents a module.

      Inherit _Class_or_Module

        inherit _Class_or_Module : _Class_or_Module

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.Module.objtype`

    CLASS Tools.AutoDoc.PikeObjects.NameSpace

      Description

        Represents a name space, eg: `predef::` or `lfun::`.

      Inherit _Class_or_Module

        inherit _Class_or_Module : _Class_or_Module

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.NameSpace.objtype`

    CLASS Tools.AutoDoc.PikeObjects.AutoDoc

      Description

        The top-level container. This container should only contain namespaces, and they in turn contain modules etc.

      Inherit _Class_or_Module

        inherit _Class_or_Module : _Class_or_Module

      Constant objtype

        `constant Tools.AutoDoc.PikeObjects.AutoDoc.objtype`

    CLASS Tools.AutoDoc.PikeObjects.Modifier

      Description

        A modifier range, e.g.:

        static private { ... <<declarations>> ... }

    Inherit _Class_or_Module

      inherit _Class_or_Module : _Class_or_Module

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.Modifier.objtype`

  CLASS Tools.AutoDoc.PikeObjects.Method

    Description

      Represents a function.

    Inherit PikeObject

      inherit PikeObject : PikeObject

    Variable argnames

      `array(string) Tools.AutoDoc.PikeObjects.Method.argnames`

    Description

      The names of the arguments.

    Variable argtypes

      `array(Type) Tools.AutoDoc.PikeObjects.Method.argtypes`

    Description

      The types for the arguments.

    Variable returntype

      `Type Tools.AutoDoc.PikeObjects.Method.returntype`

    Description

      The return type for the function.

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.Method.objtype`

  CLASS Tools.AutoDoc.PikeObjects.Constant

    Description

      Represents a named constant.

    Inherit PikeObject

      inherit PikeObject : PikeObject

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.Constant.objtype`

    Variable typedefType

      `Type Tools.AutoDoc.PikeObjects.Constant.typedefType`

    Description

      Typedef Type if it is a typedef.

  CLASS Tools.AutoDoc.PikeObjects.Typedef

    Description

      Represents a typedef.

    Inherit PikeObject

      inherit PikeObject : PikeObject

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.Typedef.objtype`

    Variable type

      `Type Tools.AutoDoc.PikeObjects.Typedef.type`

    Description

      Typedef Type .

  CLASS Tools.AutoDoc.PikeObjects.EnumConstant

    Description

      The values inside `enum Foo { ... }`

    Inherit PikeObject

      inherit PikeObject : PikeObject

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.EnumConstant.objtype`

  CLASS Tools.AutoDoc.PikeObjects.Enum

    Description

      The enum container.

    Inherit PikeObject

      inherit PikeObject : PikeObject

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.Enum.objtype`

    Variable documentation

      `Documentation Tools.AutoDoc.PikeObjects.Enum.documentation`

    Description

      Mimic the `class { ... }` behaviour.

    Variable children

      `array(DocGroup) Tools.AutoDoc.PikeObjects.Enum.children`

    Description

      The set of children.

    Method addChild

      `void addChild(DocGroup c)`

    Description

      Adds c to the set of children .

  CLASS Tools.AutoDoc.PikeObjects.Variable

    Description

      Represents a variable.

    Inherit PikeObject

      inherit PikeObject : PikeObject

    Constant objtype

      `constant Tools.AutoDoc.PikeObjects.Variable.objtype`

    Variable type

      `Type Tools.AutoDoc.PikeObjects.Variable.type`

    Description

      Type of the variable.

Module Tools.AutoDoc.DocParser

  Inherit PikeObjects

    inherit .PikeObjects : PikeObjects

  Constant EOF

    `constant Tools.AutoDoc.DocParser.EOF`

  Description

    End of file marker.

  Variable keywordtype

    `mapping(string:DocTokenType) Tools.AutoDoc.DocParser.keywordtype`

  Description

    The DocTokenType s for the documentation @-keywords.

  Method splitDocBlock

    `array(array(Token)) splitDocBlock(string block, SourcePosition position)`

  Description

    Split a block of documentation text into segments of Token s split on METAKEYWORD s.

  Returns

    Each of the arrays in the returned array can be fed to Parse::create()

  ENUM Tools.AutoDoc.DocParser.DocTokenType

    Description

      Enum of documentation token types.

    Constant METAKEYWORD

      `constant Tools.AutoDoc.DocParser.METAKEYWORD`

    Description

      eg `@decl`

    Constant BRACEKEYWORD

      `constant Tools.AutoDoc.DocParser.BRACEKEYWORD`

    Description

      eg `@i{@}`

    Constant DELIMITERKEYWORD

      `constant Tools.AutoDoc.DocParser.DELIMITERKEYWORD`

    Description

      eg `@param`

    Constant CONTAINERKEYWORD

      `constant Tools.AutoDoc.DocParser.CONTAINERKEYWORD`

    Description

      eg `@mapping`

    Constant SINGLEKEYWORD

      `constant Tools.AutoDoc.DocParser.SINGLEKEYWORD`

    Description

      None existant.

    Constant ENDKEYWORD

      `constant Tools.AutoDoc.DocParser.ENDKEYWORD`

    Description

      eg `@endmapping`

    Constant ERRORKEYWORD

      `constant Tools.AutoDoc.DocParser.ERRORKEYWORD`

    Description

      eg `@invalid`

    Constant TEXTTOKEN

      `constant Tools.AutoDoc.DocParser.TEXTTOKEN`

    Description

      Documentation text.

    Constant ENDTOKEN

      `constant Tools.AutoDoc.DocParser.ENDTOKEN`

    Description

      End of documentation marker.

  CLASS Tools.AutoDoc.DocParser.MetaData

    Description

      Metadata about a Documentation object.

    Variable type

      `string Tools.AutoDoc.DocParser.MetaData.type`

    Description

      Type of documented entity.

    Variable name

      `string Tools.AutoDoc.DocParser.MetaData.name`

    Description

      If type is one of `"class"`, `"module"`, `"endmodule"`, or `"endclass"`.

    Variable decls

      `array(PikeObject) Tools.AutoDoc.DocParser.MetaData.decls`

    Description

      Set of declarations.

      `string Tools.AutoDoc.DocParser.MetaData.belongs`
      `string Tools.AutoDoc.DocParser.MetaData.appears`

    Description

      Relocation information.

    Variable inherits

      `array(PikeObject) Tools.AutoDoc.DocParser.MetaData.inherits`

    Description

      Set of inherits.

  CLASS Tools.AutoDoc.DocParser.DocParserClass

    Description

      Internal class for parsing documentation markup.

    Variable currentPosition

      `SourcePosition Tools.AutoDoc.DocParser.DocParserClass.currentPosition`

    Variable argHandlers

      `mapping(string:function(string:string)|function(string:mapping(string:string))) Tools.AutoDoc.DocParser.DocParserClass.argHandlers`

    Description

      Contains functions that handle keywords with non-standard arg list syntax. The function for each keyword can return a mapping or a string:

      `mapping(string:string)` | If a `mapping(string:string)` is returned, it is interpreted as the attributes to put in the tag.
      `string` | If a string is returned, it is an XML fragment that gets inserted inside the tag.

    Method getMetaData

      `MetaData getMetaData()`

    Returns

      Returns the MetaData for the documentation string.

    Method getDoc

      `string getDoc(string context)`

    Returns

      Returns the documentation corresponding to the context as an XML string.

    Note

      getMetaData() must be called before this function.

  CLASS Tools.AutoDoc.DocParser.Parse

    Description

      Documentation markup parser.

      This is a class, because you need to examine the meta lines before you can determine which context to parse the actual doc lines in.

    Inherit DocParserClass

      inherit DocParserClass : DocParserClass

    Method create

      `void Tools.AutoDoc.DocParser.Parse(string|array(Token) s, SourcePosition|void sp)`

    Description

      Parse a documentation string s .

    Method metadata

      `MetaData metadata()`

    Returns

      Returns the MetaData for the documentation string.

    Method doc

      `string doc(string context)`

    Returns

      Returns the documentation corresponding to the context as an XML string.

    Note

      metadata() must be called before this function.

Module Tools.Monger

  CLASS Tools.Monger.MongerDeveloper

    Method set_auth

      `void set_auth(string _username, string _password)`

    Description

      set the username and password for accessing the remote repository.

    Method set_repository

      `void set_repository(string _repository)`

    Description

      specify an alternate repository location.

      this should be a URL specifying the XMLRPC endpoint for the repository.

    Method set_default_repository

      `void set_default_repository()`

    Description

      sets the default repository location (modules.gotpike.org)

    Method set_directory

      `void set_directory(string _directory)`

    Description

      sets the monger directory to use for working and storing configurations.

    Method set_default_directory

      `void set_default_directory()`

    Description

      sets the default directory for working and storing configurations ($HOME/.monger)

    Method add_new_version

      `int add_new_version(string module_name, string version, string changes, string license)`

    Method update_version

      `int update_version(string module_name, string version, string|void changes, string|void license)`

    Method user_change_password

      `int user_change_password(string|void _username, string _newpassword)`

    Method user_change_email

      `int user_change_email(string|void _username, string _newemail)`

    Method set_version_active

      `int set_version_active(string module_name, string version, int active)`

    Method set_module_source

      `int set_module_source(string module_name, string version, string filename)`

    Method set_dependency

      `int set_dependency(string module_name, string version, string dependency, string min_version, string max_version, int(0..1) required)`

    Method delete_dependency

      `int delete_dependency(string module_name, string version, string dependency, string min_version, string max_version)`

    Method get_dependencies

      `array get_dependencies(string module_name, string version)`

Module Tools.Standalone

  CLASS Tools.Standalone.forkd

    Description

      Fork Daemon

      This is a light-weight daemon that can be used via Process.Process to spawn new processes (by specifying the `"forkd"` modifier).

      The typical use is when the main program is large and/or when it has lots of open file descriptors. This can cause considerable overhead in process creation.

    See also

      Process.RemoteProcess , Process.create_process

    CLASS Tools.Standalone.forkd.ForkFd

      Description

        This is a process unique Stdio.Fd that is used to receive remote file descriptors and arguments to Process.create_process , as well as signalling back status changes and errors.

      Inherit Fd

        inherit Stdio.Fd : Fd

      Variable fds

        `array(Stdio.Fd) Tools.Standalone.forkd.ForkFd.fds`

      Description

        The remote file descriptors received so far in order.

    CLASS Tools.Standalone.forkd.ForkStream

      Description

        This class maps 1 to 1 to Process.RemoteProcess, and implements the daemon side of the RPC protocol.

      Inherit File

        inherit Stdio.File : File

    CLASS Tools.Standalone.forkd.FdStream

      Description

        This is the main control Stdio.Fd and is always on fd number `3`.

        To spawn a new process, a new Stdio.PROP_SEND_FD capable Stdio.Fd is sent over this fd, and a single byte of data is sent as payload.

        The sent fd will become a ForkFd inside a ForkStream .

      Inherit Fd

        inherit Stdio.Fd : Fd

  CLASS Tools.Standalone.process_files

    Description

      Boilerplate to quickly whip up rsif-like hacks for creating file processing to churn away at stdin, or files and/or directories provided on the command line, recursively or not, creating backup files or not, listing the paths of all files action was taken for, and returning an exit status of how many files that would have been taken action on which could not be written back.

      The all-round quickest way of making one of these tools is nicking the top portion of `lib/modules/Tools.pmod/Standalone.pmod/process_files.pike` or copying `rsif.pike` from the same directory. (The latter is 20 lines long, including docs, or about four lines of code.) Inherit process_files, and define your own version , description , usage , process , and, if you want arguments, want_args .

    Inherit process_files

      inherit Toole.Standalone.process_files : process_files

    Variable version

      `string Tools.Standalone.process_files.version`

    Description

      Your hack's version number. If you version control your file with cvs, we suggest you set the contents of this variable to something that that will automatically expand to a number for every new revision, for instance

    Example

          string version =
              sprintf("%d.%d.%d",(int)__REAL_VERSION__,__REAL_MINOR__,__REAL_BUILD__);

    Variable description

      `string Tools.Standalone.process_files.description`

    Description

      One-liner that gets shown for this tool when running `pike -x` without additional options. (Assuming your tool resides in `Standalone.pmod`.) Does not include the name of the tool itself; just provide a nice, terse description, ending with a period for conformity.

    Variable usage

      `string Tools.Standalone.process_files.usage`

    Description

      Long description of the purpose and usage of your tool, for --help and the case where not enough options are given on the command line. Its invocation mode (for instance "pike -x yourtool", when invoked that way) is prepended, and a list of available flags appended to this description.

    Variable want_args

      `int Tools.Standalone.process_files.want_args`

    Description

      The number of (mandatory) command-line options your hack needs and which your process callback wants (beside the input file). By default 0.

    Method process

      `string process(string input, string ... args)`

    Description

      Gets called with the contents of a file (or stdin). Return your output, or 0 if you didn't do anything. args are the first want_args command-line options provided, before the list of files to process.

    Variable verbosity

      `int(0..) Tools.Standalone.process_files.verbosity`

    Description

      0 in quiet mode, 1 by default, above = more output

    Variable overwrite

      `int(0..1) Tools.Standalone.process_files.overwrite`

    Description

      0 to make backups, 1 to overwrite (default)

    Variable recursive

      `int(0..1) Tools.Standalone.process_files.recursive`

    Description

      1 to recurse into directories, 0 not to (default)

    Variable default_flag_docs

      `string Tools.Standalone.process_files.default_flag_docs`

    Description

      Flag docs to append to your usage description. Explains default options.

    Method process_file

      `int(0..1) process_file(string path, string ... args)`

    Description

      Takes the path to a file and the first want_args command-line options provided, before the list of files to process. You might want to override this method if your tool needs to see file paths.

    See also

      process_path

    Method process_path

      `int(0..) process_path(string path, string ... args)`

    Description

      Takes the path to a file or directory and the first want_args first command-line options provided, before the list of files to process. You might want to override this method if your tool needs to see all paths.

    See also

      process_file

    Method main

      `int(0..) main(int argc, array(string) argv)`

    Description

      Base implementation of main program, handling basic flags and returning an exit status matching the number of failures during operation.

    FIXME

      No easy way of adding your own command-line flags implemented yet. This would be a rather natural next feature to add, once somebody needs some.

  CLASS Tools.Standalone.pmar_install

    Description

      a prototype installer for prepackaged modules

      note: portions of this code are highly inefficient (wrt tar filehandling). we assume that this will be used infrequently enough that this is not going to be a problem.

      a package file is a tar file that contains the following structure:

      ROOTDIR/ METADATA.TXT a file containing metadata about the package format: KEY=value, where values include: PLATFORM, in the form of os/processor (either can be "any") MODULE, the name of the module, in Module.Submodule format. VERSION, the version of this module. MODULE/ any files that need to be installed in the module directory MODREF/ ??? documentation suitable for inclusion in the modref INCLUDE/ ??? any pike language include files to be installed SCRIPTS/ standalone (no bundled dependencies) scripts used to perform custom actions they receive the installer object (this) and the System.Filesystem object of the package archive as arguments to the constructor. The method "run()" should perform the actual action. The run() method should return true or false to indicate success or failure. preinstall.pike postinstall.pike

Module Tools.PEM

  Description

    Support for parsing PEM-style messages.

  CLASS Tools.PEM.EncapsulatedMsg

    Variable boundary

      `string Tools.PEM.EncapsulatedMsg.boundary`

    Description

      contains the boundary string

    Variable body

      `string Tools.PEM.EncapsulatedMsg.body`

    Description

      contains the body of the message

    Variable headers

      `mapping(string:string) Tools.PEM.EncapsulatedMsg.headers`

    Method create

      `void Tools.PEM.EncapsulatedMsg(string eb, string contents)`

    Method decoded_body

      `string decoded_body()`

    Description

      decodes a base 64 encoded message body

    Method get_boundary

      `string get_boundary()`

    Method canonical_body

      `string canonical_body()`

    Method to_string

      `string to_string()`

    Description

      converts the message body and headers to the standard message format.

  CLASS Tools.PEM.RFC934

    Variable initial_text

      `string Tools.PEM.RFC934.initial_text`

    Variable final_text

      `string Tools.PEM.RFC934.final_text`

    Variable final_boundary

      `string Tools.PEM.RFC934.final_boundary`

    Variable encapsulated

      `array(EncapsulatedMsg) Tools.PEM.RFC934.encapsulated`

    Method create

      `void Tools.PEM.RFC934(string data)`

    Description

      decodes an RFC 934 encoded message.

    Method get_final_boundary

      `string get_final_boundary()`

    Method to_string

      `string to_string()`

  CLASS Tools.PEM.Msg

    Description

      Disassembles PGP and PEM style messages with parts separated by "-----BEGIN FOO-----" and "-----END FOO-----".

    Variable initial_text

      `string Tools.PEM.Msg.initial_text`

    Description

      Contains any text preceeding the PEM message.

    Variable final_text

      `string Tools.PEM.Msg.final_text`

    Description

      Contains any text following the PEM message.

    Variable parts

      `mapping(string:EncapsulatedMsg) Tools.PEM.Msg.parts`

    Description

      The decoded PEM message, as an array of EncapsulatedMsg objects indexed by message name, such as "CERTIFICATE".

    Method create

      `void Tools.PEM.Msg(string s)`

    Description

      Creates a decoded PEM message

    Parameter `s`

      a string containing a PEM encoded message to be decoded.

Module Tools.sed

  Description

    edit commands supported:

         <firstline>,<lastline><edit command>
            ^^ numeral (17) ^^
               or relative (+17, -17)
               or a search regexp (/regexp/)
               or multiple (17/regexp//regexp/+2)

    Command | Action
    D | Delete first line in space
    G | Insert hold space
    H | Append current space to hold space
    P | Print current data
    a<string> | Insert
    c<string> | Change current space
    d | Delete current space
    h | Copy current space to hold space
    i<string> | Print string
    l | Print current space
    p | Print first line in data
    q | Quit evaluating
    s/regexp/with/x | Replace
    y/chars/chars/ | Replace chars

    where line is numeral, first 'line'==0

  Method `()

    `string|array `()(string|array(string) commands, string|array(string) data, void|int suppress)`

Module Tools.Testsuite

  Method run_script

    `array(int) run_script(string|array(string) pike_script)`

  Description

    Runs an external pike script from a testsuite. Use Tools.Testsuite.report_result in the script to report how many tests succeeded, failed, and were skipped. Those numbers are returned in the array from this function.

  Method log_msg

    `void log_msg(string msg, mixed ... args)`

  Description

    Logs a testsuite message. The message is shown regardless of the verbosity level. If the previous message was logged "in place" by log_status for verbosity 1 then a newline is inserted first. The message should normally have a trailing newline - no extra newline is added to it.

  Method log_status

    `void log_status(string msg, mixed ... args)`

  Description

    Logs a testsuite status message. This is suitable for nonimportant progress messages.

    - If the verbosity is 0 then nothing is logged, but the message is saved and will be logged if the next call is to log_msg .

    - If the verbosity is 1, the message is "in place" on the current line without a trailing line feed, so that the next message will replace this one.

    - If the verbosity is 2 or greater, the message is logged with a trailing line feed.

    The message should be short and not contain newlines, to work when the verbosity is 1, but if it ends with a newline then it's logged normally. It can be an empty string to just clear the last "in place" logged message - it won't be logged otherwise.

  See also

    log_twiddler

  Method log_twiddler

    `void log_twiddler()`

  Description

    Logs a rotating line for showing progress. Only output at the end of an "in place" message written by log_status on verbosity level 1.

  Method report_result

    `void report_result(int succeeded, int failed, void|int skipped)`

  Description

    Use this to report the number of successful, failed, and skipped tests in a script started using run_script . Can be called multiple times - the counts are accumulated.

Module Tools.Install

  Description

    Common routines which are useful for various install scripts based on Pike.

  Method features

    `array(string) features()`

  Description

    Return an array of enabled features.

  Note

    Used by the master when given the option `--features`.

  See also

    Tools.Standalone.features

  Method make_absolute_path

    `string make_absolute_path(string path, string|void cwd)`

  CLASS Tools.Install.ProgressBar

    Description

      A class keeping some methods and state to conveniently render ASCII progress bars to stdout.

    Method set_current

      `void set_current(int _cur)`

    Description

      Change the amount of progress without updating on stdout.

    Method set_name

      `void set_name(string _name)`

    Description

      Change the name of the progress bar without updating on stdout.

    Method set_phase

      `void set_phase(float _phase_base, float _phase_size)`

    Method update

      `int update(int increment)`

    Description

      Write the current look of the progressbar to stdout.

    Parameter `increment`

      the number of increments closer to completion since last call

    Returns

      the length (in characters) of the line with the progressbar

    Method create

      `void Tools.Install.ProgressBar(string name, int cur, int max, float|void phase_base, float|void phase_size)`

    Parameter `name`

      The name (printed in the first 13 columns of the row)

    Parameter `cur`

      How much progress has been made so far

    Parameter `max`

      The amount of progress signifying 100% done. Must be greater than zero.

  CLASS Tools.Install.Readline

    Inherit Readline

      inherit Stdio.Readline : Readline

    Method trap_signal

      `void trap_signal(int n)`

    Method edit

      `string edit(mixed ... args)`

    Method edit_filename

      `string edit_filename(mixed ... args)`

    Method edit_directory

      `string edit_directory(mixed ... args)`

    Method absolute_path

      `string absolute_path(string path)`

    Method set_cwd

      `void set_cwd(string _cwd)`

Module Tools.Hilfe

  Method format_hr_time

    `string format_hr_time(int i)`

  Description

    Helper function that formats a time span in nanoseconds to something more human readable (ns, ms or s).

  CLASS Tools.Hilfe.Command

    Description

      Abstract class for Hilfe commands.

    Method help

      `string help(string what)`

    Description

      Returns a one line description of the command. This help should be shorter than 54 characters.

    Method doc

      `string doc(string what, string with)`

    Description

      A more elaborate documentation of the command. This should be less than 68 characters per line.

    Method exec

      `void exec(Evaluator e, string line, array(string) words, array(string) tokens)`

    Description

      The actual command callback. Messages to the user should be written out by using the safe_write method in the Evaluator object.

  CLASS Tools.Hilfe.CommandReset

    Description

      Variable reset command. Put ___Hilfe->commands->reset = Tools.Hilfe.CommandReset(); in your .hilferc to have this command defined when you open Hilfe.

    Inherit Command

      inherit Command : Command

  CLASS Tools.Hilfe.Expression

    Description

      Represents a Pike expression

    Method create

      `void Tools.Hilfe.Expression(array(string) t)`

    Parameter `t`

      An array of Pike tokens.

    Method _sizeof

      `int _sizeof()`

    Description

      The number of non-whitespace tokens in the expression.

    Method `[]

      `string `[](int f, void|int t)`

    Description

      Returns a token or a token range without whitespaces.

    Method `[]=

      `string `[]=(int f, string v)`

    Description

      Replaces a token with a new token.

    Method depth

      `int depth(int f)`

    Description

      Return the parenthesis depth at the given position.

    Method in_sscanf

      `int(0..1) in_sscanf(int f)`

    Description

      Returns 1 if the current position is within a sscanf expression.

    Method check_modifiers

      `string check_modifiers()`

    Description

      See if there are any forbidden modifiers used in the expression, e.g. "private int x;" is not valid inside Hilfe.

    Returns

      Returns an error message as a string if the expression contains a forbidden modifier, otherwise `0`.

    Method code

      `string code()`

    Description

      Returns the expression verbatim.

    Method endoftype

      `int(-1..) endoftype(int(-1..) position)`

    Description

      Returns at which position the type declaration that begins at position position ends. A return value of -1 means that the token or tokens from position can not be a type declaration.

    Method find_matching

      `int(-1..) find_matching(string token, int(0..)|void pos)`

    Description

      Returns the position of the matching parenthesis of the given kind, starting from the given position. The position should be the position after the opening parenthesis, or later. Assuming balanced code. Returns -1 on failure.

    Method is_block

      `int(0..1) is_block(int pos)`

    Description

      Is there a block starting at pos ?

    Method cast

      `mixed cast(string to)`

    Description

      An Expression object can be cast to an array or a string. In both forms all tokens, including white spaces will be returned.

  CLASS Tools.Hilfe.ParserState

    Description

      In every Hilfe object (Evaluator ) there is a ParserState object that manages the current state of the parser. Essentially tokens are entered in one end and complete expressions are outputted in the other. The parser object is accessible as ___Hilfe->state from Hilfe expressions.

    Method feed

      `void feed(array(string) tokens)`

    Description

      Feed more tokens into the state.

    Method read

      `array(Expression) read()`

    Description

      Read out completed expressions. Returns an array where every element is an expression represented as an array of tokens.

    Method show_error

      `void show_error(function(array(string)|string:int) w)`

    Description

      Prints out any error that might have occurred while push_string was executed. The error will be printed with the print function w .

    Method push_string

      `array(string) push_string(string line)`

    Description

      Sends the input line to Parser.Pike for tokenization, but keeps a state between each call to handle multiline /**/ comments and multiline #"" strings.

    Method datap

      `int datap()`

    Description

      Returns true if there is any waiting expression that can be fetched with read .

    Method finishedp

      `int(0..1) finishedp()`

    Description

      Are we in the middle of an expression. Used e.g. for changing the Hilfe prompt when entering multiline expressions.

    Method flush

      `void flush()`

    Description

      Clear the current state.

    Method status

      `string status()`

    Description

      Returns the current parser state. Used by "dump state".

  CLASS Tools.Hilfe.HilfeHistory

    Description

      In every Hilfe object (Evaluator ) there is a HilfeHistory object that manages the result history. That history object is accessible both from __ and ___Hilfe->history in Hilfe expressions.

    Inherit History

      inherit ADT.History : History

  CLASS Tools.Hilfe.Evaluator

    Description

      This class implements the actual Hilfe interpreter. It is accessible as ___Hilfe from Hilfe expressions.

    Variable commands

      `mapping(string:Command) Tools.Hilfe.Evaluator.commands`

    Description

      This mapping contains the available Hilfe commands, including the built in ones (dump, exit, help, new, quit), so it is possible to replace or remove them. The name of a command should be 10 characters or less.

    Variable state

      `ParserState Tools.Hilfe.Evaluator.state`

    Description

      Keeps the state, e.g. multiline input in process etc.

    Variable variables

      `mapping(string:mixed) Tools.Hilfe.Evaluator.variables`

    Description

      The locally defined variables (name:value).

    Variable types

      `mapping(string:string) Tools.Hilfe.Evaluator.types`

    Description

      The types of the locally defined variables (name:type).

    Variable constants

      `mapping(string:mixed) Tools.Hilfe.Evaluator.constants`

    Description

      The locally defined constants (name:value).

    Variable functions

      `mapping(string:function) Tools.Hilfe.Evaluator.functions`

    Description

      The locally defined functions (name:value).

    Variable programs

      `mapping(string:program) Tools.Hilfe.Evaluator.programs`

    Description

      The locally defined programs (name:value).

    Variable imports

      `array(string) Tools.Hilfe.Evaluator.imports`

    Description

      The current imports.

    Variable inherits

      `array(string) Tools.Hilfe.Evaluator.inherits`

    Description

      The current inherits.

    Variable history

      `HilfeHistory Tools.Hilfe.Evaluator.history`

    Description

      The current result history.

    Variable write

      `array|object|function(string:int(0..)) Tools.Hilfe.Evaluator.write`

    Description

      The function to use when writing to the user.

    Method add_writer

      `void add_writer(object|function(string:int(0..)) new)`

    Description

      Adds another output function.

    Method remove_writer

      `void remove_writer(object|function old)`

    Description

      Removes an output function.

    Method safe_write

      `int safe_write(array(string)|string in, mixed ... args)`

    Description

      An output method that shouldn't crash.

    Method add_input_hook

      `void add_input_hook(function|object new)`

    Description

      Adds a function to the input hook, making all user data be fed into the function.

    See also

      remove_input_hook

    Method remove_input_hook

      `void remove_input_hook(function|object old)`

    Description

      Removes a function from the input hook.

    See also

      add_input_hook

    Method create

      `void Tools.Hilfe.Evaluator()`

    Method print_version

      `void print_version()`

    Description

      Displays the current version of Hilfe.

    Method reset_evaluator

      `void reset_evaluator()`

    Description

      Clears the current state, history and removes all locally defined variables, constants, functions and programs. Removes all imports and inherits. It does not reset the command mapping nor reevaluate the .hilferc file.

    Method add_input_line

      `void add_input_line(string s)`

    Description

      Input a line of text into Hilfe. It checks if s is ".", in which case it calls state->flush(). Otherwise just calls add_buffer.

    Method add_buffer

      `void add_buffer(string s)`

    Description

      Add buffer tokenizes the input string and determines if the new line is a Hilfe command. If not, it updates the current state with the new tokens and sends any and all complete expressions to evaluation in parse_expression .

    Method parse_expression

      `string parse_expression(Expression expr)`

    Description

      Parses a Pike expression. Returns 0 if everything went well, or a string with an error message otherwise.

    Variable last_compiled_expr

      `string Tools.Hilfe.Evaluator.last_compiled_expr`

    Description

      The last created wrapper in which an expression was evaluated.

    Variable last_compile_time

      `int(0..) Tools.Hilfe.Evaluator.last_compile_time`

    Description

      The last compile time;

    Variable last_eval_time

      `int(0..) Tools.Hilfe.Evaluator.last_eval_time`

    Description

      The last evaluation time;

    Variable strict_types

      `int(0..1) Tools.Hilfe.Evaluator.strict_types`

    Description

      Strict types?

    Variable warnings

      `int(0..1) Tools.Hilfe.Evaluator.warnings`

    Description

      Show warnings?

    Variable trace_level

      `int Tools.Hilfe.Evaluator.trace_level`

    Description

      The current trace level.

    Variable assembler_debug_level

      `int Tools.Hilfe.Evaluator.assembler_debug_level`

    Description

      The current assembler debug level. Only available if Pike is compiled with RTL debug.

    Variable compiler_trace_level

      `int Tools.Hilfe.Evaluator.compiler_trace_level`

    Description

      The current compiler trace level. Only available if Pike is compiled with RTL debug.

    Variable debug_level

      `int Tools.Hilfe.Evaluator.debug_level`

    Description

      The current debug level. Only available if Pike is compiled with RTL debug.

    Variable last_else

      `int(0..1) Tools.Hilfe.Evaluator.last_else`

    Description

      Should an else expression be carried out?

    Method std_reswrite

      `void std_reswrite(function w, string sres, int num, mixed res)`

    Description

      The standard reswrite function.

    Variable reswrite

      `function Tools.Hilfe.Evaluator.reswrite`

    Description

      The function used to write results. Gets as arguments in order: The safe_write function (function(string, mixed ...:int), the result as a string (string), the history entry number (int), the result (mixed), the compilation time (int) and the evaulation time (int). If the evaluated expression didn't return anything (e.g. a for loop) then 0 will be given as the result string.

    Method hilfe_compile

      `object hilfe_compile(string f, void|string new_var)`

    Description

      Creates a wrapper and compiles the pike code f in it. If a new variable is compiled to be tested, its name should be given in new_var so that magically defined entities can be undefined and a warning printed.

    Method evaluate

      `void evaluate(string a, int(0..1) show_result)`

    Description

      Compiles the Pike code a and evaluates it by calling ___HilfeWrapper in the generated object. If show_result is set the result will be displayed and the result buffer updated with its value.

  CLASS Tools.Hilfe.StdinHilfe

    Description

      This is a wrapper containing a user interface to the Hilfe Evaluator so that it can actually be used. This wrapper uses the Stdio.Readline module to interface with the user. All input history is handled by that module, and as a consequence loading and saving .hilfe_history is handled in this class. Also .hilferc is handled by this class.

    Inherit Evaluator

      inherit Evaluator : Evaluator

    Variable readline

      `Stdio.Readline Tools.Hilfe.StdinHilfe.readline`

    Description

      The readline object,

    Method save_history

      `void save_history()`

    Description

      Saves the user input history, if possible, when called.

    Method create

      `void Tools.Hilfe.StdinHilfe(void|array(string) init)`

    Description

      Any hilfe statements given in the init array will be executed once .hilferc has been executed.

  CLASS Tools.Hilfe.GenericHilfe

    Inherit Evaluator

      inherit Evaluator : Evaluator

    Method create

      `void Tools.Hilfe.GenericHilfe(Stdio.FILE in, Stdio.File out)`

  CLASS Tools.Hilfe.GenericAsyncHilfe

    Inherit Evaluator

      inherit Evaluator : Evaluator

    Method create

      `void Tools.Hilfe.GenericAsyncHilfe(Stdio.File in, Stdio.File out)`

Module Tools.X509

  Constant CERT_TOO_OLD

    `constant Tools.X509.CERT_TOO_OLD`

  Constant CERT_TOO_NEW

    `constant Tools.X509.CERT_TOO_NEW`

  Constant CERT_INVALID

    `constant Tools.X509.CERT_INVALID`

  Constant CERT_CHAIN_BROKEN

    `constant Tools.X509.CERT_CHAIN_BROKEN`

  Constant CERT_ROOT_UNTRUSTED

    `constant Tools.X509.CERT_ROOT_UNTRUSTED`

  Constant CERT_BAD_SIGNATURE

    `constant Tools.X509.CERT_BAD_SIGNATURE`

  Constant CERT_UNAUTHORIZED_CA

    `constant Tools.X509.CERT_UNAUTHORIZED_CA`

  Method make_time

    `UTC make_time(int t)`

  Description

    Creates a Standards.ASN1.Types.UTC object from the posix time t .

  Method parse_time

    `mapping(string:int) parse_time(UTC asn1)`

  Description

    Returns a mapping similar to that returned by gmtime

  Returns

    `"year" : int`
    `"mon" : int`
    `"mday" : int`
    `"hour" : int`
    `"min" : int`
    `"sec" : int`

  Method time_compare

    `int(-1..1) time_compare(mapping(string:int) t1, mapping(string:int) t2)`

  Description

    Comparision function between two "date" mappings of the kind that parse_time returns.

  Method make_tbs

    `Sequence make_tbs(object issuer, object algorithm, object subject, object keyinfo, object serial, int ttl, array extensions)`

  Method dsa_sign_key

    `string dsa_sign_key(Sequence issuer, Crypto.DSA dsa, Sequence subject, string public_key, int serial, int ttl, array|void extensions)`

  Parameter `issuer`

    Distinguished name for the issuer.

  Parameter `rsa`

    RSA parameters for the issuer.

  Parameter `subject`

    Distinguished name for the subject.

  Parameter `public_key`

    DER-encoded integer. See Standards.PKCS.DSA.public_key() .

  Parameter `serial`

    Serial number for this key and issuer.

  Parameter `ttl`

    Validity time in seconds for this signature to be valid.

  Parameter `extensions`

    Set of extensions.

  Returns

    Returns a DER-encoded certificate.

  Method make_selfsigned_dsa_certificate

    `string make_selfsigned_dsa_certificate(Crypto.DSA dsa, int ttl, array name, array|void extensions)`

  Method rsa_sign_digest

    `string rsa_sign_digest(Crypto.RSA rsa, object digest_id, string digest)`

  Method rsa_verify_digest

    `int(0..1) rsa_verify_digest(Crypto.RSA rsa, object digest_id, string digest, string s)`

  Method rsa_sign_key

    `string rsa_sign_key(Sequence issuer, Crypto.RSA rsa, Sequence subject, string public_key, int serial, int ttl, array|void extensions)`

  Parameter `issuer`

    Distinguished name for the issuer.

  Parameter `rsa`

    RSA parameters for the issuer.

  Parameter `subject`

    Distinguished name for the issuer.

  Parameter `public_key`

    DER-encoded RSAPublicKey structure. See Standards.PKCS.RSA.public_key() .

  Parameter `serial`

    Serial number for this key and subject.

  Parameter `ttl`

    Validity time in seconds for this signature to be valid.

  Parameter `extensions`

    Set of extensions.

  Returns

    Returns a DER-encoded certificate.

  Method make_selfsigned_rsa_certificate

    `string make_selfsigned_rsa_certificate(Crypto.RSA rsa, int ttl, array name, array|void extensions)`

  Method make_verifier

    `Verifier make_verifier(Object _keyinfo)`

  Method decode_certificate

    `TBSCertificate decode_certificate(string|object cert)`

  Method verify_certificate

    `TBSCertificate verify_certificate(string s, mapping authorities)`

  Description

    Decodes a certificate, checks the signature. Returns the TBSCertificate structure, or 0 if decoding or verification failes.

    Authorities is a mapping from (DER-encoded) names to a verifiers.

  Note

    This function allows self-signed certificates, and it doesn't check that names or extensions make sense.

  Method verify_certificate_chain

    `mapping verify_certificate_chain(array(string) cert_chain, mapping authorities, int|void require_trust)`

  Description

    Decodes a certificate chain, checks the signatures. Verifies that the chain is unbroken, and that all certificates are in effect (time-wise.)

    Returns a mapping with the following contents, depending on the verification of the certificate chain:

    `"error_code" : int` | Error describing type of verification failure, if verification failed. May be one of the following: CERT_TOO_NEW , CERT_TOO_OLD , CERT_ROOT_UNTRUSTED , CERT_BAD_SIGNATURE , CERT_INVALID , CERT_UNAUTHORIZED_CA or CERT_CHAIN_BROKEN
    `"error_cert" : int` | Index number of the certificate that caused the verification failure.
    `"self_signed" : int(0..1)` | Non-zero if the certificate is self-signed.
    `"verified" : int(0..1)` | Non-zero if the certificate is verified.
    `"authority" : string` | Standards.ASN1.Sequence of the authority RDN that verified the chain.
    `"cn" : string` | Standards.ASN1.Sequence of the common name RDN of the leaf certificate.

  Parameter `cert_chain`

    An array of certificates, with the relative-root last. Each certificate should be a DER-encoded certificate.

  Parameter `authorities`

    A mapping from (DER-encoded) names to verifiers.

  Parameter `require_trust`

    Require that the certificate be traced to an authority, even if it is self signed.

    See Standards.PKCS.Certificate.get_dn_string for converting the RDN to an X500 style string.

  CLASS Tools.X509.rsa_verifier

    Inherit Verifier

      inherit Verifier : Verifier

    Method init

      `this_program init(string key)`

    Method verify

      `int(0..1) verify(Sequence algorithm, string msg, string signature)`

  CLASS Tools.X509.TBSCertificate

    Variable der

      `string Tools.X509.TBSCertificate.der`

    Variable version

      `int Tools.X509.TBSCertificate.version`

    Variable serial

      `Gmp.mpz Tools.X509.TBSCertificate.serial`

    Variable algorithm

      `Sequence Tools.X509.TBSCertificate.algorithm`

    Variable issuer

      `Sequence Tools.X509.TBSCertificate.issuer`

    Variable not_after

      `mapping Tools.X509.TBSCertificate.not_after`

    Variable not_before

      `mapping Tools.X509.TBSCertificate.not_before`

    Variable subject

      `Sequence Tools.X509.TBSCertificate.subject`

    Variable public_key

      `Verifier Tools.X509.TBSCertificate.public_key`

    Variable issuer_id

      `BitString Tools.X509.TBSCertificate.issuer_id`

    Note

      optional

    Variable subject_id

      `BitString Tools.X509.TBSCertificate.subject_id`

    Note

      optional

    Variable extensions

      `object Tools.X509.TBSCertificate.extensions`

    Note

      optional

    Method init

      `this_program init(Object asn1)`

Module Getopt

  Description

    Getopt is a group of functions which can be used to find command line options.

    Command line options come in two flavors: long and short. The short ones consists of a dash followed by a character (`-t`), the long ones consist of two dashes followed by a string of text (`--test`). The short options can also be combined, which means that you can write `-tda` instead of `-t -d -a`.

    Options can also require arguments, in which case they cannot be combined. To write an option with an argument you write `-t argument` or `-targument` or `--test=argument`.

  Method find_option

    `string|int(0..1) find_option(array(string) argv, array(string)|string shortform, array(string)|string|void longform, array(string)|string|void envvars, string|int(0..1)|void def, int|void throw_errors)`

  Description

    This is a generic function to parse command line options of the type `-f`, `--foo` or `--foo=bar`.

  Parameter `argv`

    The first argument should be the array of strings that was sent as the second argument to your `main()` function.

  Parameter `shortform`

    The second is a string with the short form of your option. The short form must be only one character long. It can also be an array of strings, in which case any of the options in the array will be accepted.

  Parameter `longform`

    This is an alternative and maybe more readable way to give the same option. If you give `"foo"` as longform your program will accept `--foo` as argument. This argument can also be an array of strings, in which case any of the options in the array will be accepted.

  Parameter `envvars`

    This argument specifies an environment variable that can be used to specify the same option, to make it easier to customize program usage. It can also be an array of strings, in which case any of the mentioned variables in the array may be used.

  Parameter `def`

    This argument has two functions: It specifies if the option takes an argument or not, and it informs find_option() what to return if the option is not present.

    The value may be one of:

    `int(0..0)|zero` | The option does not require a value.
    `int(1..1)|string` | The option requires a value, and def will be returned if the option is not present. If the option is present, but does not have an argument find_option() will fail. Note that a set option will always return a `string`, so setting def to `1` can be used to detect whether the option is present or not.

  Parameter `throw_errors`

    If throw_errors has been specified find_option() will throw errors on failure. If it has been left out, or is `0` (zero), it will instead print an error message on Stdio.stderr and exit the program with result code 1 on failure.

  Returns

    Returns the value the option has been set to if any.

    If the option is present, but has not been set to anything `1` will be returned.

    Otherwise if any of the environment variables specified in envvars has been set, that value will be returned.

    If all else fails, def will be returned.

  Throws

    If an option that requires an argument lacks an argument and throw_errors is set an error will be thrown.

  Note

    find_option() modifies argv . Parsed options will be removed from argv . Elements of argv that have been removed entirely will be replaced with zeroes.

    This function reads options even if they are written after the first non-option on the line.

    Index `0` (zero) of argv is not scanned for options, since it is reserved for the program name.

    Only the first ocurrance of an option will be parsed. To parse multiple ocurrances, call find_option() multiple times.

  See also

    Getopt.get_args()

  Constant HAS_ARG

    `constant Getopt.HAS_ARG`

  Description

    Used with find_all_options() to indicate that an option requires an argument.

  See also

    find_all_options()

  Constant NO_ARG

    `constant Getopt.NO_ARG`

  Description

    Used with find_all_options() to indicate that an option does not take an argument.

  See also

    find_all_options()

  Constant MAY_HAVE_ARG

    `constant Getopt.MAY_HAVE_ARG`

  Description

    Used with find_all_options() to indicate that an option takes an optional argument.

  See also

    find_all_options()

  Method find_all_options

    `array(array) find_all_options(array(string) argv, array(array(array(string)|string|int)) options, void|int(-1..1) posix_me_harder, void|int throw_errors)`

  Description

    This function does the job of several calls to find_option() . The main advantage of this is that it allows it to handle the `POSIX_ME_HARDER` environment variable better. When the either the argument posix_me_harder or the environment variable `POSIX_ME_HARDER` is true, no arguments will be parsed after the first non-option on the command line.

  Parameter `argv`

    The should be the array of strings that was sent as the second argument to your `main()` function.

  Parameter `options`

    Each element in the array options should be an array on the following form:

    Array
    `string name` | Name is a tag used to identify the option in the output.
    `int type` | Type is one of Getopt.HAS_ARG , Getopt.NO_ARG and Getopt.MAY_HAVE_ARG and it affects how the error handling and parsing works. You should use HAS_ARG for options that require a path, a number or similar. NO_ARG should be used for options that do not need an argument, such as `--version`. MAY_HAVE_ARG should be used for options that may or may not need an argument.

    `string|array(string) aliases`

    This is a string or an array of string of options that will be looked for. Short and long options can be mixed, and short options can be combined into one string. Note that you must include the dashes so that find_all_options() can distinguish between long and short options. Example: `({"-tT","--test"})` This would make find_all_options look for `-t`, `-T` and `--test`.

    `void|string|array(string) env_var` | This is a string or an array of strings containing names of environment variables that can be used instead of the command line option.
    `void|mixed default` | This is the default value a MAY_HAVE_ARG option will have in the output if it was set but not assigned any value.

    Only the first three elements need to be included.

  Parameter `posix_me_harder`

    Don't scan for arguments after the first non-option.

  Parameter `throw_errors`

    If throw_errors has been specified find_all_options() will throw errors on failure. If it has been left out, or is `0` (zero), it will instead print an error message on Stdio.stderr and exit the program with result code 1 on failure.

  Returns

    The good news is that the output from this function is a lot simpler. find_all_options() returns an array where each element is an array on this form:

    Array
    `string name` | Option identifier name from the input.
    `mixed value` | Value given. If no value was specified, and no default has been specified, the value will be 1.

  Note

    find_all_options() modifies argv .

    Index `0` (zero) of argv is not scanned for options, since it is reserved for the program name.

  See also

    Getopt.get_args() , Getopt.find_option()

  Method get_args

    `array(string) get_args(array(string) argv, void|int(-1..1) posix_me_harder, void|int throw_errors)`

  Description

    This function returns the remaining command line arguments after you have run find_option() or find_all_options() to find all the options in the argument list. If there are any options left not handled by find_option() or find_all_options() this function will fail.

    If throw_errors has been specified get_args() will throw errors on failure. If it has been left out, or is `0` (zero), it will instead print an error message on Stdio.stderr and exit the program with result code 1 on failure.

  Returns

    On success a new argv array without the parsed options is returned.

  See also

    Getopt.find_option() , Getopt.find_all_options()

Module Arg

  CLASS Arg.Options

    Description

      The option parser class that contains all the argument objects.

    Inherit LowOptions

      inherit LowOptions : LowOptions

Module GLU

  Description

    The GL Utilities module is a partial implementation of the GLU library. This module only contains functions that someone at some point actually needed to get his work done. If you need a GLU function that isn't in here, copy the C code from the GLU library (Mesa was used last time), tweak it so that it compiles as Pike code and then check it in into the CVS.

  Method gluLookAt

    `void gluLookAt(float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz)`
    `void gluLookAt(Math.Matrix eye, Math.Matrix center, Math.Matrix up)`

  Description

    gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an up vector. The matrix maps the reference point to the negative z axis and the eye point to the origin, so that, when a typical projection matrix is used, the center of the scene maps to the center of the viewport. Similarly, the direction described by the up vector projected onto the viewing plane is mapped to the positive y axis so that it points upward in the viewport. The up vector must not be parallel to the line of sight from the eye to the reference point.

    The matrix generated by gluLookAt postmultiplies the current matrix.

    The relation between the matrix objects and the float values are

    Math.Matrix eye = Math.Matrix( ({ eyex, eyey, eyez }) );

See also

  GL.glFrustum , gluPerspective

Method gluOrtho2D

  `void gluOrtho2D(float left, float right, float bottom, float top)`

Description

  gluOrtho2D sets up a two-dimensional orthographic viewing region. This is equivalent to calling

  glOrtho(left, right, bottom, top, -1.0, 1.0);

FIXME

  The GLU manual says `glOrtho(a,b,c,d, 0, 1)`.

See also

  GL.glOrtho , gluPerspective

Method gluPerspective

  `void gluPerspective(float fovy, float aspect, float zNear, float zFar)`

Description

  gluPerspective specifies a viewing frustum into the world coordinate system. In general, the aspect ratio in gluPerspective should match the aspect ratio of the associated viewport. For example, aspect = 2.0 means the viewer's angle of view is twice as wide in x as it is in y. If the viewport is twice as wide as it is tall, it displays the image without distortion.

  The matrix generated by gluPerspective is multipled by the current matrix, just as if GL.glMultMatrix were called with the generated matrix. To load the perspective matrix onto the current matrix stack instead, precede the call to gluPerspective with a call to GL.glLoadIdentity .

Method gluPickMatrix

  `void gluPickMatrix(float x, float y, float width, float height, array(int) viewport)`

Description

  gluPickMatrix creates a projection matrix that can be used to restrict drawing to a small region of the viewport. This is typically useful to determine what objects are being drawn near the cursor. Use gluPickMatrix to restrict drawing to a small region around the cursor. Then, enter selection mode (with GL.glRenderMode and rerender the scene. All primitives that would have been drawn near the cursor are identified and stored in the selection buffer.

  The matrix created by gluPickMatrix is multiplied by the current matrix just as if GL.glMultMatrix is called with the generated matrix. To effectively use the generated pick matrix for picking, first call GL.glLoadIdentity to load an identity matrix onto the perspective matrix stack. Then call gluPickMatrix, and finally, call a command (such as gluPerspective ) to multiply the perspective matrix by the pick matrix.

  When using gluPickMatrix to pick NURBS, be careful to turn off the NURBS property GLU_AUTO_LOAD_MATRIX. If GLU_AUTO_LOAD_MATRIX is not turned off, then any NURBS surface rendered is subdivided differently with the pick matrix than the way it was subdivided without the pick matrix.

Parameter `viewport`

  The viewport is an array with four integers.

FIXME

  Does the NURB remark apply?

See also

  GL.glGet , gluLoadIdentity , gluMultMatrix , gluRenderMode , gluPerspective

Method gluProject

  `array(float) gluProject(float objx, float objy, float objz, array(float) model, array(float) proj, array(int) viewport)`

Description

  gluProject transforms the specified object coordinates into window coordinates using model , proj , and viewport . The result is returned in a three valued array.

Module Val

  Description

    This module contains special values used by various modules, e.g. a null value used both by Sql and Standards.JSON .

    In many ways these values should be considered constant, but it is possible for a program to replace them with extended versions, provided they don't break the behavior of the base classes defined here. Since there is no good mechanism to handle such extending in several steps, pike libraries should preferably ensure that the base classes defined here provide required functionality directly.

  Note

    Since resolving using the dot operator in e.g. Val.null is done at compile time, replacement of these values often must take place very early (typically in a loader before the bulk of the pike code is compiled) to be effective in such cases. For this reason, pike libraries should use dynamic resolution through e.g. `->` or `master()->resolv()` instead.

    `True Val.true`
    `False Val.false`

  Description

    Objects that represents the boolean values true and false. In a boolean context these evaluate to true and false, respectively.

    They produce `1` and `0`, respectively, when cast to integer, and `"1"` and `"0"` when cast to string. They do however not compare as equal to the integers 1 and 0, or any other values. Val.true only compares (and hashes) as equal with other instances of True (although there should be as few as possible). Similarly, Val.false is only considered equal to other False instances.

    Protocols.JSON uses these objects to represent the JSON literals `true` and `false`.

  Note

    The correct way to programmatically recognize these values is something like

    if (objectp(something) && something->is_val_true) ...

  and

      if (objectp(something) && something->is_val_false) ...

  respectively. See Val.null for rationale.

Variable null

  `Null Val.null`

Description

  Object that represents a null value.

  In general, null is a value that represents the lack of a real value in the domain of some type. For instance, in a type system with a null value, a variable of string type typically can hold any string and also null to signify no string at all (which is different from the empty string). Pike natively uses the integer 0 (zero) for this, but since 0 also is a real integer it is sometimes necessary to have a different value for null, and then this object is preferably used.

  This object is false in a boolean context. It does not cast to anything, and it is not equal to anything else but other instances of Null (which should be avoided).

  This object is used by the Sql module to represent SQL NULL, and it is used by Protocols.JSON to represent the JSON literal `null`.

Note

  Do not confuse the null value with UNDEFINED . Although UNDEFINED often is used to represent the lack of a real value, and it can be told apart from an ordinary zero integer with some effort, it is transient in nature (for instance, it automatically becomes an ordinary zero when inserted in a mapping). That makes it unsuitable for use as a reliable null value.

Note

  The correct way to programmatically recognize Val.null is something like

  if (objectp(something) && something->is_val_null) ...

That way it's possible for other code to replace it with an extended class, or create their own variants which needs to behave like Val.null .

FIXME

  The Oracle glue currently uses static null objects which won't be affected if this object is replaced.

CLASS Val.True

  Description

    Type for the Val.true object. Do not create more instances of this - use Val.true instead.

  Constant is_val_true

    `constant Val.True.is_val_true`

  Description

    Nonzero recognition constant.

CLASS Val.False

  Description

    Type for the Val.false object. Do not create more instances of this - use Val.false instead.

  Constant is_val_false

    `constant Val.False.is_val_false`

  Description

    Nonzero recognition constant.

CLASS Val.Null

  Description

    Type for the Val.null object. Do not create more instances of this - use Val.null instead.

  Inherit SqlNull

    inherit Builtin.SqlNull : SqlNull

  Constant is_val_null

    `constant Val.Null.is_val_null`

  Description

    Nonzero recognition constant.

Module Int

  Method parity

    `int(0..1) parity(int(0..) value)`

  Description

    Returns the parity of the integer value . If the parity is odd 1 is returned. If it is even 0 is returned.

    `constant Int.NATIVE_MIN`
    `constant Int.NATIVE_MAX`

  Description

    The limits for using the native representation of integers on the current architecture. Any integer that is outside this range uses a more complex and slower representation. Also, some builtin functions that don't expect very large integers might start to complain about invalid argument type when given values outside this range (they typically say something like "Expected integer, got object").

    NATIVE_MIN is not greater than `-2147483648` (`-0x80000000`).

    NATIVE_MAX is not less than `2147483647` (`0x7fffffff`).

  Note

    The size of the native integers can be controlled when Pike is compiled with the configure flags `--with-int-int`, `--with-long-int`, and `--with-long-long-int`. The default is to use the longest available integer type that fits inside a pointer, which typically means that it's 64 bit on "true" 64 bit architectures.

  Note

    If Pike is compiled with the configure flag `--without-bignum` (which is discouraged), then all arithmetic operations will instead silently wrap around at these limits.

  Method swap_word

    `int(0..65535) swap_word(int(0..65535) i)`

  Description

    Swaps the upper and lower byte in a word.

  See also

    swap_long()

  Method swap_long

    `int(0..4294967295) swap_long(int(0..4294967295) i)`

  Description

    Swaps the upper and lower word in a longword, and the upper and lower bytes in the words. Simply put, the bytes are reversed.

  See also

    swap_word()

  Method reflect

    `int(0..) reflect(int value, int(0..) bits)`

  Description

    Reverses the order of the low order bits number of bits of the value value .

  Note

    Any higher order bits of the value will be cleared. The returned value will thus be unsigned.

  See also

    reverse() , swap_word() , swap_long()

  Variable inf

    `Inf Int.inf`

  Description

    An infinite number.

Module Object

  Description

    $Id: 86fe86bd14bf93c51c3a7758b6dbc05c6fab202b $

    `constant Object.DESTRUCT_EXPLICIT`
    `constant Object.DESTRUCT_NO_REFS`
    `constant Object.DESTRUCT_GC`
    `constant Object.DESTRUCT_CLEANUP`

  Description

    Flags passed to lfun::destroy .

  Note

    Object.DESTRUCT_EXPLICIT is `0` and Object.DESTRUCT_CLEANUP is `1` for compatibility.

Module Float

    `constant Float.DIGITS_10`
    `constant Float.MIN_10_EXP`
    `constant Float.MAX_10_EXP`
    `constant Float.MIN`
    `constant Float.MAX`
    `constant Float.EPSILON`

  Description

    These constants define the limits for floats on the current architecture:

    DIGITS_10

      The number of decimal digits that can be represented. Any number with this many decimal digits can be stored in a float and converted back to decimal form without change. DIGITS_10 is not less than `6`.

    MIN_10_EXP
    MAX_10_EXP

      Limits of the exponent in decimal base. 10 raised to any number within this range can be represented in normalized form. MIN_10_EXP is not greater than `-37`. MAX_10_EXP is not less than `37`.

    MIN

      The smallest normalized float greater than zero. It's not greater than `1e-37`.

    MAX

      The largest finite float. It's not less than `1e37`.

    EPSILON

      The difference between 1 and the smallest value greater than 1 that can be represented. It's not greater than `1e-5`.

  Note

    The size of the float type can be controlled when Pike is compiled with the configure flags `--with-double-precision` and `--with-long-double-precision`. The default is to use the longest available float type that fits inside a pointer.

    `constant Float.FLOAT_PRECISION`
    `constant Float.DOUBLE_PRECISION`
    `constant Float.LONG_DOUBLE_PRECISION`

  Description

    Tells which C compiler float type that is used for Pike floats. Only one of these constants will exist (with the value `1`) at runtime.

    FLOAT_PRECISION

      The `float` type of the C compiler is used.

    DOUBLE_PRECISION

      The `double` type of the C compiler is used.

    LONG_DOUBLE_PRECISION

      The `long double` type of the C compiler is used.

  Note

    The float type can be controlled when Pike is compiled with the configure flags `--with-double-precision` and `--with-long-double-precision`. The default is to use the longest available float type that fits inside a pointer.

  Method isnan

    `int(0..1) isnan(float x)`

  Description

    Returns true if x is nan.

Module Colors

  Method rgb_to_hsv

    `array(int(0..255)) rgb_to_hsv(array(int(0..255)) rgb)`
    `array(int(0..255)) rgb_to_hsv(int(0..255) r, int(0..255) g, int(0..255) b)`

  Description

    This function returns the HSV value of the color described by the provided RGB value. It is essentially calling Image.Color.rgb(r,g,b)->hsv().

  See also

    Colors.hsv_to_rgb() Image.Color.Color.hsv()

  Method hsv_to_rgb

    `array(int(0..255)) hsv_to_rgb(array(int(0..255)) hsv)`
    `array(int(0..255)) hsv_to_rgb(int(0..255) h, int(0..255) s, int(0..255) v)`

  Description

    This function returns the RGB value of the color described by the provided HSV value. It is essentially calling Image.Color.hsv(h,s,v)->rgb().

  See also

    Colors.rgb_to_hsv() Image.Color.hsv()

  Method rgb_to_cmyk

    `array(int(0..100)) rgb_to_cmyk(array(int(0..255)) rgb)`
    `array(int(0..100)) rgb_to_cmyk(int(0..255) r, int(0..255) g, int(0..255) b)`

  Description

    This function returns the CMYK value of the color described by the provided RGB value. It is essentially calling Image.Color.rgb(r,g,b)->cmyk().

  See also

    Colors.cmyk_to_rgb() Image.Color.Color.cmyk()

  Method cmyk_to_rgb

    `array(int(0..255)) cmyk_to_rgb(array(int(0..100)) cmyk)`
    `array(int(0..255)) cmyk_to_rgb(int(0..100) c, int(0..100) m, int(0..100) y, int(0..100) k)`

  Description

    This function return the RGB value of the color describe by the provided CMYK value. It is essentially calling Image.Color.cmyk(c,m,y,k)->rgb()

  See also

    Colors.rgb_to_cmyk() Image.Color.cmyk()

  Method parse_color

    `array(int(0..255)) parse_color(string name, void|array(int) def)`

  Description

    This function returns the RGB values that corresponds to the color that is provided by name to the function. It is essentially calling Image.Color.guess() , but returns the default value (or black if none is provided) if it failes.

  Method color_name

    `string color_name(array(int(0..255)) rgb)`

  Description

    Tries to find a name to color described by the provided RGB values. Partially an inverse function to Colors.parse_color() , although it can not find all the names that Colors.parse_color() can find RGB values for. Returns the colors rgb hex value prepended with "#" upon failure.

Module Local

  Description

    Local gives a local module namespace used for locally installed pike modules. Modules are searched for in the directory `pike_modules` which can be located in the user's home directory or profile directory, or in any of the system directories `/opt/share, /usr/local/share, /opt` or `/usr/local/`. The user's home directory is determined by examining the environment variable HOME, and if that fails the environment variable USERPROFILE. If the environment variable PIKE_LOCAL_PATH is set, the paths specified there will be searched first.

  See also

    Local.add_path() , Local.remove_path()

  Inherit __joinnode

    inherit __joinnode : __joinnode

  Method add_path

    `int(0..1) add_path(string path)`

  Description

    This function prepends path to the Local module searchpath.

  Parameter `path`

    The path to the directory to be added.

  Returns

    Returns 1 on success, otherwise 0.

  Method remove_path

    `void remove_path(string path)`

  Description

    This function removes path from the Local module searchpath. If path is not in the search path, this is a noop.

  Parameter `path`

    The path to be removed.

Namespace 7.4::

  Description

    Pike 7.4 compatibility.

    The symbols in this namespace will appear in programs that use `#pike 7.4` or lower.

  Method hash

    `int hash(string s)`
    `int hash(string s, int max)`

  Description

    Return an integer derived from the string s . The same string will always hash to the same value, also between processes.

    If max is given, the result will be >= 0 and < max , otherwise the result will be >= 0 and <= 0x7fffffff.

  Note

    This function is provided for backward compatibility reasons.

    This function is byte-order dependant for wide strings.

  See also

    hash() , 7.0::hash()

  Inherit

    inherit 7.6:: :

  Method rusage

    `array(int) rusage()`

  Description

    Return resource usage. An error is thrown if it isn't supported or if the system fails to return any information.

  Returns

    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:

    Array
    `int user_time` | Time in milliseconds spent in user code.
    `int system_time` | Time in milliseconds spent in system calls.
    `int maxrss` | Maximum used resident size in kilobytes.
    `int ixrss` | Quote from GNU libc: An integral value expressed in kilobytes times ticks of execution, which indicates the amount of memory used by text that was shared with other processes.
    `int idrss` | Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for data.
    `int isrss` | Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for stack space.
    `int minor_page_faults` | Minor page faults, i.e. TLB misses which required no disk I/O.
    `int major_page_faults` | Major page faults, i.e. paging with disk I/O required.
    `int swaps` | Number of times the process has been swapped out entirely.
    `int block_input_op` | Number of block input operations.
    `int block_output_op` | Number of block output operations.
    `int messages_sent` | Number of IPC messsages sent.
    `int messages_received` | Number of IPC messsages received.
    `int signals_received` | Number of signals received.
    `int voluntary_context_switches` | Number of voluntary context switches (usually to wait for some service).
    `int involuntary_context_switches` | Number of preemptions, i.e. context switches due to expired time slices, or when processes with higher priority were scheduled.
    `int sysc` | Number of system calls.
    `int ioch` | Number of characters read and written.
    `int rtime` | Elapsed real time (ms).
    `int ttime` | Elapsed system trap (system call) time (ms).
    `int tftime` | Text page fault sleep time (ms).
    `int dftime` | Data page fault sleep time (ms).
    `int kftime` | Kernel page fault sleep time (ms).
    `int ltime` | User lock wait sleep time (ms).
    `int slptime` | Other sleep time (ms).
    `int wtime` | Wait CPU (latency) time (ms).
    `int stoptime` | Time spent in stopped (suspended) state.
    `int brksize` | Heap size.
    `int stksize` | Stack size.

    The values will not be further explained here; read your system manual for more information.

  Note

    All values may not be present on all systems.

  Deprecated
  See also

    time() , System.getrusage()

  Module SSL

    CLASS SSL.constants

      Description

        Protocol constants

      Deprecated

    CLASS SSL.cipher

      Description

        Encryption and MAC algorithms used in SSL.

      Deprecated

      Inherit "constants"

        inherit "constants"

    CLASS SSL.sslfile

      Description

        Interface similar to Stdio.File.

      Inherit "cipher"

        inherit "cipher"

      Inherit connection

        inherit SSL.connection : connection

  Module Locale

    Module Locale.Charset

      Inherit Charset

        inherit Locale.Charset : Charset

      Constant _encoder

        `constant Locale.Charset._encoder`

      Deprecated

      CLASS Locale.Charset.ascii

        Description

          This class does not exist in the Locale module in Pike 7.6.

        Deprecated

  Module ADT

    CLASS ADT.Heap

      Inherit Heap

        inherit ADT.Heap : Heap

      Method top

        `mixed top()`

      Description

        This method has been renamed to `pop` in Pike 7.6.

      Deprecated

  Module Standards

    Module Standards.PKCS

      Module Standards.PKCS.Signature

        Inherit Signature

          inherit Standards.PKCS.Signature : Signature

        Method build_digestinfo

          `string build_digestinfo(string msg, object hash)`

        Description

          In Pike 7.6 the hash is required to be a Crypto.Hash object.

    Module Standards.ASN1

      Module Standards.ASN1.Encode

        Description

          This module is obsolete. All code should use ASN1.Types instead.

  Module Crypto

    Method crypt_md5

      `string crypt_md5(string pw, void|string salt)`

    Description

      From Pike 7.5 pw and salt are binary strings, so the result is different if any of these includes `"\0"`.

      The return type is also changed from string to int|string. If the second argument is a hash, pw will be hashed with the salt from the hash and compared with the hash.

    Constant string_to_hex

      `constant Crypto.string_to_hex`

    Deprecated

    Constant hex_to_string

      `constant Crypto.hex_to_string`

    Deprecated

    Method des_parity

      `string des_parity(string s)`

    Description

      des_parity is removed. Instead there is Crypto.DES->fix_parity , but it always outputs a key sized string.

    CLASS Crypto.md2

      Deprecated

      Inherit MD2_State

        inherit Nettle.MD2_State : MD2_State

    CLASS Crypto.hmac

      Deprecated

      Inherit HMAC

        inherit Crypto.HMAC : HMAC

    CLASS Crypto.crypto

      Deprecated

      Inherit Proxy

        inherit Nettle.Proxy : Proxy

    CLASS Crypto.dsa

      Deprecated

    CLASS Crypto.invert

      Description

        Inversion crypto module.

      Method name

        `string name()`

      Description

        Returns the string `"INVERT"`.

      Method query_block_size

        `int(8..8) query_block_size()`

      Description

        Returns the block size for the invert crypto (currently 8).

      Method query_key_length

        `int(0..0) query_key_length()`

      Description

        Returns the minimum key length for the invert crypto.

        Since this crypto doesn't use a key, this will be 0.

      Method set_encrypt_key

        `void set_encrypt_key(string key)`

      Description

        Set the encryption key (currently a no op).

      Method set_decrypt_key

        `void set_decrypt_key(string key)`

      Description

        Set the decryption key (currently a no op).

      Method crypt_block

        `string crypt_block(string data)`

      Description

        De/encrypt the string data with the invert crypto (ie invert the string).

    CLASS Crypto.md5

      Deprecated

      Inherit MD5_State

        inherit Nettle.MD5_State : MD5_State

    CLASS Crypto.rsa

      Deprecated

      Inherit RSA

        inherit Crypto.RSA : RSA

    CLASS Crypto.rijndael

      Deprecated

      Inherit AES_State

        inherit Nettle.AES_State : AES_State

    CLASS Crypto.des_cbc

      Description

        Use `Crypto.CBC(Crypto.DES)` instead.

      Deprecated

      Inherit CBC

        inherit Nettle.CBC : CBC

    CLASS Crypto.idea

      Deprecated

      Inherit IDEA_State

        inherit Nettle.IDEA_State : IDEA_State

    CLASS Crypto.des

      Deprecated

      Inherit DES_State

        inherit Nettle.DES_State : DES_State

    CLASS Crypto.aes

      Deprecated

      Inherit AES_State

        inherit Nettle.AES_State : AES_State

    CLASS Crypto.sha

      Deprecated

      Inherit SHA1_State

        inherit Nettle.SHA1_State : SHA1_State

    CLASS Crypto.cbc

      Deprecated

      Inherit CBC

        inherit Nettle.CBC : CBC

    CLASS Crypto.cast

      Deprecated

      Inherit CAST128_State

        inherit Nettle.CAST128_State : CAST128_State

    CLASS Crypto.arcfour

      Deprecated

      Inherit ARCFOUR_State

        inherit Nettle.ARCFOUR_State : ARCFOUR_State

    CLASS Crypto.substitution

      Deprecated

      Inherit Substitution

        inherit Crypto.Substitution : Substitution

    CLASS Crypto.des3

      Deprecated

      Inherit DES3_State

        inherit Nettle.DES3_State : DES3_State

    CLASS Crypto.des3_cbc

      Description

        Use `Crypto.CBC(Crypto.DES3)` instead.

      Deprecated

      Inherit CBC

        inherit Nettle.CBC : CBC

    CLASS Crypto.md4

      Deprecated

      Inherit MD4_State

        inherit Nettle.MD4_State : MD4_State

    CLASS Crypto.idea_cbc

      Description

        Use `Crypto.CBC(Crypto.IDEA)` instead.

      Deprecated

      Inherit CBC

        inherit Nettle.CBC : CBC

    Module Crypto.randomness

      Description

        Assorted stronger or weaker randomnumber generators. These devices try to collect entropy from the environment. They differ in behaviour when they run low on entropy, /dev/random will block if it can't provide enough random bits, while /dev/urandom will degenerate into a reasonably strong pseudo random generator

      Deprecated

      Method some_entropy

        `string some_entropy()`

      Description

        Executes several programs (last -256, arp -a, netstat -anv, netstat -mv, netstat -sv, uptime, ps -fel, ps aux, vmstat -s, vmstat -M, iostat, iostat -cdDItx) to generate some entropy from their output. On Microsoft Windows the Windows cryptographic routines are called to generate random data.

      Method reasonably_random

        `RandomSource reasonably_random()`

      Description

        Returns a reasonably random random-source.

      Method really_random

        `RandomSource really_random(int|void may_block)`

      Description

        Returns a really random random-source.

      CLASS Crypto.randomness.RandomSource

        Description

          Virtual class for randomness source object.

        Method read

          `string read(int(0..) len)`

        Description

          Returns a string of length len with (pseudo) random values.

      CLASS Crypto.randomness.arcfour_random

        Description

          A pseudo random generator based on the arcfour crypto.

        Inherit ARCFOUR_State

          inherit Nettle.ARCFOUR_State : ARCFOUR_State

        Method create

          `void Crypto.randomness.arcfour_random(string secret)`

        Description

          Initialize and seed the arcfour random generator.

        Method read

          `string read(int len)`

        Description

          Return a string of the next len random characters from the arcfour random generator.

    Module Crypto.koremutake

      Deprecated

      Inherit Koremutake

        inherit Crypto.Koremutake : Koremutake

  Module Sql

    CLASS Sql.sql

      Deprecated

      Inherit Sql

        inherit Sql.Sql : Sql

  Module Protocols

    Module Protocols.SMTP

      CLASS Protocols.SMTP.protocol

        Deprecated

        Inherit Protocol

          inherit Protocols.SMTP.Protocol : Protocol

      CLASS Protocols.SMTP.client

        Deprecated

        Inherit Client

          inherit Protocols.SMTP.Client : Client

  Module Stdio

    CLASS Stdio.File

      Description

        The life length of the Fd instance has changed. In newer versions it's always the same as for the File instance. That can theoretically cause incompatibilities in code that uses File.dup and File.assign, which are deprecated and very rarely used.

      Inherit File

        inherit Stdio.File : File

  Module Thread

    Inherit Thread

      inherit Thread : Thread

    Constant Mutex

      `constant Thread.Mutex`

    Description

      The Mutex destruct behaviour in Pike 7.4 and below is different from 7.6 in that destructing a mutex destroys the key that is locking it.

  Module Array

    Inherit Array

      inherit Array : Array

    Method diff3_old

      `array(array(array)) diff3_old(array mid, array left, array right)`

    Description

      This diff3 implementation is obsoleted by Array.diff3 .

    Deprecated

Namespace 7.0::

  Description

    Pike 7.0 compatibility.

    The symbols in this namespace will appear in programs that use `#pike 7.0` or lower.

  See also

    7.2::

  Method hash

    `int hash(string s)`
    `int hash(string s, int max)`

  Description

    Return an integer derived from the string s . The same string always hashes to the same value, also between processes.

    If max is given, the result will be >= 0 and < max , otherwise the result will be >= 0 and <= 0x7fffffff.

  Note

    This function is provided for backward compatibility reasons.

    This function is not NUL-safe, and is byte-order dependant.

  See also

    hash() , 7.4::hash()

  Inherit

    inherit 7.2:: :

  Method file_stat

    `array(int) file_stat(string path, void|int symlink)`

  Description

    Stat a file (Pike 7.0 compatibility).

  Returns

    Returns an array with the following content:

    Array
    `int mode` | Access mode.
    `int size` | Size in bytes, or filetype indicator.
    `int atime` | Last access time.
    `int mtime` | Last modification time.
    `int ctime` | Last change time.
    `int uid` | User id.
    `int gid` | Group id.

    See predef::file_stat() for a full description of the array.

  See also

    predef::file_stat()

  Method _typeof

    `string _typeof(mixed x)`

  Description

    Get the runtime type of a value (Pike 7.0 compatibility).

  Returns

    Returns the type of x as a string.

  See also

    predef::_typeof()

  Method m_delete

    `mapping m_delete(mapping m, mixed x)`

  Description

    Delete an entry x from a mapping m (Pike 7.0 compatibility).

  Returns

    Returns m .

  See also

    predef::m_delete()

  Method hash

    `int hash(string s, int|void f)`

  Description

    Calculate a hash of a string (Pike 7.0 compatibility).

    This function is now available as predef::hash_7_0() .

  See also

    predef::hash_7_0() , predef::hash()

  Module Calendar

    Description

      This module implements calendar calculations, and base classes for time units.

      This module exists only for backward compatibility with Pike 7.0.

    CLASS Calendar._TimeUnit

      Description

        Base class for units of time.

      Method lesser

        `array(string) lesser()`

      Description

        Gives a list of methods to get lesser (shorter) time units. ie, for a month, this gives back `({"day"})` and the method `day(mixed n)` gives back that day object. The method `days()` gives back a list of possible argument values to the method `day`. Concurrently, `Array.map(o->days(),o->day)` gives a list of day objects in the object `o`.

        Ie:

            	  array(string) lesser()    - gives back a list of possible xxx's.
            	  object xxxs()             - gives back a list of possible n's.
            	  object xxx(mixed n)       - gives back xxx n
            	  object xxx(object(Xxx) o) - gives back the corresponing xxx

        The list of n's (as returned from xxxs) are always in order.

        There are two n's with special meaning, 0 and -1. 0 always gives the first xxx, equal to my_obj->xxx(my_obj->xxxs()[0]), and -1 gives the last, equal to my_obj->xxx(my_obj->xxxs()[-1]).

        To get all xxxs in the object, do something like `Array.map(my_obj->xxxs(),my_obj->xxx)`.

        xxx(object) may return zero, if there was no correspondning xxx.

      Method greater

        `array(string) greater()`

      Description

        Gives a list of methods to get greater (longer) time units from this object. For a month, this gives back `({"year"})`, thus the method `month->year()` gives the year object.

      Method next
      Method prev
      Method `+
      Method `-

        `object next()`
        `object prev()`
        `object `+(int n)`
        `object `-(int n)`
        `object `-(object x)`

      Description

        next() and prev() give the logical next and previous object. The `+() operator gives that logical relative object, ie `my_day+14` gives 14 days ahead. `-() works the same way, but can also take an object of the same type and give the difference as an integer.

    Module Calendar.Stardate

      Description

        time unit: TNGDate

      CLASS Calendar.Stardate.TNGDate

        Description

          Implements ST:TNG stardates. Can be used as create argument to Day.

        Inherit _TimeUnit

          inherit Calendar._TimeUnit : _TimeUnit

    Module Calendar.Gregorian

      Description

        time units: <ref>Year</ref>, <ref>Month</ref>, <ref>Week</ref>, <ref>Day</ref>

      Method parse

        `object parse(string fmt, string arg)`

      Description

        parse a date, create relevant object fmt is in the format "abc%xdef..." where abc and def is matched, and %x is one of those time units: %Y absolute year %y year (70-99 is 1970-1999, 0-69 is 2000-2069) %M month (number, name or short name) (needs %y) %W week (needs %y) %D date (needs %y, %m) %a day (needs %y) %e weekday (needs %y, %w) %h hour (needs %d, %D or %W) %m minute (needs %h) %s second (needs %s)

      Method datetime

        `mapping(string:int) datetime(int|void unix_time, int|void skip_extra)`

      Description

        Replacement for localtime() .

      Method datetime_name

        `string datetime_name(int|void unix_time)`

      Description

        Replacement for ctime() .

      Method datetime_short_name

        `string datetime_short_name(int|void unix_time)`

      Description

        Replacement for ctime.

      CLASS Calendar.Gregorian.Year

        Description

          A Calendar._TimeUnit .

          Lesser units: <ref>Month</ref>, <ref>Week</ref>, <ref>Day</ref> Greater units: none

        Inherit _TimeUnit

          inherit _TimeUnit : _TimeUnit

Namespace lfun::

  Description

    Callback functions used to overload various builtin functions.

    The functions can be grouped into a few sets:

    - Object initialization and destruction.

      __INIT() , create() , destroy()

    - Unary operator overloading.

      `~() , `!() , _values() , cast() , _sizeof() , _indices() , __hash()

    - Binary asymmetric operator overloading.

      `+() , ``+() , `-() , ``-() , `&() , ``&() , `|() , ``|() , `^() , ``^() , `<<() , ``<<() , `>>() , ``>>() , `*() , ``*() , `/() , ``/() , `%() , ``%()

    - Binary symmetric operator overloading.

      The optimizer will make assumptions about the relations between these functions.

      `==() , _equal() , `<() , `>()

    - Other binary operator overloading.

      `[]() , `[]=() , `->() , `->=() , `+=() , `()()

    - Overloading of other builtin functions.

      _is_type() , _sprintf() , _m_delete() , _get_iterator() , _search()

  Note

    Although these functions are called from outside the object they exist in, they will still be used even if they are declared `protected`. It is in fact recommended to declare them `protected`, since that will hinder them being used for other purposes.

  See also

    ::

  Method _sqrt

    `mixed _sqrt()`

  Description

    Called by sqrt when the square root of an object is requested.

  Note

    _sqrt is not a real lfun, so it must not be defined as static.

  See also

    predef::sqrt()

  Method _random

    `mixed _random()`

  Description

    Called by random . Typical uses is when the object implements a ADT, then a call to this lfun should return a random member of the ADT or range implied by the ADT.

  See also

    predef::random()

  Method __INIT

    `void __INIT()`

  Description

    Inherit and variable initialization.

    This function is generated automatically by the compiler. It's called just before lfun::create() when an object is instantiated.

    It first calls any `__INIT` functions in inherited classes (regardless of modifiers on the inherits). It then executes all the variable initialization expressions in this class, in the order they occur.

  Note

    This function can not be overloaded or blocked from executing.

  See also

    lfun::create()

  Method create

    `void lfun:(zero ... args)`

  Description

    Object creation callback.

    This function is called right after lfun::__INIT() .

    args are the arguments passed when the program was called.

  Note

    In Pike 7.2 and later this function can be created implicitly by the compiler using the new syntax:

    class Foo(int foo) { int bar; }

  In the above case an implicit lfun::create() is created, and it's equvivalent to:

      class Foo {
         int foo;
         int bar;
         protected void create(int foo)
         {
           local::foo = foo;
         }
       }

See also

  lfun::__INIT() , lfun::destroy()

Method destroy

  `void destroy(void|int reason)`

Description

  Object destruction callback.

  This function is called right before the object is destructed. That can happen either through a call to predef::destruct() , when there are no more references to the object, or when the garbage collector discovers that it's part of a cyclic data structure that has become garbage.

Parameter `reason`

  A flag that tells why the object is destructed:

  `Object.DESTRUCT_EXPLICIT` | Destructed explicitly by predef::destruct .
  `Object.DESTRUCT_NO_REFS` | Destructed due to running out of references.
  `Object.DESTRUCT_GC` | Destructed by the garbage collector.
  `Object.DESTRUCT_CLEANUP` | Destructed as part of the cleanup when the pike process exits. Occurs only if Pike has been compiled with the configure option `--with-cleanup-on-exit`. See note below.

Note

  Objects are normally not destructed when a process exits, so `destroy` functions aren't called then. Use atexit to get called when the process exits.

Note

  Regarding destruction order during garbage collection:

  If an object is destructed by the garbage collector, it's part of a reference cycle with other things but with no external references. If there are other objects with `destroy` functions in the same cycle, it becomes a problem which to call first.

  E.g. if this object has a variable with another object which (directly or indirectly) points back to this one, you might find that the other object already has been destructed and the variable thus contains zero.

  The garbage collector tries to minimize such problems by defining an order as far as possible:

  - If an object A contains an lfun::destroy and an object B does not, then A is destructed before B.

  - If A references B single way, then A is destructed before B.

  - If A and B are in a cycle, and there is a reference somewhere from B to A that is weaker than any reference from A to B, then A is destructed before B.

  - If a cycle is resolved according to the rule above by ignoring a weaker reference, and there is another ambiguous cycle that would get resolved by ignoring the same reference, then the latter cycle will be resolved by ignoring that reference.

  - Weak references (e.g. set with predef::set_weak_flag() ) are considered weaker than normal references, and both are considered weaker than strong references.

  - Strong references are those from objects to the objects of their lexically surrounding classes. There can never be a cycle consisting only of strong references. (This means the gc never destructs a parent object before all children have been destructed.)

  An example with well defined destruct order due to strong references:

  class Super { class Sub { protected void destroy() { if (!Super::this) error ("My parent has been destructed!\n"); } } Sub sub = Sub(); protected void destroy() { if (!sub) werror ("sub already destructed.\n"); } }

The garbage collector ensures that these objects are destructed in an order so that `werror` in `Super` is called and not `error` in `Sub`.

Note

  When the garbage collector calls lfun::destroy , all accessible non-objects and objects without `destroy` functions are still intact. They are not freed if the `destroy` function adds external references to them. However, all objects with lfun::destroy in the cycle are already scheduled for destruction and will therefore be destroyed even if external references are added to them.

Note

  The garbage collector had completely random destruct order in versions prior to 7.2.

See also

  lfun::create() , predef::destruct()

Method `+

  `mixed `+(zero arg, zero ... rest)`

Description

  Left side addition/concatenation callback.

  This is used by predef::`+ . It's called with any arguments that follow this object in the argument list of the call to predef::`+ . The returned value should be a new instance that represents the addition/concatenation between this object and the arguments in the order they are given.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``+() , lfun::`+=() , predef::`+()

Method `+=

  `this_program `+=(zero arg, zero ... rest)`

Description

  Destructive addition/concatenation callback.

  This is used by predef::`+ . It's called with any arguments that follow this object in the argument list of the call to predef::`+ . It should update this object to represent the addition/concatenation between it and the arguments in the order they are given. It should always return this object.

Note

  This function should only be implemented if lfun::`+() also is. It should only work as a more optimized alternative to that one, for the case when it's safe to change the object destructively and use it directly as the result.

Note

  This function is not an lfun for the `+=` operator. It's only whether or not it's safe to do a destructive change that decides if this function or lfun::`+() is called; both the `+` operator and the `+=` operator can call either one.

See also

  lfun::`+() , predef::`+()

Method ``+

  `mixed ``+(zero arg, zero ... rest)`

Description

  Right side addition/concatenation callback.

  This is used by predef::`+ . It's called with any arguments that precede this object in the argument list of the call to predef::`+ . The returned value should be a new instance that represents the addition/concatenation between the arguments in the order they are given and this object.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`+() , predef::`+()

Method `-

  `mixed `-(void|zero arg)`

Description

  Negation and left side subtraction/set difference callback.

  This is used by predef::`- . When called without an argument the result should be a new instance that represents the negation of this object, otherwise the result should be a new instance that represents the difference between this object and arg .

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``-() , predef::`-()

Method ``-

  `mixed ``-(zero arg)`

Description

  Right side subtraction/set difference callback.

  This is used by predef::`- . The result should be a new instance that represents the difference between arg and this object.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`-() , predef::`-()

Method `&

  `mixed `&(zero ... args)`

Description

  Left side bitwise and/intersection callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``&() , predef::`&()

Method ``&

  `mixed ``&(zero ... args)`

Description

  Right side bitwise and/intersection callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`&() , predef::`&()

Method `|

  `mixed `|(zero ... args)`

Description

  Left side bitwise or/union callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``|() , predef::`|()

Method ``|

  `mixed ``|(zero ... args)`

Description

  Right side bitwise or/union callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`|() , predef::`|()

Method `^

  `mixed `^(zero ... args)`

Description

  Left side exclusive or callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``^() , predef::`^()

Method ``^

  `mixed ``^(zero ... args)`

Description

  Right side exclusive or callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`^() , predef::`^()

Method `<<

  `mixed `<<(zero arg)`

Description

  Left side left shift callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``<<() , predef::`<<()

Method ``<<

  `mixed ``<<(zero arg)`

Description

  Right side left shift callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`<<() , predef::`<<()

Method `>>

  `mixed `>>(zero arg)`

Description

  Left side right shift callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``>>() , predef::`>>()

Method ``>>

  `mixed ``>>(zero arg)`

Description

  Right side right shift callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`>>() , predef::`>>()

Method `*

  `mixed `*(zero ... args)`

Description

  Left side multiplication/repetition/implosion callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``*() , predef::`*()

Method ``*

  `mixed ``*(zero ... args)`

Description

  Right side multiplication/repetition/implosion callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`*() , predef::`*()

Method `/

  `mixed `/(zero ... args)`

Description

  Left side division/split callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``/() , predef::`/()

Method ``/

  `mixed ``/(zero ... args)`

Description

  Right side division/split callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`/() , predef::`/()

Method `%

  `mixed `%(zero ... args)`

Description

  Left side modulo callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::``%() , predef::`%()

Method ``%

  `mixed ``%(zero ... args)`

Description

  Right side modulo callback.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`%() , predef::`%()

Method `!

  `int `!()`

Description

  Logical not callback.

Returns

  Returns non-zero if the object should be evaluated as false, and `0` (zero) otherwise.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`!()

Method `~

  `mixed `~()`

Description

  Complement/inversion callback.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`~()

Method `==

  `int(0..1) `==(mixed arg)`

Description

  Equality test callback.

Note

  If this is implemented it might be necessary to implement lfun::__hash too. Otherwise mappings might hold several objects as indices which are duplicates according to this function. Various other functions that use hashing also might not work correctly, e.g. predef::Array.uniq .

Note

  It's assumed that this function is side-effect free.

See also

  predef::`==() , lfun::__hash

Method `<

  `int(0..1) `<(mixed arg)`

Description

  Less than test callback.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`<()

Method `>

  `int(0..1) `>(mixed arg)`

Description

  Greater than test callback.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`>()

Method __hash

  `int __hash()`

Description

  Hashing callback.

  The main caller of this function is predef::hash_value() or the low-level equvivalent, which get called by various mapping operations when the object is used as index in a mapping.

Returns

  It should return an integer that corresponds to the object in such a way that all values which lfun::`== considers equal to the object get the same hash value.

Note

  The function predef::hash does not return hash values that are compatible with this one.

Note

  It's assumed that this function is side-effect free.

See also

  lfun::`== , predef::hash_value()

Method cast

  `mixed cast(string requested_type)`

Description

  Value cast callback.

Parameter `requested_type`

  Type to cast to.

Returns

  Expected to return the object value-casted (converted) to the type described by requested_type .

Note

  The argument is currently a string with the name of the type, but might in the future be a value of the type type.

Note

  Currently casting between object types is a noop.

Note

  If the returned value is not deemed to be of the requested type a runtime error may be thrown.

Note

  It's assumed that this function is side-effect free.

Method `[..]

  `mixed `[..](zero low, int low_bound_type, zero high, int high_bound_type)`

Description

  Subrange callback.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`[..]

Method `[]

  `mixed `[](zero arg1, zero|void arg2)`

Description

  Indexing callback.

  For compatibility, this is also called to do subranges unless there is a `[..] in the class. See predef::`[..] for details.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`[]() , predef::`[..]

Method `[]=

  `mixed `[]=(zero arg1, zero arg2)`

Description

  Index assignment callback.

See also

  predef::`[]=() , lfun::`->=()

Method `->

  `mixed `->(string arg)`

Description

  Arrow index callback.

Note

  It's assumed that this function is side-effect free.

See also

  predef::`->()

Method `->=

  `mixed `->=(string arg1, zero arg2)`

Description

  Arrow index assignment callback.

See also

  predef::`->=() , lfun::`[]=()

Method _sizeof

  `int _sizeof()`

Description

  Size query callback.

  Called by predef::sizeof() to determine the number of elements in an object. If this function is not present, the number of public symbols in the object will be returned.

Returns

  Expected to return the number of valid indices in the object.

Note

  It's assumed that this function is side-effect free.

See also

  predef::sizeof()

Method _indices

  `array _indices()`

Description

  List indices callback.

Returns

  Expected to return an array with the valid indices in the object.

Note

  It's assumed that this function is side-effect free.

See also

  predef::indices() , lfun::_values()

Method _values

  `array _values()`

Description

  List values callback.

Returns

  Expected to return an array with the values corresponding to the indices returned by lfun::_indices() .

Note

  It's assumed that this function is side-effect free.

See also

  predef::values() , lfun::_indices()

Method `()

  `mixed `()(zero ... args)`

Description

  Apply callback.

See also

  predef::`()

Method _is_type

  `int(0..1) _is_type(string basic_type)`

Description

  Type comparison callback.

  Called by the cast operator to determine if an object simulates a basic type.

Parameter `basic_type`

  One of:

  `"array"`
  `"float"`
  `"function"`
  `"int"`
  `"mapping"`
  `"multiset"`
  `"object"`
  `"program"`
  `"string"`
  `"type"`
  `"void"`
  `"zero"`

  The following five shouldn't occurr, but are here for completeness:

  `"lvalue"`
  `"mapping_data"`
  `"object storage"`
  `"pike_frame"`
  `"unknown"`

Returns

  Expected to return `1` if the object is to be regarded as a simulation of the type specified by basic_type .

Note

  The argument is currently a string with the name of the type, but might in the future be a value of the type type.

Note

  It's assumed that this function is side-effect free.

Method _sprintf

  `string _sprintf(int conversion_type, mapping(string:int)|void params)`

Description

  Sprintf callback.

  This method is called by predef::sprintf() to print objects. If it is not present, printing of the object will not be supported for any conversion-type except for the `%O`-conversion-type, which will output `"object"`.

Parameter `conversion_type`

  One of:

  `'b'` | Signed binary integer.
  `'d'` | Signed decimal integer.
  `'u'` | Unsigned decimal integer.
  `'o'` | Signed octal integer.
  `'x'` | Lowercase signed hexadecimal integer.
  `'X'` | Uppercase signed hexadecimal integer.
  `'c'` | Character. If a fieldsize has been specified this will output the low-order bytes of the integer in network byte order.
  `'f'` | Float.
  `'g'` | Heuristically chosen representation of float.
  `'G'` | Like `%g`, but uses uppercase `E` for exponent.
  `'e'` | Exponential notation float.
  `'E'` | Like `%e`, but uses uppercase `E` for exponent.
  `'s'` | String.
  `'O'` | Any value (debug style).
  `'t'` | Type of the argument.

Parameter `params`

  Conversion parameters. The following parameters may be supplied:

  `"precision" : int` | Precision.
  `"width" : int` | Field width.
  `"flag_left" : int(1..1)` | Indicates that the output should be left-aligned.
  `"indent" : int` | Indentation level in `%O`-mode.

Returns

  Is expected to return a string describing the object formatted according to conversion_type .

Note

  _sprintf() is currently not called for the following conversion-types:

  `'F'` | Binary IEEE representation of float (`%4F` gives single precision, `%8F` gives double precision.)

Note

  This function might be called at odd times, e.g. before lfun::create has been called or when an error has occurred. The reason is typically that it gets called when a backtrace is being formatted to report an error. It should therefore be very robust and not make any assumptions about its own internal state, at least not when conversion_type is `'O'`.

Note

  It's assumed that this function is side-effect free.

See also

  predef::sprintf()

Method _equal

  `int _equal(mixed arg)`

Description

  Recursive equality callback.

Note

  It's assumed that this function is side-effect free.

See also

  predef::equal() , lfun::`==()

Method _m_delete

  `mixed _m_delete(mixed arg)`

Description

  Delete index callback.

See also

  predef::m_delete()

Method _get_iterator

  `predef::Iterator _get_iterator()`

Description

  Iterator creation callback.

  The returned predef::Iterator instance works as a cursor that references a specific item contained (in some arbitrary sense) in this one.

Note

  It's assumed that this function is side-effect free.

See also

  predef::Iterator , predef::get_iterator , predef::foreach()

Method _search

  `mixed _search(mixed needle, mixed|void start)`

Description

  Search callback.

See also

  predef::search()

Method `symbol

  `mixed `symbol()`
  `mixed `symbol()`

Description

  Variable retrieval callback (aka "getter").

Note

  Note that the `symbol` in the name can be any symbol.

Note

  This is not a true LFUN, since it is even more low level!

Note

  This function WILL be called even by inheriting programs when they attempt to access the variable named `symbol`.

See also

  lfun::`->symbol=() , lfun::`->()

Method `symbol=

  `void `symbol=(zero value)`
  `void `symbol=(zero value)`

Description

  Variable assignment callback (aka "setter").

Note

  Note that the `symbol` in the name can be any symbol.

Note

  This is not a true LFUN, since it is even more low level!

Note

  This function WILL be called even by inheriting programs when they attempt to set the variable named `symbol`.

See also

  lfun::`->symbol() , lfun::`->=()

Namespace cpp::

  Constant __VERSION__

    `constant __VERSION__`

  Description

    This define contains the current Pike version as a float. If another Pike version is emulated, this define is updated accordingly.

  See also

    __REAL_VERSION__

  Constant __REAL_VERSION__

    `constant __REAL_VERSION__`

  Description

    This define always contains the version of the current Pike, represented as a float.

  See also

    __VERSION__

  Constant __MAJOR__

    `constant __MAJOR__`

  Description

    This define contains the major part of the current Pike version, represented as an integer. If another Pike version is emulated, this define is updated accordingly.

  See also

    __REAL_MAJOR__

  Constant __REAL_MAJOR__

    `constant __REAL_MAJOR__`

  Description

    This define always contains the major part of the version of the current Pike, represented as an integer.

  See also

    __MAJOR__

  Constant __MINOR__

    `constant __MINOR__`

  Description

    This define contains the minor part of the current Pike version, represented as an integer. If another Pike version is emulated, this define is updated accordingly.

  See also

    __REAL_MINOR__

  Constant __REAL_MINOR__

    `constant __REAL_MINOR__`

  Description

    This define always contains the minor part of the version of the current Pike, represented as an integer.

  See also

    __MINOR__

  Constant __BUILD__

    `constant __BUILD__`

  Description

    This constant contains the build number of the current Pike version, represented as an integer. If another Pike version is emulated, this constant remains unaltered.

  See also

    __REAL_MINOR__

  Constant __REAL_BUILD__

    `constant __REAL_BUILD__`

  Description

    This define always contains the minor part of the version of the current Pike, represented as an integer.

  See also

    __BUILD__

  Constant __LINE__

    `constant __LINE__`

  Description

    This define contains the current line number, represented as an integer, in the source file.

  Constant __FILE__

    `constant __FILE__`

  Description

    This define contains the file path and name of the source file.

  Constant __DIR__

    `constant __DIR__`

  Description

    This define contains the directory path of the source file.

  Constant __DATE__

    `constant __DATE__`

  Description

    This define contains the current date at the time of compilation, e.g. "Jul 28 2001".

  Constant __TIME__

    `constant __TIME__`

  Description

    This define contains the current time at the time of compilation, e.g. "12:20:51".

  Constant __PIKE__

    `constant __PIKE__`

  Description

    This define is always true.

  Constant __AUTO_BIGNUM__

    `constant __AUTO_BIGNUM__`

  Description

    This define is defined when automatic bignum conversion is enabled. When enabled all integers will automatically be converted to bignums when they get bigger than what can be represented by an integer, hampering performance slightly instead of crashing the program.

  Constant __NT__

    `constant __NT__`

  Description

    This define is defined when the Pike is running on a Microsoft Windows OS, not just Microsoft Windows NT, as the name implies.

  Constant __amigaos__

    `constant __amigaos__`

  Description

    This define is defined when the Pike is running on Amiga OS.

Namespace ::

  Description

    Symbols implicitly inherited from the virtual base class.

    These symbols exist mainly to simplify implementation of the corresponding lfuns.

  See also

    lfun::

  Method `->

    `mixed `->(string index)`

  Description

    Builtin arrow operator.

    This function indexes the current object with the string index . This is useful when the arrow operator has been overloaded.

  See also

    ::`->=()

  Method `->=

    `void `->=(string index, mixed value)`

  Description

    Builtin arrow set operator.

    This function indexes the current object with the string index , and sets it to value . This is useful when the arrow set operator has been overloaded.

  See also

    ::`->()

  Method _indices

    `mixed _indices()`

  Description

    Builtin function to list the identifiers of an object. This is useful when lfun::_indices has been overloaded.

  See also

    ::_values, ::`->

  Method _values

    `mixed _values()`

  Description

    Builtin function to list the values of the identifiers of an object. This is useful when lfun::_values has been overloaded.

  See also

    ::_indices, ::`->

Namespace 7.2::

  Description

    Pike 7.2 compatibility.

    The symbols in this namespace will appear in programs that use `#pike 7.2` or lower.

  Inherit

    inherit 7.4:: :

  Method dirname

    `string dirname(string path)`

  Description

    Remove the last segment from path .

    This implementation differs from predef::dirname() in that it will return `""` for the input `"/"` while predef::dirname() will return `"/"`.

  See also

    predef::dirname()

  Method sleep

    `void sleep(float|int t, void|int abort)`

  Description

    High-resolution sleep (Pike 7.2 compatibility).

    Sleep t seconds. This function was renamed to delay() in Pike 7.3.

  Note

    This function will busy-wait if the sleep-interval is short.

  Deprecated
  See also

    predef::sleep() , delay()

  Method default_yp_domain

    `string default_yp_domain()`

  Description

    Get the default YP domain (Pike 7.2 compatibility). This function was removed in Pike 7.3, use Yp.default_domain() instead.

  Deprecated
  See also

    Yp.default_domain()

  Method new

    `object new(string|program prog, mixed ... args)`

  Description

    Instantiate a program (Pike 7.2 compatibility).

    A new instance of the class prog will be created. All global variables in the new object be initialized, and then lfun::create() will be called with args as arguments.

    This function was removed in Pike 7.3, use `((program)<font face='courier'>prog` )(@<font face='courier'>args ) instead.

  Deprecated
  See also

    destruct() , compile_string() , compile_file() , clone()

  Method clone

    `object clone(string|program prog, mixed ... args)`

  Description

    Alternate name for the function new() (Pike 7.2 compatibility).

    This function was removed in Pike 7.3, use `((program)<font face='courier'>prog` )(@<font face='courier'>args ) instead.

  Deprecated
  See also

    destruct() , compile_string() , compile_file() , new()

  Module LR

    CLASS LR.rule

      Description

        This object is used to represent a BNF-rule in the LR parser.

      Variable nonterminal

        `int LR.rule.nonterminal`

      Description

        Non-terminal this rule reduces to.

      Variable symbols

        `array(string|int) LR.rule.symbols`

      Description

        The actual rule

      Variable action

        `function|string LR.rule.action`

      Description

        Action to do when reducing this rule. function - call this function. string - call this function by name in the object given to the parser. The function is called with arguments corresponding to the values of the elements of the rule. The return value of the function will be the value of this non-terminal. The default rule is to return the first argument.

      Variable has_tokens

        `int LR.rule.has_tokens`

      Description

        This rule contains tokens

      Variable num_nonnullables

        `int LR.rule.num_nonnullables`

      Description

        This rule has this many non-nullable symbols at the moment.

      Variable number

        `int LR.rule.number`

      Description

        Sequence number of this rule (used for conflict resolving) Also used to identify the rule.

      Variable pri

        `object LR.rule.pri`

      Description

        Priority and associativity of this rule.

      Method create

        `void LR.rule(int nt, array(string|int) r, function|string|void a)`

      Description

        Create a BNF rule.

      Example

            The rule
            	   rule : nonterminal ":" symbols ";" { add_rule };
               might be created as
            	   rule(4, ({ 9, ";", 5, ";" }), "add_rule");
               where 4 corresponds to the nonterminal "rule", 9 to "nonterminal"
               and 5 to "symbols", and the function "add_rule" is too be called
               when this rule is reduced.

      Parameter `nt`

        Non-terminal to reduce to.

      Parameter `r`

        Symbol sequence that reduces to nt.

      Parameter `a`

        Action to do when reducing according to this rule. function - Call this function. string - Call this function by name in the object given to the parser. The function is called with arguments corresponding to the values of the elements of the rule. The return value of the function will become the value of this non-terminal. The default rule is to return the first argument.

    CLASS LR.item

      Description

        An LR(0) item, a partially parsed rule.

      Variable r

        `rule LR.item.r`

      Description

        The rule

      Variable offset

        `int LR.item.offset`

      Description

        How long into the rule the parsing has come.

      Variable next_state

        `object LR.item.next_state`

      Description

        The state we will get if we shift according to this rule

      Variable master_item

        `object LR.item.master_item`

      Description

        Item representing this one (used for shifts).

      Variable direct_lookahead

        `multiset(string) LR.item.direct_lookahead`

      Description

        Look-ahead set for this item.

      Variable error_lookahead

        `multiset(string) LR.item.error_lookahead`

      Description

        Look-ahead set used for detecting conflicts

      Variable relation

        `multiset(object) LR.item.relation`

      Description

        Relation to other items (used when compiling).

      Variable counter

        `int LR.item.counter`

      Description

        Depth counter (used when compiling).

      Variable number

        `int LR.item.number`

      Description

        Item identification number (used when compiling).

      Variable item_id

        `int LR.item.item_id`

      Description

        Used to identify the item. Equal to r->number + offset.

    CLASS LR.priority

      Description

        Specifies the priority and associativity of a rule.

      Variable value

        `int LR.priority.value`

      Description

        Priority value

      Variable assoc

        `int LR.priority.assoc`

      Description

        Associativity

        `-1` | Left
        `0` | None
        `1` | Right

      Method create

        `void LR.priority(int p, int a)`

      Description

        Create a new priority object.

      Parameter `p`

        Priority.

      Parameter `a`

        Associativity.

    CLASS LR.parser

      Description

        This object implements an LALR(1) parser and compiler.

        Normal use of this object would be:

             {add_rule, set_priority, set_associativity}*
             set_symbol_to_string
             compile
             {parse}*

      Variable grammar

        `mapping(int|string:array(rule)) LR.parser.grammar`

      Description

        The grammar itself.

      Variable start_state

        `kernel LR.parser.start_state`

      Description

        The initial LR0 state.

      Variable verbose

        `int LR.parser.verbose`

      Description

        Verbosity level

        `0` | None
        `1` | Some

      Variable error

        `int LR.parser.error`

      Description

        Error code

      Variable known_states

        `mapping(string:kernel) LR.parser.known_states`

      Description

        LR0 states that are already known to the compiler.

      Method rule_to_string

        `string rule_to_string(rule r)`

      Description

        Pretty-prints a rule to a string.

      Parameter `r`

        Rule to print.

      Method item_to_string

        `string item_to_string(item i)`

      Description

        Pretty-prints an item to a string.

      Parameter `i`

        Item to pretty-print.

      Method state_to_string

        `string state_to_string(kernel state)`

      Description

        Pretty-prints a state to a string.

      Parameter `state`

        State to pretty-print.

      Method cast_to_string

        `string cast_to_string()`

      Description

        Pretty-prints the current grammar to a string.

      Method cast

        `mixed cast(string type)`

      Description

        Implements casting.

      Parameter `type`

        Type to cast to.

      Method set_priority

        `void set_priority(string terminal, int pri_val)`

      Description

        Sets the priority of a terminal.

      Parameter `terminal`

        Terminal to set the priority for.

      Parameter `pri_val`

        Priority; higher = prefer this terminal.

      Method set_associativity

        `void set_associativity(string terminal, int assoc)`

      Description

        Sets the associativity of a terminal.

      Parameter `terminal`

        Terminal to set the associativity for.

      Parameter `assoc`

        Associativity; negative - left, positive - right, zero - no associativity.

      Method set_symbol_to_string

        `void set_symbol_to_string(void|function(int|string:string) s_to_s)`

      Description

        Sets the symbol to string conversion function. The conversion function is used by the various *_to_string functions to make comprehensible output.

      Parameter `s_to_s`

        Symbol to string conversion function. If zero or not specified, use the built-in function.

      Method add_rule

        `void add_rule(rule r)`

      Description

        Add a rule to the grammar.

      Parameter `r`

        Rule to add.

      Variable s_q

        `state_queue LR.parser.s_q`

      Description

        Contains all states used. In the queue-part are the states that remain to be compiled.

      Method compile

        `int compile()`

      Description

        Compiles the grammar into a parser, so that parse() can be called.

      Method parse

        `mixed parse(object|function(void:string|array(string|mixed)) scanner, void|object action_object)`

      Description

        Parse the input according to the compiled grammar. The last value reduced is returned.

      Note

        The parser must have been compiled (with compile()) prior to calling this function.

      Bugs

        Errors should be throw()n.

      Parameter `scanner`

        The scanner function. It returns the next symbol from the input. It should either return a string (terminal) or an array with a string (terminal) and a mixed (value). EOF is indicated with the empty string.

      Parameter `action_object`

        Object used to resolve those actions that have been specified as strings.

      CLASS LR.parser.kernel

        Description

          Implements an LR(1) state

        Variable rules

          `multiset(rule) LR.parser.kernel.rules`

        Description

          Used to check if a rule already has been added when doing closures.

        Variable items

          `array(item) LR.parser.kernel.items`

        Description

          Contains the items in this state.

        Variable item_id_to_item

          `mapping(int:item) LR.parser.kernel.item_id_to_item`

        Description

          Used to lookup items given rule and offset

        Variable symbol_items

          `mapping(int:multiset(item)) LR.parser.kernel.symbol_items`

        Description

          Contains the items whose next symbol is this non-terminal.

        Variable action

          `mapping(int|string:kernel|rule) LR.parser.kernel.action`

        Description

          The action table for this state

               object(kernel)    SHIFT to this state on this symbol.
               object(rule)      REDUCE according to this rule on this symbol.

        Variable closure_set

          `multiset LR.parser.kernel.closure_set`

        Description

          The symbols that closure has been called on.

        Method add_item

          `void add_item(item i)`

        Description

          Add an item to the state.

        Method closure

          `void closure(int nonterminal)`

        Description

          Make the closure of this state.

        Parameter `nonterminal`

          Nonterminal to make the closure on.

        Method goto_set

          `multiset(int|string) goto_set()`

        Description

          Make the goto-set of this state.

        Method do_goto

          `kernel do_goto(int|string symbol)`

        Description

          Generates the state reached when doing goto on the specified symbol. i.e. it compiles the LR(0) state.

        Parameter `symbol`

          Symbol to make goto on.

      CLASS LR.parser.state_queue

        Description

          This is a queue, which keeps the elements even after they are retrieved.

        Variable head

          `int LR.parser.state_queue.head`

        Description

          Index of the head of the queue.

        Variable tail

          `int LR.parser.state_queue.tail`

        Description

          Index of the tail of the queue.

        Variable arr

          `array(kernel) LR.parser.state_queue.arr`

        Description

          The queue itself.

        Method push

          `kernel push(kernel state)`

        Description

          Pushes the state on the queue.

        Parameter `state`

          State to push.

        Method next

          `int|kernel next()`

        Description

          Return the next state from the queue.

    Module LR.Grammar_parser

      Description

        This module generates an LR parser from a grammar specified according to the following grammar:

                    directives : directive ;
            	   directives : directives directive ;
            	   directive : declaration ;
            	   directive : rule ;
            	   declaration : "%token" terminals ";" ;
            	   rule : nonterminal ":" symbols ";" ;
            	   rule : nonterminal ":" symbols action ";" ;
            	   symbols : symbol ;
            	   symbols : symbols symbol ;
            	   terminals : terminal ;
            	   terminals : terminals terminal ;
            	   symbol : nonterminal ;
            	   symbol : "string" ;
            	   action : "{" "identifier" "}" ;
            	   nonterminal : "identifier" ;
            	   terminal : "string";

      Variable error

        `int LR.Grammar_parser.error`

      Description

        Error code from the parsing.

      Method make_parser

        `parser make_parser(string str, object|void m)`

      Description

        Compiles the parser-specification given in the first argument. Named actions are taken from the object if available, otherwise left as is.

      Bugs

        Returns error-code in both Grammar_parser.error and return_value->error.

      Method make_parser_from_file

        `int|parser make_parser_from_file(string fname, object|void m)`

      Description

        Compiles the file specified in the first argument into an LR parser.

      See also

        make_parser

  Module String

    Method count

      `string count(string haystack, string needle)`

    Description

      This function counts the number of times the needle can be found in haystack .

    Note

      Intersections between needles are not counted, ie `count("....","..")` is `2`.

    Method width

      `int width(string s)`

    Description

      Returns the width in bits (8, 16 or 32) of the widest character in s .

    Method implode_nicely

      `string implode_nicely(array(string|int|float) foo, string|void separator)`

    Description

      This function implodes a list of words to a readable string. If the separator is omitted, the default is <tt>"and"</tt>. If the words are numbers they are converted to strings first.

    See also

      `*()

    Method capitalize

      `string capitalize(string str)`

    Description

      Convert the first character in str to upper case, and return the new string.

    See also

      lower_case() , upper_case()

    Method sillycaps

      `string sillycaps(string str)`

    Description

      Convert the first character in each word (separated by spaces) in str to upper case, and return the new string.

    Method strmult

      `string strmult(string str, int num)`

    Description

      This function multiplies str by num . The return value is the same as appending str to an empty string num times.

    Note

      This function is obsolete, since this functionality has been incorporated into `*() .

    See also

      `*()

    Method common_prefix

      `string common_prefix(array(string) strs)`

    Description

      Find the longest common prefix from an array of strings.

    Method fuzzymatch

      `int fuzzymatch(string a, string b)`

    Description

      This function compares two strings using a fuzzy matching routine. The higher the resulting value, the better the strings match.

    See also

      Array.diff() , Array.diff_compare_table() Array.diff_longest_sequence()

    Method trim_whites

      `string trim_whites(string s)`

    Description

      Trim leading and trailing spaces and tabs from the string s .

    Method trim_all_whites

      `string trim_all_whites(string s)`

    Description

      Trim leading and trailing white spaces characters (`" \t\r\n"`) from the string s .

    CLASS String.String_buffer

      Description

        A helper class to optimize iterative string build-up for speed. Can help up performance noticably when dealing with buildup of huge strings by reducing the time needed for rehashing the string every time it grows.

      Deprecated

      Method get_buffer

        `string get_buffer()`

      Description

        Get the contents of the buffer.

      Method append

        `void append(string s)`

      Description

        Append the string s to the buffer.

      Method cast

        `mixed cast(string to)`

      Method flush

        `void flush()`

      Description

        Clear the buffer.

Namespace 7.6::

  Description

    Pike 7.6 compatibility.

    The symbols in this namespace will appear in programs that use `#pike 7.6` or lower.

  Inherit

    inherit predef:: :

  Module Image

    CLASS Image.Image

      Inherit Image

        inherit Image.Image : Image

      Method select_colors

        `array(Image.Color) select_colors(int n)`

      Description

        Do `(array)Image.Colortable(this, n)` instead.

      Deprecated

      Method map_closest

        `Image.Image map_closest(array(array(int)) t)`

      Description

        Do `Image.Colortable(t)->map(this)` instead.

      Deprecated

      Method map_fast

        `Image.Image map_fast(array(array(int)) t)`

      Description

        Do `Image.Colortable(t)->map(this)` instead.

      Deprecated

      Method map_fs

        `Image.Image map_fs(array(array(int)) t)`

      Description

        Do `Image.Colortable(t)->floyd_steinberg()->map(this)` instead.

      Deprecated

  Module Standards

    Module Standards.UUID

      Method new

        `string new()`

      Description

        Return a new binary UUID.

      Method new_string

        `string new_string()`

      Description

        Return a new UUID string.

      Method make_version3

        `Standards.UUID.UUID make_version3(string name, string namespace)`

      Description

        Creates a version 3 UUID with a name string and a binary representation of a name space UUID.

      Note

        This implementation differs from predef::Standards.UUID.make_version3() in that it does not attempt to normalize the namespace , and thus accepts malformed "UUIDs".

  Module Debug

    Method describe_program

      `array(array(int|string)) describe_program(program p)`

    Description

      Debug function for showing the symbol table of a program.

  Module Protocols

    Module Protocols.TELNET

      Description

        Pike 7.6 compatibility.

        Some symbols in Protocols.TELNET that now are protected used to be visible in Pike 7.6 and earlier.

      Inherit TELNET

        inherit Protocols.TELNET : TELNET

      Inherit TELNET

        inherit predef::Protocols.TELNET : TELNET

      Description

        Based on the current Protocols.TELNET.

      CLASS Protocols.TELNET.protocol

        Description

          Pike 7.6 compatibility version of Protocols.TELNET.protocol.

        Inherit protocol

          inherit TELNET::protocol : protocol

        Description

          Based on the current Protocols.TELNET.protocol.

        Method create

          `void Protocols.TELNET.protocol(object f, function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb, mapping callbacks, mixed|void new_id)`

        Description

          create() used to be visible.

        See also

          ::create()

        Method setup

          `void setup()`

        Description

          setup() used to be visible.

        See also

          ::setup()

      CLASS Protocols.TELNET.LineMode

        Description

          Pike 7.6 compatibility version of Protocols.TELNET.LineMode.

        Inherit LineMode

          inherit TELNET::LineMode : LineMode

        Description

          Based on the current Protocols.TELNET.LineMode.

        Method create

          `void Protocols.TELNET.LineMode(object f, function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb, mapping callbacks, mixed|void new_id)`

        Description

          create() used to be visible.

        See also

          ::create()

        Method setup

          `void setup()`

        Description

          setup() used to be visible.

        See also

          ::setup()

      CLASS Protocols.TELNET.Readline

        Description

          Pike 7.6 compatibility version of Protocols.TELNET.Readline.

        Inherit Readline

          inherit TELNET::Readline : Readline

        Description

          Based on the current Protocols.TELNET.Readline.

        Method create

          `void Protocols.TELNET.Readline(object f, function(mixed:void) r_cb, function(mixed|void:string) w_cb, function(mixed|void:void) c_cb, mapping callbacks, mixed|void new_id)`

        Description

          create() used to be visible.

        See also

          ::create()

        Method setup

          `void setup()`

        Description

          setup() used to be visible.

        See also

          ::setup()

  Module Calendar

    Module Calendar.ISO

      Description

        This is the standard western calendar, which is a derivate of the Gregorian calendar, but with weeks that starts on Monday instead of Sunday.

      Inherit Gregorian

        inherit Calendar.Gregorian : Gregorian

    Module Calendar.YMD

      Description

        base for all Roman-kind of Calendars, ie, one with years, months, weeks and days

      CLASS Calendar.YMD.YMD

        Description
          inherits TimeRange

          Base (virtual) time period of the Roman-kind of calendar.

        Method format_iso_ymd
        Method format_ymd
        Method format_ymd_short
        Method format_ymd_xshort
        Method format_iso_week
        Method format_iso_week_short
        Method format_week
        Method format_week_short
        Method format_month
        Method format_month_short
        Method format_iso_time
        Method format_time
        Method format_time_short
        Method format_time_xshort
        Method format_mtime
        Method format_xtime
        Method format_tod
        Method format_todz
        Method format_xtod
        Method format_mod

          `string format_iso_ymd()`
          `string format_ymd()`
          `string format_ymd_short()`
          `string format_ymd_xshort()`
          `string format_iso_week()`
          `string format_iso_week_short()`
          `string format_week()`
          `string format_week_short()`
          `string format_month()`
          `string format_month_short()`
          `string format_iso_time()`
          `string format_time()`
          `string format_time_short()`
          `string format_time_xshort()`
          `string format_mtime()`
          `string format_xtime()`
          `string format_tod()`
          `string format_todz()`
          `string format_xtod()`
          `string format_mod()`

        Description

          Format the object into nice strings;

              iso_ymd        "2000-06-02 (Jun) -W22-5 (Fri)" [2]
              ext_ymd        "Friday, 2 June 2000" [2]
              ymd            "2000-06-02"
              ymd_short      "20000602"
              ymd_xshort     "000602" [1]
              iso_week       "2000-W22"
              iso_week_short "2000W22"
              week           "2000-w22" [2]
              week_short     "2000w22" [2]
              month          "2000-06"
              month_short    "200006" [1]
              iso_time       "2000-06-02 (Jun) -W22-5 (Fri) 00:00:00 UTC+1" [2]
              ext_time       "Friday, 2 June 2000, 00:00:00" [2]
              ctime          "Fri Jun  2 00:00:00 2000\n" [2] [3]
              http           "Fri, 02 Jun 2000 00:00:00 GMT" [4]
              time           "2000-06-02 00:00:00"
              time_short     "20000602 00:00:00"
              time_xshort    "000602 00:00:00"
              iso_short      "2000-06-02T00:00:00"
              mtime          "2000-06-02 00:00"
              xtime          "2000-06-02 00:00:00.000000"
              tod            "00:00:00"
              tod_short      "000000"
              todz           "00:00:00 CET"
              todz_iso       "00:00:00 UTC+1"
              xtod           "00:00:00.000000"
              mod            "00:00"

          `[1]` note conflict (think 1 February 2003)
          `[2]` language dependent
          `[3]` as from the libc function ctime()
          `[4]` as specified by the HTTP standard; not language dependent.

        Method fraction_no
        Method hour_no
        Method julian_day
        Method leap_year
        Method minute_no
        Method month_day
        Method month_no
        Method second_no
        Method utc_offset
        Method week_day
        Method week_no
        Method year_day
        Method year_no
        Method month_name
        Method month_shortname
        Method month_day_name
        Method week_day_name
        Method week_day_shortname
        Method week_name
        Method year_name
        Method tzname
        Method tzname_iso

          `float fraction_no()`
          `int hour_no()`
          `int julian_day()`
          `int leap_year()`
          `int minute_no()`
          `int month_day()`
          `int month_no()`
          `int second_no()`
          `int utc_offset()`
          `int week_day()`
          `int week_no()`
          `int year_day()`
          `int year_no()`
          `string month_name()`
          `string month_shortname()`
          `string month_day_name()`
          `string week_day_name()`
          `string week_day_shortname()`
          `string week_name()`
          `string year_name()`
          `string tzname()`
          `string tzname_iso()`

        Description

          function method int unix_time() Returns the unix time integer corresponding to the start of the time range object. (An unix time integer is UTC.) function method datetime() This gives back a mapping with the relevant time information (representing the start of the period);

                   ([ "year":     int        // year number (2000 AD=2000, 1 BC==0)
                      "month":    int(1..)   // month of year
                      "day":      int(1..)   // day of month
                      "yearday":  int(0..)   // day of year
                      "week":     int(1..)   // week of year
                      "week_day": int(0..)   // day of week
                      "timezone": int        // offset to utc, including dst

                      "unix":     int        // unix time
                      "julian":   int        // julian day
                   // for compatibility:
                      "hour":     0          // hour of day, including dst
                      "minute":   0          // minute of hour
                      "second":   0          // second of minute
                      "fraction": 0.0        // fraction of second
                   ]);

        Note

          Day of week is compatible with old versions, ie, 0 is sunday, 6 is saturday, so it shouldn't be used to calculate the day of the week with the given week number. Year day is also backwards compatible, ie, one (1) less then from the year_day() function.

        Method second
        Method minute
        Method seconds
        Method number_of_seconds
        Method minutes
        Method number_of_minutes
        Method hour
        Method hours
        Method number_of_hours

          `Second second()`
          `Second second(int n)`
          `Minute minute(int hour, int minute, int second)`
          `array(Second) seconds()`
          `array(Second) seconds(int first, int last)`
          `int number_of_seconds()`
          `Minute minute()`
          `Minute minute(int n)`
          `Minute minute(int hour, int minute)`
          `array(Minute) minutes()`
          `array(Minute) minutes(int first, int last)`
          `int number_of_minutes()`
          `Hour hour()`
          `Hour hour(int n)`
          `array(Hour) hours()`
          `array(Hour) hours(int first, int last)`
          `int number_of_hours()`

      CLASS Calendar.YMD.Year

        Description
          inherits TimeRange
          inherits YMD

          This is the time period of a year.

        Method create

          `void Calendar.YMD.Year("unix", int unix_time)`
          `void Calendar.YMD.Year("julian", int|float julian_day)`
          `void Calendar.YMD.Year(int year)`
          `void Calendar.YMD.Year(string year)`
          `void Calendar.YMD.Year(TimeRange range)`

        Description

          It's possible to create the standard year by using three different methods; either the normal way - from standard unix time or the julian day, and also, for more practical use, from the year number.

        Method month

          `Month month()`
          `Month month(int n)`
          `Month month(string name)`

        Description

          The Year type overloads the month() method, so it is possible to get a specified month by string:

          `year->month("April")`

          The integer and no argument behavior is inherited from YMD ().

        Method week

          `Week week()`
          `Week week(int n)`
          `Week week(string name)`

        Description

          The Year type overloads the week() method, so it is possible to get a specified week by name:

          `year->week("17")` `year->week("w17")`

          The integer and no argument behavior is inherited from YMD ().

          This is useful, since the first week of a year not always (about half the years, in the ISO calendar) is numbered '1'.

      CLASS Calendar.YMD.Week

        Description

          The Calendar week represents a standard time period of a week. In the Gregorian calendar, the standard week starts on a sunday and ends on a saturday; in the ISO calendar, it starts on a monday and ends on a sunday.

          The week are might not be aligned to the year, and thus the week may cross year borders and the year of the week might not be the same as the year of all the days in the week. The basic rule is that the week year is the year that has the most days in the week, but since week number only is specified in the ISO calendar - and derivates - the week number of most calendars is the week number of most of the days in the ISO calendar, which modifies this rule for the Gregorian calendar; the week number and year is the same as for the ISO calendar, except for the sundays.

          When adding, moving and subtracting months to a week, it falls back to using days.

          When adding, moving or subtracting years, if tries to place the moved week in the resulting year.

        Method create

          `void Calendar.YMD.Week("unix", int unix_time)`
          `void Calendar.YMD.Week("julian", int|float julian_day)`
          `void Calendar.YMD.Week(int year, int week)`

        Description

          It's possible to create the standard week by using three different methods; either the normal way - from standard unix time or the julian day, and also, for more practical use, from year and week number.

        Method create

          `void Calendar.YMD.Week("unix", int unix_time)`
          `void Calendar.YMD.Week("julian", int|float julian_day)`
          `void Calendar.YMD.Week(int year, int month, int day)`
          `void Calendar.YMD.Week(int year, int year_day)`
          `void Calendar.YMD.Week(int julian_day)`

        Description

          It's possible to create the day by using five different methods; either the normal way - from standard unix time or the julian day, and also, for more practical use, from year, month and day, from year and day of year, and from julian day without extra fuzz.

        Method day

          `Day day()`
          `Day day(int n)`
          `Day day(string name)`

        Description

          The Week type overloads the day() method, so it is possible to get a specified weekday by string:

          `week->day("sunday")`

          The integer and no argument behavior is inherited from YMD ().

        Note

          the weekday-from-string routine is language dependent.

      CLASS Calendar.YMD.Hour

        Description
          inherits Time.Hour
          inherits YMD

          global convinience functions

        Method parse

          `TimeRange parse(string fmt, string arg)`

        Description

          parse a date, create relevant object fmt is in the format "abc%xdef..." where abc and def is matched, and %x is one of those time units:

              %Y absolute year
              %y dwim year (70-99 is 1970-1999, 0-69 is 2000-2069)
              %M month (number, name or short name) (needs %y)
              %W week (needs %y)
              %D date (needs %y, %m)
              %d short date (20000304, 000304)
              %a day (needs %y)
              %e weekday (needs %y, %w)
              %h hour (needs %d, %D or %W)
              %m minute (needs %h)
              %s second (needs %m)
              %S seconds since the Epoch (only combines with %f)
              %f fraction of a second (needs %s or %S)
              %t short time (205314, 2053)
              %z zone
              %p "am" or "pm"
              %n empty string (to be put at the end of formats)

        Returns

          0 if format doesn't match data, or the appropriate time object.

        Note

          The zone will be a guess if it doesn't state an exact regional timezone (like "Europe/Stockholm") - most zone abbriviations (like "CET") are used by more then one region with it's own daylight saving rules. Also beware that for instance CST can be up to four different zones, central Australia or America being the most common.

                  Abbreviation Interpretation
                  AMT          America/Manaus       [UTC-4]
                  AST          America/Curacao      [UTC-4]
                  CDT          America/Costa_Rica   [UTC-6]
                  CST          America/El Salvador  [UTC-6]
                  EST          America/Panama       [UTC-5]
                  GST          Asia/Dubai           [UTC+4]
                  IST          Asia/Jerusalem       [UTC+2]
                  WST          Australia/Perth      [UTC+8]

          This mapping is modifiable in the ruleset, see Ruleset.set_abbr2zone . function Day dwim_day(string date) function Day dwim_day(string date,TimeRange context) Tries a number of different formats on the given date (in order):

              parse  format                  as in
                  "%y-%M-%D (%M) -W%W-%e (%e)"  "2000-03-20 (Mar) -W12-1 (Mon)"
                  "%y-%M-%D"                    "2000-03-20", "00-03-20"
                  "%M%/%D/%y"                   "3/20/2000"
                  "%D%*[ /]%M%*[ /-,]%y"        "20/3/2000" "20 mar 2000" "20/3 -00"
                  "%e%*[ ]%D%*[ /]%M%*[ /-,]%y" "Mon 20 Mar 2000" "Mon 20/3 2000"
                  "-%y%*[ /]%D%*[ /]%M"         "-00 20/3" "-00 20 mar"
                  "-%y%*[ /]%M%*[ /]%D"         "-00 3/20" "-00 march 20"
                  "%y%*[ /]%D%*[ /]%M"          "00 20 mar" "2000 20/3"
                  "%y%*[ /]%M%*[ /]%D"          "2000 march 20"
                  "%D%.%M.%y"                   "20.3.2000"
                  "%D%*[ -/]%M"                 "20/3" "20 mar" "20-03"
                  "%M%*[ -/]%D"                 "3/20" "march 20"
                  "%M-%D-%y"                    "03-20-2000"
                  "%D-%M-%y"                    "20-03-2000"
                  "%e%*[- /]%D%*[- /]%M"        "mon 20 march"
                  "%e%*[- /]%M%*[- /]%D"        "mon/march/20"
                  "%e%*[ -/wv]%W%*[ -/]%y"      "mon w12 -00" "1 w12 2000"
                  "%e%*[ -/wv]%W"               "mon w12"
                  "%d"                          "20000320", "000320"
                  "today"                       "today"
                  "last %e"                     "last monday"
                  "next %e"                     "next monday"

          Casts exception if it fails to dwim out a day. "dwim" means do-what-i-mean.

          function datetime(int|void unix_time) Replacement for localtime; gives back a mapping:

                   ([ "year":     int        // year number (2000 AD=2000, 1 BC==0)
                      "month":    int(1..)   // month of year
                      "day":      int(1..)   // day of month
                      "yearday":  int(1..)   // day of year
                      "week":     int(1..)   // week of year
                      "week_day": int(1..)   // day of week (depending on calendar)
                      "unix":     int        // unix time
                      "julian":   float      // julian day
                      "hour":     int(0..)   // hour of day, including dst
                      "minute":   int(0..59) // minute of hour
                      "second":   int(0..59) // second of minute
                      "fraction": float      // fraction of second
                      "timezone": int        // offset to utc, including dst
                   ]);

          This is the same as calling Second ()->datetime ().

          function datetime_name(int|void unix_time) function datetime_short_name(int|void unix_time) Compat functions; same as format_iso and format_iso_short .

          function string format_iso(void|int unix_time) function string format_iso_short(void|int unix_time) function string format_iso_tod(void|int unix_time) function string format_day_iso(void|int unix_time) function string format_day_iso_short(void|int unix_time) Format the object into nice strings;

                  iso    "2000-06-02 (Jun) -W22-5 (Fri) 11:57:18 CEST"
                  iso_short   "2000-06-02 11:57:18"
                  iso_tod     "11:57:18"

    Module Calendar.Gregorian

      Description

        This is the standard conservative christian calendar, used regularly in some countries - USA, for instance - and which derivate - the ISO calendar - is used in most of Europe.

      Inherit YMD

        inherit Calendar.YMD : YMD

  Module Stdio

    Inherit module

      inherit Stdio.module : module

    Method read_file

      `string read_file(string filename)`
      `string read_file(string filename, int start, int len)`

    Description

      Read len lines from a file filename after skipping start lines and return those lines as a string. If both start and len are omitted the whole file is read.

    See also

      read_bytes() , write_file()

    Method read_bytes

      `string read_bytes(string filename, int start, int len)`
      `string read_bytes(string filename, int start)`
      `string read_bytes(string filename)`

    Description

      Read len number of bytes from the file filename starting at byte start , and return it as a string.

      If len is omitted, the rest of the file will be returned.

      If start is also omitted, the entire file will be returned.

    Throws

      Throws an error if filename isn't a regular file.

    Returns

      Returns `0` (zero) on failure to open filename .

      Returns a string with the requested data otherwise.

    See also

      read_file , write_file() , append_file()

    Method write_file

      `int write_file(string filename, string str, int|void access)`

    Description

      Write the string str onto the file filename . Any existing data in the file is overwritten.

      For a description of access , see Stdio.File()->open() .

    Throws

      Throws an error if filename couldn't be opened for writing.

    Returns

      Returns the number of bytes written.

    See also

      append_file() , read_bytes() , Stdio.File()->open()

    Method append_file

      `int append_file(string filename, string str, int|void access)`

    Description

      Append the string str onto the file filename .

      For a description of access , see Stdio.File->open() .

    Throws

      Throws an error if filename couldn't be opened for writing.

    Returns

      Returns the number of bytes written.

    See also

      write_file() , read_bytes() , Stdio.File()->open()

Namespace 0.6::

  Description

    Pike 0.6 compatibility.

    The symbols in this namespace will appear in programs that use `#pike 0.6` or lower.

  See also

    7.0::

  Inherit

    inherit 7.0:: :

  Method aggregate

    `array(mixed) aggregate(mixed ... args)`

  Description

    More lax types than in later versions.

  Module Array

    Inherit Array

      inherit Array : Array

    Method map

      `array map(array x, int|string|function fun, mixed ... args)`

    Description

      Much simplified type compared to later versions of map.