mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
more cmdlib cleanup
This commit is contained in:
parent
3b7ddfb22a
commit
8f2d1fa2d9
19 changed files with 171 additions and 37 deletions
|
@ -25,34 +25,10 @@
|
|||
#define __CMDLIB__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef _DEF_BYTE_
|
||||
# define _DEF_BYTE_
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
|
||||
#ifndef _DEF_BOOL_
|
||||
# define _DEF_BOOL_
|
||||
typedef enum {false, true} qboolean;
|
||||
#endif
|
||||
|
||||
// the dec offsetof macro doesn't work very well...
|
||||
#define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
|
||||
|
||||
// set these before calling CheckParm
|
||||
extern int myargc;
|
||||
extern char **myargv;
|
||||
|
||||
int FileLength (FILE *f);
|
||||
|
||||
void Error (char *error, ...)__attribute__((format(printf, 1,2)));
|
||||
int CheckParm (char *check);
|
||||
|
||||
FILE *SafeOpenWrite (char *filename);
|
||||
FILE *SafeOpenRead (char *filename);
|
||||
|
@ -64,6 +40,5 @@ int LoadFile (char *filename, void **bufferptr);
|
|||
char *Parse (char *data);
|
||||
|
||||
extern char qfcc_com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/pr_obj.h"
|
||||
|
|
|
@ -39,6 +39,8 @@ static const char rcsid[] =
|
|||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef NeXT
|
||||
#include <libc.h>
|
||||
|
@ -51,7 +53,6 @@ static const char rcsid[] =
|
|||
#define PATHSEPERATOR '/'
|
||||
|
||||
char qfcc_com_token[1024];
|
||||
qboolean com_eof;
|
||||
|
||||
/*
|
||||
Error
|
||||
|
@ -93,7 +94,6 @@ Parse (char *data)
|
|||
skipwhite:
|
||||
while ((c = *data) <= ' ') {
|
||||
if (c == 0) {
|
||||
com_eof = true;
|
||||
return NULL; // end of file;
|
||||
}
|
||||
data++;
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "qfcc.h"
|
||||
|
||||
static int auxfunctions_size;
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/mathlib.h>
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/dstring.h>
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/dstring.h"
|
||||
|
||||
#include "qfcc.h"
|
||||
|
@ -125,8 +136,10 @@ build_scope (function_t *f, def_t *func, param_t *params)
|
|||
continue; // non-param selector
|
||||
def = PR_GetDef (p->type, p->name, func, func->alloc);
|
||||
f->parm_ofs[i] = def->ofs;
|
||||
if (i > 0 && f->parm_ofs[i] < f->parm_ofs[i - 1])
|
||||
Error ("bad parm order");
|
||||
if (i > 0 && f->parm_ofs[i] < f->parm_ofs[i - 1]) {
|
||||
error (0, "bad parm order");
|
||||
abort ();
|
||||
}
|
||||
//printf ("%s%s %d\n", p == params ? "" : " ", p->name, def->ofs);
|
||||
def->used = 1; // don't warn for unused params
|
||||
PR_DefInitialized (def); // params are assumed to be initialized
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/pr_obj.h"
|
||||
|
|
|
@ -22,6 +22,12 @@ static const char rcsid[] =
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <QF/va.h>
|
||||
|
||||
|
@ -44,8 +50,10 @@ PrecacheSound (def_t *e, int ch)
|
|||
}
|
||||
}
|
||||
|
||||
if (numsounds == MAX_SOUNDS)
|
||||
Error ("PrecacheSound: numsounds == MAX_SOUNDS");
|
||||
if (numsounds == MAX_SOUNDS) {
|
||||
error (0, "PrecacheSound: numsounds == MAX_SOUNDS");
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy (precache_sounds[i], n);
|
||||
if (ch >= '1' && ch <= '9')
|
||||
|
@ -73,8 +81,10 @@ PrecacheModel (def_t *e, int ch)
|
|||
}
|
||||
}
|
||||
|
||||
if (nummodels == MAX_MODELS)
|
||||
Error ("PrecacheModels: nummodels == MAX_MODELS");
|
||||
if (nummodels == MAX_MODELS) {
|
||||
error (0, "PrecacheModels: nummodels == MAX_MODELS");
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy (precache_models[i], n);
|
||||
if (ch >= '1' && ch <= '9')
|
||||
|
@ -102,8 +112,10 @@ PrecacheFile (def_t *e, int ch)
|
|||
}
|
||||
}
|
||||
|
||||
if (numfiles == MAX_FILES)
|
||||
Error ("PrecacheFile: numfiles == MAX_FILES");
|
||||
if (numfiles == MAX_FILES) {
|
||||
error (0, "PrecacheFile: numfiles == MAX_FILES");
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy (precache_files[i], n);
|
||||
if (ch >= '1' && ch <= '9')
|
||||
|
|
|
@ -22,6 +22,14 @@ static const char rcsid[] =
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
|
|
|
@ -22,6 +22,14 @@ static const char rcsid[] =
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/hash.h"
|
||||
|
||||
#include "qfcc.h"
|
||||
|
|
|
@ -22,6 +22,13 @@ static const char rcsid[] =
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/hash.h>
|
||||
|
||||
|
|
|
@ -31,6 +31,18 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
#include "qfcc.h"
|
||||
|
|
|
@ -31,6 +31,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
|
|
|
@ -51,7 +51,13 @@ static const char rcsid[] =
|
|||
#ifdef HAVE_PROCESS_H
|
||||
# include <process.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <getopt.h>
|
||||
|
@ -62,6 +68,7 @@ static const char rcsid[] =
|
|||
#include <QF/qendian.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "qfcc.h"
|
||||
#include "class.h"
|
||||
#include "type.h"
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/dstring.h>
|
||||
#include <QF/hash.h>
|
||||
#include <QF/pr_obj.h>
|
||||
|
|
|
@ -30,6 +30,17 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/dstring.h"
|
||||
|
|
Loading…
Reference in a new issue