/usr/share/doc/racket/inside/exceptions.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>9 Exceptions and Escape Continuations</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Inside:<span class="mywbr"> </span> Racket C API</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="overview.html" class="tocviewlink" data-pltdoc="x">Overview</a></td></tr><tr><td align="right">2 </td><td><a href="embedding.html" class="tocviewlink" data-pltdoc="x">Embedding into a Program</a></td></tr><tr><td align="right">3 </td><td><a href="Writing_Racket_Extensions.html" class="tocviewlink" data-pltdoc="x">Writing Racket Extensions</a></td></tr><tr><td align="right">4 </td><td><a href="im_values_types.html" class="tocviewlink" data-pltdoc="x">Values and Types</a></td></tr><tr><td align="right">5 </td><td><a href="im_memoryalloc.html" class="tocviewlink" data-pltdoc="x">Memory Allocation</a></td></tr><tr><td align="right">6 </td><td><a href="im_env.html" class="tocviewlink" data-pltdoc="x">Namespaces and Modules</a></td></tr><tr><td align="right">7 </td><td><a href="Procedures.html" class="tocviewlink" data-pltdoc="x">Procedures</a></td></tr><tr><td align="right">8 </td><td><a href="Evaluation.html" class="tocviewlink" data-pltdoc="x">Evaluation</a></td></tr><tr><td align="right">9 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Exceptions and Escape Continuations</a></td></tr><tr><td align="right">10 </td><td><a href="threads.html" class="tocviewlink" data-pltdoc="x">Threads</a></td></tr><tr><td align="right">11 </td><td><a href="config.html" class="tocviewlink" data-pltdoc="x">Parameterizations</a></td></tr><tr><td align="right">12 </td><td><a href="contmarks.html" class="tocviewlink" data-pltdoc="x">Continuation Marks</a></td></tr><tr><td align="right">13 </td><td><a href="im_encodings.html" class="tocviewlink" data-pltdoc="x">String Encodings</a></td></tr><tr><td align="right">14 </td><td><a href="Bignums__Rationals__and_Complex_Numbers.html" class="tocviewlink" data-pltdoc="x">Bignums, Rationals, and Complex Numbers</a></td></tr><tr><td align="right">15 </td><td><a href="Ports_and_the_Filesystem.html" class="tocviewlink" data-pltdoc="x">Ports and the Filesystem</a></td></tr><tr><td align="right">16 </td><td><a href="Structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">17 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Security Guards</a></td></tr><tr><td align="right">18 </td><td><a href="Custodians.html" class="tocviewlink" data-pltdoc="x">Custodians</a></td></tr><tr><td align="right">19 </td><td><a href="Subprocesses.html" class="tocviewlink" data-pltdoc="x">Subprocesses</a></td></tr><tr><td align="right">20 </td><td><a href="Miscellaneous_Utilities.html" class="tocviewlink" data-pltdoc="x">Miscellaneous Utilities</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>9 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Exceptions and Escape Continuations</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">9.1 </td><td><a href="#%28part._imz~3atempcatch%29" class="tocviewlink" data-pltdoc="x">Temporarily Catching Error Escapes</a></td></tr><tr><td align="right">9.2 </td><td><a href="#%28part._.Enabling_and_.Disabling_.Breaks%29" class="tocviewlink" data-pltdoc="x">Enabling and Disabling Breaks</a></td></tr><tr><td align="right">9.3 </td><td><a href="#%28part._.Exception_.Functions%29" class="tocviewlink" data-pltdoc="x">Exception Functions</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">9.1<tt> </tt></span><a href="#%28part._imz~3atempcatch%29" class="tocsubseclink" data-pltdoc="x">Temporarily Catching Error Escapes</a></td></tr><tr><td><span class="tocsublinknumber">9.2<tt> </tt></span><a href="#%28part._.Enabling_and_.Disabling_.Breaks%29" class="tocsubseclink" data-pltdoc="x">Enabling and Disabling Breaks</a></td></tr><tr><td><span class="tocsublinknumber">9.3<tt> </tt></span><a href="#%28part._.Exception_.Functions%29" class="tocsubseclink" data-pltdoc="x">Exception Functions</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="Evaluation.html" title="backward to "8 Evaluation"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Inside: Racket C API"" data-pltdoc="x">up</a> <a href="threads.html" title="forward to "10 Threads"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "scribblings/inside/inside.scrbl")" x-part-tag=""exceptions"">9<tt> </tt><a name="(part._exceptions)"></a>Exceptions and Escape Continuations</h3><p>When Racket encounters an error, it raises an exception. The default
exception handler invokes the error display handler and then the error
escape handler. The default error escape handler escapes via a
<span style="font-style: italic">primitive error escape</span>, which is implemented by calling
<span class="stt">scheme_longjmp(*scheme_current_thread->error_buf)</span>.</p><p>An embedding program should install a fresh buffer into
<span class="stt">scheme_current_thread->error_buf</span> and call
<span class="stt">scheme_setjmp(*scheme_current_thread->error_buf)</span> before any
top-level entry into Racket evaluation to catch primitive error
escapes. When the new buffer goes out of scope, restore the original
in <span class="stt">scheme_current_thread->error_buf</span>. The macro
<span class="stt">scheme_error_buf</span> is a shorthand for
<span class="stt">*scheme_current_thread->error_buf</span>.</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace"> </span><span class="stt">mz_jmp_buf * volatile save, fresh;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">...</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">save = scheme_current_thread->error_buf;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">scheme_current_thread->error_buf = &fresh;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">if (scheme_setjmp(scheme_error_buf)) {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* There was an error */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">...</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">} else {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">v = scheme_eval_string(s, env);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">scheme_current_thread->error_buf = save;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">...</span></p></td></tr></table></p><p>3m: when <span class="stt">scheme_setjmp</span> is used, the enclosing context must
provide a local-variable registration record via <a href="im_memoryalloc.html#%28cpp._.M.Z_.G.C_.D.E.C.L_.R.E.G%29" class="RktStxLink" data-pltdoc="x"><span class="stt">MZ_GC_DECL_REG</span></a>.
Use <span class="stt">MZ_GC_DECL_REG(0)</span> if the context has no local variables to
register. Unfortunately, when using <span class="nobreak"><span class="stt">--xform</span></span> with <span class="stt">raco ctool</span> instead
of <a href="im_memoryalloc.html#%28cpp._.M.Z_.G.C_.D.E.C.L_.R.E.G%29" class="RktStxLink" data-pltdoc="x"><span class="stt">MZ_GC_DECL_REG</span></a>, etc., you may need to declare a dummy pointer
and use it after <span class="stt">scheme_setjmp</span> to ensure that a local-variable
registration is generated.</p><p>New primitive procedures can raise a generic exception by calling
<a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a>. The arguments for
<a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a> are roughly the same as for the standard C
function <span class="stt">printf</span>. A specific primitive exception can be raised by
calling <a href="#%28cpp._scheme_raise_exn%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_raise_exn</span></a>.</p><p>Full <a name="(idx._(gentag._331._(lib._scribblings/inside/inside..scrbl)))"></a>continuations are implemented in Racket by copying
the C stack and using <span class="stt">scheme_setjmp</span> and <span class="stt">scheme_longjmp</span>.
As long a C/C++ application invokes Racket evaluation through the
top-level evaluation functions (<a href="Evaluation.html#%28cpp._scheme_eval%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_eval</span></a>, <a href="Evaluation.html#%28cpp._scheme_apply%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_apply</span></a>,
etc., as opposed to <a href="Evaluation.html#%28cpp.__scheme_apply%29" class="RktStxLink" data-pltdoc="x"><span class="stt">_scheme_apply</span></a>, <a href="Evaluation.html#%28cpp.__scheme_eval_compiled%29" class="RktStxLink" data-pltdoc="x"><span class="stt">_scheme_eval_compiled</span></a>,
etc.), the code is protected against any unusual behavior from Racket
evaluations (such as returning twice from a function) because
continuation invocations are confined to jumps within a single
top-level evaluation. However, escape continuation jumps are still
allowed; as explained in the following sub-section, special care must
be taken in extension that is sensitive to escapes.</p><h4 x-source-module="(lib "scribblings/inside/inside.scrbl")" x-part-tag=""imz:tempcatch"">9.1<tt> </tt><a name="(part._imz~3atempcatch)"></a>Temporarily Catching Error Escapes</h4><p>When implementing new primitive procedure, it is sometimes useful to
catch and handle errors that occur in evaluating subexpressions. One
way to do this is the following: save
<span class="stt">scheme_current_thread->error_buf</span> to a temporary variable, set
<span class="stt">scheme_current_thread->error_buf</span> to the address of a
stack-allocated <span class="stt">mz_jmp_buf</span>, invoke
<span class="stt">scheme_setjmp(scheme_error_buf)</span>, perform the function’s work,
and then restore <span class="stt">scheme_current_thread->error_buf</span> before
returning a value. (3m: A stack-allocated <span class="stt">mz_jmp_buf</span> instance
need not be registered with the garbage collector, and a
heap-allocated <span class="stt">mz_jmp_buf</span> should be allocated as atomic.)</p><p>However, beware that a prompt abort or the invocation of an escaping
continuation looks like a primitive error escape. In that case, the
special indicator flag <span class="stt">scheme_jumping_to_continuation</span> is
non-zero (instead of its normal zero value); this situation is only
visible when implementing a new primitive procedure. When
<span class="stt">scheme_jumping_to_continuation</span> is non-zero, honor the escape
request by chaining to the previously saved error buffer; otherwise,
call <a href="#%28cpp._scheme_clear_escape%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_clear_escape</span></a>.</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace"> </span><span class="stt">mz_jmp_buf * volatile save, fresh;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">save = scheme_current_thread->error_buf;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">scheme_current_thread->error_buf = &fresh;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">if (scheme_setjmp(scheme_error_buf)) {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* There was an error or continuation invocation */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">if (scheme_jumping_to_continuation) {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* It was a continuation jump */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">scheme_longjmp(*save, 1);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* To block the jump, instead: scheme_clear_escape(); */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">} else {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* It was a primitive error escape */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">} else {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">scheme_eval_string("x", scheme_env);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">scheme_current_thread->error_buf = save;</span></p></td></tr></table></p><p>This solution works fine as long as the procedure implementation only
calls top-level evaluation functions (<a href="Evaluation.html#%28cpp._scheme_eval%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_eval</span></a>,
<a href="Evaluation.html#%28cpp._scheme_apply%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_apply</span></a>, etc., as opposed to <a href="Evaluation.html#%28cpp.__scheme_apply%29" class="RktStxLink" data-pltdoc="x"><span class="stt">_scheme_apply</span></a>,
<a href="Evaluation.html#%28cpp.__scheme_eval_compiled%29" class="RktStxLink" data-pltdoc="x"><span class="stt">_scheme_eval_compiled</span></a>, etc.). Otherwise, use
<a href="#%28cpp._scheme_dynamic_wind%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_dynamic_wind</span></a> to protect your code against full
continuation jumps in the same way that <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=cont.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._dynamic-wind%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">dynamic-wind</a></span> is used
in Racket.</p><p>The above solution simply traps the escape; it doesn’t report the
reason that the escape occurred. To catch exceptions and obtain
information about the exception, the simplest route is to mix Racket
code with C-implemented thunks. The code below can be used to catch
exceptions in a variety of situations. It implements the function
<span class="stt">_apply_catch_exceptions</span>, which catches exceptions during the
application of a thunk. (This code is in
<span class="stt">"collects/mzscheme/examples/catch.c"</span> in the distribution.)</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace"> </span><span class="stt">static Scheme_Object *exn_catching_apply, *exn_p, *exn_message;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">static void init_exn_catching_apply()</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">{</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">if (!exn_catching_apply) {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">char *e =</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">"(lambda (thunk) "</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">"(with-handlers ([void (lambda (exn) (cons #f exn))]) "</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">"(cons #t (thunk))))";</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* make sure we have a namespace with the standard bindings: */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">Scheme_Env *env = (Scheme_Env *)scheme_make_namespace(0, NULL);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">scheme_register_extension_global(&exn_catching_apply,</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">sizeof(Scheme_Object *));</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">scheme_register_extension_global(&exn_p,</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">sizeof(Scheme_Object *));</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">scheme_register_extension_global(&exn_message,</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">sizeof(Scheme_Object *));</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">exn_catching_apply = scheme_eval_string(e, env);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">exn_p = scheme_lookup_global(scheme_intern_symbol("exn?"), env);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">exn_message</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">= scheme_lookup_global(scheme_intern_symbol("exn-message"),</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">env);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">/* This function applies a thunk, returning the Racket value if</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">there's no exception, otherwise returning NULL and setting *exn</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">to the raised value (usually an exn structure). */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">Scheme_Object *_apply_thunk_catch_exceptions(Scheme_Object *f,</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">Scheme_Object **exn)</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">{</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">Scheme_Object *v;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">init_exn_catching_apply();</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">v = _scheme_apply(exn_catching_apply, 1, &f);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* v is a pair: (cons #t value) or (cons #f exn) */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">if (SCHEME_TRUEP(SCHEME_CAR(v)))</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return SCHEME_CDR(v);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">else {</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">*exn = SCHEME_CDR(v);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return NULL;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">Scheme_Object *extract_exn_message(Scheme_Object *v)</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">{</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">init_exn_catching_apply();</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">if (SCHEME_TRUEP(_scheme_apply(exn_p, 1, &v)))</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return _scheme_apply(exn_message, 1, &v);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">else</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return NULL; /* Not an exn structure */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr></table></p><p>In the following example, the above code is used to catch exceptions
that occur during while evaluating source code from a string.</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace"> </span><span class="stt">static Scheme_Object *do_eval(void *s, int noargc,</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">Scheme_Object **noargv)</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">{</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return scheme_eval_string((char *)s,</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">scheme_get_env(scheme_config));</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">static Scheme_Object *eval_string_or_get_exn_message(char *s)</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">{</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">Scheme_Object *v, *exn;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">v = scheme_make_closed_prim(do_eval, s);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">v = _apply_thunk_catch_exceptions(v, &exn);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* Got a value? */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">if (v)</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return v;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">v = extract_exn_message(exn);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* Got an exn? */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">if (v)</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return v;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">/* `raise' was called on some arbitrary value */</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt"></span><span class="hspace"> </span><span class="stt">return exn;</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">}</span></p></td></tr></table></p><h4 x-source-module="(lib "scribblings/inside/inside.scrbl")" x-part-tag=""Enabling_and_Disabling_Breaks"">9.2<tt> </tt><a name="(part._.Enabling_and_.Disabling_.Breaks)"></a>Enabling and Disabling Breaks</h4><p>When embedding Racket, asynchronous break exceptions are disabled by
default. Call <a href="#%28cpp._scheme_set_can_break%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_set_can_break</span></a> (which is the same as calling
the Racket function <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=breakhandler.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._break-enabled%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">break-enabled</a></span>) to enable or disable
breaks. To enable or disable breaks during the dynamic extent of
another evaluation (where you would use
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=breakhandler.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmore-scheme..rkt%2529._call-with-break-parameterization%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">call-with-break-parameterization</a></span> in Racket), use
<a href="#%28cpp._scheme_push_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_push_break_enable</span></a> before and
<a href="#%28cpp._scheme_pop_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_pop_break_enable</span></a> after, instead.</p><h4 x-source-module="(lib "scribblings/inside/inside.scrbl")" x-part-tag=""Exception_Functions"">9.3<tt> </tt><a name="(part._.Exception_.Functions)"></a>Exception Functions</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_signal_error)"></a><a name="(idx._(gentag._332._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">msg</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">...</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Raises a generic primitive exception. The parameters are roughly as
for <span class="stt">printf</span>, but with the following format directives:</div></p><ul><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%c</span><span class="hspace"></span></span> : a Unicode character (of type <span class="stt">mzchar</span>)</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%d</span><span class="hspace"></span></span> : an <span class="stt">int</span></p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%o</span><span class="hspace"></span></span> : an <span class="stt">int</span> formatted in octal</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%gd</span><span class="hspace"></span></span> : a <span class="stt">long</span> integer</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%gx</span><span class="hspace"></span></span> : a <span class="stt">long</span> integer formatted in hexadecimal</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%ld</span><span class="hspace"></span></span> : an <span class="stt">intptr_t</span> integer</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%lx</span><span class="hspace"></span></span> : an <span class="stt">intptr_t</span> integer formatted in hexadecimal</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%f</span><span class="hspace"></span></span> : a floating-point <span class="stt">double</span></p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%s</span><span class="hspace"></span></span> : a nul-terminated <span class="stt">char</span> string</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%5</span><span class="hspace"></span></span> : a nul-terminated <span class="stt">mzchar</span> string</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%S</span><span class="hspace"></span></span> : a Racket symbol (a <span class="stt">Scheme_Object*</span>)</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%t</span><span class="hspace"></span></span> : a <span class="stt">char</span> string with a <span class="stt">intptr_t</span> size (two
arguments), possibly containing a non-terminating nul byte, and
possibly without a nul-terminator</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%u</span><span class="hspace"></span></span> : a <span class="stt">mzchar</span> string with a <span class="stt">intptr_t</span> size (two
arguments), possibly containing a non-terminating nul character, and
possibly without a nul-terminator</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%T</span><span class="hspace"></span></span> : a Racket string (a <span class="stt">Scheme_Object*</span>)</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%q</span><span class="hspace"></span></span> : a string, truncated to 253 characters, with ellipses
printed if the string is truncated</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%Q</span><span class="hspace"></span></span> : a Racket string (a <span class="stt">Scheme_Object*</span>),
truncated to 253 characters, with ellipses printed if the string is
truncated</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%V</span><span class="hspace"></span></span> : a Racket value (a <span class="stt">Scheme_Object*</span>),
truncated according to the current error print width.</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%D</span><span class="hspace"></span></span> : a Racket value (a <span class="stt">Scheme_Object*</span>),
to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._display%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">display</a></span>.</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%@</span><span class="hspace"></span></span> : a Racket value (a <span class="stt">Scheme_Object*</span>),
that is a list whose printed elements are spliced into the result.</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%e</span><span class="hspace"></span></span> : an <span class="stt">errno</span> value, to be printed as a text
message.</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%E</span><span class="hspace"></span></span> : a platform-specific error value, to be printed as a
text message.</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%Z</span><span class="hspace"></span></span> : a potential platform-specific error value and a
<span class="stt">char</span> string; if the string is non-<span class="stt">NULL</span>, then the error
value is ignored, otherwise the error value is used as for <span class="RktInBG"><span class="hspace"></span><span class="RktIn">%E</span><span class="hspace"></span></span>.</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%%</span><span class="hspace"></span></span> : a percent sign</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%_</span><span class="hspace"></span></span> : a pointer to ignore</p></li><li><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">%-</span><span class="hspace"></span></span> : an <span class="stt">int</span> to ignore</p></li></ul><p>The arguments following the format string must include no more than 25
strings and Racket values, 25 integers, and 25 floating-point
numbers. (This restriction simplifies the implementation with precise
garbage collection.)</p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_raise_exn)"></a><a name="(idx._(gentag._333._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_raise_exn%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_raise_exn</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">exnid</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">...</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Raises a specific primitive exception. The <span style="font-style: italic">exnid</span> argument
specifies the exception to be raised. If an instance of that exception
has <span style="font-style: italic">n</span> fields, then the next <span style="font-style: italic">n-</span>2<span style="font-style: italic"></span> arguments are values for
those fields (skipping the <span class="RktSym">message</span> and <span class="RktSym">debug-info</span>
fields). The remaining arguments start with an error string and
proceed roughly as for <span class="stt">printf</span>; see <a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a>
above for more details.</div></p><p>Exception ids are <span class="stt">#define</span>d using the same names as in Racket,
but prefixed with “MZ”, all letters are capitalized, and all “:’s’,
“-”s, and “/”s are replaced with underscores. For example,
<span class="stt">MZEXN_FAIL_FILESYSTEM</span> is the exception id for a filesystem
exception.</p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_wrong_count)"></a><a name="(idx._(gentag._334._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_wrong_count%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_count</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">name</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">minc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">maxc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">argc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">This function is automatically invoked when the wrong number of
arguments are given to a primitive procedure. It signals that the
wrong number of parameters was received and escapes (like
<a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a>). The <span style="font-style: italic">name</span> argument is the name of
the procedure that was given the wrong number of arguments; <span style="font-style: italic">minc</span>
is the minimum number of expected arguments; <span style="font-style: italic">maxc</span> is the maximum
number of expected arguments, or -1 if there is no maximum; <span style="font-style: italic">argc</span>
and <span style="font-style: italic">argv</span> contain all of the received arguments.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_wrong_contract)"></a><a name="(idx._(gentag._335._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_wrong_contract%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_contract</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">name</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">contract</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">which</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">argc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Signals that an argument was received that does not satisfy a
contract and escapes (like <a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a>). The
<span style="font-style: italic">name</span> argument is the name of the procedure that was given the
wrong argument; <span style="font-style: italic">expected</span> is the contract; <span style="font-style: italic">which</span> is the
offending argument in the <span style="font-style: italic">argv</span> array; <span style="font-style: italic">argc</span> and <span style="font-style: italic">argv</span>
contain all of the received arguments. If the original <span style="font-style: italic">argc</span> and
<span style="font-style: italic">argv</span> are not available, provide -1 for <span style="font-style: italic">which</span> and a pointer
to the bad value in <span style="font-style: italic">argv</span>, in which case the magnitude (but not
sign) of <span style="font-style: italic">argc</span> is ignored. Negate <span style="font-style: italic">argc</span> if the exception
corresponds to a result contract instead of an argument contract.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_wrong_type)"></a><a name="(idx._(gentag._336._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_wrong_type%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_type</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">name</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">expected</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">which</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">argc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Signals that an argument of the wrong type was received and
escapes. Use <a href="#%28cpp._scheme_wrong_contract%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_contract</span></a>, instead.</div></p><p>The arguments are the same as for <a href="#%28cpp._scheme_wrong_contract%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_contract</span></a>,
except that <span style="font-style: italic">expected</span> is the name of the expected type.</p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_wrong_return_arity)"></a><a name="(idx._(gentag._337._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_wrong_return_arity%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_return_arity</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">name</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">expected</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">got</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">const char*</span><span class="hspace"> </span><span style="font-style: italic">detail</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Signals that the wrong number of values were returned to a
multiple-values context. The <span style="font-style: italic">expected</span> argument indicates how
many values were expected, <span style="font-style: italic">got</span> indicates the number received,
and <span style="font-style: italic">argv</span> are the received values. The <span style="font-style: italic">detail</span> string can be
<span class="stt">NULL</span> or it can contain a <span class="stt">printf</span>-style string (with
additional arguments) to describe the context of the error; see
<a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a> above for more details about the
<span class="stt">printf</span>-style string.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_unbound_global)"></a><a name="(idx._(gentag._338._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_unbound_global%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_unbound_global</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">name</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Signals an unbound-variable error, where <span style="font-style: italic">name</span> is the name of the
variable.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_contract_error)"></a><a name="(idx._(gentag._339._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_contract_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_contract_error</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">const char*</span><span class="hspace"> </span><span style="font-style: italic">name</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">const char*</span><span class="hspace"> </span><span style="font-style: italic">msg</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">...</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Raises a contract-violation exception. The <span style="font-style: italic">msg</span> string is static,
instead of a format string. After <span style="font-style: italic">msg</span>, any number of triples can
be provided to add fields (each on its own line) to the error message;
each triple is a string for the field name, a <span class="stt">0</span> or <span class="stt">1</span> to
indicate whether the field value is a literal string or a Racket
value, and either a literal string or a Racket value. The sequence of
field triples must be terminated with <span class="stt">NULL</span>.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">char*</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_make_provided_string)"></a><a name="(idx._(gentag._340._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_make_provided_string%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_make_provided_string</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">Scheme_Object*</span><span class="hspace"> </span><span style="font-style: italic">o</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">count</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int*</span><span class="hspace"> </span><span style="font-style: italic">len</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Converts a Racket value into a string for the purposes of reporting an
error message. The <span style="font-style: italic">count</span> argument specifies how many Racket
values total will appear in the error message (so the string for this
value can be scaled appropriately). If <span style="font-style: italic">len</span> is not <span class="stt">NULL</span>, it
is filled with the length of the returned string.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">char*</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_make_arg_lines_string)"></a><a name="(idx._(gentag._341._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_make_arg_lines_string%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_make_arg_lines_string</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">s</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">which</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">argc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">intptr_t*</span><span class="hspace"> </span><span style="font-style: italic">len</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Converts an array of Racket values into a byte string, skipping the
array element indicated by <span style="font-style: italic">which</span> if <span style="font-style: italic">which</span> is not -1. This
function is used to format the “other” arguments to a function when
one argument is bad (thus giving the user more information about the
state of the program when the error occurred). If <span style="font-style: italic">len</span> is not
<span class="stt">NULL</span>, it is filled with the length of the returned string.</div></p><p>If the arguments are shown on multiple lines, then the result string
starts with a newline character and each line is indented by three
spaces. Otherwise, the result string starts with a space. If the
result would contain no arguments, it contains <span class="RktInBG"><span class="hspace"></span><span class="RktIn">[none]</span><span class="hspace"></span></span>,
instead.</p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">char*</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_make_args_string)"></a><a name="(idx._(gentag._342._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_make_args_string%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_make_args_string</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">s</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">which</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">argc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">intptr_t*</span><span class="hspace"> </span><span style="font-style: italic">len</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Like <a href="#%28cpp._scheme_make_arg_lines_string%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_make_arg_lines_string</span></a>, but for old-style messages
where the arguments are always shown within a single line. The result
does not include a leading space.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_check_proc_arity)"></a><a name="(idx._(gentag._343._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_check_proc_arity%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_check_proc_arity</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">where</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">a</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">which</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">argc</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Scheme_Object**</span><span class="hspace"> </span><span style="font-style: italic">argv</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Checks the <span style="font-style: italic">which</span>th argument in <span style="font-style: italic">argv</span> to make sure it is a
procedure that can take <span style="font-style: italic">a</span> arguments. If there is an error, the
<span style="font-style: italic">where</span>, <span style="font-style: italic">which</span>, <span style="font-style: italic">argc</span>, and <span style="font-style: italic">argv</span> arguments are
passed on to <a href="#%28cpp._scheme_wrong_type%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_type</span></a>. As in <a href="#%28cpp._scheme_wrong_type%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_wrong_type</span></a>,
<span style="font-style: italic">which</span> can be -1, in which case <span class="stt">*</span><span style="font-style: italic">argv</span> is checked.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">Scheme_Object*</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_dynamic_wind)"></a><a name="(idx._(gentag._344._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_dynamic_wind%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_dynamic_wind</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">Pre_Post_Proc</span><span class="hspace"> </span><span style="font-style: italic">pre</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Action_Proc</span><span class="hspace"> </span><span style="font-style: italic">action</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Pre_Post_Proc</span><span class="hspace"> </span><span style="font-style: italic">post</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">Action_Proc</span><span class="hspace"> </span><span style="font-style: italic">jmp_handler</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">void*</span><span class="hspace"> </span><span style="font-style: italic">data</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Evaluates calls the function <span style="font-style: italic">action</span> to get a value for the
<a href="#%28cpp._scheme_dynamic_wind%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_dynamic_wind</span></a> call. The <span class="stt">Pre_Post_Proc</span> and
<span class="stt">Action_Proc</span> types are not actually defined; instead the types
are inlined as if they were defined as follows:</div></p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace"> </span><span class="stt">typedef void (*Pre_Post_Proc)(void *data);</span></p></td></tr><tr><td><p><span class="hspace"> </span><span class="stt">typedef Scheme_Object* (*Action_Proc)(void *data);</span></p></td></tr></table></p><p>The functions <span style="font-style: italic">pre</span> and <span style="font-style: italic">post</span> are invoked when jumping into
and out of <span style="font-style: italic">action</span>, respectively.</p><p>The function <span style="font-style: italic">jmp_handler</span> is called when an error is signaled (or
an escaping continuation is invoked) during the call to <span style="font-style: italic">action</span>;
if <span style="font-style: italic">jmp_handler</span> returns <span class="stt">NULL</span>, then the error is passed on
to the next error handler, otherwise the return value is used as the
return value for the <a href="#%28cpp._scheme_dynamic_wind%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_dynamic_wind</span></a> call.</p><p>The pointer <span style="font-style: italic">data</span> can be anything; it is passed along in calls to
<span style="font-style: italic">action</span>, <span style="font-style: italic">pre</span>, <span style="font-style: italic">post</span>, and <span style="font-style: italic">jmp_handler</span>.</p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_clear_escape)"></a><a name="(idx._(gentag._345._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_clear_escape%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_clear_escape</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Clears the “jumping to escape continuation” flag associated with a
thread. Call this function when blocking escape continuation hops (see
the first example in <a href="#%28part._imz~3atempcatch%29" data-pltdoc="x">Temporarily Catching Error Escapes</a>).</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_set_can_break)"></a><a name="(idx._(gentag._346._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_set_can_break%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_set_can_break</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">on</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Enables or disables breaks in the same way as
calling <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=breakhandler.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._break-enabled%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">break-enabled</a></span>.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_push_break_enable)"></a><a name="(idx._(gentag._347._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_push_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_push_break_enable</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">Scheme_Cont_Frame_Data*</span><span class="hspace"> </span><span style="font-style: italic">cframe</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">on</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">pre_check</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Use this function with <a href="#%28cpp._scheme_pop_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_pop_break_enable</span></a> to enable or
disable breaks in the same way as
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=breakhandler.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmore-scheme..rkt%2529._call-with-break-parameterization%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">call-with-break-parameterization</a></span>; this function writes to
<span style="font-style: italic">cframe</span> to initialize it, and <a href="#%28cpp._scheme_pop_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_pop_break_enable</span></a> reads
from <span style="font-style: italic">cframe</span>. If <span style="font-style: italic">pre_check</span> is non-zero and breaks are
currently enabled, any pending break exception is raised.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_pop_break_enable)"></a><a name="(idx._(gentag._348._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_pop_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_pop_break_enable</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">Scheme_Cont_Frame_Data*</span><span class="hspace"> </span><span style="font-style: italic">cframe</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">int</span><span class="hspace"> </span><span style="font-style: italic">post_check</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Use this function with <a href="#%28cpp._scheme_push_break_enable%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_push_break_enable</span></a>. If
<span style="font-style: italic">post_check</span> is non-zero and breaks are enabled after restoring
the previous state, then any pending break exception is raised.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td colspan="3"><p><span class="stt">Scheme_Object*</span></p></td></tr><tr><td><p><a name="(cpp._scheme_current_continuation_marks)"></a><a name="(idx._(gentag._349._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_current_continuation_marks%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_current_continuation_marks</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">Scheme_Object*</span><span class="hspace"> </span><span style="font-style: italic">prompt_tag</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Like <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-continuation-marks%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-continuation-marks</a></span>. Passing <span class="stt">NULL</span> as
<span style="font-style: italic">prompt_tag</span> is the same as providing the default continuation
prompt tag.</div></p><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="boxed"><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">void</span></p></td><td><p><span class="hspace"> </span></p></td><td><p><a name="(cpp._scheme_warning)"></a><a name="(idx._(gentag._350._(lib._scribblings/inside/inside..scrbl)))"></a><a href="#%28cpp._scheme_warning%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_warning</span></a></p></td><td><p><span class="stt">(</span></p></td><td><p><span class="stt">char*</span><span class="hspace"> </span><span style="font-style: italic">msg</span><span class="stt">,</span></p></td></tr><tr><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="hspace"> </span></p></td><td><p><span class="stt">...</span><span class="stt">)</span></p></td></tr></table></td></tr></table></div><div class="SIntrapara">Writes a warning message. The parameters are roughly as for
<span class="stt">printf</span>; see <a href="#%28cpp._scheme_signal_error%29" class="RktStxLink" data-pltdoc="x"><span class="stt">scheme_signal_error</span></a> above for more details.</div></p><p>Normally, Racket’s logging facilities should be used instead of this
function.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="Evaluation.html" title="backward to "8 Evaluation"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Inside: Racket C API"" data-pltdoc="x">up</a> <a href="threads.html" title="forward to "10 Threads"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|