30 # include "../ports/android/config_android.h"
32 # include "../../config.h"
57 #if defined __ICC || !defined __GNUC__
58 # define __attribute__(x)
62 #define UFO_DEPRECATED __attribute__ ((deprecated))
64 #define UFO_DEPRECATED
69 # define snprintf _snprintf
78 #if !defined __cplusplus && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)
81 # define inline __inline__
83 # define inline __inline
89 #define STRINGIFY(x) #x
90 #define DOUBLEQUOTE(x) STRINGIFY(x)
98 int Com_Filter(
const char* pattern,
const char* text);
105 #define lengthof(x) (sizeof(x) / sizeof(*(x)))
106 #define endof(x) ((x) + lengthof((x)))
107 #define CASSERT(x) extern int ASSERT_COMPILE[((x) != 0) * 2 - 1]
110 int Q_FloatSort(const
void* float1, const
void* float2);
118 #if defined(__MINGW32_VERSION) && defined(__STRICT_ANSI__)
120 _CRTIMP
char* __cdecl strdup (
const char*) __MINGW_ATTRIB_MALLOC;
121 _CRTIMP
int __cdecl _stricmp (const
char*, const
char*);
122 _CRTIMP
int __cdecl _strnicmp (const
char*, const
char*,
size_t);
123 #define strncasecmp _strnicmp
128 # define Q_strcasecmp(a, b) _stricmp((a), (b))
129 # define Q_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
131 # define Q_strcasecmp(a, b) strcasecmp((a), (b))
132 # define Q_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
135 #define Q_strcaseeq(a, b) (Q_strcasecmp(a, b) == 0)
136 #define Q_streq(a, b) (strcmp(a, b) == 0)
137 #define Q_strneq(a, b, n) (strncmp(a, b, n) == 0)
139 return string ==
nullptr ||
string[0] ==
'\0';
141 #define Q_strvalid(string) !Q_strnull(string)
146 #define Q_strncpyz(string1,string2,length) Q_strncpyzDebug( string1, string2, length, __FILE__, __LINE__ )
147 void Q_strncpyzDebug(
char* dest,
const char* src,
size_t destsize,
const char* file,
int line)
__attribute__((nonnull));
150 int Q_vsnprintf(
char* str,
size_t size,
const char* format, va_list ap);
151 void Q_strcat(
char* dest,
size_t destsize,
const char* src, ...)
__attribute__((nonnull, format(__printf__, 3, 4)));
167 bool Q_strreplace(const
char* source, const
char* pattern, const
char* replace,
char* dest,
size_t destsize);
177 #define OBJSET(obj, val) (memset(&(obj), (val), sizeof(obj)))
178 #define OBJZERO(obj) OBJSET((obj), 0)
181 #define UFO_assert(condition, ...)
bool Q_strnull(const char *string)
char const * Q_strstart(char const *str, char const *start) __attribute__((nonnull))
Matches the start of a string.
const char * va(const char *format,...) __attribute__((format(__printf__
int Q_StringSort(const void *string1, const void *string2) __attribute__((nonnull))
Compare two strings.
void Q_strcat(char *dest, size_t destsize, const char *src,...) __attribute__((nonnull
char * Q_strlwr(char *str) __attribute__((nonnull))
Converts a string to lowercase.
const char * Com_SkipPath(const char *pathname)
Returns just the filename from a given path.
void Com_MakeTimestamp(char *ts, const size_t tslen)
Creates a timestamp with date and time at the specified location.
void void void Com_Error(int code, const char *fmt,...) __attribute__((noreturn
bool Com_sprintf(char *dest, size_t size, const char *fmt,...) __attribute__((format(__printf__
void Com_DefaultExtension(char *path, size_t len, const char *extension)
Sets a default extension if there is none.
void format(__printf__, 3, 4)))
void UFO_assert(bool condition, const char *fmt,...) __attribute__((format(__printf__
const char * Com_GetExtension(const char *path)
QGL_EXTERN GLenum GLuint * dest
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap)
Safe (null terminating) vsnprintf implementation.
void Com_FilePath(const char *in, char *out, size_t size)
Returns the path up to, but not including the last /.
const char int Q_FloatSort(const void *float1, const void *float2)
Compare two floats.
void Q_strncpyz(char *dest, const char *src, size_t destsize) __attribute__((nonnull))
Safe strncpy that ensures a trailing zero.
int Com_Filter(const char *pattern, const char *text)
Match the pattern PATTERN against the string TEXT;.
void void Com_DPrintf(int level, const char *msg,...) __attribute__((format(__printf__
bool Q_strreplace(const char *source, const char *pattern, const char *replace, char *dest, size_t destsize)
Replaces the first occurence of the given pattern in the source string with the given replace string...
char * Com_Chop(char *s)
Removed trailing whitespaces.
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
char * Com_ConvertToASCII7(char *s)
Remove high character values and only keep ascii. This can be used to print utf-8 characters to the c...
void Com_ReplaceFilename(const char *fileName, const char *name, char *path, size_t size)
Replaces the filename from one path with another one.
const char * Q_stristr(const char *str, const char *substr) __attribute__((nonnull))
Checks in case insensitive manner whether str contains substr.
char * Com_Trim(char *s)
Removed leading and trailing whitespaces.
Cross-platform type definitions.
unsigned int Com_HashKey(const char *name, int hashsize)
returns hash key for a string
void Com_StripExtension(const char *in, char *out, size_t size)
Removes the file extension from a filename.
void Com_Printf(const char *fmt,...) __attribute__((format(__printf__
bool Com_IsValidName(const char *input)
Checks whether the given input string is allowed to be used as a user-given name string for aircraft...