/[guile]/guile/guile-core/doc/ref/scheme-modules.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/scheme-modules.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by ghouston, Sat Aug 10 14:23:49 2002 UTC revision 1.14 by mvo, Mon Aug 12 23:10:38 2002 UTC
# Line 131  change in the future, the Scheme program Line 131  change in the future, the Scheme program
131  manual should be considered stable.  The C programming interface is  manual should be considered stable.  The C programming interface is
132  considered relatively stable, although at the time of this writing,  considered relatively stable, although at the time of this writing,
133  there is still some flux.  there is still some flux.
 @c fixme: Review: Need better C code interface commentary.  
134    
135  @menu  @menu
136  * General Information about Modules::  Guile module basics.  * General Information about Modules::  Guile module basics.
137  * Using Guile Modules::         How to use existing modules.  * Using Guile Modules::         How to use existing modules.
138  * Creating Guile Modules::      How to package your code into modules.  * Creating Guile Modules::      How to package your code into modules.
 * More Module Procedures::      Low-level module code.  
139  * Module System Quirks::        Strange things to be aware of.  * Module System Quirks::        Strange things to be aware of.
140  * Included Guile Modules::      Which modules come with Guile?  * Included Guile Modules::      Which modules come with Guile?
141    * Accessing Modules from C::    How to work with modules with C code.
142  @end menu  @end menu
143    
144  @node General Information about Modules  @node General Information about Modules
# Line 376  Equivalent to @code{(begin (define foo . Line 375  Equivalent to @code{(begin (define foo .
375  @c end  @c end
376    
377    
 @node More Module Procedures  
 @subsection More Module Procedures  
   
 @c FIXME::martin: Review me!  
   
 @c FIXME::martin: Should this procedure be documented and supported  
 @c   at all?  
   
 The procedures in this section are useful if you want to dig into the  
 innards of Guile's module system.  If you don't know precisely what you  
 do, you should probably avoid using any of them.  
   
 @deffn {Scheme Procedure} standard-eval-closure module  
 @deffnx {C Function} scm_standard_eval_closure (module)  
 Return an eval closure for the module @var{module}.  
 @end deffn  
   
   
378  @node Module System Quirks  @node Module System Quirks
379  @subsection Module System Quirks  @subsection Module System Quirks
380    
# Line 502  package Jacal from Guile (@pxref{JACAL}) Line 483  package Jacal from Guile (@pxref{JACAL})
483  @end table  @end table
484    
485    
486    @node Accessing Modules from C
487    @subsection Accessing Modules from C
488    
489    The last sections have described how modules are used in Scheme code,
490    which is the recommended way of creating and accessing modules.  You
491    can also work with modules from C, but it is more cumbersome.
492    
493    The following procedures are available.
494    
495    @deftypefn {C Procedure} SCM scm_current_module ()
496    Return the module that is the @emph{current module}.
497    @end deftypefn
498    
499    @deftypefn {C Procedure} SCM scm_set_current_module (SCM module)
500    Set the current module to @var{module} and return the previous current
501    module.
502    @end deftypefn
503    
504    @deftypefn {C Procedure} SCM scm_c_call_with_current_module (SCM module, SCM (*func)(void *), void *data)
505    Call @var{func} and make @var{module} the current module during the
506    call.  The argument @var{data} is passed to @var{func}.  The return
507    value of @code{scm_c_call_with_current_module} is the return value of
508    @var{func}.
509    @end deftypefn
510    
511    @deftypefn {C Procedure} SCM scm_c_lookup (const char *name)
512    Return the variable bound to the symbol indicated by @var{name} in the
513    current module.  If there is no such binding or the symbol is not
514    bound to a variable, signal an error.
515    @end deftypefn
516    
517    @deftypefn {C Procedure} SCM scm_lookup (SCM name)
518    Like @code{scm_c_lookup}, but the symbol is specified directly.
519    @end deftypefn
520    
521    @deftypefn {C Procedure} SCM scm_c_module_lookup (SCM module, const char *name)
522    @deftypefnx {C Procedure} SCM scm_module_lookup (SCM module, SCM name)
523    Like @code{scm_c_lookup} and @code{scm_lookup}, but the specified
524    module is used instead of the current one.
525    @end deftypefn
526    
527    @deftypefn {C Procedure} SCM scm_c_define (const char *name, SCM val)
528    Bind the symbol indicated by @var{name} to a variable in the current
529    module and set that variable to @var{val}.  When @var{name} is already
530    bound to a variable, use that.  Else create a new variable.
531    @end deftypefn
532    
533    @deftypefn {C Procedure} SCM scm_define (SCM name, SCM val)
534    Like @code{scm_c_define}, but the symbol is specified directly.
535    @end deftypefn
536    
537    @deftypefn {C Procedure} SCM scm_c_module_define (SCM module, const char *name, SCM val)
538    @deftypefnx {C Procedure} SCM scm_module_define (SCM module, SCM name, SCM val)
539    Like @code{scm_c_define} and @code{scm_define}, but the specified
540    module is used instead of the current one.
541    @end deftypefn
542    
543    @deftypefn {C Procedure} SCM scm_module_reverse_lookup (SCM module, SCM variable)
544    Find the symbol that is bound to @var{variable} in @var{module}.  When no such binding is found, return @var{#f}.
545    @end deftypefn
546    
547    @deftypefn {C Procedure} SCM scm_c_define_module (const char *name, void (*init)(void *), void *data)
548    Define a new module named @var{name} and make it current while
549    @var{init} is called, passing it @var{data}.  Return the module.
550    
551    The parameter @var{name} is a string with the symbols that make up
552    the module name, separated by spaces.  For example, @samp{"foo bar"} names
553    the module @samp{(foo bar)}.
554    
555    When there already exists a module named @var{name}, it is used
556    unchanged, otherwise, an empty module is created.
557    @end deftypefn
558    
559    @deftypefn {C Procedure} SCM scm_c_resolve_module (const char *name)
560    Find the module name @var{name} and return it.  When it has not
561    already been defined, try to auto-load it.  When it can't be found
562    that way either, create an empty module.  The name is interpreted as
563    for @code{scm_c_define_module}.
564    @end deftypefn
565    
566    @deftypefn {C Procedure} SCM scm_resolve_module (SCM name)
567    Like @code{scm_c_resolve_module}, but the name is given as a real list
568    of symbols.
569    @end deftypefn
570    
571    @deftypefn {C Procedure} SCM scm_c_use_module (const char *name)
572    Add the module named @var{name} to the uses list of the current
573    module, as with @code{(use-modules @var{name})}.  The name is
574    interpreted as for @code{scm_c_define_module}.
575    @end deftypefn
576    
577    @deftypefn {C Procedure} SCM scm_c_export (const char *name, ...)
578    Add the bindings designated by @var{name}, ... to the public interface
579    of the current module.  The list of names is terminated by
580    @code{NULL}.
581    @end deftypefn
582    
583  @node Dynamic Libraries  @node Dynamic Libraries
584  @section Dynamic Libraries  @section Dynamic Libraries
585    

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26