Up: cl-cffi-gtk API documentation

Package glib

GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on. It works on many UNIX-like platforms, as well as Windows and OS X. GLib is released under the GNU Library General Public License (GNU LGPL).

This is the API documentation of a Lisp binding to the library GLib. Only a small part of GLib is implemented in Lisp which is necessary to implement GTK in Lisp.

About This Package

Version Information
Miscellaneous
Character Set Conversion
Random Numbers
The Main Event Loop
GBytes
Quarks
Error Reporting
Utility Functions
Command line option parser
Key-value file parser
GVariantType
GVariant

Version Information

Variables and functions to check the GLib version.

GLib provides version information, primarily useful in configure checks for builds that have a configure script. Applications will not typically use the features described here.

The major version number of the Glib C library the Lisp binding is running against. ...

The minor version number of the GLib C library the Lisp binding is running against. ...

The micro version number of the GLib C library the Lisp binding is running against. ...

The binary age of the GLib C library the Lisp binding is running against. ...

The interface age of the GLib C library the Lisp binding is running against. ...

Checks that the GLib C library in use is compatible with the given version. ...

Miscellaneous

Documentation of several type definitions and functions, which are needed for the implemenation of the GTK library. Only a small part of the GLib library is implemented.

Basic Types

Standard GLib types, defined for ease-of-use and portability. Only the following types are implemented:

An unsigned integer type of the result of the sizeof operator, corresponding to the size_t type defined in C99. ...

A signed variant of the g-size type, corresponding to the ssize_t type defined on most platforms. ...

A signed integer type that is used for file offsets, corresponding to the C99 off64_t type. ...


Memory Allocation

The following functions for the general memory-handling are implemented:

Allocates n-bytes bytes of memory. ...

Frees the memory pointed to by the mem foreign pointer. ...


String Utility Functions

String Utility Functions. The following types are implemented:

A type that is almost like the foreign CFFI :string type but uses the GLib g-malloc and g-free functions to allocate and free memory. ...

This type represents and performs automatic conversion between a list of Lisp strings and an array of C strings of the g-string type. ...


Doubly-Linked Lists

Linked lists containing integer values or pointers to data, with the ability to iterate over the list in both directions. Implemented is the type:

The g-list type represents a C doubly-linked list with elements of the GList structure. ...


Singly-Linked Lists

Linked lists containing integer values or pointers to data, limited to iterating over the list in one direction. Implemented is the type:

The g-slist type represents a C singly-linked list with elements of GSList structure. ...


File Utilities

Various file related functions. Implemented is:

A wrapper for the POSIX chdir() function. ...

Character Set Conversion

Convert strings between different character sets.

Converts a string which is in the encoding used by GLib for filenames into a UTF-8 string. ...

Random Numbers

Pseudo-random number generator.

Sets the seed for the global random number generator, which is used by the g-random-* functions, to seed. ...

Returns a random integer equally distributed over the range [begin ... end -1 ]. ...

The Main Event Loop

The Main Event Loop manages all available sources of events.

Use this for high priority event sources. ...

Use this for default priority event sources. ...

Use this for high priority idle functions. ...

Use this for default priority idle functions. ...

Use this for very low priority background tasks. ...

Use this constant as the return value of a g-source-func callback function to leave the g-source instance in the main loop. ...

Use this constant as the return value of a g-source-func callback function to remove the g-source instance from the main loop. ...

The main event loop manages all the available sources of events for GLib and GTK applications. These events can come from any number of different types of sources such as file descriptors (plain files, pipes or sockets) and timeouts. ...

Creates a new main loop. ...

Increases the reference count on a main loop by one. ...

Decreases the reference count on a main loop by one. ...

Runs a main loop until the g-main-loop-quit function is called on the main loop. ...

Stops a main loop from running. ...

Checks to see if the main loop is currently being run via the g-main-loop-run function. ...

Returns the context of the main loop. ...

The g-main-context structure is an opaque data type representing a set of sources to be handled in a main loop. ...

Creates a new context. ...

Increases the reference count on a context by one. ...

Decreases the reference count on a context by one. ...

Returns the global default context. ...

Runs a single iteration for the given main loop. ...

Checks if any sources have pending events for the given main context. ...

Finds a source given a pair of context and ID. ...

If context is currently blocking in a call of the g-main-context-iteration function waiting for a source to become ready, cause it to stop blocking and return. ...

Tries to become the owner of the specified context. ...

Releases ownership of a context previously acquired by this thread with the g-main-context-acquire function. ...

Determines whether this thread holds the (recursive) ownership of this context. ...

Dispatches all pending sources. ...

Returns the depth of the stack of calls to the g-main-context-dispatch function on any context in the current thread. ...

Returns the currently firing source for this thread. ...

The g-source structure is an opaque data type representing an event source. ...

Creates a new timeout source. ...

Creates a new timeout source. ...

Sets a function to be called at regular intervals, with priority. ...

Sets a function to be called at regular intervals with priority. ...

Creates a new idle source. ...

Adds a function to be called whenever there are no higher priority events pending to the default main loop. ...

Increases the reference count on a source by one. ...

Decreases the reference count of source by one. ...

Adds a source to a context so that it will be executed within that context. ...

Removes a source from its context, if any, and mark it as destroyed. ...

Returns whether the source has been destroyed. ...

The g-source-priority function gets the priority of the source. ...

The g-source-can-recurse function checks whether the source is allowed to be called recursively. ...

Returns the numeric ID for a particular source. ...

The g-source-name function gets a name for the source, used in ebugging and profiling. ...

Sets the name of a source using its ID. ...

Gets the context with which the source is associated. ...

Sets the callback function for a source. ...

Specifies the type of callback function passed to the g-timeout-add, and g-idle-add functions. ...

Gets the time to be used when checking this source. ...

Removes the source with the given ID from the default main context. ...

GBytes

A simple refcounted data type representing an immutable sequence of zero or more bytes from an unspecified origin.

A simple refcounted data type representing an immutable sequence of zero or more bytes from an unspecified origin. ...

Creates a new g-bytes instance from data. ...

Get the byte data in the g-bytes instance. ...

Get the size of the byte data in the g-bytes instance. ...

Quarks

A 2-way association between a string and a unique integer identifier.

Quarks are associations between strings and integer identifiers. ...

Error Reporting

A system for reporting errors.

GLib provides a standard method of reporting errors from a called function to the calling code. In the Lisp binding we provide internally the macros with-g-error and with-catching-to-g-error to handle errors from the GTK and GLIB libraries. Only the type g-error is exported.

Utility Functions

A selection of portable utility functions.

These are logical IDs for special directories which are defined depending on the platform used. ...

Accessor of a human readable name for the application. ...

Accessor of the name of the program. ...

Gets the list of environment variables for the current process. ...

Returns the value of an environment variable. ...

Sets an environment variable. ...

Gets the names of all variables set in the environment. ...

Gets the user name of the current user. ...

Gets the real name of the user. ...

Returns a base directory in which to store non-essential, cached data specific to particular user. ...

Returns a base directory in which to access application data such as icons that is customized for a particular user. ...

Returns a base directory in which to store user-specific application configuration information such as user preferences and settings. ...

Returns a directory that is unique to the current user on the local system. ...

Returns the full path of a special directory using its logical ID. ...

Returns an ordered list of base directories in which to access system-wide application data. ...

Returns an ordered list of base directories in which to access system-wide configuration information. ...

Return a name for the machine. ...

Gets the current user's home directory. ...

Gets the directory to use for temporary files. ...

Gets the current directory. ...

Returns true if the given file-name is an absolute file name. ...

Creates a filename from a series of elements using the correct separator for filenames. ...

Creates a path from a series of elements using separator as the separator between elements. ...

Command line option parser

Parses command line options.

The g-option-arg enumeration determines which type of extra argument the options expect to find. If an option expects an extra argument, it can be specified in several ways, with a short option: -x arg, with a long option: --name arg or combined in a single argument: --name=arg. ...

Flags which modify individual options. ...

The GOption command line parser is intended to be a simpler replacement for the popt library. ...

Creates a new option context. ...

The function g-option-context-summary returns the summary. ...

The function g-option-context-description returns the description. ...

The type of functions which are used to translate user visible strings, for --help output. ...

Sets the function which is used to translate the user visible strings of the option context, for --help output. ...

A convenience function to use GNU gettext for translating user visible strings. ...

Frees context and all the groups which have been added to it. ...

Parses the command line arguments, recognizing options which have been added to context. ...

Parses the command line arguments. ...

Enables or disables automatic generation of --help output. ...

The g-option-context-ignore-unknown-options function returns whether unknown options are ignored or not. ...

Returns a formatted, translated help text for the given option context. ...

The g-option-context-strict-posix function returns whether strict POSIX code is enabled. ...

A convenience function which creates a main group if it does not exist, adds the option entries to it and sets the translation domain. ...

Adds a g-option-group instance to context, so that parsing with context will recognize the options in the group. ...

The function g-option-context-main-group returns the main group of context. ...

A g-option-group structure defines the options in a single group. ...

Creates a new g-option-group instance. ...

Increments the reference count of group by one. ...

Decrements the reference count of group by one. ...

Adds the options specified in entries to group. ...

Sets the function which is used to translate user visible strings, for --help output. ...

A convenience function to use GNU gettext for translating user visible strings. ...

Key-value file parser

Parses .ini-like config files.

Flags which influence the parsing of key values. ...

The g-key-file structure lets you parse, edit or create files containing groups of key-value pairs, which we call key files for lack of a better name. ...

Creates a new empty g-key-file instance. ...

Sets the character which is used to separate values in lists. ...

Loads a key file into a g-key-file instance. ...

Loads a key file from memory into a g-key-file instance. ...

Outputs the key file as a string. ...

Writes the contents of the key file to a file. ...

Returns the name of the start group of the key file. ...

Returns all groups in the key file loaded with keyfile. ...

Returns all keys for the group name. ...

Looks whether the key file has the group group. ...

Looks whether the key file has the key key in the group group. ...

The function g-key-file-string returns the string value associated with key under group. ...

The function g-key-file-string-list returns the values associated with key under group. ...

GVariantType

Introduction to the GVariant type system.

The GVariant type system is based, in large part, on the D-Bus type system, with two major changes and some minor lifting of restrictions. ...

Frees a g-variant-type instance that was allocated with the functions g-variant-type-copy, g-variant-type-new or one of the container type constructor functions. ...

Makes a copy of a g-variant-type instance. ...

Creates a new g-variant-type instance corresponding to the type string given by string. ...

Checks if string is a valid g-variant-type type string. ...

Returns a newly allocated copy of the type string corresponding to vtype. ...

Determines if the given variant type is definite, i.e. not indefinite. ...

Determines if the given variant type is a container type. ...

Determines if the given variant type is a basic type. ...

Determines if the given variant type is a maybe type. ...

Determines if the given variant type is an array type. ...

Determines if the given type is a tuple type. ...

Determines if the given variant type is a dictionary entry type. ...

Determines if the given variant type is the variant type. ...

The has value of the given variant type. ...

Compares two variant types for equality. ...

Checks if vtype is a subtype of supertype. ...

Constructs the type corresponding to a maybe instance containing type vtype or nothing. ...

Constructs the type corresponding to an array of elements of the type vtype. ...

Constructs a new tuple type, from items. ...

Constructs the type corresponding to a dictionary entry with a key of type key and a value of type value. ...

Determines the element type of an array or maybe type. ...

Determines the number of items contained in a tuple or dictionary entry vtype. ...

Determines the first item type of a tuple or dictionary entry type. ...

Determines the next item type of a tuple or dictionary entry type. ...

Determines the key type of a dictionary entry type. ...

Determines the value type of a dictionary entry type. ...

GVariant

Strongly typed value datatype.

The g-variant structure is a variant datatype. ...

The range of possible toplevel types of g-variant instances. ...

Decreases the reference count of value. ...

Increases the reference count of value. ...

The g-variant structure uses a floating reference count system. All functions with names starting with g_variant_new_ return floating references. ...

Checks whether value has a floating reference count. ...

If value is floating, sink it. Otherwise, do nothing. ...

Determines the type of value. ...

Returns the type string of value. ...

Checks if a value has a type matching the provided variant-type. ...

Checks if value is a container. ...

Compares value-1 and value-2. ...

Classifies value according to its toplevel type. ...

Creates a new boolean g-variant instance -- either true or false. ...

Creates a new byte g-variant instance. ...

Creates a new int16 g-variant instance. ...

Creates a new uint16 g-variant instance. ...

Creates a new int32 g-variant instance. ...

Creates a new uint32 g-variant instance. ...

Creates a new int64 g-variant instance. ...

Creates a new uint64 g-variant instance. ...

Creates a new handle g-variant instance. ...

Creates a new double g-variant instance. ...

Creates a g-variant string with the contents of string. ...

Creates a D-Bus object path g-variant with the contents of string. ...

Determines if a given string is a valid D-Bus object path. ...

Creates a D-Bus type g-variant signature with the contents of string. ...

Determines if a given string is a valid D-Bus type signature. ...

Boxes value. ...

Returns the boolean value of value. ...

Returns the byte value of value. ...

Returns the 16-bit signed integer value of value. ...

Returns the 16-bit unsigned integer value of value. ...

Returns the 32-bit signed integer value of value. ...

Returns the 32-bit unsigned integer value of value. ...

Returns the 64-bit signed integer value of value. ...

Returns the 64-bit signed integer value of value. ...

Returns the 64-bit unsigned integer value of value. ...

Returns the 32-bit signed integer value of value. ...

Returns the double precision floating point value of value. ...

Returns the string value of a g-variant instance with a string type. ...

Checks if value-1 and value-2 have the same type and value. ...

Pretty-prints value in the format understood by the function g-variant-parse. ...

The g-variant-dict structure is a mutable interface to g-variant dictionaries. ...

Checks if the key exists in the dictionary. ...

Parses a g-variant instance from a text representation. ...

Exported Symbol Index

+g-priority-default+, Constant
+g-priority-default-idle+, Constant
+g-priority-high+, Constant
+g-priority-high-idle+, Constant
+g-priority-low+, Constant
+g-source-continue+, Constant
+g-source-remove+, Constant
+glib-binary-age+, Constant
+glib-interface-age+, Constant
+glib-major-version+, Constant
+glib-micro-version+, Constant
+glib-minor-version+, Constant
g-application-name, Function
g-build-filename, Function
g-build-path, Function
g-bytes, GBoxed
g-bytes-data, Function
g-bytes-new, Function
g-bytes-size, Function
g-chdir, Function
g-current-dir, Function
g-environ, Function
g-filename-to-utf8, Function
g-free, Function
g-getenv, Function
g-home-dir, Function
g-host-name, Function
g-idle-add, Function
g-idle-source-new, Function
g-key-file, CStruct
g-key-file-flags, Bitfield
g-key-file-groups, Function
g-key-file-has-group, Function
g-key-file-has-key, Function
g-key-file-keys, Function
g-key-file-load-from-data, Function
g-key-file-load-from-file, Function
g-key-file-new, Function
g-key-file-save-to-file, Function
g-key-file-set-list-separator, Function
g-key-file-start-group, Function
g-key-file-string, Function
g-key-file-string-list, Function
g-key-file-to-data, Function
g-list, Type
g-listenv, Function
g-main-context, CStruct
g-main-context-acquire, Function
g-main-context-default, Function
g-main-context-dispatch, Function
g-main-context-find-source-by-id, Function
g-main-context-is-owner, Function
g-main-context-iteration, Function
g-main-context-new, Function
g-main-context-pending, Function
g-main-context-ref, Function
g-main-context-release, Function
g-main-context-unref, Function
g-main-context-wakeup, Function
g-main-current-source, Function
g-main-depth, Function
g-main-loop, CStruct
g-main-loop-context, Function
g-main-loop-is-running, Function
g-main-loop-new, Function
g-main-loop-quit, Function
g-main-loop-ref, Function
g-main-loop-run, Function
g-main-loop-unref, Function
g-malloc, Function
g-offset, Type
g-option-arg, CEnum
g-option-context, CStruct
g-option-context-add-group, Function
g-option-context-add-main-entries, Function
g-option-context-description, Function
g-option-context-free, Function
g-option-context-help, Function
g-option-context-help-enabled, Function
g-option-context-ignore-unknown-options, Function
g-option-context-main-group, Function
g-option-context-new, Function
g-option-context-parse, Function
g-option-context-parse-strv, Function
g-option-context-set-translate-func, Function
g-option-context-set-translation-domain, Function
g-option-context-strict-posix, Function
g-option-context-summary, Function
g-option-flags, Bitfield
g-option-group, CStruct
g-option-group-add-entries, Function
g-option-group-new, Function
g-option-group-ref, Function
g-option-group-set-translate-func, Function
g-option-group-set-translation-domain, Function
g-option-group-unref, Function
g-path-is-absolute, Function
g-prgname, Function
g-quark, Type
g-random-int-range, Function
g-random-set-seed, Function
g-real-name, Function
g-setenv, Function
g-size, Type
g-slist, Type
g-source, CStruct
g-source-attach, Function
g-source-can-recurse, Function
g-source-context, Function
g-source-destroy, Function
g-source-func, Callback
g-source-id, Function
g-source-is-destroyed, Function
g-source-name, Function
g-source-priority, Function
g-source-ref, Function
g-source-remove, Function
g-source-set-callback, Function
g-source-set-name-by-id, Function
g-source-time, Function
g-source-unref, Function
g-ssize, Type
g-string, Type
g-strv, Type
g-system-config-dirs, Function
g-system-data-dirs, Function
g-timeout-add, Function
g-timeout-add-seconds, Function
g-timeout-source-new, Function
g-timeout-source-new-seconds, Function
g-tmp-dir, Function
g-translate-func, Callback
g-user-cache-dir, Function
g-user-config-dir, Function
g-user-data-dir, Function
g-user-directory, Enum
g-user-name, Function
g-user-runtime-dir, Function
g-user-special-dir, Function
g-variant, CStruct
g-variant-boolean, Function
g-variant-byte, Function
g-variant-class, Enum
g-variant-classify, Function
g-variant-compare, Function
g-variant-dict, GBoxed
g-variant-dict-contains, Function
g-variant-double, Function
g-variant-equal, Function
g-variant-handle, Function
g-variant-int16, Function
g-variant-int32, Function
g-variant-int64, Function
g-variant-is-container, Function
g-variant-is-floating, Function
g-variant-is-object-path, Function
g-variant-is-of-type, Function
g-variant-is-signature, Function
g-variant-new-boolean, Function
g-variant-new-byte, Function
g-variant-new-double, Function
g-variant-new-handle, Function
g-variant-new-int16, Function
g-variant-new-int32, Function
g-variant-new-int64, Function
g-variant-new-object-path, Function
g-variant-new-signature, Function
g-variant-new-string, Function
g-variant-new-uint16, Function
g-variant-new-uint32, Function
g-variant-new-uint64, Function
g-variant-new-variant, Function
g-variant-parse, Function
g-variant-print, Function
g-variant-ref, Function
g-variant-ref-sink, Function
g-variant-string, Function
g-variant-take-ref, Function
g-variant-type, Function
g-variant-type, GBoxed
g-variant-type-copy, Function
g-variant-type-dup-string, Function
g-variant-type-element, Function
g-variant-type-equal, Function
g-variant-type-first, Function
g-variant-type-free, Function
g-variant-type-hash, Function
g-variant-type-is-array, Function
g-variant-type-is-basic, Function
g-variant-type-is-container, Function
g-variant-type-is-definite, Function
g-variant-type-is-dict-entry, Function
g-variant-type-is-maybe, Function
g-variant-type-is-subtype-of, Function
g-variant-type-is-tuple, Function
g-variant-type-is-variant, Function
g-variant-type-key, Function
g-variant-type-n-items, Function
g-variant-type-new, Function
g-variant-type-new-array, Function
g-variant-type-new-dict-entry, Function
g-variant-type-new-maybe, Function
g-variant-type-new-tuple, Function
g-variant-type-next, Function
g-variant-type-string, Function
g-variant-type-string-is-valid, Function
g-variant-type-value, Function
g-variant-uint16, Function
g-variant-uint32, Function
g-variant-uint64, Function
g-variant-unref, Function
glib-check-version, Function