mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 13:50:53 +00:00
410db5d6b0
tweak drawtextfield to understand fonts. now available to menuqc too. provide player and full server info to qc server browsers. allow qc to actually use cfg_save. I've been issuing that on quit for a while now and not noticed that it was getting denied. fix some focus issues with cwindows. tweak splitscreens to display centerprints+scoreboards in more suitable places. harder to glitch out. path command can now displays hashes (in tooltips), which can be useful for creating fmf files. fix q3game crash. fix some qcc issues with hexenc and -O0. fix some qccgui unicode issues, now preserves encoding when saving. provide easy upgrade path for qccx syntax to fteqcc: string[%1] -> string+1 (which is still potentially unsafe (tempstrings), and thus generates a compiler warning). rework xmpp plugin to use cwindows for chats and the buddylist. this should make it more intuitive and thus more userfriendly. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4865 fc73d0e0-1445-4013-8a0c-d673dee63da5
123 lines
2.8 KiB
C
123 lines
2.8 KiB
C
// cmdlib.h
|
|
|
|
#ifndef __CMDLIB__
|
|
#define __CMDLIB__
|
|
|
|
#include "progsint.h"
|
|
|
|
/*#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <ctype.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <stdarg.h>
|
|
#include <setjmp.h>
|
|
#include <io.h>
|
|
|
|
#ifdef NeXT
|
|
#include <libc.h>
|
|
#endif
|
|
*/
|
|
|
|
// the dec offsetof macro doesn't work very well...
|
|
#define myoffsetof(type,identifier) ((size_t)&((type *)NULL)->identifier)
|
|
|
|
|
|
// set these before calling CheckParm
|
|
extern int myargc;
|
|
extern char **myargv;
|
|
|
|
//char *strupr (char *in);
|
|
//char *strlower (char *in);
|
|
int QCC_filelength (int handle);
|
|
int QCC_tell (int handle);
|
|
|
|
int QC_strcasecmp (const char *s1, const char *s2);
|
|
|
|
void QC_strlcat(char *dest, const char *src, size_t destsize);
|
|
void QC_strlcpy(char *dest, const char *src, size_t destsize);
|
|
void QC_strnlcpy(char *dest, const char *src, size_t srclen, size_t destsize);
|
|
|
|
#ifdef _MSC_VER
|
|
#define QC_vsnprintf _vsnprintf
|
|
static void VARGS QC_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
va_start (args, fmt);
|
|
vsnprintf (dest, size-1, fmt, args);
|
|
va_end (args);
|
|
//make sure its terminated.
|
|
dest[size-1] = 0;
|
|
}
|
|
#else
|
|
#define QC_vsnprintf vsnprintf
|
|
#define QC_snprintfz snprintf
|
|
#endif
|
|
|
|
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
|
#ifndef LIKEPRINTF
|
|
#define LIKEPRINTF(x) __attribute__((format(printf,x,x+1)))
|
|
#endif
|
|
#endif
|
|
#ifndef LIKEPRINTF
|
|
#define LIKEPRINTF(x)
|
|
#endif
|
|
|
|
double I_FloatTime (void);
|
|
|
|
void VARGS QCC_Error (int errortype, const char *error, ...) LIKEPRINTF(2);
|
|
int CheckParm (char *check);
|
|
|
|
|
|
int SafeOpenWrite (char *filename, int maxsize);
|
|
int SafeOpenRead (char *filename);
|
|
void SafeRead (int handle, void *buffer, long count);
|
|
void SafeWrite (int handle, void *buffer, long count);
|
|
pbool SafeClose(int hand);
|
|
int SafeSeek(int hand, int ofs, int mode);
|
|
void *SafeMalloc (long size);
|
|
|
|
|
|
long QCC_LoadFile (char *filename, void **bufferptr);
|
|
void QCC_SaveFile (char *filename, void *buffer, long count);
|
|
|
|
void DefaultExtension (char *path, char *extension);
|
|
void DefaultPath (char *path, char *basepath);
|
|
void StripFilename (char *path);
|
|
void StripExtension (char *path);
|
|
|
|
void ExtractFilePath (char *path, char *dest);
|
|
void ExtractFileBase (char *path, char *dest);
|
|
void ExtractFileExtension (char *path, char *dest);
|
|
|
|
long ParseNum (char *str);
|
|
|
|
|
|
char *QCC_COM_Parse (const char *data);
|
|
char *QCC_COM_Parse2 (char *data);
|
|
|
|
unsigned int utf8_check(const void *in, unsigned int *value);
|
|
|
|
extern char qcc_token[1024];
|
|
extern int qcc_eof;
|
|
|
|
|
|
#define qcc_iswhite(c) ((c) == ' ' || (c) == '\r' || (c) == '\n' || (c) == '\t' || (c) == '\v')
|
|
#define qcc_iswhitesameline(c) ((c) == ' ' || (c) == '\t')
|
|
|
|
|
|
enum
|
|
{
|
|
UTF8_RAW,
|
|
UTF8_BOM,
|
|
UTF_ANSI,
|
|
UTF16LE,
|
|
UTF16BE,
|
|
UTF32LE,
|
|
UTF32BE,
|
|
};
|
|
|
|
#endif
|