The enchant Reference Manual

This is the enchant Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 15:10:08 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 enchant

Programming interface for Enchant spell-checker library

Author

Teemu Likonen <>

License

Creative Commons CC0 (public domain dedication)

Dependency

cffi (system).

Source

enchant.asd.

Child Component

enchant.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 enchant/enchant.asd

Source

enchant.asd.

Parent Component

enchant (system).

ASDF Systems

enchant.


3.1.2 enchant/enchant.lisp

Source

enchant.asd.

Parent Component

enchant (system).

Packages

enchant.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 enchant

Source

enchant.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: with-broker (variable &body body)

Initialize a new ‘broker‘ (using ‘broker-init‘) and lexically bind _variable_ to the ‘broker‘ object. Execute all _body_ forms and return the values of the last _body_ form. Finally, free the ‘broker‘ resources with function ‘broker-free‘.

Package

enchant.

Source

enchant.lisp.

Macro: with-dict ((variable language &optional broker) &body body)

Request a new ‘dict‘ object for _language_. Lexically bind _variable_ to the new ‘dict‘ object and execute all _body_ forms. Return the values of the last _body_ form. Finally, free the ‘dict‘ resources with function ‘broker-free-dict‘.

If the optional _broker_ argument is given reuse that broker object when requesting ‘dict‘. If the _broker_ argument is not given create implicitly a new ‘broker‘ object with ‘broker-init‘ and free it in the end with ‘broker-free‘. Note that the decision about the _broker_ argument is done at the macro-expansion time. If there is
anything (except the symbol ‘nil‘) in the place of the _broker_ argument that will be used as the broker.

Examples:

ENCHANT> (with-dict (lang "en_GB")
(dict-check lang "working"))
"working"

ENCHANT> (with-dict (lang "en_GB")
(dict-suggest lang "wrking"))
("wring" "working" "irking" "waking" "wrecking" "winking" "wrinkling" "marking" "Wrekin" "raking")

Package

enchant.

Source

enchant.lisp.

Macro: with-pwl-dict ((variable pwl &optional broker) &body body)

Request a new ‘dict‘ object for personal word list file _pwl_. Lexically bind _variable_ to the new ‘dict‘ object and execute all _body_ forms. Return the values of the last _body_ form. Finally, free the ‘dict‘ resources with function ‘broker-free-dict‘.

For more information on personal word list files see the documentation of function ‘broker-request-pwl-dict‘.

If the optional _broker_ argument is given reuse that broker object when requesting ‘dict‘. If the _broker_ argument is not given create implicitly a new ‘broker‘ object with ‘broker-init‘ and free it in the end with ‘broker-free‘. Note that the decision about the _broker_ argument is done at the macro-expansion time. If there is
anything (except the symbol ‘nil‘) in the place of the _broker_ argument that will be used as the broker.

Package

enchant.

Source

enchant.lisp.


5.1.2 Ordinary functions

Function: broker-describe (broker)

Get information about Enchant dictionary providers. Return a list of lists of three strings: provider name, provider description, provider library filename.

If _broker_ is not an active ‘broker‘ object, signal ‘not-active-broker‘ error condition.

Package

enchant.

Source

enchant.lisp.

Function: broker-dict-exists-p (broker language)

Check if dictionary for _language_ exists. _Broker_ must be a valid ‘broker‘ object returned by ‘broker-init‘. _Language_ is a language code and optional country code as a string (e.g., ‘"en"‘, ‘"en_GB"‘). If the _language_ exists return the _language_ string. Otherwise return ‘nil‘.

If _broker_ is not an active ‘broker‘ object, signal ‘not-active-broker‘ error condition.

Package

enchant.

Source

enchant.lisp.

Function: broker-free (broker)

Free the foreign (non-Lisp) ‘broker‘ resources. The argument is a ‘broker‘ object returned by ‘broker-init‘. The ‘broker‘ object becomes inactive and can’t be used anymore.

Package

enchant.

Source

enchant.lisp.

Function: broker-free-dict (broker dict)

Free the foreign (non-Lisp) ‘dict‘ resources. The first argument is a ‘broker‘ object returned by ‘broker-init‘ and the second a ‘dict‘ object returned by ‘broker-request-dict‘. The ‘dict‘ object becomes inactive and can’t be used anymore.

Package

enchant.

Source

enchant.lisp.

Function: broker-get-error (broker)

Return an error message string (or ‘nil‘) describing the last error in the UTF-8 encoding. This can be called after ‘broker‘ operations.

Package

enchant.

Source

enchant.lisp.

Function: broker-init ()

Initialize a new broker. Return a ‘broker‘ object which can be used to request dictionaries etc. See function ‘broker-request-dict‘.

A ‘broker‘ object is active when it has been successfully created. It allocates foreign (non-Lisp) resources and must be freed after use with function ‘broker-free‘. After being freed it becomes inactive and thus unusable. Generic function ‘activep‘ can be used to test if a ‘broker‘ object is active or not.

See macros ‘with-broker‘, ‘with-dict‘ and ‘with-pwl-dict‘ which automatically initialize and free broker and dictionary resources.

Package

enchant.

Source

enchant.lisp.

Function: broker-list-dicts (broker)

List all dictionaries that are available. Return a list of lists with four strings: language and optional country code (e.g., ‘"en"‘ or ‘"en_GB"‘), provider name, provider description and provider library filename.

If _broker_ is not an active ‘broker‘ object, signal ‘not-active-broker‘ error condition.

Package

enchant.

Source

enchant.lisp.

Function: broker-request-dict (broker language)

Request a new dictionary for _language_. Return a ‘dict‘ object which can be used with spell-checker operations etc.

The _broker_ argument must be an active ‘broker‘ object created with ‘broker-init‘. _Language_ is a language code and optional country code as a string (e.g., ‘"en"‘ or ‘"en_GB"‘).

A ‘dict‘ object is active when it has been successfully created. It allocates foreign (non-Lisp) resources and must be freed after use with function ‘broker-free-dict‘. After being freed it becomes inactive and thus unusable. Generic function ‘activep‘ can be used to test if ‘dict‘ object is active or not.

If no suitable dictionary could be found ‘dict-not-found‘ error condition is signaled.

See also ‘with-dict‘ macro which automatically creates a ‘dict‘ environment and frees it in the end.

Package

enchant.

Source

enchant.lisp.

Function: broker-request-pwl-dict (broker pwl)

Request a new dictionary for personal word list file _pwl_ (a filename string). Return a ‘dict‘ object which can be used with spell-checker operations.

The _broker_ argument must be an active ‘broker‘ object created with ‘broker-init‘. Personal word list file _pwl_ is a text file with one
entry (a word) per line. If the file does not exist it is created. New words can be added to the personal word list file with function
‘dict-add‘.

A ‘dict‘ object is active when it has been successfully created. It allocates foreign (non-Lisp) resources and must be freed after use with function ‘broker-free-dict‘. After being freed it becomes inactive and
thus unusable. Generic function ‘activep‘ can be used to test if ‘dict‘ object is active or not.

See also ‘with-pwl-dict‘ macro which automatically creates a ‘dict‘ environment and frees it in the end.

Package

enchant.

Source

enchant.lisp.

Function: broker-set-ordering (broker language ordering)

Declares a preference of providers to use for _language_.
The _language_ argument is a language code and optional country
code (e.g., ‘"en"‘ or ‘"en_GB"‘). Pseudo language ‘"*"‘ can be
used to declare a default ordering. It is used by any language that does not explicitly declare an ordering. The _ordering_ argument is a list of provider name strings (e.g., ‘("myspell" "aspell" "ispell")‘).

If _broker_ is not an active ‘broker‘ object, signal ‘not-active-broker‘ error condition.

Package

enchant.

Source

enchant.lisp.

Function: dict-add (dict word)

Add _word_ to user’s personal dictionary _dict_. If the _word_ exists in user’s exclude dictionary also remove it from there.

Package

enchant.

Source

enchant.lisp.

Function: dict-add-to-session (dict word)

Add _word_ to the current spell-checking session _dict_. _Word_ is then recognized as a correct word in the current session.

Package

enchant.

Source

enchant.lisp.

Function: dict-check (dict word)

Check the spelling of _word_ (string) using dictionary _dict_. Return the _word_ if the spelling is correct, ‘nil‘ otherwise.

_Dict_ must be an active ‘dict‘ object returned by ‘broker-request-dict‘, if not, signal a ‘not-active-dict‘ condition.

Package

enchant.

Source

enchant.lisp.

Function: dict-describe (dict)

Describe dictionary _dict_. Return a list of four strings: language code and optional country code (e.g., ‘"en"‘ or ‘"en_GB"‘), provider name, provider description and provider library filename.

_Dict_ must be an active ‘dict‘ object returned by ‘broker-request-dict‘, if not, signal a ‘not-active-dict‘ condition.

Package

enchant.

Source

enchant.lisp.

Function: dict-get-error (dict)

Return an error message string (or ‘nil‘) describing the last error in the UTF-8 encoding. This can be called after ‘dict‘ operations.

Package

enchant.

Source

enchant.lisp.

Function: dict-is-added-p (dict word)

Check if _word_ has been added to user’s personal dictionary or to the current spell-checking session _dict_. If true, return _word_. Otherwise return ‘nil‘.

Functions for adding words are ‘dict-add‘ and ‘dict-add-to-session‘.

Package

enchant.

Source

enchant.lisp.

Function: dict-is-removed-p (dict word)

Check if _word_ has been removed from user’s personal dictionary or from the current spell-checking session _dict_. If true, return _word_. Otherwise return ‘nil‘.

Package

enchant.

Source

enchant.lisp.

Function: dict-remove (dict word)

Add _word_ to user’s exclude dictionary for _dict_. If the _word_ exists in user’s personal dictionary also remove it from there.

Package

enchant.

Source

enchant.lisp.

Function: dict-remove-from-session (dict word)

Remove _word_ from the current spell-checking session _dict_. The _word_ is not recognized anymore in the current session.

Package

enchant.

Source

enchant.lisp.

Function: dict-store-replacement (dict word correction)

Add a correction statement from misspelled _word_ to _correction_ using dictionary _dict_. _Correction_ might show up in the suggestion list.

Package

enchant.

Source

enchant.lisp.

Function: dict-suggest (dict word)

Request spelling suggestions for _word_ (string) using dictionary _dict_. Return a list of suggestions (strings) or ‘nil‘ if there aren’t any.

_Dict_ must be an active ‘dict‘ object returned by ‘broker-request-dict‘, if not, signal ‘not-active-dict‘ condition.

Package

enchant.

Source

enchant.lisp.

Function: get-version ()

Return the Enchant library version.

Package

enchant.

Source

enchant.lisp.


5.1.3 Generic functions

Generic Function: activep (object)

Test if _object_ is active. Return a generalized boolean. This can be used with ‘broker‘ and ‘dict‘ objects.

Package

enchant.

Source

enchant.lisp.

Methods
Method: activep ((object foreign-object))
Generic Reader: error-string (condition)
Package

enchant.

Methods
Reader Method: error-string ((condition enchant-error))
Source

enchant.lisp.

Target Slot

error-string.


5.1.4 Standalone methods

Method: print-object ((object foreign-object) stream)
Source

enchant.lisp.


5.1.5 Conditions

Condition: dict-not-found
Package

enchant.

Source

enchant.lisp.

Direct superclasses

enchant-error.

Condition: enchant-error
Package

enchant.

Source

enchant.lisp.

Direct superclasses

error.

Direct subclasses
Direct methods

error-string.

Direct slots
Slot: error-string
Initargs

:string

Readers

error-string.

Writers

This slot is read-only.

Condition: not-active-broker
Package

enchant.

Source

enchant.lisp.

Direct superclasses

enchant-error.

Condition: not-active-dict
Package

enchant.

Source

enchant.lisp.

Direct superclasses

enchant-error.


5.1.6 Classes

Class: broker

Class for holding pointers to foreign (non-Lisp) broker resources. Instances are created with ‘broker-init‘ function.

Package

enchant.

Source

enchant.lisp.

Direct superclasses

foreign-object.

Direct methods

free-foreign-resource.

Class: dict

Class for holding pointers to foreign (non-Lisp) dictionary resources. Instances are created with ‘broker-request-dict‘ function.

Package

enchant.

Source

enchant.lisp.

Direct superclasses

foreign-object.

Direct methods

free-foreign-resource.


5.2 Internals


5.2.1 Special variables

Special Variable: *callback-data*
Package

enchant.

Source

enchant.lisp.


5.2.2 Ordinary functions

Function: error-if-not-active-broker (object)
Package

enchant.

Source

enchant.lisp.

Function: error-if-not-active-dict (object)
Package

enchant.

Source

enchant.lisp.

Function: error-if-not-proper-string (object)
Package

enchant.

Source

enchant.lisp.

Function: proper-pointer-p (object)
Package

enchant.

Source

enchant.lisp.


5.2.3 Generic functions

Generic Reader: address (object)
Package

enchant.

Methods
Reader Method: address ((foreign-object foreign-object))

automatically generated reader method

Source

enchant.lisp.

Target Slot

address.

Generic Writer: (setf address) (object)
Package

enchant.

Methods
Writer Method: (setf address) ((foreign-object foreign-object))

automatically generated writer method

Source

enchant.lisp.

Target Slot

address.

Generic Function: free-foreign-resource (object &key broker &allow-other-keys)
Package

enchant.

Source

enchant.lisp.

Methods
Method: free-foreign-resource ((dict dict) &key broker)
Method: free-foreign-resource ((broker broker) &key)
Method: free-foreign-resource :around ((object foreign-object) &key)

5.2.4 Classes

Class: foreign-object
Package

enchant.

Source

enchant.lisp.

Direct subclasses
Direct methods
Direct slots
Slot: address
Initargs

:address

Readers

address.

Writers

(setf address).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   B   D   E   F   G   M   P   W  
Index Entry  Section

(
(setf address): Private generic functions
(setf address): Private generic functions

A
activep: Public generic functions
activep: Public generic functions
address: Private generic functions
address: Private generic functions

B
broker-describe: Public ordinary functions
broker-dict-exists-p: Public ordinary functions
broker-free: Public ordinary functions
broker-free-dict: Public ordinary functions
broker-get-error: Public ordinary functions
broker-init: Public ordinary functions
broker-list-dicts: Public ordinary functions
broker-request-dict: Public ordinary functions
broker-request-pwl-dict: Public ordinary functions
broker-set-ordering: Public ordinary functions

D
dict-add: Public ordinary functions
dict-add-to-session: Public ordinary functions
dict-check: Public ordinary functions
dict-describe: Public ordinary functions
dict-get-error: Public ordinary functions
dict-is-added-p: Public ordinary functions
dict-is-removed-p: Public ordinary functions
dict-remove: Public ordinary functions
dict-remove-from-session: Public ordinary functions
dict-store-replacement: Public ordinary functions
dict-suggest: Public ordinary functions

E
error-if-not-active-broker: Private ordinary functions
error-if-not-active-dict: Private ordinary functions
error-if-not-proper-string: Private ordinary functions
error-string: Public generic functions
error-string: Public generic functions

F
free-foreign-resource: Private generic functions
free-foreign-resource: Private generic functions
free-foreign-resource: Private generic functions
free-foreign-resource: Private generic functions
Function, broker-describe: Public ordinary functions
Function, broker-dict-exists-p: Public ordinary functions
Function, broker-free: Public ordinary functions
Function, broker-free-dict: Public ordinary functions
Function, broker-get-error: Public ordinary functions
Function, broker-init: Public ordinary functions
Function, broker-list-dicts: Public ordinary functions
Function, broker-request-dict: Public ordinary functions
Function, broker-request-pwl-dict: Public ordinary functions
Function, broker-set-ordering: Public ordinary functions
Function, dict-add: Public ordinary functions
Function, dict-add-to-session: Public ordinary functions
Function, dict-check: Public ordinary functions
Function, dict-describe: Public ordinary functions
Function, dict-get-error: Public ordinary functions
Function, dict-is-added-p: Public ordinary functions
Function, dict-is-removed-p: Public ordinary functions
Function, dict-remove: Public ordinary functions
Function, dict-remove-from-session: Public ordinary functions
Function, dict-store-replacement: Public ordinary functions
Function, dict-suggest: Public ordinary functions
Function, error-if-not-active-broker: Private ordinary functions
Function, error-if-not-active-dict: Private ordinary functions
Function, error-if-not-proper-string: Private ordinary functions
Function, get-version: Public ordinary functions
Function, proper-pointer-p: Private ordinary functions

G
Generic Function, (setf address): Private generic functions
Generic Function, activep: Public generic functions
Generic Function, address: Private generic functions
Generic Function, error-string: Public generic functions
Generic Function, free-foreign-resource: Private generic functions
get-version: Public ordinary functions

M
Macro, with-broker: Public macros
Macro, with-dict: Public macros
Macro, with-pwl-dict: Public macros
Method, (setf address): Private generic functions
Method, activep: Public generic functions
Method, address: Private generic functions
Method, error-string: Public generic functions
Method, free-foreign-resource: Private generic functions
Method, free-foreign-resource: Private generic functions
Method, free-foreign-resource: Private generic functions
Method, print-object: Public standalone methods

P
print-object: Public standalone methods
proper-pointer-p: Private ordinary functions

W
with-broker: Public macros
with-dict: Public macros
with-pwl-dict: Public macros