cc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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(void);
  46. char* int2str(int x, int base, int signed_p);
  47. struct type
  48. {
  49. struct type* next;
  50. int size;
  51. int offset;
  52. int is_signed;
  53. struct type* indirect;
  54. struct type* members;
  55. struct type* type;
  56. char* name;
  57. };
  58. struct token_list
  59. {
  60. struct token_list* next;
  61. struct token_list* locals;
  62. struct token_list* prev;
  63. char* s;
  64. struct type* type;
  65. char* filename;
  66. struct token_list* arguments;
  67. int depth;
  68. int linenumber;
  69. };
  70. struct case_list
  71. {
  72. struct case_list* next;
  73. char* value;
  74. };
  75. struct token_list* sym_declare(char *s, struct type* t, struct token_list* list);
  76. #include "cc_globals.h"