Next: , Up: Guile   [Contents][Index]


5.5.1 Virtual Functions

A database handled by the guile module is assigned a virtual function table. This table is an association list which keeps Scheme call-back functions implemented to perform particular tasks on that database. In this list, the car of each element contains the name of a function, and its cdr gives the corresponding function. The defined function names and their semantics are:

open

Open the database.

close

Close the database.

descr

Return a short description of the database.

info

Return a full information about the database.

define

Define a word.

match

Look up a word in the database.

output

Output a search result.

result-count

Return number of entries in the result.

For example, the following is a valid virtual function table:

(list (cons "open" open-module)
      (cons "close" close-module)
      (cons "descr" descr)
      (cons "info" info)
      (cons "define" define-word)
      (cons "match" match-word)
      (cons "output" output)
      (cons "result-count" result-count))

Apart from a per-database virtual table, there is also a global virtual function table, which supplies entries missing in the former. Both tables are created during the module initialization, as described in the next subsection.

The purposes of particular virtuals functions are described in Guile API.