X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=gmqcc.h;h=fc93d92b002857e7476d187679194156891bd460;hb=802005f57192f91b73871d48ce8c4b0b64bd6ad1;hp=b3ba81782320d517ad4e6976416d3530fd8e6bbb;hpb=73070395ebdf177b456bdaf52f75a3c3a40cd416;p=xonotic%2Fgmqcc.git diff --git a/gmqcc.h b/gmqcc.h index b3ba817..fc93d92 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -39,8 +39,8 @@ #endif /*! _MSC_VER */ #define GMQCC_VERSION_MAJOR 0 -#define GMQCC_VERSION_MINOR 2 -#define GMQCC_VERSION_PATCH 9 +#define GMQCC_VERSION_MINOR 3 +#define GMQCC_VERSION_PATCH 0 #define GMQCC_VERSION_BUILD(J,N,P) (((J)<<16)|((N)<<8)|(P)) #define GMQCC_VERSION \ GMQCC_VERSION_BUILD(GMQCC_VERSION_MAJOR, GMQCC_VERSION_MINOR, GMQCC_VERSION_PATCH) @@ -48,13 +48,17 @@ #define GMQCC_VERSION_TYPE_DEVEL /* Full version string in case we need it */ -#ifdef GMQCC_GITINFO -# define GMQCC_DEV_VERSION_STRING "git build: " GMQCC_GITINFO "\n" -#elif defined(GMQCC_VERSION_TYPE_DEVEL) -# define GMQCC_DEV_VERSION_STRING "development build\n" +#ifdef GMQCC_VERSION_TYPE_DEVEL +# ifdef GMQCC_GITINFO +# define GMQCC_DEV_VERSION_STRING "git build: " GMQCC_GITINFO "\n" +# elif defined(GMQCC_VERSION_TYPE_DEVEL) +# define GMQCC_DEV_VERSION_STRING "development build\n" +# else +# define GMQCC_DEV_VERSION_STRING +# endif /*! GMQCC_GITINGO */ #else # define GMQCC_DEV_VERSION_STRING -#endif /*! GMQCC_GITINGO */ +#endif #define GMQCC_STRINGIFY(x) #x #define GMQCC_IND_STRING(x) GMQCC_STRINGIFY(x) @@ -703,32 +707,40 @@ enum { VINSTR_NRCALL }; -/* TODO: cleanup this mess */ -extern prog_section_statement *code_statements; -extern int *code_linenums; -extern prog_section_def *code_defs; -extern prog_section_field *code_fields; -extern prog_section_function *code_functions; -extern int *code_globals; -extern char *code_chars; -extern uint16_t code_crc; - /* uhh? */ typedef float qcfloat; typedef int32_t qcint; +typedef struct { + prog_section_statement *statements; + int *linenums; + prog_section_def *defs; + prog_section_field *fields; + prog_section_function *functions; + int *globals; + char *chars; + uint16_t crc; + uint32_t entfields; + ht string_cache; + qcint string_cached_empty; +} code_t; + /* - * code_write -- writes out the compiled file - * code_init -- prepares the code file + * code_write -- writes out the compiled file + * code_init -- prepares the code file + * code_genstrin -- generates string for code + * code_alloc_field -- allocated a field + * code_push_statement -- keeps statements and linenumbers together + * code_pop_statement -- keeps statements and linenumbers together */ -bool code_write (const char *filename, const char *lno); -void code_init (); -uint32_t code_genstring (const char *string); -qcint code_alloc_field (size_t qcsize); - -/* this function is used to keep statements and linenumbers together */ -void code_push_statement(prog_section_statement *stmt, int linenum); -void code_pop_statement(); +bool code_write (code_t *, const char *filename, const char *lno); +GMQCC_WARN +code_t *code_init (void); +void code_cleanup (code_t *); +uint32_t code_genstring (code_t *, const char *string); +qcint code_alloc_field (code_t *, size_t qcsize); +void code_push_statement(code_t *, prog_section_statement *stmt, int linenum); +void code_pop_statement (code_t *); /* * A shallow copy of a lex_file to remember where which ast node @@ -1002,22 +1014,7 @@ void parser_cleanup (struct parser_s *parser); /*===================================================================*/ /*====================== ftepp.c commandline ========================*/ /*===================================================================*/ -struct lex_file_s; struct ftepp_s; - -typedef struct { - const char *name; - char *(*func)(struct lex_file_s *); -} ftepp_predef_t; - -/* - * line, file, counter, counter_last, random, random_last, date, time - * time_stamp. - * - * increment when items are added - */ -#define FTEPP_PREDEF_COUNT 9 - struct ftepp_s *ftepp_create (); bool ftepp_preprocess_file (struct ftepp_s *ftepp, const char *filename); bool ftepp_preprocess_string(struct ftepp_s *ftepp, const char *name, const char *str); @@ -1027,8 +1024,6 @@ void ftepp_flush (struct ftepp_s *ftepp); void ftepp_add_define (struct ftepp_s *ftepp, const char *source, const char *name); void ftepp_add_macro (struct ftepp_s *ftepp, const char *name, const char *value); -extern const ftepp_predef_t ftepp_predefs[FTEPP_PREDEF_COUNT]; - /*===================================================================*/ /*======================= main.c commandline ========================*/ /*===================================================================*/