|
Dico |
GNU Dictionary Server |
Sergey Poznyakoff |
| GNU Dico Manual (split by node): | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
? |
The following configuration statement causes loading and
initialization of the guile module:
load-module mod-name {
command "guile init-script=‘script’"
" init-fun=function";
}
|
Upon module initialization stage, the module attempts to load the
file named ‘script’. The file is loaded using
primitive-load call (see primitive-load: (guile)Loading section `Loading' in The Guile Reference Manual), i.e. the load paths are not
searched, so script must be an absolute path name. The
init-fun parameter supplies the name of an initialization
function. This Scheme function is used to construct virtual
function tables for the module itself and for each database that uses
this module. It must be declared as follows:
(define (function arg) ...) |
This function is called several times. First of all, it is called after
script is loaded. This time it is given #f as its
argument, and its return value is saved as a global function table.
Then, it is called for each database statement that has
mod-name (used in load-module above) in its
handler keyword, e.g.:
database {
name db-name;
handler "mod-name...";
}
|
This time, it is given db-name as its argument and its return is stored as the virtual function table for this particular database.
The following example function returns a complete virtual function table:
(define-public (my-dico-init arg)
(list (cons "open" open-module)
(cons "close" close-module)
(cons "descr" descr)
(cons "info" info)
(cons "lang" lang)
(cons "define" define-word)
(cons "match" match-word)
(cons "output" output)
(cons "result-count" result-count)))
|
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.