An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

58 lignes
1.0 KiB

  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 <stdbool.h>
  5. #include <stddef.h>
  6. #include <stdint.h>
  7. #include <stdlib.h>
  8. /* Structs */
  9. struct Line {
  10. char *data;
  11. size_t length;
  12. size_t lineno;
  13. struct Line *next;
  14. };
  15. typedef struct Line Line;
  16. typedef struct {
  17. Line *lines;
  18. char *filename;
  19. } LineBuffer;
  20. typedef enum {
  21. ET_SYNTAX,
  22. ET_FILEIO
  23. } ErrorType;
  24. typedef enum {
  25. ED_INCLUDE_BAD_ARG,
  26. ED_FILE_READ_ERR
  27. } ErrorDesc;
  28. struct ErrorLine {
  29. char *data;
  30. size_t length;
  31. size_t lineno;
  32. char *filename;
  33. ssize_t index;
  34. struct ErrorLine *next;
  35. };
  36. typedef struct ErrorLine ErrorLine;
  37. typedef struct {
  38. ErrorType type;
  39. ErrorDesc desc;
  40. ErrorLine *line;
  41. } ErrorInfo;
  42. /* Functions */
  43. void error_info_print(const ErrorInfo*, FILE*);
  44. void error_info_destroy(ErrorInfo*);
  45. size_t assemble(const LineBuffer*, uint8_t**, ErrorInfo**);
  46. bool assemble_file(const char*, const char*);