[f587e9]: ref_c_conditions.xml Maximize Restore History

Download this file

ref_c_conditions.xml    174 lines (136 with data), 8.9 kB

  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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book [
<!ENTITY % eclent SYSTEM "ecl.ent">
%eclent;
]>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
<chapter>
<title>Conditions</title>
<section xml:id="ansi.conditions.c-dict">
<title>C Reference</title>
<refentry xml:id="ECL_HANDLER_CASE">
<refnamediv>
<refname><function>ECL_HANDLER_CASE</function></refname>
<refpurpose>C macro for <ulink url="&clhs;m_hand_1.htm"><symbol>handler-case</symbol></ulink></refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><code><function>ECL_HANDLER_CASE_BEGIN</function>(env,names) {</code></synopsis>
<synopsis><code>} <function>ECL_HANDLER_CASE(n,condition) {</function> {</code></synopsis>
<synopsis><code>} <function>ECL_HANDLER_CASE_END</function>;</code></synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>ECL_HANDLER_CASE_BEGIN</function> runs a block of C code with a set of error handlers bound to the names given by the list <replaceable>names</replaceable>. The subsequent <function>ECL_HANDLER_CASE</function> statements specify what to do when the <replaceable>n</replaceable>-th type of conditions is found, where <replaceable>n</replaceable> is an integer denoting the position of the name in the list <replaceable>names</replaceable>.</para>
<para>When a condition is signaled, &ECL; scans the list of signal handlers, looking for matches based on <symbol>typep</symbol>. If the match with the highest precedence belongs to the list <replaceable>names</replaceable>, &ECL; will perform a non-local transfer of control to the appropriate <function>ECL_HANDLER_CASE</function>, passing it a <replaceable>condition</replaceable> object as unique argument.</para>
<para>The following example shows how to establish a handler for <symbol>ERROR</symbol> conditions. Note how the first value to <function>ECL_HANDLER_CASE</function> matches the position of the restart name in the list:</para>
<programlisting>
cl_object error = ecl_make_symbol("ERROR","CL");
ECL_RESTART_BEGIN(the_env, ecl_list1(error)) {
/* This form is evaluated with bound handlers */
output = cl_eval(1, form);
} ECL_HANDLER_CASE(1, condition) {
/* This code is executed when an error happens */
/* We just return the error that took place */
output = condition;
} ECL_RESTART_END;
</programlisting>
</refsect1>
</refentry>
<refentry xml:id="ECL_RESTART_CASE">
<refnamediv>
<refname><function>ECL_RESTART_CASE</function></refname>
<refpurpose>C macro for <ulink url="&clhs;m_rst_ca.htm"><symbol>restart-case</symbol></ulink></refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><code><function>ECL_RESTART_CASE_BEGIN</function>(env,names) {</code></synopsis>
<synopsis><code>} <function>ECL_RESTART_CASE(n,args) {</function> {</code></synopsis>
<synopsis><code>} <function>ECL_RESTART_CASE_END</function>;</code></synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>ECL_RESTART_CASE_BEGIN</function> runs a block of C code with a set of restarts bound to the names given by the list <replaceable>names</replaceable>. The subsequent <function>ECL_RESTART_CASE</function> statements specify what to do when the <replaceable>n</replaceable>-th restart is invoked, where <replaceable>n</replaceable> is an integer denoting the position of the name in the list <replaceable>names</replaceable>.</para>
<para>When the restart is invoked, it can receive any number of arguments, which are grouped in a list and stored in a new variable created with the name <replaceable>args</replaceable>.</para>
<para>The following example shows how to establish an <symbol>ABORT</symbol> and a <symbol>USE-VALUE</symbol> restart. Note how the first value to <function>ECL_RESTART_CASE</function> matches the position of the restart name in the list:</para>
<programlisting>
cl_object abort = ecl_make_symbol("ABORT","CL");
cl_object use_value = ecl_make_symbol("USE-VALUE","CL");
ECL_RESTART_BEGIN(the_env, cl_list(2, abort, use_value)) {
/* This form is evaluated with bound restarts */
output = cl_eval(1, form);
} ECL_RESTART_CASE(1, args) {
/* This code is executed when the 1st restart (ABORT) is invoked */
output = Cnil;
} ECL_RESTART_CASE(2, args) {
/* This code is executed when the 2nd restart (ABORT) is invoked */
output = ECL_CAR(args);
} ECL_RESTART_END;
</programlisting>
</refsect1>
</refentry>
<refentry>
<refnamediv>
<refname>Conditions C dictionary</refname>
<refpurpose>&ANSI-C-Dict;</refpurpose>
</refnamediv>
<refsynopsisdiv>
<simplelist columns="2" type="horiz">
<member>Lisp symbol</member>
<member>C function</member>
<member><ulink url="&clhs;f_abortc.htm"><symbol>abort</symbol></ulink></member>
<member><code>cl_object cl_abort(cl_narg narg, ...)</code></member>
<member><ulink url="&clhs;f_break.htm"><symbol>break</symbol></ulink></member>
<member><code>cl_object cl_break()</code></member>
<member><ulink url="&clhs;f_cell_e.htm"><symbol>cell-error-name</symbol></ulink></member>
<member><code>&OCL;</code></member>
<member><ulink url="&clhs;f_cerror.htm"><symbol>cerror</symbol></ulink></member>
<member><code>cl_object cl_cerror(cl_narg narg, cl_object continue_format_control, cl_object datum, ...)</code></member>
<member><ulink url="&clhs;f_comp_1.htm"><symbol>compute-restarts</symbol></ulink></member>
<member><code>cl_object cl_compute_restarts(cl_narg narg, ...)</code></member>
<member><ulink url="&clhs;f_abortc.htm"><symbol>continue</symbol></ulink></member>
<member><code>cl_object cl_continue(cl_narg narg, ...)</code></member>
<member><ulink url="&clhs;f_error.htm"><symbol>error</symbol></ulink></member>
<member><code>cl_object cl_error(cl_narg narg, cl_object datum, ...)</code></member>
<member><ulink url="&clhs;f_find_r.htm"><symbol>find-restart</symbol></ulink></member>
<member><code>cl_object cl_find_restart(cl_narg narg, cl_object identifier, ...)</code></member>
<member><ulink url="&clhs;m_hand_1.htm"><symbol>handler-case</symbol></ulink></member>
<member><link linkend="ECL_HANDLER_CASE"><function>ECL_HANDLER_CASE</function></link> macro</member>
<member><ulink url="&clhs;f_invali.htm"><symbol>invalid-method-error</symbol></ulink></member>
<member><code>&OCL;</code></member>
<member><ulink url="&clhs;f_invoke.htm"><symbol>invoke-debugger</symbol></ulink></member>
<member><code>cl_object cl_invoke_debugger(cl_object condition)</code></member>
<member><ulink url="&clhs;f_invo_1.htm"><symbol>invoke-restart</symbol></ulink></member>
<member><code>cl_object cl_invoke_restart(cl_narg narg, cl_object restart, ...)</code></member>
<member><ulink url="&clhs;f_invo_2.htm"><symbol>invoke-restart-interactively</symbol></ulink></member>
<member><code>cl_object cl_invoke_restart_interactively(cl_object restart)</code></member>
<member><ulink url="&clhs;f_mk_cnd.htm"><symbol>make-condition</symbol></ulink></member>
<member><code>cl_object cl_make_condition(cl_narg narg, cl_object type)</code></member>
<member><ulink url="&clhs;f_meth_1.htm"><symbol>method-combination-error</symbol></ulink></member>
<member><code>&OCL;</code></member>
<member><ulink url="&clhs;f_abortc.htm"><symbol>muffle-warning</symbol></ulink></member>
<member><code>cl_object cl_muffle_warning(cl_narg narg, ...)</code></member>
<member><ulink url="&clhs;f_rst_na.htm"><symbol>restart-name</symbol></ulink></member>
<member><code>&OCL;</code></member>
<member><ulink url="&clhs;m_rst_ca.htm"><symbol>restart-case</symbol></ulink></member>
<member><link linkend="ECL_RESTART_CASE"><function>ECL_RESTART_CASE</function></link> macro</member>
<member><ulink url="&clhs;f_signal.htm"><symbol>signal</symbol></ulink></member>
<member><code>cl_object cl_signal(cl_narg narg, cl_object datum, ...)</code></member>
<member><ulink url="&clhs;f_smp_cn.htm"><symbol>simple-condition-format-control</symbol></ulink></member>
<member><code>&OCL;</code></member>
<member><ulink url="&clhs;f_smp_cn.htm"><symbol>simple-condition-format-arguments</symbol></ulink></member>
<member><code>&OCL;</code></member>
<member><ulink url="&clhs;f_abortc.htm"><symbol>store-value</symbol></ulink></member>
<member><code>cl_object cl_store_value(cl_narg narg, ...)</code></member>
<member><ulink url="&clhs;f_abortc.htm"><symbol>use-value</symbol></ulink></member>
<member><code>cl_object cl_use_value(cl_narg narg, ...)</code></member>
<member><ulink url="&clhs;f_warn.htm"><symbol>warn</symbol></ulink></member>
<member><code>cl_object cl_warn(cl_narg narg, cl_object datum, ...)</code></member>
</simplelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para></para>
</refsect1>
</refentry>
</section>
</chapter>
</book>