Most of the CLIPS API is implemented in PyCLIPS. The lower
level interface (which directly maps CLIPS exposed functions as
described in Clips Reference Guide Vol. II:
Advanced Programming Guide) can be accessed using the
clips._clips submodule. Almost all the functions defined here
have a counterpart in the CLIPS API, and a combined use of documentation
strings and Clips Reference Guide Vol. II:
Advanced Programming Guide itself can allow you to directly manipulate the
CLIPS subsystem as you would have done by embedding it in a C program.
However, there are some functions that appear in dir(clips._clips)
but, when called, issue an error:
>>> clips._clips.addClearFunction()
Traceback (most recent call last):
File "<pyshell#46>", line 1, in ?
clips._clips.addClearFunction()
ClipsError: C98: unimplemented feature/function
and in fact, even their documentation string reports
>>> print clips._clips.addClearFunction.__doc__ unimplemented feature/function
even if the name of the function is defined and is a callable.
A list of such functions follows:
| Function | Type |
|---|---|
addClearFunction |
execution hook |
addPeriodicFunction |
execution hook |
addResetFunction |
execution hook |
removeClearFunction |
execution hook |
removePeriodicFunction |
execution hook |
removeResetFunction |
execution hook |
addRunFunction |
execution hook |
removeRunFunction |
execution hook |
decrementFactCount |
reference count handler |
incrementFactCount |
reference count handler |
decrementInstanceCount |
reference count handler |
incrementInstanceCount |
reference count handler |
setOutOfMemoryFunction |
memory handler hook |
addEnvironmentCleanupFunction |
execution hook |
allocateEnvironmentData |
memory handler |
deallocateEnvironmentData |
memory handler |
destroyEnvironment |
environment destructor |
getEnvironmentData |
memory handler |
The description of these functions is outside the scope of this guide, and can be found in Clips Reference Guide Vol. II: Advanced Programming Guide of CLIPS. It is not likely that these functions will be implemented even in future versions of PyCLIPS since Python programmers are usually not interested in dealing with low level memory handling (which is the primary use of the memory oriented functions), and tasks like reference count handling are performed directly by Python itself (for Python objects which shadow CLIPS entities) and by the low level PyCLIPS submodule. Also, the functions referred to above as execution hooks often have to deal with CLIPS internal structures at a very low level, so they would be of no use in a Python program.
Other API functions, which are used internally by PyCLIPS (for instance the InitializeEnvironment() C function), are not implemented in the module.
"C97: higher engine
version required". Moreover, the CLIPS engine version may affect the
behaviour of some functions. Please consider reading the documentation
related to the used CLIPS version when a function does not behave as
expected.