32# include "../../config.h"
57#if defined __ICC || !defined __GNUC__
58# define __attribute__(x)
62#define UFO_DEPRECATED __attribute__ ((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)
98int 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]
110int 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__ )
147void Q_strncpyzDebug(
char*
dest,
const char* src,
size_t destsize,
const char* file,
int line)
__attribute__((nonnull));
167bool 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, ...)
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
void Com_Error(int code, const char *fmt,...)
void Com_Printf(const char *const fmt,...)
void format(__printf__, 1, 2)))
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN GLenum GLuint * dest
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void Com_StripExtension(const char *in, char *out, size_t size)
Removes the file extension from a filename.
const char * va(const char *format,...) __attribute__((format(__printf__
void Q_strncpyz(char *dest, const char *src, size_t destsize) __attribute__((nonnull))
Safe strncpy that ensures a trailing zero.
char * Com_Chop(char *s)
Removed trailing whitespaces.
void Com_ReplaceFilename(const char *fileName, const char *name, char *path, size_t size)
Replaces the filename from one path with another one.
bool Q_strnull(const char *string)
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,...
const char * Com_SkipPath(const char *pathname)
Returns just the filename from a given path.
void Com_DefaultExtension(char *path, size_t len, const char *extension)
Sets a default extension if there is none.
void Com_FilePath(const char *in, char *out, size_t size)
Returns the path up to, but not including the last /.
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap)
Safe (null terminating) vsnprintf implementation.
const char * Com_GetExtension(const char *path)
char * Com_Trim(char *s)
Removed leading and trailing whitespaces.
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 UFO_assert(bool condition, const char *fmt,...) __attribute__((format(__printf__
int Com_Filter(const char *pattern, const char *text)
Match the pattern PATTERN against the string TEXT;.
void Q_strcat(char *dest, size_t destsize, const char *src,...) __attribute__((nonnull
char * Q_strlwr(char *str)
Converts a string to lowercase.
unsigned int Com_HashKey(const char *name, int hashsize)
returns hash key for a string
int Q_StringSort(const void *string1, const void *string2)
Compare two strings.
void Com_MakeTimestamp(char *ts, const size_t tslen)
Creates a timestamp with date and time at the specified location.
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
const char * Q_stristr(const char *str, const char *substr)
Checks in case insensitive manner whether str contains substr.
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.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
int Q_FloatSort(const void *float1, const void *float2)
Compare two floats.
Cross-platform type definitions.