From 715c6e1f1a58b294f61b8c7d3536bd73218ba64a Mon Sep 17 00:00:00 2001 From: mquinson Date: Sun, 7 Aug 2005 14:20:59 +0000 Subject: [PATCH] change mismatch_error to not_found_error where appropriate git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1603 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/gras/DataDesc/ddt_create.c | 17 ++++++-- src/gras/DataDesc/ddt_exchange.c | 6 +-- src/gras/DataDesc/ddt_parse.yy.c | 66 ++++++++++++++++---------------- src/gras/Msg/msg.c | 2 +- 4 files changed, 50 insertions(+), 41 deletions(-) diff --git a/src/gras/DataDesc/ddt_create.c b/src/gras/DataDesc/ddt_create.c index 2ab137801b..81f2a50800 100644 --- a/src/gras/DataDesc/ddt_create.c +++ b/src/gras/DataDesc/ddt_create.c @@ -57,18 +57,29 @@ gras_datadesc_type_t gras_datadesc_by_name(const char *name) { TRY { res = (gras_datadesc_type_t)xbt_set_get_by_name(gras_datadesc_set_local,name); } CATCH(e) { - if (e.category != mismatch_error) + if (e.category != not_found_error) RETHROW; + xbt_ex_free(e); res = NULL; } return res; } /** - * Retrieve a type from its code + * Retrieve a type from its code (or NULL if not found) */ gras_datadesc_type_t gras_datadesc_by_id(long int code) { - return (gras_datadesc_type_t)xbt_set_get_by_id(gras_datadesc_set_local,code); + xbt_ex_t e; + gras_datadesc_type_t res; + TRY { + res = (gras_datadesc_type_t)xbt_set_get_by_id(gras_datadesc_set_local,code); + } CATCH(e) { + if (e.category != not_found_error) + RETHROW; + xbt_ex_free(e); + res = NULL; + } + return res; } /** diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index e675b78eb4..111a6748d4 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -256,11 +256,11 @@ gras_datadesc_send_rec(gras_socket_t sock, TRY { if (detect_cycle) /* return ignored. Just checking whether it's known or not */ - xbt_dict_get_ext(refs,(char*)ref, sizeof(void*)); + xbt_dict_get_ext(refs,(char*)ref, sizeof(char*)); else reference_is_to_send = 1; } CATCH(e) { - if (e.category != mismatch_error) + if (e.category != not_found_error) RETHROW; reference_is_to_send = 1; xbt_ex_free(e); @@ -510,7 +510,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, else reference_is_to_recv = 1; } CATCH(e) { - if (e.category != mismatch_error) + if (e.category != not_found_error) RETHROW; reference_is_to_recv = 1; xbt_ex_free(e); diff --git a/src/gras/DataDesc/ddt_parse.yy.c b/src/gras/DataDesc/ddt_parse.yy.c index e326df1f4b..36a4b8e7d3 100644 --- a/src/gras/DataDesc/ddt_parse.yy.c +++ b/src/gras/DataDesc/ddt_parse.yy.c @@ -486,9 +486,7 @@ char *gras_ddt_parse_text; /* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -/* char string_buf[GRAS_DDT_PARSE_MAX_STR_CONST]; - char *string_buf_ptr = NULL; FIXME; killme*/ -#line 15 "gras/DataDesc/ddt_parse.yy.l" +#line 12 "gras/DataDesc/ddt_parse.yy.l" #include "gras/DataDesc/datadesc_private.h" #include "gras/DataDesc/ddt_parse.yy.h" #include @@ -503,7 +501,7 @@ char *gras_ddt_parse_text; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing"); #define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,gras_ddt_parse_text) -#line 507 "gras/DataDesc/ddt_parse.yy.c" +#line 505 "gras/DataDesc/ddt_parse.yy.c" #define INITIAL 0 #define annotate 1 @@ -657,12 +655,12 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 35 "gras/DataDesc/ddt_parse.yy.l" +#line 32 "gras/DataDesc/ddt_parse.yy.l" int comment_caller=0; int annotate_caller=0; -#line 666 "gras/DataDesc/ddt_parse.yy.c" +#line 664 "gras/DataDesc/ddt_parse.yy.c" if ( (yy_init) ) { @@ -747,12 +745,12 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 39 "gras/DataDesc/ddt_parse.yy.l" +#line 36 "gras/DataDesc/ddt_parse.yy.l" YY_BREAK case 2: YY_RULE_SETUP -#line 41 "gras/DataDesc/ddt_parse.yy.l" +#line 38 "gras/DataDesc/ddt_parse.yy.l" { /****************** ANNOTATION ************************/ DEBUG0("Begin annotation"); annotate_caller = INITIAL; @@ -763,7 +761,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 48 "gras/DataDesc/ddt_parse.yy.l" +#line 45 "gras/DataDesc/ddt_parse.yy.l" { /* trim annotation */ DEBUG0("Begin annotation"); annotate_caller = foo; @@ -774,7 +772,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 56 "gras/DataDesc/ddt_parse.yy.l" +#line 53 "gras/DataDesc/ddt_parse.yy.l" { DEBUG0("End annotation"); gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); @@ -784,7 +782,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 63 "gras/DataDesc/ddt_parse.yy.l" +#line 60 "gras/DataDesc/ddt_parse.yy.l" { PARSE_ERROR0("``/*g'' construct closed by a regular ``*/''"); } @@ -792,14 +790,14 @@ YY_RULE_SETUP case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 66 "gras/DataDesc/ddt_parse.yy.l" +#line 63 "gras/DataDesc/ddt_parse.yy.l" { PARSE_ERROR0("Type annotation cannot spread over several lines"); } YY_BREAK case 7: YY_RULE_SETUP -#line 70 "gras/DataDesc/ddt_parse.yy.l" +#line 67 "gras/DataDesc/ddt_parse.yy.l" { /* eat the rest */ gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); @@ -808,7 +806,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 76 "gras/DataDesc/ddt_parse.yy.l" +#line 73 "gras/DataDesc/ddt_parse.yy.l" { /****************** COMMENTS ************************/ /* constructs like : */ /*g [string] g*/ @@ -819,7 +817,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 84 "gras/DataDesc/ddt_parse.yy.l" +#line 81 "gras/DataDesc/ddt_parse.yy.l" { comment_caller = foo; BEGIN(comment); @@ -827,20 +825,20 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 89 "gras/DataDesc/ddt_parse.yy.l" +#line 86 "gras/DataDesc/ddt_parse.yy.l" { /* eat anything that's not a '*' */ } YY_BREAK case 11: YY_RULE_SETUP -#line 91 "gras/DataDesc/ddt_parse.yy.l" +#line 88 "gras/DataDesc/ddt_parse.yy.l" { /* eat up '*'s not followed by '/'s */ } YY_BREAK case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 93 "gras/DataDesc/ddt_parse.yy.l" +#line 90 "gras/DataDesc/ddt_parse.yy.l" { ++gras_ddt_parse_line_pos; gras_ddt_parse_col_pos=0; @@ -849,7 +847,7 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 98 "gras/DataDesc/ddt_parse.yy.l" +#line 95 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); @@ -858,7 +856,7 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 104 "gras/DataDesc/ddt_parse.yy.l" +#line 101 "gras/DataDesc/ddt_parse.yy.l" { /****************** STATEMENTS ************************/ gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text); gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text); @@ -868,7 +866,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 110 "gras/DataDesc/ddt_parse.yy.l" +#line 107 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -878,7 +876,7 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 116 "gras/DataDesc/ddt_parse.yy.l" +#line 113 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -888,7 +886,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 122 "gras/DataDesc/ddt_parse.yy.l" +#line 119 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -898,7 +896,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 128 "gras/DataDesc/ddt_parse.yy.l" +#line 125 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -908,7 +906,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 134 "gras/DataDesc/ddt_parse.yy.l" +#line 131 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -918,7 +916,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 140 "gras/DataDesc/ddt_parse.yy.l" +#line 137 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -928,7 +926,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 146 "gras/DataDesc/ddt_parse.yy.l" +#line 143 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -938,7 +936,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 152 "gras/DataDesc/ddt_parse.yy.l" +#line 149 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -948,7 +946,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 158 "gras/DataDesc/ddt_parse.yy.l" +#line 155 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -959,7 +957,7 @@ YY_RULE_SETUP case 24: /* rule 24 can match eol */ YY_RULE_SETUP -#line 164 "gras/DataDesc/ddt_parse.yy.l" +#line 161 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_line_pos++; gras_ddt_parse_char_pos++; @@ -969,7 +967,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 170 "gras/DataDesc/ddt_parse.yy.l" +#line 167 "gras/DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -978,10 +976,10 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 175 "gras/DataDesc/ddt_parse.yy.l" +#line 172 "gras/DataDesc/ddt_parse.yy.l" ECHO; YY_BREAK -#line 985 "gras/DataDesc/ddt_parse.yy.c" +#line 983 "gras/DataDesc/ddt_parse.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(annotate): case YY_STATE_EOF(comment): @@ -1950,7 +1948,7 @@ void gras_ddt_parse_free (void * ptr ) #undef YY_DECL_IS_OURS #undef YY_DECL #endif -#line 175 "gras/DataDesc/ddt_parse.yy.l" +#line 172 "gras/DataDesc/ddt_parse.yy.l" /* {space}+ { return(TOKEN_SPACE);} */ diff --git a/src/gras/Msg/msg.c b/src/gras/Msg/msg.c index ab15d331ef..6ec3e4d56e 100644 --- a/src/gras/Msg/msg.c +++ b/src/gras/Msg/msg.c @@ -147,7 +147,7 @@ gras_msgtype_declare_v(const char *name, msgtype = (gras_msgtype_t)xbt_set_get_by_name(_gras_msgtype_set,namev); found = 1; } CATCH(e) { - if (e.category != mismatch_error) + if (e.category != not_found_error) RETHROW; xbt_ex_free(e); } -- 2.20.1