2 ** OSSP ex - Exception Handling (modified to fit into SimGrid)
3 ** Copyright (c) 2005 Martin Quinson
4 ** Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
5 ** Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
6 ** Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
8 ** This file is part of OSSP ex, an exception handling library
9 ** which can be found at http://www.ossp.org/pkg/lib/ex/.
11 ** Permission to use, copy, modify, and distribute this software for
12 ** any purpose with or without fee is hereby granted, provided that
13 ** the above copyright notice and this permission notice appear in all
16 ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
17 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
20 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 ** ex.c: exception handling (compiler part)
37 /* default __ex_ctx callback function */
38 ex_ctx_t *__xbt_ex_ctx_default(void) {
39 static ex_ctx_t ctx = SG_CTX_INITIALIZER;
44 /* default __ex_terminate callback function */
45 void __xbt_ex_terminate_default(ex_t *e) {
48 "** SimGrid: UNCAUGHT EXCEPTION:\n"
50 "** Thrown by %s%s%s at %s:%d:%s\n",
51 e->code, e->value, e->msg,
52 e->procname, (e->host?"@":""),(e->host?e->host:""),
53 e->file,e->line,e->func);
57 /* the externally visible API */
58 ex_ctx_cb_t __xbt_ex_ctx = &__xbt_ex_ctx_default;
59 ex_term_cb_t __xbt_ex_terminate = &__xbt_ex_terminate_default;