mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
fix the verbosity levels to what they were
--no-cpp is now cpp or no-cpp in code add cpp to code_options_t
This commit is contained in:
parent
b8eb324ded
commit
d8e6bf9cb6
3 changed files with 20 additions and 43 deletions
|
@ -555,6 +555,7 @@ int CopyString (const char *str);
|
||||||
int ReuseString (const char *str);
|
int ReuseString (const char *str);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
qboolean cpp; // use the C pre-processor
|
||||||
qboolean cow; // Turn constants into variables if written to
|
qboolean cow; // Turn constants into variables if written to
|
||||||
qboolean debug; // Generate debug info for the engine
|
qboolean debug; // Generate debug info for the engine
|
||||||
int progsversion; // Progs version to generate code for
|
int progsversion; // Progs version to generate code for
|
||||||
|
|
|
@ -49,10 +49,6 @@
|
||||||
|
|
||||||
#define PATHSEPERATOR '/'
|
#define PATHSEPERATOR '/'
|
||||||
|
|
||||||
// set these before calling CheckParm
|
|
||||||
int myargc;
|
|
||||||
char **myargv;
|
|
||||||
|
|
||||||
char com_token[1024];
|
char com_token[1024];
|
||||||
qboolean com_eof;
|
qboolean com_eof;
|
||||||
|
|
||||||
|
@ -156,27 +152,6 @@ skipwhite:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
CheckParm
|
|
||||||
|
|
||||||
Checks for the given parameter in the program's command line arguments
|
|
||||||
Returns the argument number (1 to argc-1) or 0 if not present
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
CheckParm (char *check)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 1; i < myargc; i++) {
|
|
||||||
if (!strcasecmp (check, myargv[i]))
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FileLength
|
FileLength
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,6 +55,8 @@ options_t options;
|
||||||
|
|
||||||
char *sourcedir;
|
char *sourcedir;
|
||||||
|
|
||||||
|
const char *this_program;
|
||||||
|
|
||||||
static struct option const long_options[] =
|
static struct option const long_options[] =
|
||||||
{
|
{
|
||||||
{"source", required_argument, 0, 's'},
|
{"source", required_argument, 0, 's'},
|
||||||
|
@ -297,7 +299,7 @@ WriteData (int crc)
|
||||||
// PrintGlobals ();
|
// PrintGlobals ();
|
||||||
strofs = (strofs + 3) & ~3;
|
strofs = (strofs + 3) & ~3;
|
||||||
|
|
||||||
if (options.verbosity > 1) {
|
if (options.verbosity) {
|
||||||
printf ("%6i strofs\n", strofs);
|
printf ("%6i strofs\n", strofs);
|
||||||
printf ("%6i statements\n", numstatements);
|
printf ("%6i statements\n", numstatements);
|
||||||
printf ("%6i functions\n", numfunctions);
|
printf ("%6i functions\n", numfunctions);
|
||||||
|
@ -362,7 +364,7 @@ WriteData (int crc)
|
||||||
|
|
||||||
SafeWrite (h, pr_globals, numpr_globals * 4);
|
SafeWrite (h, pr_globals, numpr_globals * 4);
|
||||||
|
|
||||||
if (options.verbosity > 1)
|
if (options.verbosity)
|
||||||
printf ("%6i TOTAL SIZE\n", (int) ftell (h));
|
printf ("%6i TOTAL SIZE\n", (int) ftell (h));
|
||||||
|
|
||||||
progs.entityfields = pr.size_fields;
|
progs.entityfields = pr.size_fields;
|
||||||
|
@ -782,7 +784,7 @@ PR_WriteProgdefs (char *filename)
|
||||||
unsigned short crc;
|
unsigned short crc;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (options.verbosity)
|
if (options.verbosity > 1)
|
||||||
printf ("writing %s\n", filename);
|
printf ("writing %s\n", filename);
|
||||||
f = fopen (filename, "w");
|
f = fopen (filename, "w");
|
||||||
|
|
||||||
|
@ -923,8 +925,8 @@ PR_PrintFunction (def_t *def)
|
||||||
static void
|
static void
|
||||||
usage (int status)
|
usage (int status)
|
||||||
{
|
{
|
||||||
printf ("%s - the QuakeForge Code Compiler\n", myargv[0]);
|
printf ("%s - the QuakeForge Code Compiler\n", this_program);
|
||||||
printf ("Usage: %s [options]\n", myargv[0]);
|
printf ("Usage: %s [options]\n", this_program);
|
||||||
printf (
|
printf (
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -s, --source DIR look for progs.src in DIR instead of \".\"\n"
|
" -s, --source DIR look for progs.src in DIR instead of \".\"\n"
|
||||||
|
@ -944,6 +946,7 @@ DecodeArgs (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
options.code.cpp = 1;
|
||||||
options.code.progsversion = PROG_VERSION;
|
options.code.progsversion = PROG_VERSION;
|
||||||
options.warnings.uninited_variable = 1;
|
options.warnings.uninited_variable = 1;
|
||||||
options.verbosity = 2;
|
options.verbosity = 2;
|
||||||
|
@ -985,6 +988,10 @@ DecodeArgs (int argc, char **argv)
|
||||||
options.code.cow = true;
|
options.code.cow = true;
|
||||||
} else if (!(strcasecmp (temp, "no-cow"))) {
|
} else if (!(strcasecmp (temp, "no-cow"))) {
|
||||||
options.code.cow = false;
|
options.code.cow = false;
|
||||||
|
} else if (!(strcasecmp (temp, "cpp"))) {
|
||||||
|
options.code.cpp = true;
|
||||||
|
} else if (!(strcasecmp (temp, "no-cpp"))) {
|
||||||
|
options.code.cpp = false;
|
||||||
} else if (!(strcasecmp (temp, "debug"))) {
|
} else if (!(strcasecmp (temp, "debug"))) {
|
||||||
options.code.debug = true;
|
options.code.debug = true;
|
||||||
} else if (!(strcasecmp (temp, "no-debug"))) {
|
} else if (!(strcasecmp (temp, "no-debug"))) {
|
||||||
|
@ -1061,19 +1068,13 @@ main (int argc, char **argv)
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
long int crc;
|
long int crc;
|
||||||
double start, stop;
|
double start, stop;
|
||||||
qboolean no_cpp = false;
|
|
||||||
|
|
||||||
start = Sys_DoubleTime ();
|
start = Sys_DoubleTime ();
|
||||||
|
|
||||||
myargc = argc;
|
this_program = argv[0];
|
||||||
myargv = argv;
|
|
||||||
|
|
||||||
DecodeArgs (argc, argv);
|
DecodeArgs (argc, argv);
|
||||||
|
|
||||||
if (CheckParm ("--no-cpp")) {
|
|
||||||
no_cpp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp (sourcedir, ".")) {
|
if (strcmp (sourcedir, ".")) {
|
||||||
printf ("Source directory: %s\n", sourcedir);
|
printf ("Source directory: %s\n", sourcedir);
|
||||||
}
|
}
|
||||||
|
@ -1089,7 +1090,7 @@ main (int argc, char **argv)
|
||||||
Error ("No destination filename. qfcc --help for info.\n");
|
Error ("No destination filename. qfcc --help for info.\n");
|
||||||
|
|
||||||
strcpy (destfile, com_token);
|
strcpy (destfile, com_token);
|
||||||
if (options.verbosity) {
|
if (options.verbosity > 1) {
|
||||||
printf ("outputfile: %s\n", destfile);
|
printf ("outputfile: %s\n", destfile);
|
||||||
}
|
}
|
||||||
if (options.code.debug) {
|
if (options.code.debug) {
|
||||||
|
@ -1106,7 +1107,7 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcpy (s, ".sym");
|
strcpy (s, ".sym");
|
||||||
if (options.verbosity)
|
if (options.verbosity > 1)
|
||||||
printf ("debug file: %s\n", debugfile);
|
printf ("debug file: %s\n", debugfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1131,11 +1132,11 @@ main (int argc, char **argv)
|
||||||
//yydebug = 1;
|
//yydebug = 1;
|
||||||
|
|
||||||
sprintf (filename, "%s%c%s", sourcedir, PATH_SEPARATOR, com_token);
|
sprintf (filename, "%s%c%s", sourcedir, PATH_SEPARATOR, com_token);
|
||||||
if (options.verbosity)
|
if (options.verbosity > 1)
|
||||||
printf ("compiling %s\n", filename);
|
printf ("compiling %s\n", filename);
|
||||||
|
|
||||||
#ifdef USE_CPP
|
#ifdef USE_CPP
|
||||||
if (!no_cpp) {
|
if (options.code.cpp) {
|
||||||
temp1 = getenv ("TMPDIR");
|
temp1 = getenv ("TMPDIR");
|
||||||
if ((!temp1) || (!temp1[0])) {
|
if ((!temp1) || (!temp1[0])) {
|
||||||
temp1 = getenv ("TEMP");
|
temp1 = getenv ("TEMP");
|
||||||
|
@ -1197,7 +1198,7 @@ main (int argc, char **argv)
|
||||||
error = yyparse () || pr_error_count;
|
error = yyparse () || pr_error_count;
|
||||||
fclose (yyin);
|
fclose (yyin);
|
||||||
#ifdef USE_CPP
|
#ifdef USE_CPP
|
||||||
if (!no_cpp) {
|
if (options.code.cpp) {
|
||||||
if (unlink (tempname)) {
|
if (unlink (tempname)) {
|
||||||
perror ("unlink");
|
perror ("unlink");
|
||||||
exit (1);
|
exit (1);
|
||||||
|
@ -1221,7 +1222,7 @@ main (int argc, char **argv)
|
||||||
WriteFiles ();
|
WriteFiles ();
|
||||||
|
|
||||||
stop = Sys_DoubleTime ();
|
stop = Sys_DoubleTime ();
|
||||||
if (options.verbosity > 1)
|
if (options.verbosity)
|
||||||
printf ("Compilation time: %0.3g seconds.\n", (stop - start));
|
printf ("Compilation time: %0.3g seconds.\n", (stop - start));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue