diff options
author | Teddy <[email protected]> | 2014-03-26 20:03:50 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-03-26 20:03:50 +0800 |
commit | 3599a86d68c664f24fce8c853f482cad0af6ed6a (patch) | |
tree | 71453eadb97151ce4a79ffa15fd5bf74a9b5b310 | |
parent | dc4cacf854d28a0df88e37e2f0c0abce421657a9 (diff) |
move all const to a seperate file
-rw-r--r-- | ast.h | 24 | ||||
-rw-r--r-- | const.h | 23 | ||||
-rw-r--r-- | semantics.c | 2 | ||||
-rw-r--r-- | semantics.h | 3 |
4 files changed, 26 insertions, 26 deletions
@@ -1,31 +1,9 @@ #ifndef AST_H #define AST_H #include <stdarg.h> +#include "const.h" #include "cibic.tab.h" -#define EXP_POSTFIX 1024 -#define POSTFIX_ARR 1025 -#define POSTFIX_CALL 1026 -#define POSTFIX_DOT 1027 -#define POSTFIX_PTR 1028 -#define EXP_CAST 1029 -#define INITR_NORM 1030 -#define INITR_ARR 1031 -#define DECLR_FUNC 1032 -#define DECLR_ARR 1033 -#define STMT_EXP 1034 -#define STMT_COMP 1035 -#define STMT_IF 1036 -#define STMT_WHILE 1037 -#define STMT_FOR 1038 -#define STMT_CONT 1039 -#define STMT_BREAK 1040 -#define STMT_RET 1041 - -#define MAX_CHDN 1024 -#define MAX_DEBUG_PRINT_BUFF 1024 -#define MAX_DEBUG_PRINT_LVL 1024 - typedef struct CNode { enum { /* Top Level */ @@ -0,0 +1,23 @@ +#define EXP_POSTFIX 1024 +#define POSTFIX_ARR 1025 +#define POSTFIX_CALL 1026 +#define POSTFIX_DOT 1027 +#define POSTFIX_PTR 1028 +#define EXP_CAST 1029 +#define INITR_NORM 1030 +#define INITR_ARR 1031 +#define DECLR_FUNC 1032 +#define DECLR_ARR 1033 +#define STMT_EXP 1034 +#define STMT_COMP 1035 +#define STMT_IF 1036 +#define STMT_WHILE 1037 +#define STMT_FOR 1038 +#define STMT_CONT 1039 +#define STMT_BREAK 1040 +#define STMT_RET 1041 + +#define MAX_CHDN 1024 +#define MAX_DEBUG_PRINT_BUFF 1024 +#define MAX_DEBUG_PRINT_LVL 1024 +#define MAX_TABLE_SIZE 1021 diff --git a/semantics.c b/semantics.c index cb12c29..0f95d2c 100644 --- a/semantics.c +++ b/semantics.c @@ -158,7 +158,7 @@ unsigned int bkdr_hash(const char *str) { unsigned int hv = 0; while (*str) hv = hv * seed + (unsigned)(*str++); - return hv % 5; + return hv; } const char *cvar_print(void *var) { diff --git a/semantics.h b/semantics.h index 1ec4c21..93ab787 100644 --- a/semantics.h +++ b/semantics.h @@ -1,7 +1,6 @@ #ifndef SEMANTICS_H #define SEMANTICS_H -#include "ast.h" -#define MAX_TABLE_SIZE 1021 +#include "const.h" #define CIBIC_DEBUG struct CTable; |