next up previous contents index
Next: Appendices Up: Morphine - Reference Manual Previous: Scenario ``help''

Subsections

     
Scenario ``scenario_handler''

The scenario handler manages all the Opium objects: scenarios, commands, parameters, primitives, types and demos. It also handles an error recovery mechanism and the autoload of inactive scenarios.

Commands

make(Scenario)    
Command which loads a single scenario as active, traceable, and local into the current module. The declaration of a scenario must be done in a file named <scenario>.op. Only those files of the scenario are loaded which are not up-to-date. The scenario source files must be in the current directory. The object files will be put in a directory called ``opiumfiles''.
Scenario : atom
type of command : tool

make(Scenario, Module)    
Command which loads a single scenario as active, traceable, and local into the given module. The declaration of a scenario must be done in a file named <scenario>.op. Only those files of the scenario are loaded which are not up-to-date. The scenario source files must be in the current directory. The object files will be put in a directory called ``opiumfiles''.
Scenario : atom
Module : atom
type of command : opium

make(Scenario, Module, OptionList)    
Command which loads a single scenario into a given module. The options are active/inactive, traceable/untraceable, and global/local; they have to be given in this order. The declaration of a scenario must be done in a file named <scenario>.op. Only those files of the scenario are loaded which are not up-to-date. The scenario source files must be in the current directory. The object files will be put in a directory called ``opiumfiles''.
Scenario : atom
Module : atom
OptionList : is_option_list
type of command : opium

make(Scenario, Module, OptionList, SrcDir, ObjDir)    
Command which loads a single scenario into a given module. The source files are taken from SrcDir, the object files are taken from, resp. written to, ObjDir. The options are active/inactive, traceable/untraceable, and global/local; they have to be given in this order. Only those files of the scenario are loaded which are not up-to-date.
Scenario : atom
Module : atom
OptionList : is_option_list
SrcDir : is_absolute_dir
ObjDir : is_absolute_dir
type of command : opium

get_parameter(Parameter, ValueList)    
Command which gets the value of the parameter visible in the current module.
Parameter : is_opium_parameter
ValueList : is_list_or_var
type of command : tool

get_parameter_in_module(Parameter, ValueList, Module)    
Command which gets the value of the parameter in a given module.
Parameter : is_opium_parameter
ValueList : is_list_or_var
Module : is_opium_module
type of command : opium

set_parameter(Parameter, ValueList)    
Command which sets the value of the parameter visible in the current module. It automatically prompts the user for the values using the types given in the declaration of the parameter.
Parameter : is_opium_parameter
ValueList : is_list
type of command : tool

set_parameter_in_module(Parameter, ValueList, Module)    
Command which sets the value of the parameter in a given module. It automatically prompts the user for the values using the types given in the declaration of the parameter.
Parameter : is_opium_parameter
ValueList : is_list
Module : is_opium_module
type of command : opium

set_parameter(Parameter)    
Interactive command which helps to set the value of the parameter which is visible in the current module. It automatically checks the type of the values according to the type given in the declaration of the parameter.
Parameter : is_opium_parameter
type of command : tool

set_parameter_in_module(Parameter, Module)    
Interactive command which helps to set the value of the parameter in a given module. It automatically checks the type of the values according to the type given in the declaration of the parameter.
Parameter : is_opium_parameter
Module : is_opium_module
type of command : opium

unset_parameter(Parameter, ValueList)    
Command which unsets a value of a parameter which may have multiple values. For a parameter of type ``single'' or ``c'' you can use set_parameter.
Parameter : is_opium_parameter
ValueList : is_list
type of command : tool

unset_parameter_in_module(Parameter, ValueList, Module)    
Command which unsets the value of a parameter which may have multiple values, in a given module. For a parameter of type ``single'' or ``c'' you can use set_parameter_in_module.
Parameter : is_opium_parameter
ValueList : is_list
Module : is_opium_module
type of command : opium

set_default_parameters    
Command which sets or resets all the parameters of all the scenarios to their default values.
type of command : opium

set_default_parameters(Scenario)    
Command which sets or resets the parameters of a scenario visible in the current module to their default values.
Scenario : is_opium_scenario
type of command : tool

set_default_parameters_in_module(Scenario, Module)    
Command which sets or resets the parameters of a scenario to their default values in a given module.
Scenario : is_opium_scenario
Module : is_opium_module
type of command : opium

set_default(Parameter)    
Command which sets or resets the default value of Parameter visible in the current module.
Parameter : is_opium_parameter
type of command : tool

set_default_in_module(Parameter, Module)    
Command which sets or resets the default value of Parameter in a given module.
Parameter : is_opium_parameter
Module : is_opium_module
type of command : opium

show_parameters(Scenario)    
Command which shows the values of all the parameters related to a scenario visible in the current module.
Scenario : is_opium_scenario
type of command : tool

show_parameters_in_module(Scenario, Module)    
Command which shows the values of all the parameters related to Scenario in a given module.
Scenario : is_opium_scenario
Module : is_opium_module
type of command : opium

show_parameters    
Command which shows the values of all the parameters of all scenarios.
type of command : opium

initialization(Goals)    
When called as a compiled goal in a scenario file, initialization/1 asserts a clause which ensures that the goals given as argument of initialization/1 will be called whenever a new trace is started. NOTE: it has to be ensured that these goals refer to either global or exported predicates!
Goals : is_term
type of command : tool

set_default(ObjectType, Pred, Scenario, Module)    
Commands which sets the object Pred (e.g. next/1) of type ObjectType (e.g. command) in Scenario and Module to its default value. If used with variables it will set to default the matching objects on backtracking. For parameters use set_default/1.
ObjectType : is_customizable_type_or_var
Pred : is_pred_or_var
Scenario : is_opium_scenario_or_var
Module : is_opium_module_or_var
type of command : opium

rebuild_object(ObjectType, Pred, Implementation, Scenario, Module)    
Commands which links Pred (e.g. next/1) of ObjectType (e.g. command) in Scenario and Module to the given Implementation. Pred must be the name of an existing object with same arity. Implementation must be the name of a predicate (e.g. mynext). This predicate must have the same arity as the object to rebuild (except for tools commands where the implementation must be of arity +1). The existence of such a predicate is not checked by Opium.
ObjectType : is_customizable_type
Pred : is_pred
Implementation : atom
Scenario : is_opium_scenario_or_var
Module : is_opium_module_or_var
type of command : opium

Primitives

get_opium_filename(File, FileName)    
Primitive which gives the full file name including suffix of an Opium file. If the file does not exist it fails and gives an error message.
File : atom
FileName : var

get_parameter_info(Parameter, Scenario, Module, ArgList, ArgType, Default, CurrentValues)    
Primitive which gives information about parameter Name related to Scenario in a given module. CurrentValues is instantiated to the list of all current values.
Parameter : is_opium_parameter
Scenario : is_opium_scenario
Module : is_opium_module
ArgList : var
ArgType : var
Default : var
CurrentValues : var

opium_module(M)    
Primitive which succeeds if its argument is an opium module. It can also be used to generate all the opium modules on backtracking.
M : is_opium_module_or_var

implementation_link(ObjectType, Pred, DefaultImpl, Module)    
Primitive which retrieves the link between Pred, an Opium objects (e.g. next/0) of ObjectType and its default implementation visible in Module. This is useful when you want to customize an object and you want to re-use the default implementation. Only commands, primitives, procedures and types can be customized. For parameters see set_parameter.
ObjectType : is_customizable_type_or_var
Pred : is_pred_or_var
DefaultImpl : is_atom_or_var
Module : is_opium_module_or_var

Procedures

opium_scenario_in_module(Scenario, Module)    
Procedure which succeeds if Scenario is declared in Module.

opium_command_in_module(Command, Module)    
Procedure which succeeds if Command is declared in Module.

opium_primitive_in_module(Primitive, Module)    
Procedure which succeeds if Primitive is declared in Module.

opium_procedure_in_module(Procedure, Module)    
Procedure which succeeds if Procedure is declared in Module.

opium_parameter_in_module(Parameter, Module)    
Procedure which succeeds if Parameter is declared in Module.

opium_type_in_module(Type, Module)    
Procedure which succeeds if Type is declared in Module.

opium_demo_in_module(Demo, Module)    
Procedure which succeeds if Demo is declared in Module.

modify_time(File, Time)    
Procedure which returns the Time when File has been modified. If the file does not exist, it returns 0.

check_arg_type(ArgValList, ArgNameList, ArgTypeList, NewValList, Module)    
Procedure which checks the types of a list of arguments. If the type of an argument is not correct the user will be prompted for another value. If ArgVal is [] but ArgTypeList is not [] then the procedure will prompt the user for proper values. The types have to be visible in Module.

check_arg(ArgValue, ArgName, ArgType, NewValue, Module)    
Procedure which is called to check the type of a single argument. If the type of an argument is not correct the user will be prompted for another value until the new argument has the proper type. The type has to be visible in Module.

Types

is_opium_scenario    
Type which succeeds for an active opium scenario.

is_opium_scenario_or_var    
Type which succeeds for an active opium scenario or a variable.

is_opium_parameter    
Type which succeeds for a parameter of an opium scenario.

is_opium_object_or_var    
Type which succeeds for an object declared in an opium scenario, or a variable. An Opium object is a scenario, a command, a primitive, a procedure, a parameter, or a type.

is_option_list    
Type which succeeds for a list of options for a scenario: [active/inactive, traceable/untraceable, global/local].

is_absolute_dir    
Type which succeeds for an atom starting with ``/'' and ending with ``/''.

is_opium_module    
Type which succeeds for the name of a module which contains an opium scenario, or a module which has been initialized interactively by calling an Opium command or primitive.

is_opium_module_or_var    
Type which succeeds if the argument is an opium module or a variable.

is_customizable_type_or_var    
Type which succeeds for a type of Opium object which is customizable, or a variable. Customizable types are command, primitive, procedure, type.

is_customizable_type    
Type which succeeds for a type of Opium object which is customizable. Customizable types are command, primitive, procedure, type.

is_list_of_vars_or_empty_list    
Type which succeeds for a list of variables, or the empty list.

is_list_of_atoms_or_empty_list    
Type which succeeds for a list containing atoms, or an empty list.

is_opium_declaration    
Type which succeeds for an opium object (eg. opium_command/9). The arity of the predicate must be the arity of the declaration in the source.

is_pred    
Type which succeeds for a predicate id of the form P/A or M:P/A. The default module is the toplevel module in the traced session.

is_pred_id    
Type which succeeds for a predicate id which consists of P/A only.

is_goal_or_var    
Type which succeeds for a term which is either a var, a compound term or an atom.

is_goal    
Type which succeeds for a term which is either a compound term or an atom.

is_list    
Type which succeeds for any list.

is_term    
Type which succeeds for any Prolog term.

is_pred_or_var    
Type which succeeds for a predicate id of the form P/A, or M:P/A, or a variable. The default module is the toplevel module in the traced session.

is_integer_or_var    
Type which succeeds for an integer or a variable.

is_atom_or_var    
Type which succeeds for an atom or a variable.

is_string_or_var    
Type which succeeds if its argument is a string or a variable.

is_string_or_integer_or_var    
Type which succeeds if its argument is a string or a variable.

is_string_or_integer    
Type which succeeds if its argument is a string or an integer.

is_list_or_var    
Type which succeeds for a list or a variable.

is_list_of_atoms    
Type which succeeds for a list of atoms.

is_atom_or_list_of_atoms    
Type which succeeds for a single atom or a non-empty list of atoms.

is_list_of_preds    
Type which succeeds for a list of predicate ids of the form P/A or M:P/A. The default module is the toplevel module in the traced session.

is_pred_or_list_of_preds    
Type which succeeds for a predicate id, or for a list of predicate ids of the form P/A or M:P/A.

is_list_of_integers    
Type which succeeds for a list of integers.

is_list_of_integers_or_var    
Type which succeeds for a list of integers or a variable.


next up previous contents index
Next: Appendices Up: Morphine - Reference Manual Previous: Scenario ``help''
jahier@irisa.fr