예제 #1
0
    def module(self):
        """The module in which the Template is defined.

        Python equivalent of the CLIPS deftemplate-module command.

        """
        modname = ffi.string(lib.EnvDeftemplateModule(self._env, self._tpl))
        defmodule = lib.EnvFindDefmodule(self._env, modname)

        return Module(self._env, defmodule)
예제 #2
0
def template_pp_string(env, template):
    strn = lib.EnvGetDeftemplatePPForm(env, template)

    if strn != ffi.NULL:
        return ffi.string(strn).decode().strip()
    else:
        module = ffi.string(lib.EnvDeftemplateModule(env, template)).decode()
        name = ffi.string(lib.EnvGetDeftemplateName(env, template)).decode()

        return '(deftemplate %s::%s)' % (module, name)