Lines Matching defs:exc
14 SM_RCSID("@(#)$Id: exc.c,v 1.49 2006/12/19 19:28:09 ca Exp $")
18 ** For documentation, see exc.html
25 #include <sm/exc.h>
38 ** exc -- exception.
54 sm_etype_printf(exc, stream)
55 SM_EXC_T *exc;
58 size_t n = strlen(exc->exc_type->etype_argformat);
62 for (p = exc->exc_type->etype_printcontext; *p != '\0'; ++p)
97 switch (exc->exc_type->etype_argformat[i])
101 s = exc->exc_argv[i].v_str;
112 exc->exc_argv[i].v_int);
120 exc->exc_argv[i].v_long);
123 sm_exc_write(exc->exc_argv[i].v_exc,
144 ** exc -- exception.
153 SM_EXC_T *exc,
157 sm_etype_os_print(exc, stream)
158 SM_EXC_T *exc;
161 int err = exc->exc_argv[0].v_int;
162 char *syscall = exc->exc_argv[1].v_str;
163 char *sysargs = exc->exc_argv[2].v_str;
225 ** SM_EXCEPT(exc, "*")
226 ** sm_exc_raisenew_x(&MyEtype, exc);
229 ** exception E that owns exc. When E is eventually freed, exc is also freed.
230 ** In the exceptional case, sm_exc_raisenew_x must free exc before raising
231 ** an out-of-memory exception so that exc is not leaked.
247 SM_EXC_T * volatile exc = NULL;
262 exc = sm_malloc_x(sizeof(SM_EXC_T));
263 exc->sm_magic = SmExcMagic;
264 exc->exc_refcount = 1;
265 exc->exc_type = etype;
266 exc->exc_argv = NULL;
270 ** On failure, free exc, scan the varargs list and free all
276 exc->exc_argv = argv;
307 ** On failure, free exc, argv, all the exception arguments
334 if (exc == NULL || argv == NULL)
386 sm_free(exc);
391 return exc;
416 SM_EXC_T *exc;
420 exc = sm_exc_vnew_x(etype, ap);
422 return exc;
429 ** exc -- exception object.
436 sm_exc_free(exc)
437 SM_EXC_T *exc;
439 if (exc == NULL)
441 SM_REQUIRE(exc->sm_magic == SmExcMagic);
442 if (exc->exc_refcount == 0)
444 if (--exc->exc_refcount == 0)
448 for (i = 0; (c = exc->exc_type->etype_argformat[i]) != '\0';
455 sm_free(exc->exc_argv[i].v_str);
458 sm_exc_free(exc->exc_argv[i].v_exc);
462 exc->sm_magic = NULL;
463 sm_free(exc->exc_argv);
464 sm_free(exc);
472 ** exc -- exception.
480 sm_exc_match(exc, pattern)
481 SM_EXC_T *exc;
484 if (exc == NULL)
486 SM_REQUIRE(exc->sm_magic == SmExcMagic);
487 return sm_match(exc->exc_type->etype_category, pattern);
494 ** exc -- exception.
502 sm_exc_write(exc, stream)
503 SM_EXC_T *exc;
506 SM_REQUIRE_ISA(exc, SmExcMagic);
507 exc->exc_type->etype_print(exc, stream);
514 ** exc -- exception.
522 sm_exc_print(exc, stream)
523 SM_EXC_T *exc;
526 SM_REQUIRE_ISA(exc, SmExcMagic);
527 exc->exc_type->etype_print(exc, stream);
568 ** exc -- exception.
575 sm_exc_raise_x(exc)
576 SM_EXC_T *exc;
578 SM_REQUIRE_ISA(exc, SmExcMagic);
600 (*h)(exc);
612 sm_exc_print(exc, smioerr);
617 SmExcHandler->eh_value = exc;
619 sm_exc_free(exc);
646 SM_EXC_T *exc;
650 exc = sm_exc_vnew_x(etype, ap);
652 sm_exc_raise_x(exc);