cc.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 0
  26. #define KNIGHT_NATIVE 0
  27. // CONSTANT KNIGHT_POSIX 1
  28. #define KNIGHT_POSIX 1
  29. // CONSTANT X86 2
  30. #define X86 2
  31. // CONSTANT AMD64 3
  32. #define AMD64 3
  33. // CONSTANT ARMV7L 4
  34. #define ARMV7L 4
  35. // CONSTANT AARCH64 5
  36. #define AARCH64 5
  37. void copy_string(char* target, char* source, int max);
  38. int in_set(int c, char* s);
  39. int match(char* a, char* b);
  40. void file_print(char* s, FILE* f);
  41. void require(int bool, char* error);
  42. void reset_hold_string();
  43. struct type
  44. {
  45. struct type* next;
  46. int size;
  47. int offset;
  48. int is_signed;
  49. struct type* indirect;
  50. struct type* members;
  51. struct type* type;
  52. char* name;
  53. };
  54. struct token_list
  55. {
  56. struct token_list* next;
  57. union
  58. {
  59. struct token_list* locals;
  60. struct token_list* prev;
  61. };
  62. char* s;
  63. union
  64. {
  65. struct type* type;
  66. char* filename;
  67. };
  68. union
  69. {
  70. struct token_list* arguments;
  71. int depth;
  72. int linenumber;
  73. };
  74. };
  75. #include "cc_globals.h"