next up previous
Next: Catching Signals (Software Up: The Foreign Include Previous: Calls based on

Foreign Code and Modules

Modules are identified via a unique handle. The following functions are available to query and manipulate modules.

module_t
PL_context()
  Return the module identifier of the context module of the currently active foreign predicate.
term_t
PL_strip_module( term_t, module_t *)
  Utility function. If term_t is a term, possibly holding the module construct module:rest this function will return rest and fill module * with module. For further nested module constructs the inner most module is returned via module *. If term is not a module construct term will simply be returned. If module * is NULL it will be set to the context module. Otherwise it will be left untouched. The following example shows how to obtain the plain term and module if the default module is the user module:

{ module m = PL_new_module(PL_new_atom("user"));

  if ( (term = PL_strip_module(term, &m)) == NULL )
    return PL_warning("Illegal module specification");

  ...

atomic_t
PL_module_name( module_t)
  Return the name of module as an atom.
module_t
PL_new_module( atomic_t)
  Find an existing or create a new module with name specified by the atom atomic.



Passani Luca
Tue Nov 14 08:58:33 MET 1995