Exemple #1
0
    def __call__(self, arguments=''):
        """Call the CLIPS function.

        Function arguments must be provided as a string.

        """
        data = clips.data.DataObject(self._env)
        name = ffi.string(lib.EnvGetDeffunctionName(self._env, self._fnc))
        args = arguments.encode() if arguments != '' else ffi.NULL

        if lib.EnvFunctionCall(self._env, name, args, data.byref) == 1:
            raise CLIPSError(self._env)

        return data.value
Exemple #2
0
 def name(self):
     """Function name."""
     return ffi.string(
         lib.EnvGetDeffunctionName(self._env, self._fnc)).decode()