cc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. // CONSTANT NO_STRUCT_DEFINITION 0
  42. #define NO_STRUCT_DEFINITION 0
  43. void copy_string(char* target, char* source, int max);
  44. int in_set(int c, char* s);
  45. int match(char* a, char* b);
  46. void require(int bool, char* error);
  47. void reset_hold_string(void);
  48. char* int2str(int x, int base, int signed_p);
  49. struct type
  50. {
  51. struct type* next;
  52. int size;
  53. int offset;
  54. int is_signed;
  55. struct type* indirect;
  56. struct type* members;
  57. struct type* type;
  58. char* name;
  59. };
  60. struct token_list
  61. {
  62. struct token_list* next;
  63. struct token_list* locals;
  64. struct token_list* prev;
  65. char* s;
  66. struct type* type;
  67. char* filename;
  68. struct token_list* arguments;
  69. int depth;
  70. int linenumber;
  71. };
  72. struct case_list
  73. {
  74. struct case_list* next;
  75. char* value;
  76. };
  77. struct token_list* sym_declare(char *s, struct type* t, struct token_list* list);
  78. #include "cc_globals.h"