An emulator, assembler, and disassembler for the Sega Game Gear
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

errors.h 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #pragma once
  4. #include <stdio.h>
  5. #include "state.h"
  6. /* Enums */
  7. typedef enum {
  8. ET_INCLUDE,
  9. ET_PREPROC
  10. } ASMErrorType;
  11. typedef enum {
  12. ED_INC_BAD_ARG,
  13. ED_INC_RECURSION,
  14. ED_INC_FILE_READ,
  15. ED_PP_UNKNOWN,
  16. ED_PP_DUPLICATE,
  17. ED_PP_NO_ARG,
  18. ED_PP_BAD_ARG,
  19. ED_PP_ARG_RANGE,
  20. ED_PP_HEADER_RANGE,
  21. ED_PP_DECLARE_RANGE
  22. } ASMErrorDesc;
  23. /* Strings */
  24. static const char *asm_error_types[] = {
  25. "include directive",
  26. "preprocessor"
  27. };
  28. static const char *asm_error_descs[] = {
  29. "missing or invalid argument",
  30. "infinite recursion detected",
  31. "couldn't read included file",
  32. "unknown directive",
  33. "multiple values for directive",
  34. "missing argument for directive",
  35. "invalid argument for directive",
  36. "directive argument out of range",
  37. "header offset exceeds given ROM size",
  38. "declared ROM size in header exceeds actual size"
  39. };
  40. /* Structs */
  41. typedef struct ErrorInfo ErrorInfo;
  42. /* Functions */
  43. ErrorInfo* error_info_create(const ASMLine*, ASMErrorType, ASMErrorDesc);
  44. void error_info_append(ErrorInfo*, const ASMLine*);
  45. void error_info_print(const ErrorInfo*, FILE*);
  46. void error_info_destroy(ErrorInfo*);