Browse Source

Use nice initializer syntax for error strings rather than comments.

master
Ben Kurtovic 9 years ago
parent
commit
9c895af762
3 changed files with 29 additions and 29 deletions
  1. +27
    -27
      src/assembler/errors.c
  2. +1
    -1
      src/assembler/errors.h
  3. +1
    -1
      src/assembler/preprocessor.c

+ 27
- 27
src/assembler/errors.c View File

@@ -14,36 +14,36 @@
/* Error strings */

static const char *asm_error_types[] = {
"include directive", // ET_INCLUDE
"preprocessor", // ET_PREPROC
"memory layout", // ET_LAYOUT
"symbol table", // ET_SYMBOL
"instruction parser" // ET_PARSER
[ET_INCLUDE] = "include directive",
[ET_PREPROC] = "preprocessor",
[ET_LAYOUT] = "memory layout",
[ET_SYMBOL] = "symbol table",
[ET_PARSER] = "instruction parser"
};

static const char *asm_error_descs[] = {
"missing or invalid argument", // ED_INC_BAD_ARG
"infinite recursion detected", // ED_INC_RECURSION
"couldn't read included file", // ED_INC_FILE_READ
"unknown directive", // ED_PP_UNKNOWN
"multiple values for directive", // ED_PP_DUPLICATE
"missing argument for directive", // ED_PP_NO_ARG
"invalid argument for directive", // ED_PP_BAD_ARG
"directive argument out of range", // ED_PP_ARG_RANGE
"header offset exceeds given ROM size", // ED_LYT_HEADER_RANGE
"declared ROM size in header exceeds actual size", // ED_LYT_DECLARE_RANGE
"location is out of bounds for the ROM size", // ED_LYT_BOUNDS
"block zero cannot be mapped into a nonzero slot", // ED_LYT_BLOCK0
"multiple slot declarations for block directive", // ED_LYT_SLOTS
"location overlaps with instruction or data", // ED_LYT_OVERLAP
"location overlaps with ROM header", // ED_LYT_OVERLAP_HEAD
"duplicate definitions for label", // ED_SYM_DUPE_LABELS
"undefined reference to label", // ED_SYM_NO_LABEL
"syntax error" // ED_PARSE_SYNTAX
[ED_INC_BAD_ARG] = "missing or invalid argument",
[ED_INC_RECURSION] = "infinite recursion detected",
[ED_INC_FILE_READ] = "couldn't read included file",
[ED_PP_UNKNOWN] = "unknown directive",
[ED_PP_DUPLICATE] = "multiple values for directive",
[ED_PP_NO_ARG] = "missing argument for directive",
[ED_PP_BAD_ARG] = "invalid argument for directive",
[ED_PP_ARG_RANGE] = "directive argument out of range",
[ED_LYT_HEADER_RANGE] = "header offset exceeds given ROM size",
[ED_LYT_DECL_RANGE] = "declared ROM size in header exceeds actual size",
[ED_LYT_BOUNDS] = "location is out of bounds for the ROM size",
[ED_LYT_BLOCK0] = "block zero cannot be mapped into a nonzero slot",
[ED_LYT_SLOTS] = "multiple slot declarations for block directive",
[ED_LYT_OVERLAP] = "location overlaps with instruction or data",
[ED_LYT_OVERLAP_HEAD] = "location overlaps with ROM header",
[ED_SYM_DUPE_LABELS] = "duplicate definitions for label",
[ED_SYM_NO_LABEL] = "undefined reference to label",
[ED_PARSE_SYNTAX] = "syntax error"
};

/* Internal structs */


+ 1
- 1
src/assembler/errors.h View File

@@ -29,7 +29,7 @@ typedef enum {
ED_PP_ARG_RANGE,

ED_LYT_HEADER_RANGE,
ED_LYT_DECLARE_RANGE,
ED_LYT_DECL_RANGE,
ED_LYT_BOUNDS,
ED_LYT_BLOCK0,
ED_LYT_SLOTS,


+ 1
- 1
src/assembler/preprocessor.c View File

@@ -500,7 +500,7 @@ ErrorInfo* preprocess(AssemblerState *state, const LineBuffer *source)

if (rom_size_line && rom_declsize_line &&
size_code_to_bytes(state->header.rom_size) > state->rom_size) {
ei = error_info_create(rom_size_line, ET_LAYOUT, ED_LYT_DECLARE_RANGE);
ei = error_info_create(rom_size_line, ET_LAYOUT, ED_LYT_DECL_RANGE);
error_info_append(ei, rom_declsize_line);
goto cleanup;
}


Loading…
Cancel
Save