Lines Matching +full:single +full:- +full:tt

11     <br> $Id: exc.html,v 1.13 2006-06-20 17:18:16 ca Exp $
30 Errors are not represented by a single integer error code,
32 might need to know about an error by a single integer.
170 program; instead, we terminate the program using <tt>sm_abort</tt>.
190 if (fd == -1)
194 Because the idiom <tt>sm_exc_raise_x(sm_exc_new_x(...))</tt>
195 is so common, it can be abbreviated as <tt>sm_exc_raisenew_x(...)</tt>.
199 you don't call a function like BSD's <tt>errx</tt>,
219 The end result is substantially the same as a call to <tt>errx</tt>.
274 For example, you might want to handle an end-of-file exception
280 /* code that might raise end-of-file, or some other exception */
283 /* what to do if end-of-file is encountered */
294 In traditional C code, errors are usually denoted by a single integer,
311 by <tt>SM_VAL_T&nbsp;*exc_argv</tt>, where <tt>SM_VAL_T</tt>
322 <tt> const char *sm_magic </tt>
324 A pointer to <tt>SmExcTypeMagic</tt>.
327 <tt> const char *etype_category </tt>
330 <tt>"</tt><i>class</i><tt>:</tt><i>name</i><tt>"</tt>.
339 <dt><tt>"F"</tt>
345 The out-of-memory exception raised by sm_malloc_x
350 <dt><tt>"E"</tt>
356 <dt><tt>"J"</tt>
358 non-local jump. No error has occurred; we are just
359 performing the non-local equivalent of a <tt>continue</tt>,
360 <tt>break</tt> or <tt>return</tt>.
362 <dt><tt>"S"</tt>
371 Eric's libsm paper defines <tt>"W"</tt>, <tt>"D"</tt> and <tt>"I"</tt>
379 <i>library</i><tt>.</tt><i>package</i><tt>.</tt><i>detail</i>.
382 <tt> const char *etype_argformat </tt>
384 This is an array of single character codes.
386 <tt>sm_exc_new_x</tt> uses this string to decode its variable
390 <dt><tt>i</tt>
392 The exception argument has type <tt>int</tt>.
393 <dt><tt>l</tt>
395 The exception argument has type <tt>long</tt>.
396 <dt><tt>e</tt>
398 The exception argument has type <tt>SM_EXC_T*</tt>.
399 The value may either be <tt>NULL</tt> or a pointer
402 <dt><tt>s</tt>
404 The exception argument has type <tt>char*</tt>.
405 The value may either be <tt>NULL</tt> or a pointer
407 <tt>sm_exc_new_x</tt> will make a copy of the string.
408 <dt><tt>r</tt>
410 The exception argument has type <tt>char*</tt>.
411 <tt>sm_exc_new_x</tt> will read a printf-style
416 of <tt>exc_argformat</tt>.
420 <tt> void (*etype_print)(SM_EXC_T *exc, SM_FILE_T *stream) </tt>
429 Libsm defines one standard exception value, <tt>SmHeapOutOfMemory</tt>.
433 This exception has category <tt>"F:sm.heap"</tt>.
435 with <tt>sm_exc_raise_x(&SmHeapOutOfMemory)</tt>.
439 run-time parameters, so the normal case is to dynamically allocate
446 <tt> SmEtypeOs </tt>
449 The category is <tt>"E:sm.os"</tt>.
450 The argformat is <tt>"isr"</tt>,
451 where argv[0] is the value of <tt>errno</tt>
454 and argv[2] is either <tt>NULL</tt>
461 if (fd == -1)
473 <tt> SmEtypeErr </tt>
476 The category is <tt>"E:sm.err"</tt>,
477 and the argformat is <tt>"r"</tt>.
501 The standard print function <tt>sm_etype_printf</tt>
503 It prints the <tt>etype_printcontext</tt> string of the exception type,
526 for this, you use the standard <tt>SmHeapOutOfMemory</tt> exception.
538 exc-&gt;exc_argv[0].v_int,
539 exc-&gt;exc_type-&gt;etype_printcontext);
574 an unbalanced parenthesis at string offset <tt>i</tt> using:
579 If <tt>i==42</tt> then this exception will be printed as:
590 int i = exc-&gt;exc_argv[0].v_int;
599 make sense to define a single exception type, patterned after SmEtypeOs,
618 <tt> SM_EXC_T *sm_exc_new_x(const SM_EXC_TYPE_T *type, ...) </tt>
627 by <tt>type-&gt;etype_argformat</tt>.
639 <tt> SM_EXC_T *sm_exc_addref(SM_EXC_T *exc) </tt>
645 <tt> void sm_exc_free(SM_EXC_T *exc) </tt>
651 <tt> bool sm_exc_match(SM_EXC_T *exc, const char *pattern) </tt>
657 <tt> void sm_exc_print(SM_EXC_T *exc, SM_FILE_T *stream) </tt>
663 <tt> void sm_exc_write(SM_EXC_T *exc, SM_FILE_T *stream) </tt>
668 <tt> void sm_exc_raise_x(SM_EXC_T *exc) </tt>
673 <tt> void sm_exc_raisenew_x(const SM_EXC_TYPE_T *type, ...) </tt>
675 A short form for <tt>sm_exc_raise_x(sm_exc_new_x(type,...))</tt>.
710 (see <tt>sm_exc_match</tt>) is executed.
712 no SM_EXCEPT clauses, then the remembered exception is re-raised.
721 You can't use <tt>break</tt> or <tt>continue</tt> in an SM_EXCEPT clause;
731 Suppose you declare an auto variable <tt>i</tt> outside of a
733 Then you modify <tt>i</tt> inside of a SM_TRY or SM_FINALLY clause,
735 If you reference <tt>i</tt> in a different SM_FINALLY clause, or in
736 an SM_EXCEPT clause, then it is implementation dependent whether <tt>i</tt>
737 will be 0 or 1, unless you have declared <tt>i</tt> to be <tt>volatile</tt>.