X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=gmqcc.h;h=1ea2ceff8bb472286c8bc3982d1f785fdb4dcc9e;hb=79619fbf50c473672f268b27b8c667f0a2e83271;hp=9f330da11ffdae5145717bec420e01f581a44c7c;hpb=df61f3c182714187842c3f1cdfe523523176e12e;p=xonotic%2Fgmqcc.git diff --git a/gmqcc.h b/gmqcc.h index 9f330da..1ea2cef 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -239,6 +239,7 @@ uint32_t util_crc32(uint32_t crc, const char *data, size_t len); #define _vec_needsgrow(A,N) ((!(A)) || (_vec_end(A) + (N) >= _vec_beg(A))) #define _vec_mightgrow(A,N) (_vec_needsgrow((A), (N)) ? _vec_forcegrow((A),(N)) : 0) #define _vec_forcegrow(A,N) _util_vec_grow((void**)&(A), (N), sizeof(*(A))) +#define _vec_remove(A,S,I,N) (memmove((char*)(A)+(I)*(S),(char*)(A)+((I)+(N))*(S),(S)*(vec_size(A)-(I)-(N))), _vec_end(A)-=(N)) void _util_vec_grow(void **a, size_t i, size_t s); /* exposed interface */ #define vec_free(A) ((A) ? (mem_d(_vec_raw(A)), (A) = NULL) : 0) @@ -247,7 +248,6 @@ void _util_vec_grow(void **a, size_t i, size_t s); #define vec_add(A,N) (_vec_mightgrow((A),(N)), _vec_end(A)+=(N), &(A)[_vec_end(A)-(N)]) #define vec_last(A) ((A)[_vec_end(A)-1]) #define vec_append(A,N,S) memcpy(vec_add((A), (N)), (S), N * sizeof(*(S))) -#define _vec_remove(A,S,I,N) (memmove((char*)(A)+(I)*(S),(char*)(A)+((I)+(N))*(S),(S)*(vec_size(A)-(I)-(N))), _vec_end(A)-=(N)) #define vec_remove(A,I,N) _vec_remove((A), sizeof(*(A)), (I), (N)) #define vec_pop(A) vec_remove((A), _vec_end(A)-1, 1) /* these are supposed to NOT reallocate */ @@ -751,6 +751,18 @@ bool parser_compile_file (const char *filename); bool parser_compile_string(const char *name, const char *str); bool parser_finish (const char *output); void parser_cleanup (); +/* There's really no need to strlen() preprocessed files */ +bool parser_compile_string_len(const char *name, const char *str, size_t len); + +/*===================================================================*/ +/*====================== ftepp.c commandline ========================*/ +/*===================================================================*/ +bool ftepp_init (); +bool ftepp_preprocess_file (const char *filename); +bool ftepp_preprocess_string(const char *name, const char *str); +void ftepp_finish (); +const char *ftepp_get (); +void ftepp_flush (); /*===================================================================*/ /*======================= main.c commandline ========================*/