1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
%------------------------------------------------------------------------------%
% Copyright (C) 1999 INRIA/INSA.
%
% 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 :
"Command which moves forward to the next trace event according to the \
``traced_ports'' parameter. This is the same command as step/0 (``next'' is \
the name used in the Prolog version of Opium, ``step'' is the name used in the \
internal Mercury debugger)."
).
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 :
"Command which prints the 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 :
"Command which 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 a 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 :
"Parameter which tells which events (w.r.t. ports) are to be traced by \
commands ``next'' and ``step''."
).
|