X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=gmqcc.h;h=eca1e156f05b3edd615dcd47fd79f9a02098e4bd;hb=de01d34925cb609607e76b3cb7e7a48312f2cc8e;hp=24d34cda71217f9f3027598ea9f994340ba92529;hpb=1fd2666fba4d44c1f8d14e2fcb50dd4fcad0a808;p=xonotic%2Fgmqcc.git diff --git a/gmqcc.h b/gmqcc.h index 24d34cd..eca1e15 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -27,6 +27,37 @@ #include #include #include + +#define GMQCC_VERSION_MAJOR 0 +#define GMQCC_VERSION_MINOR 1 +#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) + +/* + * We cannoy rely on C99 at all, since compilers like MSVC + * simply don't support it. We define our own boolean type + * as a result (since we cannot include ). For + * compilers that are in 1999 mode (C99 compliant) we can use + * the language keyword _Bool which can allow for better code + * on GCC and GCC-like compilers, opposed to `int`. + */ +#ifndef __cplusplus +# ifdef false +# undef false +# endif /* !false */ +# ifdef true +# undef true +# endif /* !true */ +# define false (0) +# define true (1) +# define bool _Bool +# if __STDC_VERSION__ < 199901L && __GNUC__ < 3 + typedef int _Bool +# endif +# endif /* !__cplusplus */ + /* * stdint.h and inttypes.h -less subset * for systems that don't have it, which we must @@ -62,7 +93,6 @@ typedef char uint8_size_is_correct [sizeof(uint8_t) == 1?1:-1]; typedef char uint16_size_if_correct [sizeof(uint16_t) == 2?1:-1]; typedef char uint32_size_is_correct [sizeof(uint32_t) == 4?1:-1]; -typedef char int8_size_is_correct [sizeof(int8_t) == 1?1:-1]; typedef char int16_size_if_correct [sizeof(int16_t) == 2?1:-1]; typedef char int32_size_is_correct [sizeof(int32_t) == 4?1:-1]; /* intptr_t / uintptr_t correct size check */ @@ -164,9 +194,13 @@ void *util_memory_a (unsigned int, unsigned int, const char *); void util_memory_d (void *, unsigned int, const char *); void util_meminfo (); +bool util_strupper (const char *); +bool util_strdigit (const char *); char *util_strdup (const char *); char *util_strrq (char *); char *util_strrnl (char *); +char *util_strsws (const char *); +char *util_strchp (const char *, const char *); void util_debug (const char *, const char *, ...); int util_getline (char **, size_t *, FILE *); void util_endianswap (void *, int, int); @@ -508,8 +542,9 @@ enum { COMPILER_QCCX, /* qccx QuakeC */ COMPILER_GMQCC /* this QuakeC */ }; -extern int opts_debug; -extern int opts_memchk; -extern int opts_darkplaces_stringtablebug; -extern int opts_omit_nullcode; +extern bool opts_debug; +extern bool opts_memchk; +extern bool opts_darkplaces_stringtablebug; +extern bool opts_omit_nullcode; +extern int opts_compiler; #endif