1\input texinfo @c -*-texinfo-*- 2@c %**start of header 3@setfilename guile-gnome-gobject.info 4@settitle Guile-GNOME: GObject 5@c %**end of header 6 7@copying 8This manual is for Guile-GNOME: GObject (version 2.16.0, updated 12 June 2008) 9 10Copyright 2003,2004,2005,2006,2007,2008 Free Software Foundation 11 12@quotation 13Permission is granted to copy, distribute and/or modify this document under the 14terms of the GNU General Public License, Version 2 or any later version 15published by the Free Software Foundation. 16 17@end quotation 18 19@end copying 20 21@dircategory The Algorithmic Language Scheme 22@direntry 23* Guile-GNOME: GObject: (guile-gnome-gobject.info). The GLib object system in Scheme. 24@end direntry 25 26@titlepage 27@title Guile-GNOME: GObject 28@subtitle version 2.16.0, updated 12 June 2008 29@author Andy Wingo (@email{wingo at pobox.com}) 30@author Martin Baulig (@email{baulig at suse.de}) 31@page 32@vskip 0pt plus 1filll 33@insertcopying 34@end titlepage 35 36@ifnottex 37@node Top 38@top Guile-GNOME: GObject 39@insertcopying 40@menu 41* gnome-2:: Guile-GNOME is stable and parallel-installable 42* gnome gobject:: One module to bind them 43* gnome gobject gtype:: The base of the GObject type system 44* gnome gobject gvalue:: Generic boxed values 45* gnome gobject gparameter:: Parameters with constraints and default values 46* gnome gobject gclosure:: Language-portable closures 47* gnome gobject gsignal:: Using closures as extension points 48* gnome gobject gobject:: GLib's main object implementation 49* gnome gobject generics:: Shorthand for many common GObject operations 50* gnome gobject utils:: Miscellaneous useful functions 51* gnome gw generics:: A home for generated generic functions 52* gnome gw support gobject:: Integration between G-Wrap and GObject types 53* gnome gw support defs:: Create G-Wrap wrapsets from ``defs'' files 54* gnome gw support gtk-doc:: Parse C documentation from gtk-doc into texinfo 55* gnome gw support modules:: Fondling Guile's module system 56 57* Type Index:: 58* Function Index:: 59@end menu 60 61@end ifnottex 62 63@iftex 64@shortcontents 65@end iftex 66 67@node gnome-2 68@chapter (gnome-2) 69@section Overview 70Selects version 2 of the Guile-GNOME libraries. This module is used for its side 71effects; it exports no procedures. 72 73@section Rationale 74Early in the development of guile-gnome, we realized that at some point we might 75need to make incompatible changes. Of course, we would not want to force a 76correctly-written program to break when guile-gnome gets upgraded. For this 77reason, we decided to make guile-gnome parallel-installable. A program is 78completely specified when it indicates which version of guile-gnome it should 79use. 80 81Guile-gnome has the concept of an API version, which indicates a stable API 82series. For example, a program written against API version 2 of guile-gnome will 83continue to work against all future releases of that API version. It is 84permitted to add interfaces within a stable series, but never to remove or 85change them incompatibly. 86 87Changing the API version is expected to be a relatively infrequent operation. 88The current API version is 2. 89 90There are two manners for a program to specify the guile-gnome version: 91 92@enumerate 93@item 94Via importing the @code{(gnome-@var{version})} module. 95 96This special module alters guile's load path to include the path of the 97specified API version of guile-gnome. For example: 98 99@lisp 100 (use-modules (gnome-2)) 101 102@end lisp 103 104@item 105Via invoking guile as guile-gnome-@var{version}. 106 107This shell script is installed when building a particular version of 108guile-gnome, and serves to automatically load the 109@code{(gnome-@var{apiversion})} module. For example, to get a repl ready for 110guile-gnome: 111 112@example 113 $ guile-gnome-2 114 115@end example 116 117To load a script with a particular version of guile-gnome: 118 119@example 120 $ guile-gnome-2 -s @var{script} @var{args...} 121@end example 122 123To specify the guile-gnome version in a script, you might begin the file with: 124 125@example 126 #! /bin/sh 127 # -*- scheme -*- 128 exec guile-gnome-2 -s $0 129 !# 130 ;; scheme code here... 131 132@end example 133 134@end enumerate 135 136A program must select the guile-gnome version before importing any guile-gnome 137modules. Indeed, one cannot even import @code{(gnome gobject)} before doing so. 138 139For a further rationale on parallel installability, see 140@uref{http://ometer.com/parallel.html}. 141 142@section Usage 143@node gnome gobject 144@chapter (gnome gobject) 145@section Overview 146This is the Guile wrapper of @code{libgobject}, an implementation of a runtime, 147dynamic type system for C. Besides providing an object system to C, 148@code{libgobject}'s main design goal was to increase the ease with which C code 149can be wrapped by interpreted languages, such as Guile or Perl. 150 151This module, @code{(gnome gobject)}, just re-exports procedures from other 152modules, so its documentation seems an opportune spot for a more tutorial-like 153introduction. So open up a Guile session and let's begin. 154 155First, if you haven't done it, load the appropriate version of Guile-GNOME: 156 157@lisp 158 guile> (use-modules (gnome-2)) 159 160@end lisp 161 162@code{(gnome gobject)} is based heavily on GOOPS, Guile's object system, so go 163ahead and load up that too: 164 165@lisp 166 guile> (use-modules (oop goops)) 167 168@end lisp 169 170We will leave off the @code{guile>} prompt in the rest of this tutorial. When we 171want to show the value of an expression, we use @result{}: 172 173@lisp 174 (+ 3 5) 175 @result{} 8 176 177@end lisp 178 179@section Basic types 180When communicating with @code{libgobject}, most values need to be 181strictly-typed. There is a type class corresponding to each basic type in C: 182@code{<gchar>}, @code{<guchar>}, @code{<gboolean>}, @code{<gint>}, 183@code{<guint>}, @code{<glong>}, @code{<gulong>}, @code{<gint64>}, 184@code{<guint64>}, @code{<gfloat>}, @code{<gdouble>}, and @code{<gchararray>}. 185 186You can make instances of these class with @code{make}: 187 188@lisp 189 (make <gboolean> #:value #f) 190 @result{} #<gvalue <gboolean> 40529040 #f> 191 192 (make <guint> #:value 85) 193 @result{} #<gvalue <guint> 4054f040 85> 194 195 (make <gfloat> #:value 3.1415) 196 @result{} #<gvalue <gfloat> 40556af0 3.1414999961853> 197 198 (make <gchararray> #:value "Hello World!") 199 @result{} #<gvalue <gchararray> 4055af90 Hello World!> 200 201@end lisp 202 203You can get the normal Scheme values back with @code{gvalue->scm}: 204 205@lisp 206 (gvalue->scm (make <gchararray> #:value "Hello World!")) 207 @result{} "Hello World!" 208 209@end lisp 210 211@section Enums and flags 212Enumerated values and bitflags are an essential part of many C APIs, and so they 213are specially wrapped in the GLib type system. You can create new enumerated 214types in Scheme by subclassing @code{<genum>}: 215 216@lisp 217 (define-class <foo> (<genum>) 218 #:vtable '#((hello "Hello World" 1) (test "Test" 2))) 219 220@end lisp 221 222Instances are created with @code{make}, just like with the other types: 223 224@lisp 225 (make <foo> #:value 'hello) 226 (make <foo> #:value "Hello World") 227 (make <foo> #:value 1) 228 229 ;; These three all do the same thing 230 @result{} #<gvalue <foo> 406275f8 (hello Hello World 1)> 231 232@end lisp 233 234If there is an already existing enum or flags class, you can get information 235about it: 236 237@lisp 238 (genum-class->value-table <foo>) 239 @result{} #((hello "Hello World" 1) (test "Test" 2)) 240 241@end lisp 242 243Enums and flags have a special representation on the Scheme side. You can 244convert them to Scheme values as symbols, names, or as a numeric value. 245 246@lisp 247 (define foo (make <foo> #:value 'hello)) 248 (genum->symbol foo) 249 @result{} hello 250 (genum->name foo) 251 @result{} "Hello World" 252 (genum->value foo) 253 @result{} 1 254 255@end lisp 256 257@section GType 258All of the types that GLib knows about are available to Guile, regardless of 259which language defined them. GLib implements this via a type system, where every 260type has a name. So if you make a type called ``Foo'' in C, you can get to it in 261Scheme via @code{gtype-name->class}: 262 263@lisp 264 ;; Retrieve the type for the foo enum we made earlier in the tutorial 265 (define copy-of-<foo> (gtype-name->class "Foo")) 266 (eq? <foo> copy-of-<foo>) 267 @result{} #t 268 269 (make copy-of-<foo> #:value 2) 270 @result{} #<gvalue <foo> 40535e50 (test Test 2)> 271 272@end lisp 273 274@section GObject 275@code{<gobject>} (@code{GObject} in C) is the basic object type in 276@code{libgobject}. @code{(gnome gobject)} allows you to access existing GObject 277types, as well as to create new GObject types in Scheme. 278 279Before we start, let's pull in some generic functions that reduce the amount of 280typing we have to do: 281 282@lisp 283 (use-modules (gnome gobject generics)) 284 285@end lisp 286 287Let's assume we start with @code{<gtk-window>} from @code{(gnome gtk)}. The 288keyword arguments to @code{make} are interpreted as GObject properties to set: 289 290@lisp 291 (define window (make <gtk-window> 292 #:type 'toplevel #:title "Hello, World!")) 293 294@end lisp 295 296You can connect to signals on the new instance: 297 298@lisp 299 (connect window 'delete-event 300 (lambda (window event) 301 ;; Returns #t to ignore this event 302 #t)) 303 304 ;; connect is a generic function implemented by 305 ;; gtype-instance-signal-connect 306 307@end lisp 308 309And get and set properties... 310 311@lisp 312 (get window 'title) 313 @result{} "Hello, World!" 314 (set window 'resizable #f) 315 316 ;; get and set are also generics, implemented by gobject-get-property 317 ;; and gobject-set-property 318 319@end lisp 320 321@section Deriving your own GObject types 322You can create new GObject types directly from Scheme, deriving either from a C 323object type or one you made in Scheme. 324 325@lisp 326 ;; deriving from <gobject> 327 (define-class <test> (<gobject>) 328 ;; a normal object slot 329 my-data 330 331 ;; an object slot exported as a gobject property 332 (pub-data #:gparam (list <gparam-long> #:name 'test)) 333 334 ;; a signal with no arguments and no return value 335 #:gsignal '(frobate #f)) 336 337 ;; deriving from <test> -- also inherits properties and signals 338 (define-class <hungry> (<test>)) 339 340@end lisp 341 342Adding a signal automatically defines the default method: 343 344@lisp 345 ;; This is the default handler for this signal. 346 (define-method (test:frobate (object <test>)) 347 (format #t "Frobating ~A\n" object)) 348 349 ;; We can override it for subclasses 350 (define-method (test:frobate (object <hungry>)) 351 (next-method) ;; chain up 352 (format #t "I'm hungry\n")) 353 354 (emit (make <hungry>) 'frobate) 355 ;; Try it! 356 357@end lisp 358 359You can override the @code{initialize}, @code{gobject:get-property}, and 360@code{gobject:set-property} methods. For an extended example, see 361@code{tic-tac-toe.scm} in the @code{gtk/examples/gtk} directory of the 362distribution. 363 364@section Usage 365@node gnome gobject gtype 366@chapter (gnome gobject gtype) 367@section Overview 368Base support for the GLib type system. 369 370The GLib runtime type system is broken into a number of modules, of which GType 371is the base. A GType is a simply a named type. Some types are fundamental and 372cannot be subclassed, such as integers. Others can form the root of complicated 373object hierarchies, such as @code{<gobject>}. 374 375One can obtain the class for a type if you know its name. For example, 376 377@lisp 378 (gtype-name->class "guint64") @result{} #<<gvalue-class> <guint64>> 379 380@end lisp 381 382A more detailed reference on the GLib type system may be had at 383@uref{http://library.gnome.org/devel/gobject/stable/}. 384 385@section Usage 386@anchor{gnome gobject gtype <gtype-class>}@deftp Class <gtype-class> 387The metaclass of all GType classes. Ensures that GType classes have a 388@code{gtype} slot, which records the primitive GType information for this class. 389 390@end deftp 391 392@anchor{gnome gobject gtype <gtype-instance>}@deftp Class <gtype-instance> 393The root class of all instantiatable GType classes. Adds a slot, 394@code{gtype-instance}, to instances, which holds a pointer to the C value. 395 396@end deftp 397 398@anchor{gnome gobject gtype gtype-name->class}@deffn Primitive gtype-name->class name 399Return the @code{<gtype-class>} associated with the GType, @var{name}. 400 401@end deffn 402 403@anchor{gnome gobject gtype class-name->gtype-name}@defun class-name->gtype-name class-name 404Convert the name of a class into a suitable name for a GType. For example: 405 406@lisp 407 (class-name->gtype-name '<foo-bar>) @result{} "FooBar" 408@end lisp 409 410@end defun 411 412@anchor{gnome gobject gtype gruntime-error}@defun gruntime-error format-string . args 413Signal a runtime error. The error will be thrown to the key 414@code{gruntime-error}. 415 416@end defun 417 418@anchor{gnome gobject gtype gtype-instance-destroy!}@deffn Primitive gtype-instance-destroy! instance 419Release all references that the Scheme wrapper @var{instance} has on the 420underlying C value, and release pointers associated with the C value that point 421back to Scheme. 422 423Normally, you don't need to call this function, because garbage collection will 424take care of resource management. However some @code{<gtype-class>} instances 425have semantics that require this function. The canonical example is that when a 426@code{<gtk-object>} emits the @code{destroy} signal, all code should drop their 427references to the object. This is, of course, handled internally in the 428@code{(gnome gtk)} module. 429 430@end deffn 431 432@node gnome gobject gvalue 433@chapter (gnome gobject gvalue) 434@section Overview 435GLib supports generic typed values via its GValue module. These values are 436wrapped in Scheme as instances of @code{<gvalue-class>} classes, such as 437@code{<gint>}, @code{<gfloat>}, etc. 438 439In most cases, use of @code{<gvalue>} is transparent to the Scheme user. Values 440which can be represented directly as Scheme values are normally given to the 441user in their Scheme form, e.g. @code{#\a} instead of @code{#<gvalue <gchar> 4423020c708 a>}. However, when dealing with low-level routines it is sometimes 443necessary to have values in @code{<gvalue>} form. The conversion between the two 444is performed via the @code{scm->gvalue} and @code{gvalue->scm} functions. 445 446The other set of useful procedures exported by this module are those dealing 447with enumerated values and flags. These objects are normally represented on the 448C side with integers, but they have symbolic representations registered in the 449GLib type system. 450 451On the Scheme side, enumerated and flags values are canonically expressed as 452@code{<gvalue>} objects. They can be converted to integers or symbols using the 453conversion procedures exported by this module. It is conventional for Scheme 454procedures that take enumerated values to accept any form for the values, which 455can be canonicalized using @code{(make <your-enum-type> #:value @var{value})}, 456where @var{value} can be an integer, a symbol (or symbol list in the case of 457flags), or the string ``nickname'' (or string list) of the enumerated/flags 458value. 459 460@section Usage 461@anchor{gnome gobject gvalue <gvalue>}@deftp Class <gvalue> 462@end deftp 463 464@anchor{gnome gobject gvalue <gboolean>}@deftp Class <gboolean> 465A @code{<gvalue>} class for boolean values. 466 467@end deftp 468 469@anchor{gnome gobject gvalue <gchar>}@deftp Class <gchar> 470A @code{<gvalue>} class for signed 8-bit values. 471 472@end deftp 473 474@anchor{gnome gobject gvalue <guchar>}@deftp Class <guchar> 475A @code{<gvalue>} class for unsigned 8-bit values. 476 477@end deftp 478 479@anchor{gnome gobject gvalue <gint>}@deftp Class <gint> 480A @code{<gvalue>} class for signed 32-bit values. 481 482@end deftp 483 484@anchor{gnome gobject gvalue <guint>}@deftp Class <guint> 485A @code{<gvalue>} class for unsigned 32-bit values. 486 487@end deftp 488 489@anchor{gnome gobject gvalue <glong>}@deftp Class <glong> 490A @code{<gvalue>} class for signed ``long'' (32- or 64-bit) values. 491 492@end deftp 493 494@anchor{gnome gobject gvalue <gulong>}@deftp Class <gulong> 495A @code{<gvalue>} class for unsigned ``long'' (32- or 64-bit) values. 496 497@end deftp 498 499@anchor{gnome gobject gvalue <gint64>}@deftp Class <gint64> 500A @code{<gvalue>} class for signed 64-bit values. 501 502@end deftp 503 504@anchor{gnome gobject gvalue <guint64>}@deftp Class <guint64> 505A @code{<gvalue>} class for unsigned 64-bit values. 506 507@end deftp 508 509@anchor{gnome gobject gvalue <gfloat>}@deftp Class <gfloat> 510A @code{<gvalue>} class for 32-bit floating-point values. 511 512@end deftp 513 514@anchor{gnome gobject gvalue <gdouble>}@deftp Class <gdouble> 515A @code{<gvalue>} class for 64-bit floating-point values. 516 517@end deftp 518 519@anchor{gnome gobject gvalue <gchararray>}@deftp Class <gchararray> 520A @code{<gvalue>} class for arrays of 8-bit values (C strings). 521 522@end deftp 523 524@anchor{gnome gobject gvalue <gboxed>}@deftp Class <gboxed> 525A @code{<gvalue>} class for ``boxed'' types, a way of wrapping generic C 526structures. You won't see instances of this class, only of its subclasses. 527 528@end deftp 529 530@anchor{gnome gobject gvalue <gboxed-scm>}@deftp Class <gboxed-scm> 531A @code{<gboxed>} class for holding arbitrary Scheme objects. 532 533@end deftp 534 535@anchor{gnome gobject gvalue <gvalue-array>}@deftp Class <gvalue-array> 536A @code{<gvalue>} class for arrays of @code{<gvalue>}. 537 538@end deftp 539 540@anchor{gnome gobject gvalue <gpointer>}@deftp Class <gpointer> 541A @code{<gvalue>} class for opaque pointers. 542 543@end deftp 544 545@anchor{gnome gobject gvalue <genum>}@deftp Class <genum> 546A @code{<gvalue>} base class for enumerated values. Users may define new 547enumerated value types via subclssing from @code{<genum>}, passing 548@code{#:vtable @var{table}} as an initarg, where @var{table} should be in a 549format suitable for passing to @code{genum-register-static}. 550 551@end deftp 552 553@anchor{gnome gobject gvalue <gflags>}@deftp Class <gflags> 554A @code{<gvalue>} base class for flag values. Users may define new flag value 555types via subclssing from @code{<gflags>}, passing @code{#:vtable @var{table}} 556as an initarg, where @var{table} should be in a format suitable for passing to 557@code{gflags-register-static}. 558 559@end deftp 560 561@anchor{gnome gobject gvalue genum-register-static}@deffn Primitive genum-register-static name vtable 562Creates and registers a new enumerated type with name @var{name} with the C 563runtime. There must be no type with name @var{name} when this function is 564called. 565 566The new type can be accessed by using @code{gtype-name->class}. 567 568@var{vtable} is a vector describing the new enum type. Each vector element 569describes one enum element and must be a list of 3 elements: the element's nick 570name as a symbol, its name as a string, and its integer value. 571 572@lisp 573(genum-register-static "Test" 574 #((foo "Foo" 1) (bar "Bar" 2) (baz "Long name of baz" 4))) 575@end lisp 576 577@end deffn 578 579@anchor{gnome gobject gvalue gflags-register-static}@deffn Primitive gflags-register-static name vtable 580Creates and registers a new flags @code{<gtype-class>} with name @var{name} with 581the C runtime. 582 583The @var{vtable} should be in the format described in the documentation for 584@code{genum-register-static}. 585 586@end deffn 587 588@anchor{gnome gobject gvalue genum-class->value-table}@deffn Primitive genum-class->value-table class 589Return a table of the values supported by the enumerated @code{<gtype-class>} 590@var{class}. The return value will be in the format described in 591@code{genum-register-static}. 592 593@end deffn 594 595@anchor{gnome gobject gvalue gflags-class->value-table}@deffn Primitive gflags-class->value-table class 596Return a table of the values supported by the flag @code{<gtype-class>} 597@var{class}. The return value will be in the format described in 598@code{gflags-register-static}. 599 600@end deffn 601 602@anchor{gnome gobject gvalue scm->gvalue}@deffn Primitive scm->gvalue class scm 603Convert a Scheme value into a @code{<gvalue>} of type @var{class}. If the 604conversion is not possible, raise a @code{gruntime-error}. 605 606@end deffn 607 608@anchor{gnome gobject gvalue gvalue->scm}@deffn Primitive gvalue->scm value 609Convert a @code{<gvalue>} into it normal scheme representation, for example 610unboxing characters into Scheme characters. Note that the Scheme form for some 611values is the @code{<gvalue>} form, for example with boxed or enumerated values. 612 613@end deffn 614 615@anchor{gnome gobject gvalue genum->symbol}@defun genum->symbol obj 616Convert the enumerated value @var{obj} from a @code{<gvalue>} to its symbol 617representation (its ``nickname''). 618 619@end defun 620 621@anchor{gnome gobject gvalue genum->name}@defun genum->name obj 622Convert the enumerated value @var{obj} from a @code{<gvalue>} to its 623representation as a string (its ``name''). 624 625@end defun 626 627@anchor{gnome gobject gvalue genum->value}@deffn Primitive genum->value value 628Convert the enumerated value @var{obj} from a @code{<gvalue>} to its 629representation as an integer. 630 631@end deffn 632 633@anchor{gnome gobject gvalue gflags->value}@deffn Primitive gflags->value value 634Convert the flags value @var{obj} from a @code{<gvalue>} to its representation 635as an integer. 636 637@end deffn 638 639@anchor{gnome gobject gvalue gflags->symbol-list}@defun gflags->symbol-list obj 640Convert the flags value @var{obj} from a @code{<gvalue>} to a list of the 641symbols that it represents. 642 643@end defun 644 645@anchor{gnome gobject gvalue gflags->name-list}@defun gflags->name-list obj 646Convert the flags value @var{obj} from a @code{<gvalue>} to a list of strings, 647the names of the values it represents. 648 649@end defun 650 651@anchor{gnome gobject gvalue gflags->value-list}@defun gflags->value-list obj 652Convert the flags value @var{obj} from a @code{<gvalue>} to a list of integers, 653which when @code{logand}'d together yield the flags' value. 654 655@end defun 656 657@node gnome gobject gparameter 658@chapter (gnome gobject gparameter) 659@section Overview 660Parameters are constraints for values, both in type and in range. This module 661wraps the parameters code of the GLib type system, allowing parameters to be 662manipulated and created from Scheme. 663 664There is a parameter class for each type of parameter: @code{<gparam-int>}, 665@code{<gparam-object>}, etc. 666 667@section Usage 668@anchor{gnome gobject gparameter <gparam>}@deftp Class <gparam> 669The base class for GLib parameter objects. (Doc slots) 670 671@end deftp 672 673@anchor{gnome gobject gparameter <gparam-char>}@deftp Class <gparam-char> 674Parameter for @code{<gchar>} values. 675 676@end deftp 677 678@anchor{gnome gobject gparameter <gparam-uchar>}@deftp Class <gparam-uchar> 679Parameter for @code{<guchar>} values. 680 681@end deftp 682 683@anchor{gnome gobject gparameter <gparam-boolean>}@deftp Class <gparam-boolean> 684Parameter for @code{<gboolean>} values. 685 686@end deftp 687 688@anchor{gnome gobject gparameter <gparam-int>}@deftp Class <gparam-int> 689Parameter for @code{<gint>} values. 690 691@end deftp 692 693@anchor{gnome gobject gparameter <gparam-uint>}@deftp Class <gparam-uint> 694Parameter for @code{<guint>} values. 695 696@end deftp 697 698@anchor{gnome gobject gparameter <gparam-long>}@deftp Class <gparam-long> 699Parameter for @code{<glong>} values. 700 701@end deftp 702 703@anchor{gnome gobject gparameter <gparam-ulong>}@deftp Class <gparam-ulong> 704Parameter for @code{<gulong>} values. 705 706@end deftp 707 708@anchor{gnome gobject gparameter <gparam-int64>}@deftp Class <gparam-int64> 709Parameter for @code{<gint64>} values. 710 711@end deftp 712 713@anchor{gnome gobject gparameter <gparam-uint64>}@deftp Class <gparam-uint64> 714Parameter for @code{<guint64>} values. 715 716@end deftp 717 718@anchor{gnome gobject gparameter <gparam-float>}@deftp Class <gparam-float> 719Parameter for @code{<gfloat>} values. 720 721@end deftp 722 723@anchor{gnome gobject gparameter <gparam-double>}@deftp Class <gparam-double> 724Parameter for @code{<gdouble>} values. 725 726@end deftp 727 728@anchor{gnome gobject gparameter <gparam-unichar>}@deftp Class <gparam-unichar> 729Parameter for Unicode codepoints, represented as @code{<guint>} values. 730 731@end deftp 732 733@anchor{gnome gobject gparameter <gparam-pointer>}@deftp Class <gparam-pointer> 734Parameter for @code{<gpointer>} values. 735 736@end deftp 737 738@anchor{gnome gobject gparameter <gparam-string>}@deftp Class <gparam-string> 739Parameter for @code{<gchararray>} values. 740 741@end deftp 742 743@anchor{gnome gobject gparameter <gparam-boxed>}@deftp Class <gparam-boxed> 744Parameter for @code{<gboxed>} values. 745 746@end deftp 747 748@anchor{gnome gobject gparameter <gparam-enum>}@deftp Class <gparam-enum> 749Parameter for @code{<genum>} values. 750 751@end deftp 752 753@anchor{gnome gobject gparameter <gparam-flags>}@deftp Class <gparam-flags> 754Parameter for @code{<gflags>} values. 755 756@end deftp 757 758@anchor{gnome gobject gparameter <gparam-spec-flags>}@deftp Class <gparam-spec-flags> 759A @code{<gflags>} type for the flags allowable on a @code{<gparam>}: 760@code{read}, @code{write}, @code{construct}, @code{construct-only}, and 761@code{lax-validation}. 762 763@end deftp 764 765@anchor{gnome gobject gparameter gparameter:uint-max}@defvar gparameter:uint-max 766@end defvar 767 768@anchor{gnome gobject gparameter gparameter:int-min}@defvar gparameter:int-min 769@end defvar 770 771@anchor{gnome gobject gparameter gparameter:int-max}@defvar gparameter:int-max 772@end defvar 773 774@anchor{gnome gobject gparameter gparameter:ulong-max}@defvar gparameter:ulong-max 775@end defvar 776 777@anchor{gnome gobject gparameter gparameter:long-min}@defvar gparameter:long-min 778@end defvar 779 780@anchor{gnome gobject gparameter gparameter:long-max}@defvar gparameter:long-max 781@end defvar 782 783@anchor{gnome gobject gparameter gparameter:uint64-max}@defvar gparameter:uint64-max 784@end defvar 785 786@anchor{gnome gobject gparameter gparameter:int64-min}@defvar gparameter:int64-min 787@end defvar 788 789@anchor{gnome gobject gparameter gparameter:int64-max}@defvar gparameter:int64-max 790@end defvar 791 792@anchor{gnome gobject gparameter gparameter:float-max}@defvar gparameter:float-max 793@end defvar 794 795@anchor{gnome gobject gparameter gparameter:float-min}@defvar gparameter:float-min 796@end defvar 797 798@anchor{gnome gobject gparameter gparameter:double-max}@defvar gparameter:double-max 799@end defvar 800 801@anchor{gnome gobject gparameter gparameter:double-min}@defvar gparameter:double-min 802@end defvar 803 804@anchor{gnome gobject gparameter gparameter:byte-order}@defvar gparameter:byte-order 805@end defvar 806 807@node gnome gobject gclosure 808@chapter (gnome gobject gclosure) 809@section Overview 810The GLib type system supports the creation and invocation of ``closures'', 811objects which can be invoked like procedures. Its infrastructure allows one to 812pass a Scheme function to C, and have C call into Scheme, and vice versa. In 813Scheme, @code{<gclosure>} holds a Scheme procedure, the @code{<gtype>} of its 814return value, and a list of the @code{<gtype>}'s of its arguments. Closures can 815be invoked with @code{gclosure-invoke}. 816 817However since on the C level, closures do not carry a description of their 818argument and return types, when we invoke a closure we have to be very explicit 819about the types involved. For example: 820 821@lisp 822 (gclosure-invoke (make <gclosure> 823 #:return-type <gint> 824 #:param-types (list <gulong>) 825 #:func (lambda (x) (* x x))) 826 <gulong> 827 (scm->gvalue <gulong> 10)) 828 @result{} 100 829 830@end lisp 831 832@section Usage 833@anchor{gnome gobject gclosure <gclosure>}@deftp Class <gclosure> 834The Scheme representation of a GLib closure: a typed procedure object that can 835be passed to other languages. 836 837@end deftp 838 839@anchor{gnome gobject gclosure gclosure-invoke}@deffn Primitive gclosure-invoke closure return_type args 840Invoke a closure. 841 842A @code{<gclosure>} in GLib's abstraction for a callable object. This 843abstraction carries no type information, so the caller must supply all arguments 844as typed <gvalue> instances, which may be obtained by the scheme procedure, 845@code{scm->gvalue}. 846 847As you can see, this is a low-level function. In fact, it is not used internally 848by the @code{guile-gobject} bindings. 849 850@end deffn 851 852@node gnome gobject gsignal 853@chapter (gnome gobject gsignal) 854@section Overview 855GSignal is a mechanism by which code, normally written in C, may expose 856extension points to which closures can be connected, much like Guile's hooks. 857Instantiatable types can have signals associated with them; for example, 858@code{<gtk-widget>} has an @code{expose} signal that will be ``fired'' at 859certain well-documented points. 860 861Signals are typed. They specify the types of their return value, and the types 862of their arguments. 863 864This module defines routines for introspecting, emitting, connecting to, 865disconnecting from, blocking, and unblocking signals. Additionally it defines 866routines to define new signal types on instantiatable types. 867 868@section Usage 869@anchor{gnome gobject gsignal <gsignal>}@deftp Class <gsignal> 870A @code{<gsignal>} describes a signal on a @code{<gtype-instance>}: its name, 871and how it should be called. 872 873@end deftp 874 875@anchor{gnome gobject gsignal gtype-class-get-signals}@deffn Primitive gtype-class-get-signals class tail 876Returns a list of signals belonging to @var{class} and all parent types. 877 878@end deffn 879 880@anchor{gnome gobject gsignal gtype-class-get-signal-names}@defun gtype-class-get-signal-names class 881Returns a vector of signal names belonging to @var{class} and all parent 882classes. 883 884@end defun 885 886@anchor{gnome gobject gsignal gtype-instance-signal-emit}@deffn Primitive gtype-instance-signal-emit object name args 887@end deffn 888 889@anchor{gnome gobject gsignal gtype-instance-signal-connect}@defun gtype-instance-signal-connect object name func . after? 890Connects @var{func} as handler for the @code{<gtype-instance>} @var{object}'s 891signal @var{name}. 892 893@var{name} should be a symbol. @var{after} is boolean specifying whether the 894handler is run before (@code{#f}) or after (@code{#t}) the signal's default 895handler. 896 897Returns an integer number which can be used as arugment of 898@code{gsignal-handler-block}, @code{gsignal-handler-unblock}, 899@code{gsignal-handler-disconnect} and @code{gsignal-handler-connected?}. 900 901@end defun 902 903@anchor{gnome gobject gsignal gtype-instance-signal-connect-after}@defun gtype-instance-signal-connect-after object name func 904Convenience function for calling @code{gtype-instance-signal-connect} with 905@var{after} = @code{#t}. 906 907@end defun 908 909@anchor{gnome gobject gsignal gsignal-handler-block}@deffn Primitive gsignal-handler-block instance handler_id 910@end deffn 911 912@anchor{gnome gobject gsignal gsignal-handler-unblock}@deffn Primitive gsignal-handler-unblock instance handler_id 913@end deffn 914 915@anchor{gnome gobject gsignal gsignal-handler-disconnect}@deffn Primitive gsignal-handler-disconnect instance handler_id 916@end deffn 917 918@anchor{gnome gobject gsignal gsignal-handler-connected?}@deffn Primitive gsignal-handler-connected? instance handler_id 919@end deffn 920 921@anchor{gnome gobject gsignal gtype-class-create-signal}@defun gtype-class-create-signal class name return-type param-types 922Create a new signal associated with the @code{<gtype-class>} @var{class}. 923 924@var{name} should be a symbol, the name of the signal. @var{return-type} should 925be a @code{<gtype-class>} object. @var{param-types} should be a list of 926@code{<gtype-class>} objects. 927 928In a bit of an odd interface, this function will return a new generic function, 929which will be run as the signal's default handler, whose default method will 930silently return an unspecified value. The user may define new methods on this 931generic to provide alternative default handler implementations. 932 933@end defun 934 935@node gnome gobject gobject 936@chapter (gnome gobject gobject) 937@section Overview 938GObject is what is commonly understood as @emph{the} object system for GLib. 939This is not strictly true. GObject is @emph{one} implementation of an object 940system, built on the other modules: GType, GValue, GParameter, GClosure, and 941GSignal. 942 943Similarly, this Guile module provides integration with the GObject object 944system, built on the Guile modules that support GType, GValue, GParameter, 945GClosure, and GSignal. 946 947The main class exported by this module is @code{<gobject>}. @code{<gobject>} 948classes can be subclassed by the user, which will register new subtypes with the 949GType runtime type system. @code{<gobject>} classes are are also created as 950needed when wrapping GObjects that come from C, for example from a function's 951return value. 952 953Besides supporting derivation, and signals like other @code{<gtype-instance>} 954implementations, @code{<gobject>} has the concept of @dfn{properties}, which are 955@code{<gvalue>}'s associated with the object. The values are constrained by 956@code{<gparam>}'s, which are associated with the object's class. This module 957exports the necessary routines to query, get, and set @code{<gobject>} 958properties. 959 960In addition, this module defines the @code{<ginterface>} base class, whose 961subclasses may be present as mixins of @code{<gobject>} classes. For example: 962 963@lisp 964 (use-modules (gnome gtk) (oop goops)) 965 (class-direct-supers <gtk-widget>) @result{} 966 (#<<gobject-class> <atk-implementor-iface> 3033bad0> 967 #<<gobject-class> <gtk-object> 3034bc90>) 968 969@end lisp 970 971In this example, we see that @code{<gtk-widget>} has two superclasses, 972@code{<gtk-object>} and @code{<atk-implementor-iface>}. The second is an 973interface implemented by the @code{<gtk-widget>} class. See 974@code{gtype-interfaces} for more details. 975 976@section Usage 977@anchor{gnome gobject gobject <gobject>}@deftp Class <gobject> 978The base class for GLib's default object system. 979 980@code{<gobject>}'s metaclass understands a new slot option, @code{#:gparam}, 981which will export a slot as a @code{<gobject>} property. The default 982implementation will set and access the value from the slot, but you can 983customize this by writing your own methods for @code{gobject:set-property} and 984@code{gobject:get-property}. 985 986In addition, the metaclass also understands @code{#:gsignal} arguments, which 987define signals on the class, and define the generics for the default signal 988handler. See @code{gtype-class-define-signal} for more information. 989 990For example: 991 992@lisp 993 ;; deriving from <gobject> 994 (define-class <test> (<gobject>) 995 ;; a normal object slot 996 my-data 997 998 ;; an object slot exported as a gobject property 999 (pub-data #:gparam (list <gparam-long> #:name 'test)) 1000 1001 ;; likewise, using non-default parameter settings 1002 (foo-data #:gparam (list <gparam-long> #:name 'foo 1003 #:minimum -3 #:maximum 1000 1004 #:default-value 42)) 1005 1006 ;; a signal with no arguments and no return value 1007 #:gsignal '(frobate #f) 1008 1009 ;; a signal with arguments and a return value 1010 #:gsignal (list 'frobate <gboolean> <gint> <glong>)) 1011 1012 ;; deriving from <test> -- also inherits properties and signals 1013 (define-class <hungry> (<test>)) 1014@end lisp 1015 1016@code{<gobject>} classes also expose a slot for each GObject property defined on 1017the class, if such a slot is not already defined. 1018 1019@end deftp 1020 1021@anchor{gnome gobject gobject <ginterface>}@deftp Class <ginterface> 1022The base class for GLib's interface types. Not derivable in Scheme. 1023 1024@end deftp 1025 1026@anchor{gnome gobject gobject <gparam-object>}@deftp Class <gparam-object> 1027Parameter for @code{<gobject>} values. 1028 1029@end deftp 1030 1031@anchor{gnome gobject gobject gtype-register-static}@deffn Primitive gtype-register-static name parent_class 1032Derive a new type named @var{name} from @var{parent_class}. Returns the new 1033@code{<gtype-class>}. This function is called when deriving from 1034@code{<gobject>}; users do not normally call this function directly. 1035 1036@end deffn 1037 1038@anchor{gnome gobject gobject gobject:get-property}@deffn Generic gobject:get-property 1039Called to get a gobject property. Only properties directly belonging to the 1040object's class will come through this function; superclasses handle their own 1041properties. 1042 1043Takes two arguments: the object and the property name. 1044 1045Call @code{(next-method)} in your methods to invoke the default handler 1046 1047@end deffn 1048 1049@deffn Method gobject:get-property (@var{object} @code{<gobject>}) (@var{name} @code{<symbol>}) 1050The default implementation of @code{gobject:get-property}, which calls 1051@code{(slot-ref obj name)}. 1052 1053@end deffn 1054 1055@anchor{gnome gobject gobject gobject:set-property}@deffn Generic gobject:set-property 1056Called to set a gobject property. Only properties directly belonging to the 1057object's class will come through this function; superclasses handle their own 1058properties. 1059 1060Takes three arguments: the object, the property name, and the value. 1061 1062Call @code{(next-method)} in your methods to invoke the default handler. 1063 1064@end deffn 1065 1066@deffn Method gobject:set-property (@var{object} @code{<gobject>}) (@var{name} @code{<symbol>}) (@var{value} @code{<top>}) 1067The default implementation of @code{gobject:set-property}, which sets slots on 1068the object. 1069 1070@end deffn 1071 1072@anchor{gnome gobject gobject gobject-class-get-properties}@deffn Primitive gobject-class-get-properties class 1073@end deffn 1074 1075@anchor{gnome gobject gobject gobject-class-find-property}@defun gobject-class-find-property class name 1076Returns a property named @var{name} (a symbol), belonging to @var{class} or one 1077of its parent classes, or @code{#f} if not found. 1078 1079@end defun 1080 1081@anchor{gnome gobject gobject gobject-class-get-property-names}@deffn Primitive gobject-class-get-property-names class 1082@end deffn 1083 1084@anchor{gnome gobject gobject gobject-get-property}@deffn Primitive gobject-get-property object name 1085Gets a the property named @var{name} (a symbol) from @var{object}. 1086 1087@end deffn 1088 1089@anchor{gnome gobject gobject gobject-set-property}@deffn Primitive gobject-set-property object name value 1090Sets the property named @var{name} (a symbol) on @var{object} to 1091@var{init-value}. 1092 1093@end deffn 1094 1095@node gnome gobject generics 1096@chapter (gnome gobject generics) 1097@section Overview 1098Generic functions for procedures in the @code{(gnome gobject)} module. 1099 1100@subsection Mapping class libraries to Scheme 1101Guile-GNOME exists to wrap a C library, @code{libgobject}, its types, and the 1102set of libraries that based themselves on the GLib types. 1103 1104Procedure invocation feels very similar in Scheme and in C. For example, the C 1105@code{gtk_widget_show (widget)} transliterates almost exactly to the Scheme 1106@code{(gtk-widget-show widget)}. 1107 1108GLib-based libraries are not random collections of functions, however. 1109GLib-based libraries also implement classes and methods, insofar that it is 1110possible in C. For example, in the above example, @code{show} may be seen to be 1111a method on instances of the @code{<gtk-widget>} class. 1112 1113Indeed, other object-oriented languages such as Python express this pattern 1114directly, translating the @code{show} operation as the pleasantly brief 1115@code{widget.show()}. However this representation of methods as being bound to 1116instances, while common, has a number of drawbacks. 1117 1118The largest drawback is that the method itself is not bound to a generic 1119operation. For example, mapping the @code{show} operation across a set of 1120widgets cannot be done with the straightforward @code{map(show, set)}, because 1121there is no object for the @code{show} operation. Instead the user must locally 1122bind each widget to a variable in order to access a method of the abstract 1123@code{show} operation: @code{map(lambda widget: widget.show(), set)}. 1124 1125Additionally, most languages which express methods as bound to instances only 1126select the method via the type of the first (implicit) argument. The rule for 1127these lanugages is, ``@code{gtk-widget-show} is an applicable method of the 1128@code{show} operation when the first argument to @code{show} is a 1129@code{<gtk-widget>}.'' Note the lack of specification for other arguments; the 1130same object cannot have two applicable methods of the @code{show} operation. A 1131more complete specification would be, ``@code{gtk-widget-show} is an applicable 1132method of the @code{show} operation when applied to one argument, a 1133@code{<gtk-widget>}.'' It is a fine difference, but sometimes important. 1134 1135For these and other reasons, the conventional way to implement generic 1136operations in Lisp has been to define @dfn{generic functions}, and then 1137associate specific methods with those functions. For example, one would write 1138the following: 1139 1140@lisp 1141 ;; defining a generic function, and one method implementation 1142 (define-generic show) 1143 (define-method (show (widget <gtk-widget>)) 1144 (gtk-widget-show widget)) 1145 1146 ;; invoking the generic function 1147 (show my-widget) 1148 1149@end lisp 1150 1151One benefit of this approach is that method definitions can be made far away in 1152space and time from type definitions. This leads to a more dynamic environment, 1153in which methods can be added to existing types at runtime, which then can apply 1154to existing instances. 1155 1156@subsection The semantics of generic functions in Guile-GNOME 1157Naturally, there is an impedance mismatch between the conventions used in the C 1158libraries and their Scheme equivalents. Operations in GLib-based libraries do 1159not form a coherent whole, in the sense that there is no place that defines the 1160meaning of an abstract @code{show} operation. For example, 1161@code{gtk-widget-set-state}, which can make a widget become uneditable, and 1162@code{gst-element-set-state}, which can start a video player, would both map to 1163the generic function @code{set-state}, even though they have nothing to do with 1164each other besides their name. 1165 1166There is no conflict here; the methods apply on disjoint types. However there is 1167a problem of modularity, in that @emph{both methods must be defined on the same 1168generic function}, so that @code{(set-state foo bar)} picks the correct method, 1169depending on the types of @var{foo} and @var{bar}. 1170 1171This point leads to the conclusion that @emph{generic functions in Guile-GNOME 1172have no abstract meaning, apart from their names}. Semantically, generics in 1173Guile-GNOME are abbreviations to save typing, not abstract operations with 1174defined meanings. 1175 1176@subsection Practicalities 1177This module defines a number of ``abbreviations'', in the form of generic 1178functions, for operations on types defined in the @code{(gnome gobject)} 1179modules. Generic functions for generated bindings like @code{(gnome gtk)} are 1180defined in another module, @code{(gnome gw generics)}, which re-exports the 1181public bindings from this module. 1182 1183@section Usage 1184@anchor{gnome gobject generics get}@deffn Generic get 1185@end deffn 1186 1187@deffn Method get (@var{object} @code{<gobject>}) (@var{name} @code{<symbol>}) 1188A shorthand for @code{gobject-get-property}. 1189 1190@end deffn 1191 1192@anchor{gnome gobject generics set}@deffn Generic set 1193@end deffn 1194 1195@deffn Method set (@var{object} @code{<gobject>}) (@var{name} @code{<symbol>}) (@var{value} @code{<top>}) 1196A shorthand for @code{gobject-set-property}. 1197 1198@end deffn 1199 1200@anchor{gnome gobject generics emit}@deffn Generic emit 1201@end deffn 1202 1203@deffn Method emit (@var{object} @code{<gtype-instance>}) (@var{name} @code{<symbol>}) (@var{args} @code{<top>})... 1204A shorthand for @code{gtype-instance-signal-emit}. 1205 1206@end deffn 1207 1208@anchor{gnome gobject generics connect}@deffn Generic connect 1209@end deffn 1210 1211@deffn Method connect (@var{object} @code{<gtype-instance>}) (@var{name} @code{<symbol>}) (@var{func} @code{<procedure>}) 1212A shorthand for @code{gtype-instance-signal-connect}. 1213 1214@end deffn 1215 1216@deffn Method connect (@var{args} @code{<top>})... 1217The core Guile implementation of the connect(2) POSIX call 1218 1219@end deffn 1220 1221@anchor{gnome gobject generics connect-after}@deffn Generic connect-after 1222@end deffn 1223 1224@deffn Method connect-after (@var{object} @code{<gtype-instance>}) (@var{name} @code{<symbol>}) (@var{func} @code{<procedure>}) 1225A shorthand for @code{gtype-instance-signal-connect-after}. 1226 1227@end deffn 1228 1229@anchor{gnome gobject generics block}@deffn Generic block 1230@end deffn 1231 1232@deffn Method block (@var{object} @code{<gtype-instance>}) (@var{id} @code{<top>}) 1233A shorthand for @code{gsignal-handler-block}. 1234 1235@end deffn 1236 1237@anchor{gnome gobject generics unblock}@deffn Generic unblock 1238@end deffn 1239 1240@deffn Method unblock (@var{object} @code{<gtype-instance>}) (@var{id} @code{<top>}) 1241A shorthand for @code{gsignal-handler-unblock}. 1242 1243@end deffn 1244 1245@anchor{gnome gobject generics disconnect}@deffn Generic disconnect 1246@end deffn 1247 1248@deffn Method disconnect (@var{object} @code{<gtype-instance>}) (@var{id} @code{<top>}) 1249A shorthand for @code{gsignal-handler-disconnect}. 1250 1251@end deffn 1252 1253@anchor{gnome gobject generics connected?}@deffn Generic connected? 1254@end deffn 1255 1256@deffn Method connected? (@var{object} @code{<gtype-instance>}) (@var{id} @code{<top>}) 1257A shorthand for @code{gsignal-handler-connected?}. 1258 1259@end deffn 1260 1261@anchor{gnome gobject generics invoke}@deffn Generic invoke 1262@end deffn 1263 1264@deffn Method invoke (@var{closure} @code{<gclosure>}) (@var{args} @code{<top>})... 1265A shorthand for @code{gclosure-invoke}. 1266 1267@end deffn 1268 1269@anchor{gnome gobject generics create-signal}@deffn Generic create-signal 1270@end deffn 1271 1272@deffn Method create-signal (@var{class} @code{<gtype-class>}) (@var{name} @code{<symbol>}) (@var{return-type} @code{<top>}) (@var{param-types} @code{<top>}) 1273A shorthand for @code{gtype-class-create-signal}. 1274 1275@end deffn 1276 1277@anchor{gnome gobject generics get-signals}@deffn Generic get-signals 1278@end deffn 1279 1280@deffn Method get-signals (@var{class} @code{<gtype-class>}) 1281A shorthand for @code{gtype-class-get-signals}. 1282 1283@end deffn 1284 1285@anchor{gnome gobject generics get-properties}@deffn Generic get-properties 1286@end deffn 1287 1288@deffn Method get-properties (@var{class} @code{<gtype-class>}) 1289A shorthand for @code{gobject-class-get-properties}. 1290 1291@end deffn 1292 1293@anchor{gnome gobject generics get-property-names}@deffn Generic get-property-names 1294@end deffn 1295 1296@deffn Method get-property-names (@var{class} @code{<gtype-class>}) 1297A shorthand for @code{gobject-class-get-property-names}. 1298 1299@end deffn 1300 1301@anchor{gnome gobject generics find-property}@deffn Generic find-property 1302@end deffn 1303 1304@deffn Method find-property (@var{class} @code{<gtype-class>}) (@var{name} @code{<symbol>}) 1305A shorthand for @code{gobject-class-find-property}. 1306 1307@end deffn 1308 1309@node gnome gobject utils 1310@chapter (gnome gobject utils) 1311@section Overview 1312@c 1313Common utility routines. 1314 1315@section Usage 1316@anchor{gnome gobject utils GStudlyCapsExpand}@defun GStudlyCapsExpand nstr 1317Expand the StudlyCaps @var{nstr} to a more schemey-form, according to the 1318conventions of GLib libraries. For example: 1319 1320@lisp 1321 (GStudlyCapsExpand "GSource") @result{} g-source 1322 (GStudlyCapsExpand "GtkIMContext") @result{} gtk-im-context 1323 (GStudlyCapsExpand "GtkHBox") @result{} gtk-hbox 1324@end lisp 1325 1326@end defun 1327 1328@anchor{gnome gobject utils gtype-name->scheme-name-alist}@defvar gtype-name->scheme-name-alist 1329An alist of exceptions to the name transformation algorithm implemented in 1330@code{GStudlyCapsExpand}. 1331 1332@end defvar 1333 1334@anchor{gnome gobject utils gtype-name->scheme-name}@defun gtype-name->scheme-name type-name 1335Transform a name of a @code{<gtype>}, such as "GtkWindow", to a scheme form, 1336such as @code{gtk-window}, taking into account the exceptions in 1337@code{gtype-name->scheme-name-alist}, and trimming trailing dashes if any. 1338 1339@end defun 1340 1341@anchor{gnome gobject utils gtype-name->class-name}@defun gtype-name->class-name type-name 1342Transform a name of a @code{<gtype>}, such as "GtkWindow", to a suitable name of 1343a Scheme class, such as @code{<gtk-window>}. Uses 1344@code{gtype-name->scheme-name}. 1345 1346@end defun 1347 1348@anchor{gnome gobject utils gtype-class-name->method-name}@defun gtype-class-name->method-name class-name name 1349Generate the name of a method given the name of a @code{<gtype>} and the name of 1350the operation. For example: 1351 1352@lisp 1353 (gtype-name->method-name "GtkFoo" "bar") @result{} gtk-foo:bar 1354@end lisp 1355 1356Uses @code{gtype-name->scheme-name}. 1357 1358@end defun 1359 1360@anchor{gnome gobject utils re-export-modules}@defspec re-export-modules . args 1361Re-export the public interface of a module or modules. Invoked as 1362@code{(re-export-modules (mod1) (mod2)...)}. 1363 1364@end defspec 1365 1366@anchor{gnome gobject utils define-macro-with-docs}@defspec define-macro-with-docs form docs . body 1367@end defspec 1368 1369@anchor{gnome gobject utils define-with-docs}@defspec define-with-docs name docs val 1370Define @var{name} as @var{val}, documenting the value with @var{docs}. 1371 1372@end defspec 1373 1374@anchor{gnome gobject utils define-generic-with-docs}@defspec define-generic-with-docs name documentation 1375Define a generic named @var{name}, with documentation @var{documentation}. 1376 1377@end defspec 1378 1379@anchor{gnome gobject utils define-class-with-docs}@defspec define-class-with-docs name supers docs . rest 1380Define a class named @var{name}, with superclasses @var{supers}, with 1381documentation @var{docs}. 1382 1383@end defspec 1384 1385@anchor{gnome gobject utils unless}@defspec unless test . body 1386@end defspec 1387 1388@anchor{gnome gobject utils with-accessors}@defspec with-accessors names . body 1389@end defspec 1390 1391@node gnome gw generics 1392@chapter (gnome gw generics) 1393@section Overview 1394This module exists so that all @code{(gnome gw)} modules have a common place to 1395put their generic functions. Whenever a wrapset is loaded, it adds method 1396definitions to generics defined in this module. 1397 1398See the documentation for @code{(gnome gobject generics)} for more notes about 1399generic functions in Guile-GNOME. This module re-exports bindings from 1400@code{(gnome gobject generics)}, so there is no need to import them both. 1401 1402@section Usage 1403@node gnome gw support gobject 1404@chapter (gnome gw support gobject) 1405@section Overview 1406@c 1407G-Wrap support for @code{(gnome gobject)} types. Code in this module is only 1408loaded when generating wrapsets; as such, it is not for end users. 1409 1410@section Usage 1411@anchor{gnome gw support gobject <gobject-wrapset-base>}@deftp Class <gobject-wrapset-base> 1412The base class for G-Wrap wrapsets that use @code{<gobject>} types. 1413 1414@end deftp 1415 1416@anchor{gnome gw support gobject add-type-alias!}@deffn Generic add-type-alias! 1417@end deffn 1418 1419@deffn Method add-type-alias! (@var{wrapset} @code{<gobject-wrapset-base>}) (@var{alias} @code{<string>}) (@var{name} @code{<symbol>}) 1420Add a type alias to @var{wrapset}, that the string @var{alias} is associated 1421with the type named @var{symbol}. For example, @code{"GtkWindow*"} might be 1422associated with a type named @code{<gtk-window>}. See 1423@code{lookup-type-by-alias}. 1424 1425@end deffn 1426 1427@anchor{gnome gw support gobject lookup-type-by-alias}@deffn Generic lookup-type-by-alias 1428@end deffn 1429 1430@deffn Method lookup-type-by-alias (@var{wrapset} @code{<gobject-wrapset-base>}) (@var{name} @code{<string>}) 1431Lookup a type aliased @var{name} in @var{wrapset}, and all wrapsets on which 1432@var{wrapset} depends. This interface is used by @code{load-defs} to associate 1433G-Wrap types with the strings parsed out of the C header files. 1434 1435@end deffn 1436 1437@anchor{gnome gw support gobject add-type-rule!}@deffn Generic add-type-rule! 1438@end deffn 1439 1440@deffn Method add-type-rule! (@var{self} @code{<gobject-wrapset-base>}) (@var{param-type} @code{<string>}) (@var{typespec} @code{<top>}) 1441Add a type rule to @var{wrapset}, that the string @var{param-type} maps directly 1442to the g-wrap typespec @var{typespec}. For example, @code{"int*"} might map to 1443the typespec @code{(int out)}. See @code{find-type-rule}. 1444 1445@end deffn 1446 1447@anchor{gnome gw support gobject find-type-rule}@deffn Generic find-type-rule 1448@end deffn 1449 1450@deffn Method find-type-rule (@var{self} @code{<gobject-wrapset-base>}) (@var{param-type} @code{<string>}) 1451See if the parameter type @var{param-type} has a type rule present in 1452@var{wrapset} or in any wrapset on which @var{wrapset} depends. This interface 1453is used by @code{load-defs} to associate G-Wrap typespecs with the strings 1454parsed out of the C header files. 1455 1456@end deffn 1457 1458@anchor{gnome gw support gobject <gobject-type-base>}@deftp Class <gobject-type-base> 1459A base G-Wrap type class for GLib types. 1460 1461@end deftp 1462 1463@anchor{gnome gw support gobject <gobject-classed-type>}@deftp Class <gobject-classed-type> 1464A base G-Wrap type class for classed GLib types (see @code{gtype-classed?}). 1465 1466@end deftp 1467 1468@anchor{gnome gw support gobject gtype-id}@deffn Generic gtype-id 1469@end deffn 1470 1471@deffn Method gtype-id (@var{o} @code{<gobject-custom-gvalue-type>}) 1472@end deffn 1473 1474@deffn Method gtype-id (@var{o} @code{<gobject-custom-boxed-type>}) 1475@end deffn 1476 1477@deffn Method gtype-id (@var{o} @code{<gobject-class-type>}) 1478@end deffn 1479 1480@deffn Method gtype-id (@var{o} @code{<gobject-flags-type>}) 1481@end deffn 1482 1483@deffn Method gtype-id (@var{o} @code{<gobject-enum-type>}) 1484@end deffn 1485 1486@deffn Method gtype-id (@var{o} @code{<gobject-interface-type>}) 1487@end deffn 1488 1489@deffn Method gtype-id (@var{o} @code{<gobject-pointer-type>}) 1490@end deffn 1491 1492@deffn Method gtype-id (@var{o} @code{<gobject-boxed-type>}) 1493@end deffn 1494 1495@deffn Method gtype-id (@var{o} @code{<gobject-instance-type>}) 1496@end deffn 1497 1498@deffn Method gtype-id (@var{o} @code{<gobject-classed-pointer-type>}) 1499@end deffn 1500 1501@deffn Method gtype-id (@var{o} @code{<gobject-classed-type>}) 1502@end deffn 1503 1504@anchor{gnome gw support gobject <gobject-classed-pointer-type>}@deftp Class <gobject-classed-pointer-type> 1505A base G-Wrap type class for for classed GLib types whose values are pointers. 1506 1507@end deftp 1508 1509@anchor{gnome gw support gobject unwrap-null-checked}@deffn Generic unwrap-null-checked 1510@end deffn 1511 1512@deffn Method unwrap-null-checked (@var{value} @code{<gw-value>}) (@var{status-var} @code{<top>}) (@var{code} @code{<top>}) 1513Unwrap a value into a C pointer, optionally unwrapping @code{#f} as @code{NULL}. 1514 1515This function checks the typespec options on @var{value}, which should be a 1516@code{<gw-value>}. If the @code{null-ok} option is set (which is only the case 1517for value classes with @code{null-ok} in its @code{#:allowed-options}), this 1518function generates code that unwraps @code{#f} as @code{NULL}. If @code{null-ok} 1519is unset, or the value is not @code{#f}, @var{code} is run instead. 1520 1521@end deffn 1522 1523@anchor{gnome gw support gobject wrap-instance!}@deffn Generic wrap-instance! 1524@end deffn 1525 1526@deffn Method wrap-instance! (@var{ws} @code{<gobject-wrapset-base>}) (@var{args} @code{<top>})... 1527Define a wrapper for a specific instantiatable (@code{<gtype-instance>}-derived) 1528type in @var{ws}. Required keyword arguments are @code{#:ctype} and 1529@code{#:gtype-id}. For example, 1530 1531@lisp 1532 (wrap-instance! ws #:ctype "GtkWidget" 1533 #:gtype-id "GTK_TYPE_WIDGET") 1534@end lisp 1535 1536Normally only called from @code{load-defs}. 1537 1538@end deffn 1539 1540@anchor{gnome gw support gobject wrap-boxed!}@deffn Generic wrap-boxed! 1541@end deffn 1542 1543@deffn Method wrap-boxed! (@var{ws} @code{<gobject-wrapset-base>}) (@var{args} @code{<top>})... 1544Define a wrapper for a specific boxed type in @var{ws}. Required keyword 1545arguments are @code{#:ctype} and @code{#:gtype-id}, as in @code{wrap-instance!}. 1546 1547@end deffn 1548 1549@anchor{gnome gw support gobject wrap-pointer!}@deffn Generic wrap-pointer! 1550@end deffn 1551 1552@deffn Method wrap-pointer! (@var{ws} @code{<gobject-wrapset-base>}) (@var{args} @code{<top>})... 1553Define a wrapper for a specific pointer type in @var{ws}. Required keyword 1554arguments are @code{#:ctype} and @code{#:gtype-id}, as in @code{wrap-instance!}. 1555 1556@end deffn 1557 1558@anchor{gnome gw support gobject wrap-opaque-pointer!}@defun wrap-opaque-pointer! ws ctype 1559Define a wrapper for an opaque pointer with the C type @var{ctype}. It will not 1560be possible to create these types from Scheme, but they can be received from a 1561library, and passed as arguments to other calls into the library. 1562 1563@end defun 1564 1565@anchor{gnome gw support gobject wrap-freeable-pointer!}@defun wrap-freeable-pointer! ws ctype free 1566foo 1567 1568@end defun 1569 1570@anchor{gnome gw support gobject wrap-refcounted-pointer!}@defun wrap-refcounted-pointer! ws ctype ref unref 1571foo 1572 1573@end defun 1574 1575@anchor{gnome gw support gobject wrap-structure!}@defun wrap-structure! ws ctype wrap unwrap 1576Define a wrapper for structure values of type @var{ctype}. 1577 1578@var{wrap} and @var{unwrap} are the names of C functions to convert a C 1579structure to Scheme and vice versa, respectively. When in a function call, 1580parameters of this type of the form `@var{StructName}*' are interpreted as `out' 1581parameters, while `const-@var{StructName}*' are treated as `in' parameters. 1582 1583Note that @var{ctype} should be the type of the structure, not a pointer to the 1584structure. 1585 1586@end defun 1587 1588@anchor{gnome gw support gobject wrap-interface!}@deffn Generic wrap-interface! 1589@end deffn 1590 1591@deffn Method wrap-interface! (@var{ws} @code{<gobject-wrapset-base>}) (@var{args} @code{<top>})... 1592Define a wrapper for an interface type in @var{ws}. Required keyword arguments 1593are @code{#:ctype} and @code{#:gtype-id}, as in @code{wrap-instance!}. 1594 1595@end deffn 1596 1597@anchor{gnome gw support gobject wrap-flags!}@deffn Generic wrap-flags! 1598@end deffn 1599 1600@deffn Method wrap-flags! (@var{ws} @code{<gobject-wrapset-base>}) (@var{args} @code{<top>})... 1601Define a wrapper for a flags type in @var{ws}. Required keyword arguments are 1602@code{#:ctype} and @code{#:gtype-id} or @code{#:values}, as in 1603@code{wrap-enum!}. 1604 1605@end deffn 1606 1607@anchor{gnome gw support gobject wrap-gobject-class!}@deffn Generic wrap-gobject-class! 1608@end deffn 1609 1610@deffn Method wrap-gobject-class! (@var{ws} @code{<gobject-wrapset-base>}) (@var{args} @code{<top>})... 1611Define a wrapper for GObject class values @var{ws}. Required keyword arguments 1612are @code{#:ctype} and @code{#:gtype-id}, as in @code{wrap-instance!}. 1613 1614@code{#:ctype} should refer to the type of the class and not the instance; e.g. 1615@code{"GtkWidgetClass"} and not @code{"GtkWidget"}. This function will not be 1616called by @code{load-defs}, and should be invoked manually in a wrapset as 1617needed. 1618 1619@end deffn 1620 1621@anchor{gnome gw support gobject wrap-custom-boxed!}@defspec wrap-custom-boxed! ctype gtype wrap unwrap 1622Wrap a boxed type using custom wrappers and unwrappers. 1623 1624FIXME: missing a wrapset argument! 1625 1626@var{ctype} and @var{gtype} are as @code{#:ctype} and @code{#:gtype-id} in 1627@code{wrap-instance!}. @var{wrap} and @var{unwrap} are G-Wrap forms in which 1628@code{scm-var} and @code{c-var} will be bound to the names of the SCM and C 1629values, respectively. For example: 1630 1631@lisp 1632 (wrap-custom-boxed! 1633 "GdkRectangle" "GDK_TYPE_RECTANGLE" 1634 (list scm-var " = " 1635 c-var " ? scm_gdk_rectangle_to_scm (" c-var ")" 1636 " : SCM_BOOL_F;") 1637 (list c-var " = scm_scm_to_gdk_rectangle (" scm-var ");")) 1638@end lisp 1639 1640@end defspec 1641 1642@anchor{gnome gw support gobject wrap-custom-gvalue!}@defspec wrap-custom-gvalue! ctype gtype wrap-func unwrap-func 1643Wrap a GValue type using custom wrap and unwrap functions. 1644 1645FIXME: missing a wrapset argument! 1646 1647@var{ctype} and @var{gtype} are as @code{#:ctype} and @code{#:gtype-id} in 1648@code{wrap-instance!}. @var{wrap-func} and @var{unwrap-func} are names of 1649functions to convert to and from Scheme values, respectively. For example: 1650 1651@lisp 1652 (wrap-custom-gvalue! "GstFraction" "GST_TYPE_FRACTION" 1653 "scm_from_gst_fraction" 1654 "scm_to_gst_fraction") 1655@end lisp 1656 1657@end defspec 1658 1659@node gnome gw support defs 1660@chapter (gnome gw support defs) 1661@section Overview 1662This module serves as a way to automatically populate G-Wrap wrapsets using 1663information parsed out of C header files. 1664 1665First, the C header files are parsed into S-expression API description forms and 1666written into @code{.defs} files. These files are typically included in the 1667distribution, and regenerated infrequently. Then, the binding author includes a 1668call to @code{load-defs} in their G-Wrap wrapset definition, which loads those 1669API definitions into the wrapset. 1670 1671The @code{.defs} files are usually produced using the API scanner script, 1672@code{h2defs.py}, included in the Guile-GNOME source distribution. 1673 1674Code in this module is only loaded when generating wrapsets; as such, it is not 1675for end users. 1676 1677As an example, ATK is wrapped with the following code, from 1678@code{atk/gnome/gw/atk-spec.scm}: 1679 1680@example 1681 (define-module (gnome gw atk-spec) 1682 #:use-module (oop goops) 1683 #:use-module (gnome gw support g-wrap) 1684 #:use-module (gnome gw gobject-spec) 1685 #:use-module (gnome gw support gobject) 1686 #:use-module (gnome gw support defs)) 1687 1688 (define-class <atk-wrapset> (<gobject-wrapset-base>) 1689 #:id 'gnome-atk 1690 #:dependencies '(standard gnome-glib gnome-gobject)) 1691 1692 (define-method (global-declarations-cg (self <atk-wrapset>)) 1693 (list 1694 (next-method) 1695 "#include <atk/atk.h>\n" 1696 "#include <atk/atk-enum-types.h>\n")) 1697 1698 (define-method (initialize (ws <atk-wrapset>) initargs) 1699 (next-method ws (append '(#:module (gnome gw atk)) initargs)) 1700 ;; manually wrap AtkState as a 64 bit uint 1701 (add-type-alias! ws "AtkState" 'unsigned-int64) 1702 (load-defs-with-overrides ws "gnome/defs/atk.defs")) 1703 1704@end example 1705 1706The wrapper-specifiction modules are actually installed, along with the .defs 1707files, so that other wrappers which use ATK's types, such as GTK+, can have them 1708available. 1709 1710A full discussion of the Makefile mechanics of how to generate and compile the C 1711file, or how to interact with the wrapset objects, is probably prone to bitrot 1712here. Your best bet is to poke at Guile-GNOME's source, or especially the source 1713of a module distributed independently of @code{guile-gnome-platform}, such as 1714@code{guile-gnome-libwnck}. 1715 1716Further details about the procedural API available for use e.g. within the 1717wrapset's @code{initialize} function can be found in the documentation for 1718@code{(gnome gw support gobject)}, and in G-Wrap's documentation. 1719 1720@section Usage 1721@anchor{gnome gw support defs load-defs}@defun load-defs ws file [overrides = #f] 1722Load G-Wrap type and function information from @var{file} into the G-Wrap 1723wrapset @var{ws}. 1724 1725@var{file} should be a relative path, which will be searched in the vicinity of 1726Guile's @code{%load-path}. @code{include} directives in the file will be 1727searched relative to the absolute path of the file. 1728 1729The following forms are understood: @code{define-enum}, @code{define-flags}, 1730@code{define-object}, @code{define-interface}, @code{define-pointer}, 1731@code{define-boxed}, @code{define-function}, @code{define-method}, 1732@code{ignore}, @code{ignore-glob}, and @code{ignore-types}. 1733 1734The optional argument, @var{overrides}, specifies the location of an overrides 1735file that will be spliced into the @code{.defs} file at the point of an 1736@code{(include overrides)} form. 1737 1738@end defun 1739 1740@anchor{gnome gw support defs load-defs-with-overrides}@defun load-defs-with-overrides ws defs 1741Equivalent to: 1742 1743@lisp 1744 (load-defs ws defs 1745 (string-append "gnome/overrides/" 1746 (basename defs))) 1747@end lisp 1748 1749@end defun 1750 1751@node gnome gw support gtk-doc 1752@chapter (gnome gw support gtk-doc) 1753@section Overview 1754This module exports two high-level procedures to transform the Docbook files 1755generated by GTK-Doc into texinfo. 1756 1757@uref{http://www.gtk.org/gtk-doc/,GTK-Doc} is commonly used to document 1758GObject-based libraries, such as those that Guile-GNOME wraps. In a typical 1759build setup, GTK-Doc generates a reference manual with one XML file per section. 1760The routines in this module attempt to recreate those sections, but in Texinfo 1761instead of Docbook, and which document the Scheme modules instead of the 1762upstream C libraries. 1763 1764The tricky part of translating GTK-Doc's documentation is not the vocabulary 1765(Docbook), but that it documents C functions which have different calling 1766conventions than Scheme. For example, a C function might take four 1767@code{double*} arguments, but in Scheme the function would return four rational 1768values. Given only the C prototype, the code in this module will make an attempt 1769to determine what the Scheme function's arguments will be based on some 1770heuristics. 1771 1772In most cases, however, we can do better than heuristics, because we have the 1773G-Wrap information that describes the relationship between the C function and 1774the Scheme wrapper. In that way we can know exactly what the input and output 1775arguments are for a particular function. 1776 1777The @code{gtk-doc->texi-stubs} function is straightforward. It extracts the 1778"header" in a set of GTK-Doc files, translates them into texinfo, writing them 1779out one by one to files named @samp{section-@var{foo}.texi}, where @var{foo} is 1780the name of the XML file. It is unclear whether it is best to continously 1781generate these sections when updating the manuals, or whether this "stub" 1782generation should be run only once when the documentation is initially 1783generated, and thereafter maintained by hand. Your call! 1784 1785@code{gtk-doc->texi-defuns} is slightly more complicated, because you have the 1786choice as to whether to use heuristics or the g-wrap method for determining the 1787arguments. See its documentation for more information. 1788 1789Both of these functions are designed to be directly callable from the shell. 1790Here is a makefile snippet suitable for using the heuristics method for defuns 1791generation: 1792 1793@example 1794 GTK_DOC_TO_TEXI_STUBS = \ 1795 '((@@ (gnome gw support gtk-doc) gtk-doc->texi-stubs) \ 1796 (cdr (program-arguments)))' 1797 GTK_DOC_DEFUN_METHOD = heuristics 1798 GTK_DOC_DEFUN_ARGS = (your-module-here) 1799 GTK_DOC_TO_TEXI_DEFUNS = "(apply (@@ (gnome gw support gtk-doc) \ 1800 gtk-doc->texi-defuns) (cadr (program-arguments)) \ 1801 '$(GTK_DOC_DEFUN_METHOD) '($(GTK_DOC_DEFUN_ARGS)) \ 1802 (cddr (program-arguments)))" 1803 GUILE = $(top_builddir)/dev-environ guile 1804 1805 generate-stubs: 1806 $(GUILE) $(GUILE_FLAGS) -c $(GTK_DOC_TO_TEXI_STUBS) \ 1807 $(docbook_xml_files) 1808 1809 generate-defuns: 1810 $(GUILE) $(GUILE_FLAGS) -c $(GTK_DOC_TO_TEXI_DEFUNS) \ 1811 ./overrides.texi $(docbook_xml_files) 1812 1813@end example 1814 1815To make the above snippet work, you will have to define 1816@code{$(docbook_xml_files)} as the set of docbook XML files to transform. To use 1817the G-Wrap method, try the following: 1818 1819@example 1820 wrapset_module = (gnome gw $(wrapset_stem)-spec) 1821 wrapset_name = gnome-$(wrapset_stem) 1822 GTK_DOC_DEFUN_METHOD = g-wrap 1823 GTK_DOC_DEFUN_ARGS = $(wrapset_module) $(wrapset_name) 1824 1825@end example 1826 1827Set @code{$(wrapset_stem)} to the stem of the wrapset name, e.g. @code{pango}, 1828and there you are. 1829 1830@section Usage 1831@anchor{gnome gw support gtk-doc gtk-doc->texi-stubs}@defun gtk-doc->texi-stubs files 1832Generate a section overview texinfo file for each docbook XML file in 1833@var{files}. 1834 1835The files will be created in the current directory, as described in the 1836documentation for @code{(gnome gw support gtk-doc)}. They will include a file 1837named @code{defuns-@var{file}.texi}, which should probably be created using 1838@code{gtk-doc->texi-defuns}. 1839 1840@end defun 1841 1842@anchor{gnome gw support gtk-doc gtk-doc->texi-defuns}@defun gtk-doc->texi-defuns overrides method args . files 1843Generate documentation for the types and functions defined in a set of docbook 1844files genearted by GTK-Doc. 1845 1846@var{overrides} should be a path to a texinfo file from which @code{@@deffn} 1847overrides will be taken. @var{method} should be either @code{g-wrap} or 1848@code{heuristics}, as discussed in the @code{(gnome gw support gtk-doc)} 1849documentation. @var{files} is the list of docbook XML files from which to pull 1850function documentation. 1851 1852@var{args} should be a list, whose form depends on the @var{method}. For 1853@code{g-wrap}, it should be two elements, the first the name of a module that, 1854when loaded, will load the necessary wrapset into the g-wrap runtime. For 1855example, @code{(gnome gw glib-spec)}. The second argument should be the name of 1856the wrapset, e.g. @code{gnome-glib}. 1857 1858If @var{method} is @code{heuristics}, @var{args} should have only one element, 1859the name of the module to load to check the existence of procedures, e.g. 1860@code{(cairo)}. 1861 1862@end defun 1863 1864@anchor{gnome gw support gtk-doc check-documentation-coverage}@defun check-documentation-coverage modules texi 1865Check the coverage of generated documentation. 1866 1867@var{modules} is a list of module names, and @var{texi} is a path to a texinfo 1868file. The set of exports of @var{modules} is checked against the set of 1869procedures defined in @var{texi}, resulting in a calculation of documentation 1870coverage, and the output of any missing documentation to the current output 1871port. 1872 1873@end defun 1874 1875@anchor{gnome gw support gtk-doc generate-undocumented-texi}@defun generate-undocumented-texi modules texi 1876Verify the bindings exported by @var{modules} against the documentation in 1877@var{texi}, writing documentation for any undocumented symbol to 1878@code{undocumented.texi}. 1879 1880@var{modules} is a list of module names, and @var{texi} is a path to a texinfo 1881file. 1882 1883@end defun 1884 1885@node gnome gw support modules 1886@chapter (gnome gw support modules) 1887@section Overview 1888@c 1889Support routines for automatically-generated scheme G-Wrap modules. 1890 1891@section Usage 1892@anchor{gnome gw support modules export-all-lazy!}@defun export-all-lazy! symbols 1893Export the @var{symbols} from the current module. 1894 1895Most generic functions and classes that G-Wrap defines are bound lazily, as 1896needed in evaluation. This is done by placing module binder procedures on the 1897generated modules. However, if we export all symbols by name, this will force 1898the binding eagerly for all values, which is slow. 1899 1900This procedure exports all bindings named in @var{symbols} that are already 1901bound in the current module, and then installs a module binder procedure on the 1902public interface, which allows lazy binding to work. 1903 1904@end defun 1905 1906@anchor{gnome gw support modules re-export-modules}@defspec re-export-modules . args 1907Re-export the public interface of a module; used like @code{use-modules}. 1908 1909@end defspec 1910 1911@node Type Index 1912@unnumbered Type Index 1913@printindex tp 1914@node Function Index 1915@unnumbered Function Index 1916@printindex fn 1917@bye 1918