From 01838a708a3a15dda2db7a8b2d6fd480e75eea8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Sat, 23 May 2009 19:55:48 +0000 Subject: [PATCH] change some errors to fatals git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1624 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 4 ++++ urjtag/src/bsdl/bsdl_bison.y | 14 +++++++------- urjtag/src/bsdl/bsdl_flex.l | 6 +++--- urjtag/src/bsdl/bsdl_msg.h | 6 ++++++ urjtag/src/bsdl/vhdl_bison.y | 16 ++++++++-------- urjtag/src/bsdl/vhdl_flex.l | 8 ++++---- 6 files changed, 32 insertions(+), 22 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index d1d49de5..d038265e 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,5 +1,9 @@ 2009-05-23 Arnim Laeuger + * src/bsdl/bsdl_msg.h, src/bsdl/vhdl_flex.l, src/bsdl/vhdl_bison.y, + src/bsdl/bsdl_flex.l, src/bsdl/bsdl_bison.y: + change some errors to fatals + * include/urjtag/error.h, src/global/urjtag.c, src/apps/bsdl2jtag/bsdl2jtag.c, src/bsdl/bsdl_msg.h, src/bsdl/bsdl.c, src/bsdl/bsdl_sem.c, diff --git a/urjtag/src/bsdl/bsdl_bison.y b/urjtag/src/bsdl/bsdl_bison.y index fec62bd5..31a2f044 100644 --- a/urjtag/src/bsdl/bsdl_bison.y +++ b/urjtag/src/bsdl/bsdl_bison.y @@ -1141,7 +1141,7 @@ urj_bsdl_parser_init (urj_bsdl_jtag_ctrl_t *jtag_ctrl) if (!(new_priv = malloc (sizeof (urj_bsdl_parser_priv_t)))) { - urj_bsdl_err_set (jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); return NULL; } @@ -1212,7 +1212,7 @@ add_instruction (urj_bsdl_parser_priv_t *priv, char *instr, char *opcode) priv->jtag_ctrl->instr_list = new_instr; } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1273,7 +1273,7 @@ ac_add_instruction (urj_bsdl_parser_priv_t *priv, char *instr) tmp_ai->instr_list = new_instr; } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1309,7 +1309,7 @@ ac_apply_assoc (urj_bsdl_parser_priv_t *priv) jc->ainfo_list = new_ai; } else - urj_bsdl_err_set (jc->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (jc->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); /* clean up obsolete temporary entries */ @@ -1348,7 +1348,7 @@ prt_add_name (urj_bsdl_parser_priv_t *priv, char *name) pd->names_list = new_string; } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1504,7 +1504,7 @@ ci_set_cell_spec (urj_bsdl_parser_priv_t *priv, } else { - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); ci->port_name = NULL; } @@ -1555,7 +1555,7 @@ ci_append_cell_info (urj_bsdl_parser_priv_t *priv, int bit_num) tmp_ci->basic_safe_value = NULL; } else - urj_bsdl_err_set (jc->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (jc->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } diff --git a/urjtag/src/bsdl/bsdl_flex.l b/urjtag/src/bsdl/bsdl_flex.l index eb153e24..4edbcfd0 100644 --- a/urjtag/src/bsdl/bsdl_flex.l +++ b/urjtag/src/bsdl/bsdl_flex.l @@ -434,14 +434,14 @@ urj_bsdl_flex_init (int proc_mode) /* get our scanner structure */ if (yylex_init (&scanner) != 0) { - urj_bsdl_err_set (proc_mode, URJ_ERROR_BSDL_BSDL, + urj_bsdl_ftl_set (proc_mode, URJ_ERROR_BSDL_BSDL, "Scanner could not be initialized"); return NULL; } if (!(extra = malloc (sizeof (urj_bsdl_scan_extra_t)))) { - urj_bsdl_err_set (proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); yylex_destroy (scanner); return NULL; @@ -531,7 +531,7 @@ new_string (urj_bsdl_scan_extra_t *extra, const char *str) n_str[n_str_size - 1] = '\0'; /* set very last element to EOS */ } else - urj_bsdl_err_set (extra->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (extra->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); return (n_str); diff --git a/urjtag/src/bsdl/bsdl_msg.h b/urjtag/src/bsdl/bsdl_msg.h index 48c95bae..e79a24a1 100644 --- a/urjtag/src/bsdl/bsdl_msg.h +++ b/urjtag/src/bsdl/bsdl_msg.h @@ -59,4 +59,10 @@ urj_error_set (err, __VA_ARGS__); \ } while (0) +#define urj_bsdl_ftl_set(proc_mode, err, ...) \ + do { \ + if (proc_mode & URJ_BSDL_MODE_MSG_FATAL) \ + urj_error_set (err, __VA_ARGS__); \ + } while (0) + #endif /* URJ_BSDL_MSG_H */ diff --git a/urjtag/src/bsdl/vhdl_bison.y b/urjtag/src/bsdl/vhdl_bison.y index 8c763918..a6cf3352 100644 --- a/urjtag/src/bsdl/vhdl_bison.y +++ b/urjtag/src/bsdl/vhdl_bison.y @@ -848,7 +848,7 @@ urj_vhdl_parser_init (FILE *f, urj_bsdl_jtag_ctrl_t *jtag_ctrl) if (!(new_priv = malloc (sizeof (urj_vhdl_parser_priv_t)))) { - urj_bsdl_err_set (jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); return NULL; } @@ -953,7 +953,7 @@ urj_vhdl_port_add_name (urj_vhdl_parser_priv_t *priv, char *name) pd->names_list = new_string; } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1045,7 +1045,7 @@ urj_vhdl_port_apply_port (urj_vhdl_parser_priv_t *priv) tmp_pd->next = NULL; } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1080,7 +1080,7 @@ set_attr_bool (urj_vhdl_parser_priv_t *priv, char *name, int value) add_elem (priv, el); } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } #endif @@ -1101,7 +1101,7 @@ set_attr_decimal (urj_vhdl_parser_priv_t *priv, char *name, int value) add_elem (priv, el); } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1132,7 +1132,7 @@ set_attr_string (urj_vhdl_parser_priv_t *priv, char *name, char *string) add_elem (priv, el); } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } @@ -1151,7 +1151,7 @@ set_attr_real (urj_vhdl_parser_priv_t *priv, char *name, char *string) add_elem (priv, el); } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } #endif @@ -1171,7 +1171,7 @@ set_attr_const (urj_vhdl_parser_priv_t *priv, char *name, char *string) add_elem (priv, el); } else - urj_bsdl_err_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (priv->jtag_ctrl->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); } #endif diff --git a/urjtag/src/bsdl/vhdl_flex.l b/urjtag/src/bsdl/vhdl_flex.l index 1368b556..992e62c8 100644 --- a/urjtag/src/bsdl/vhdl_flex.l +++ b/urjtag/src/bsdl/vhdl_flex.l @@ -365,7 +365,7 @@ urj_vhdl_flex_init (FILE *f, int proc_mode) /* get our scanner structure */ if (yylex_init (&scanner) != 0) { - urj_bsdl_err_set (proc_mode, URJ_ERROR_BSDL_VHDL, + urj_bsdl_ftl_set (proc_mode, URJ_ERROR_BSDL_VHDL, "Scanner could not be initialized"); return NULL; } @@ -373,7 +373,7 @@ urj_vhdl_flex_init (FILE *f, int proc_mode) if (!(extra = malloc (sizeof (urj_bsdl_scan_extra_t)))) { - urj_bsdl_err_set (proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); yylex_destroy (scanner); return NULL; @@ -463,7 +463,7 @@ new_string (urj_bsdl_scan_extra_t *extra, const char *str) n_str[n_str_size - 1] = '\0'; /* set very last element to EOS */ } else - urj_bsdl_err_set (extra->proc_mode, URJ_ERROR_OUT_OF_MEMORY, + urj_bsdl_ftl_set (extra->proc_mode, URJ_ERROR_OUT_OF_MEMORY, "No memory"); return n_str; @@ -521,7 +521,7 @@ urj_vhdl_flex_switch_file (yyscan_t scanner, char *filename) f = fopen (db_file, "r"); if (!f) - urj_bsdl_err_set (extra->proc_mode, URJ_ERROR_IO, + urj_bsdl_ftl_set (extra->proc_mode, URJ_ERROR_IO, "Cannot open file %s or %s", filename, db_file); free (db_file);