Files
mercury/extras/morphine/source/step_by_step.op
Erwan Jahier 5bfe81af8a Improve the Morphine documentation.
Estimated hours taken: 20
Branch: main


Improve the Morphine documentation.

extras/morphine/source/forward_move.op:
extras/morphine/source/current_arg.op:
extras/morphine/source/current_slots.op:
extras/morphine/source/event_attributes.op:
extras/morphine/source/exec_control.op:
extras/morphine/source/coprocess.op:
extras/morphine/source/interactive_queries.op:
extras/morphine/source/step_by_step.op:
extras/morphine/source/display.op:
extras/morphine/source/source.op:
extras/morphine/source/collect.op:
extras/morphine/source/collect.in:
extras/morphine/source/make_scenario.pl:

	Make the documentation more homogeneous; in particular, wrap all
 	predicates, variables, and atoms with quotes like this:
	`...'.  Also make the help messages begin with a verb when
	possible for consistency.

	Fix a few typos.

	Fix quite a few grammatical errors.
2001-06-15 13:02:34 +00:00

192 lines
4.3 KiB
Plaintext

%------------------------------------------------------------------------------%
% Copyright (C) 1999-2001 INRIA/INSA de Rennes/IFSIC.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file License in the Morphine distribution.
%
% Author : Erwan Jahier <jahier@irisa.fr>
%
opium_scenario(
name : step_by_step,
files : [step_by_step],
scenarios : [],
message :
"Scenario which provides standard step by step tracing facilities. The tracing \
commands of this scenario are different from those of the ``kernel'' scenario. \
User can use a more simple execution model by setting the ``traced_ports'' \
parameter which filters out some of the traced events."
).
%------------------------------------------------------------------------------%
opium_command(
name : next,
arg_list : [],
arg_type_list : [],
abbrev : n,
interface : button,
command_type : trace,
implementation : next_Op,
parameters : [traced_ports],
message :
"Moves forward to the next trace event according to the \
`traced_ports' parameter. This is the same command as `step/0' (`next/0' is \
the name used in Opium (The Prolog version of Morphine), `step' is the name \
used in the internal Mercury debugger mdb)."
).
opium_command(
name : step,
arg_list : [],
arg_type_list : [],
abbrev : _,
interface : hidden,
command_type : trace,
implementation : next_Op,
parameters : [traced_ports],
message :
"See `next/0'."
).
next_Op :-
traced_ports(PortList),
fget_np(port = PortList).
%------------------------------------------------------------------------------%
opium_command(
name : det_next,
arg_list : [],
arg_type_list : [],
abbrev : _,
interface : menu,
command_type : trace,
implementation : det_next_Op,
parameters : [traced_ports],
message :
"Command which does the same thing as step/0, but it is not backtrackable."
).
opium_command(
name : det_step,
arg_list : [],
arg_type_list : [],
abbrev : _,
interface : hidden,
command_type : trace,
implementation : det_next_Op,
parameters : [traced_ports],
message :
"See `det_next/0'."
).
det_next_Op :-
next_np,
!.
%------------------------------------------------------------------------------%
opium_command(
name : next,
arg_list : [N],
arg_type_list : [integer],
abbrev : n,
interface : menu,
command_type : opium,
implementation : next_Op,
parameters : [traced_ports],
message :
"Prints `N' next trace events according to the `traced_ports' parameter."
).
opium_command(
name : step,
arg_list : [N],
arg_type_list : [integer],
abbrev : _,
interface : hidden,
command_type : opium,
implementation : next_Op,
parameters : [traced_ports],
message :
"See `next/1'."
).
next_Op(N) :-
N =< 0,
!.
next_Op(N) :-
setval(next_counter, N),
next,
decval(next_counter),
getval(next_counter, 0),
!.
%------------------------------------------------------------------------------%
opium_command(
name : finish,
arg_list : [],
arg_type_list : [],
abbrev : f,
interface : button,
command_type : trace,
implementation : skip_Op,
parameters : [],
message :
"Makes the execution continuing until it reaches a final port \
(`exit' or `fail') of the goal to which the current event refers. If the current \
port is already final, it acts like `step/0'.\n\
It is the same command as `skip/0' (`skip' is the name used in the Prolog \
version of Opium, `finish' is the name used in the internal Mercury \
debugger)."
).
opium_command(
name : skip,
arg_list : [],
arg_type_list : [],
abbrev : sk,
interface : hidden,
command_type : trace,
implementation : skip_Op,
parameters : [],
message :
"See finish/0."
).
skip_Op :-
current(port = Port),
skip_int(Port).
skip_int(Port) :-
is_quit_port(Port),
!,
det_next_np.
skip_int(_) :-
current(call = Call),
fget_np(call = Call and port = [exit, fail]),
!.
is_quit_port(exit).
is_quit_port(fail).
%------------------------------------------------------------------------------%
opium_parameter(
name : traced_ports,
arg_list : [PortList],
arg_type_list : [is_list_of_ports],
parameter_type : single,
default : [[call, exit, fail, redo, then, else,
switch, disj, first, later]],
commands : [next],
message :
"Specifies which events (w.r.t. ports) are to be traced by \
commands `next' and `step'."
).