cc.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* Copyright (C) 2016 Jeremiah Orians
  2. * Copyright (C) 2020 deesix <deesix@tuta.io>
  3. * This file is part of M2-Planet.
  4. *
  5. * M2-Planet is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * M2-Planet is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #include <string.h>
  21. // CONSTANT FALSE 0
  22. #define FALSE 0
  23. // CONSTANT TRUE 1
  24. #define TRUE 1
  25. // CONSTANT KNIGHT_NATIVE 1
  26. #define KNIGHT_NATIVE 1
  27. // CONSTANT KNIGHT_POSIX 2
  28. #define KNIGHT_POSIX 2
  29. // CONSTANT X86 3
  30. #define X86 3
  31. // CONSTANT AMD64 4
  32. #define AMD64 4
  33. // CONSTANT ARMV7L 5
  34. #define ARMV7L 5
  35. // CONSTANT AARCH64 6
  36. #define AARCH64 6
  37. // CONSTANT RISCV32 7
  38. #define RISCV32 7
  39. // CONSTANT RISCV64 8
  40. #define RISCV64 8
  41. void copy_string(char* target, char* source, int max);
  42. int in_set(int c, char* s);
  43. int match(char* a, char* b);
  44. void require(int bool, char* error);
  45. void reset_hold_string();
  46. struct type
  47. {
  48. struct type* next;
  49. int size;
  50. int offset;
  51. int is_signed;
  52. struct type* indirect;
  53. struct type* members;
  54. struct type* type;
  55. char* name;
  56. };
  57. struct token_list
  58. {
  59. struct token_list* next;
  60. union
  61. {
  62. struct token_list* locals;
  63. struct token_list* prev;
  64. };
  65. char* s;
  66. union
  67. {
  68. struct type* type;
  69. char* filename;
  70. };
  71. union
  72. {
  73. struct token_list* arguments;
  74. int depth;
  75. int linenumber;
  76. };
  77. };
  78. struct case_list
  79. {
  80. struct case_list* next;
  81. char* value;
  82. };
  83. #include "cc_globals.h"