git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1536
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
/* default __ex_ctx callback function */
ex_ctx_t *__xbt_ex_ctx_default(void) {
/* default __ex_ctx callback function */
ex_ctx_t *__xbt_ex_ctx_default(void) {
- static ex_ctx_t ctx = SG_CTX_INITIALIZER;
+ static ex_ctx_t ctx = XBT_CTX_INITIALIZER;
"** SimGrid: UNCAUGHT EXCEPTION:\n"
"** (%d/%d) %s\n"
"** Thrown by %s%s%s at %s:%d:%s\n",
"** SimGrid: UNCAUGHT EXCEPTION:\n"
"** (%d/%d) %s\n"
"** Thrown by %s%s%s at %s:%d:%s\n",
- e->code, e->value, e->msg,
+ e->category, e->value, e->msg,
e->procname, (e->host?"@":""),(e->host?e->host:""),
e->file,e->line,e->func);
abort();
e->procname, (e->host?"@":""),(e->host?e->host:""),
e->file,e->line,e->func);
abort();
ts_test_check(TS_CTX, "basic nested control flow");
n = 1;
ts_test_check(TS_CTX, "basic nested control flow");
n = 1;
if (n != 1)
ts_test_fail(TS_CTX, "M1: n=%d (!= 1)", n);
n++;
if (n != 1)
ts_test_fail(TS_CTX, "M1: n=%d (!= 1)", n);
n++;
if (n != 2)
ts_test_fail(TS_CTX, "M2: n=%d (!= 2)", n);
n++;
if (n != 2)
ts_test_fail(TS_CTX, "M2: n=%d (!= 2)", n);
n++;
- sg_throw(0,0,"something");
+ xbt_throw(0,0,"something");
if (n != 3)
ts_test_fail(TS_CTX, "M3: n=%d (!= 1)", n);
n++;
if (n != 3)
ts_test_fail(TS_CTX, "M3: n=%d (!= 1)", n);
n++;
}
ts_test_fail(TS_CTX, "MX: n=%d (expected: not reached)", n);
}
}
ts_test_fail(TS_CTX, "MX: n=%d (expected: not reached)", n);
}
if (n != 4)
ts_test_fail(TS_CTX, "M4: n=%d (!= 4)", n);
n++;
if (n != 4)
ts_test_fail(TS_CTX, "M4: n=%d (!= 4)", n);
n++;
- sg_try {
- sg_throw(1, 2, "toto");
+ xbt_try {
+ xbt_throw(1, 2, "toto");
ts_test_check(TS_CTX, "exception value passing");
ts_test_check(TS_CTX, "exception value passing");
- if (ex.code != 1)
- ts_test_fail(TS_CTX, "code=%d (!= 1)", ex.code);
+ if (ex.category != 1)
+ ts_test_fail(TS_CTX, "category=%d (!= 1)", ex.category);
if (ex.value != 2)
ts_test_fail(TS_CTX, "value=%d (!= 2)", ex.value);
if (strcmp(ex.msg,"toto"))
if (ex.value != 2)
ts_test_fail(TS_CTX, "value=%d (!= 2)", ex.value);
if (strcmp(ex.msg,"toto"))
volatile int v1, v2;
r1 = r2 = v1 = v2 = 1234;
volatile int v1, v2;
r1 = r2 = v1 = v2 = 1234;
ts_test_check(TS_CTX, "variable preservation");
if (r1 != 1234)
ts_test_fail(TS_CTX, "r1=%d (!= 1234)", r1);
ts_test_check(TS_CTX, "variable preservation");
if (r1 != 1234)
ts_test_fail(TS_CTX, "r1=%d (!= 1234)", r1);
volatile int i3 = 0;
ts_test_check(TS_CTX, "exception deferring");
volatile int i3 = 0;
ts_test_check(TS_CTX, "exception deferring");
ts_test_fail(TS_CTX, "unexpected deferring scope");
ts_test_fail(TS_CTX, "unexpected deferring scope");
- sg_try {
- sg_defer {
- if (!sg_deferring)
+ xbt_try {
+ xbt_defer {
+ if (!xbt_deferring)
ts_test_fail(TS_CTX, "unexpected non-deferring scope");
ts_test_fail(TS_CTX, "unexpected non-deferring scope");
- sg_throw(4711, 0, NULL);
+ xbt_throw(4711, 0, NULL);
}
ts_test_fail(TS_CTX, "unexpected not occurred deferred throwing");
}
}
ts_test_fail(TS_CTX, "unexpected not occurred deferred throwing");
}
- sg_catch (ex) {
- if (ex.code != 4711)
+ xbt_catch (ex) {
+ if (ex.category != 4711)
ts_test_fail(TS_CTX, "caught exception with value %d, expected 4711", ex.value);
}
if (i1 != 1)
ts_test_fail(TS_CTX, "caught exception with value %d, expected 4711", ex.value);
}
if (i1 != 1)
ex_t ex;
ts_test_check(TS_CTX, "exception shielding");
ex_t ex;
ts_test_check(TS_CTX, "exception shielding");
ts_test_fail(TS_CTX, "unexpected shielding scope");
ts_test_fail(TS_CTX, "unexpected shielding scope");
ts_test_fail(TS_CTX, "unexpected catching scope");
ts_test_fail(TS_CTX, "unexpected catching scope");
- sg_try {
- sg_shield {
- if (!sg_shielding)
+ xbt_try {
+ xbt_shield {
+ if (!xbt_shielding)
ts_test_fail(TS_CTX, "unexpected non-shielding scope");
ts_test_fail(TS_CTX, "unexpected non-shielding scope");
ts_test_fail(TS_CTX, "unexpected shielding scope");
ts_test_fail(TS_CTX, "unexpected shielding scope");
ts_test_fail(TS_CTX, "unexpected non-catching scope");
}
ts_test_fail(TS_CTX, "unexpected non-catching scope");
}
ts_test_fail(TS_CTX, "unexpected exception catched");
ts_test_fail(TS_CTX, "unexpected exception catched");
ts_test_fail(TS_CTX, "unexpected catching scope");
}
ts_test_fail(TS_CTX, "unexpected catching scope");
}
ts_test_fail(TS_CTX, "unexpected catching scope");
}
ts_test_fail(TS_CTX, "unexpected catching scope");
}
- sg_throw(1, 2, "blah");
+ xbt_throw(1, 2, "blah");
if (v1 != 5678)
ts_test_fail(TS_CTX, "v1 = %d (!= 5678)", v1);
c = 1;
}
if (v1 != 5678)
ts_test_fail(TS_CTX, "v1 = %d (!= 5678)", v1);
c = 1;
}
if (v1 != 5678)
ts_test_fail(TS_CTX, "v1 = %d (!= 5678)", v1);
if (v1 != 5678)
ts_test_fail(TS_CTX, "v1 = %d (!= 5678)", v1);
- if (!(ex.code == 1 && ex.value == 2 && !strcmp(ex.msg,"blah")))
+ if (!(ex.category == 1 && ex.value == 2 && !strcmp(ex.msg,"blah")))
ts_test_fail(TS_CTX, "unexpected exception contents");
}
if (!c)
ts_test_fail(TS_CTX, "unexpected exception contents");
}
if (!c)