Debian Codegraph @

src/doc/old-manual/ref_c_conditions.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book [
3 <!ENTITY % eclent SYSTEM "ecl.ent">
4 %eclent;
5 ]>
6 <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
7 <chapter>
8 <title>Conditions</title>
9 <section xml:id="ansi.conditions.c-dict">
10 <title>C Reference</title>
11 <refentry xml:id="ECL_HANDLER_CASE">
12 <refnamediv>
13 <refname><function>ECL_HANDLER_CASE</function></refname>
14 <refpurpose>C macro for <ulink url="&clhs;m_hand_1.htm"><symbol>handler-case</symbol></ulink></refpurpose>
15 </refnamediv>
16
17 <refsynopsisdiv>
18 <synopsis><code><function>ECL_HANDLER_CASE_BEGIN</function>(env,names) {</code></synopsis>
19 <synopsis><code>} <function>ECL_HANDLER_CASE(n,condition) {</function> {</code></synopsis>
20 <synopsis><code>} <function>ECL_HANDLER_CASE_END</function>;</code></synopsis>
21 </refsynopsisdiv>
22
23 <refsect1>
24 <title>Description</title>
25
26 <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>
27
28 <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>
29
30 <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>
31 <programlisting>
32 cl_object error = ecl_make_symbol("ERROR","CL");
33 ECL_HANDLER_CASE_BEGIN(the_env, ecl_list1(error)) {
34 /* This form is evaluated with bound handlers */
35 output = cl_eval(1, form);
36 } ECL_HANDLER_CASE(1, condition) {
37 /* This code is executed when an error happens */
38 /* We just return the error that took place */
39 output = condition;
40 } ECL_HANDLER_CASE_END;
41 </programlisting>
42 </refsect1>
43 </refentry>
44
45 <refentry xml:id="ECL_RESTART_CASE">
46 <refnamediv>
47 <refname><function>ECL_RESTART_CASE</function></refname>
48 <refpurpose>C macro for <ulink url="&clhs;m_rst_ca.htm"><symbol>restart-case</symbol></ulink></refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <synopsis><code><function>ECL_RESTART_CASE_BEGIN</function>(env,names) {</code></synopsis>
53 <synopsis><code>} <function>ECL_RESTART_CASE(n,args) {</function> {</code></synopsis>
54 <synopsis><code>} <function>ECL_RESTART_CASE_END</function>;</code></synopsis>
55 </refsynopsisdiv>
56
57 <refsect1>
58 <title>Description</title>
59
60 <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>
61
62 <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>
63
64 <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>
65 <programlisting>
66 cl_object abort = ecl_make_symbol("ABORT","CL");
67 cl_object use_value = ecl_make_symbol("USE-VALUE","CL");
68 ECL_RESTART_CASE_BEGIN(the_env, cl_list(2, abort, use_value)) {
69 /* This form is evaluated with bound restarts */
70 output = cl_eval(1, form);
71 } ECL_RESTART_CASE(1, args) {
72 /* This code is executed when the 1st restart (ABORT) is invoked */
73 output = Cnil;
74 } ECL_RESTART_CASE(2, args) {
75 /* This code is executed when the 2nd restart (ABORT) is invoked */
76 output = ECL_CAR(args);
77 } ECL_RESTART_CASE_END;
78 </programlisting>
79 </refsect1>
80 </refentry>
81
82 <refentry>
83 <refnamediv>
84 <refname>Conditions C dictionary</refname>
85 <refpurpose>&ANSI-C-Dict;</refpurpose>
86 </refnamediv>
87
88 <refsynopsisdiv>
89 <simplelist columns="2" type="horiz">
90 <member>Lisp symbol</member>
91 <member>C function</member>
92
93 <member><ulink url="&clhs;f_abortc.htm"><symbol>abort</symbol></ulink></member>
94 <member><code>cl_object cl_abort(cl_narg narg, ...)</code></member>
95
96 <member><ulink url="&clhs;f_break.htm"><symbol>break</symbol></ulink></member>
97 <member><code>cl_object cl_break()</code></member>
98
99 <member><ulink url="&clhs;f_cell_e.htm"><symbol>cell-error-name</symbol></ulink></member>
100 <member><code>&OCL;</code></member>
101
102 <member><ulink url="&clhs;f_cerror.htm"><symbol>cerror</symbol></ulink></member>
103 <member><code>cl_object cl_cerror(cl_narg narg, cl_object continue_format_control, cl_object datum, ...)</code></member>
104
105 <member><ulink url="&clhs;f_comp_1.htm"><symbol>compute-restarts</symbol></ulink></member>
106 <member><code>cl_object cl_compute_restarts(cl_narg narg, ...)</code></member>
107
108 <member><ulink url="&clhs;f_abortc.htm"><symbol>continue</symbol></ulink></member>
109 <member><code>cl_object cl_continue(cl_narg narg, ...)</code></member>
110
111 <member><ulink url="&clhs;f_error.htm"><symbol>error</symbol></ulink></member>
112 <member><code>cl_object cl_error(cl_narg narg, cl_object datum, ...)</code></member>
113
114 <member><ulink url="&clhs;f_find_r.htm"><symbol>find-restart</symbol></ulink></member>
115 <member><code>cl_object cl_find_restart(cl_narg narg, cl_object identifier, ...)</code></member>
116
117 <member><ulink url="&clhs;m_hand_1.htm"><symbol>handler-case</symbol></ulink></member>
118 <member><link linkend="ECL_HANDLER_CASE"><function>ECL_HANDLER_CASE</function></link> macro</member>
119
120 <member><ulink url="&clhs;f_invali.htm"><symbol>invalid-method-error</symbol></ulink></member>
121 <member><code>&OCL;</code></member>
122
123 <member><ulink url="&clhs;f_invoke.htm"><symbol>invoke-debugger</symbol></ulink></member>
124 <member><code>cl_object cl_invoke_debugger(cl_object condition)</code></member>
125
126 <member><ulink url="&clhs;f_invo_1.htm"><symbol>invoke-restart</symbol></ulink></member>
127 <member><code>cl_object cl_invoke_restart(cl_narg narg, cl_object restart, ...)</code></member>
128
129 <member><ulink url="&clhs;f_invo_2.htm"><symbol>invoke-restart-interactively</symbol></ulink></member>
130 <member><code>cl_object cl_invoke_restart_interactively(cl_object restart)</code></member>
131
132 <member><ulink url="&clhs;f_mk_cnd.htm"><symbol>make-condition</symbol></ulink></member>
133 <member><code>cl_object cl_make_condition(cl_narg narg, cl_object type)</code></member>
134
135 <member><ulink url="&clhs;f_meth_1.htm"><symbol>method-combination-error</symbol></ulink></member>
136 <member><code>&OCL;</code></member>
137
138 <member><ulink url="&clhs;f_abortc.htm"><symbol>muffle-warning</symbol></ulink></member>
139 <member><code>cl_object cl_muffle_warning(cl_narg narg, ...)</code></member>
140
141 <member><ulink url="&clhs;f_rst_na.htm"><symbol>restart-name</symbol></ulink></member>
142 <member><code>&OCL;</code></member>
143
144 <member><ulink url="&clhs;m_rst_ca.htm"><symbol>restart-case</symbol></ulink></member>
145 <member><link linkend="ECL_RESTART_CASE"><function>ECL_RESTART_CASE</function></link> macro</member>
146
147 <member><ulink url="&clhs;f_signal.htm"><symbol>signal</symbol></ulink></member>
148 <member><code>cl_object cl_signal(cl_narg narg, cl_object datum, ...)</code></member>
149
150 <member><ulink url="&clhs;f_smp_cn.htm"><symbol>simple-condition-format-control</symbol></ulink></member>
151 <member><code>&OCL;</code></member>
152
153 <member><ulink url="&clhs;f_smp_cn.htm"><symbol>simple-condition-format-arguments</symbol></ulink></member>
154 <member><code>&OCL;</code></member>
155
156 <member><ulink url="&clhs;f_abortc.htm"><symbol>store-value</symbol></ulink></member>
157 <member><code>cl_object cl_store_value(cl_narg narg, ...)</code></member>
158
159 <member><ulink url="&clhs;f_abortc.htm"><symbol>use-value</symbol></ulink></member>
160 <member><code>cl_object cl_use_value(cl_narg narg, ...)</code></member>
161
162 <member><ulink url="&clhs;f_warn.htm"><symbol>warn</symbol></ulink></member>
163 <member><code>cl_object cl_warn(cl_narg narg, cl_object datum, ...)</code></member>
164 </simplelist>
165 </refsynopsisdiv>
166
167 <refsect1>
168 <title>Description</title>
169 <para></para>
170 </refsect1>
171 </refentry>
172 </section>
173 </chapter>
174 </book>