Package: glib

Type g-quark

Details

Quarks are associations between strings and integer identifiers. Given either the string or the GQuark identifier it is possible to retrieve the other.

Lisp binding

In the Lisp binding the type g-quark translates a string argument to the corresponding GQuark identifier and a GQuark return value is translated to the corresponding Lisp string. No further functions are implemented for the g-quark type.

If the Lisp string does not currently have an associated GQuark, a new GQuark is created. A GQuark value of zero is associated to nil in Lisp.

See the function g-type-qdata for attaching a GQuark identifier to a g-type.

Example

Translate a Lisp String to a GQuark identifier:
  (convert-to-foreign "GtkWidget" 'g-quark)
=> 232
  (convert-to-foreign "gboolean" 'g-quark)
=> 9
  (convert-to-foreign nil 'g-quark)
=> 0     
Translate a GQuark identifier to a Lisp string:
  (convert-from-foreign 232 'g-quark)
=> "GtkWidget"
  (convert-from-foreign 9 'g-quark)
=> "gboolean"
  (convert-from-foreign 0 'g-quark)
=> NIL     
 

See also

2020-10-4