Allow control of progdefs.h CRC writing.

CRC writing defaults to off for non-v6 progs, but on for v6 progs. The
--progdefs option forces CRC writing.
This commit is contained in:
Bill Currie 2012-05-03 00:22:24 +09:00
parent 44fcd76475
commit e267e0a664
4 changed files with 24 additions and 4 deletions

View file

@ -113,7 +113,7 @@ Specify output file name.
In \fBprogs.src\fP mode, this overrides the output file in \*[progs.src].
.TP
.B \-\-progdefs
Generate \fIprogdefs.h\fP.
Generate \fIprogdefs.h\fP. Forces \fB\-\-code crc\fP.
.TP
.B \-P, \-\-progs\-src FILE
File to use instead of \*[progs.src].
@ -192,6 +192,11 @@ that assigns values to initialized globals in this manner.
Preprocess all input files with \*[cpp].
This includes the \*[progs.src] file when used.
.TP
.B crc
Write the CRC of \fBprogdefs.h\fP to \*(lqprogs.dat\*(rq. Default for v6 progs,
otherwise defaults to off. However, \fB\-\-progdefs\fP has the effect of
forcing this option.
.TP
.B debug
Generate debug code for QuakeForge engines.
The QuakeForge engine has the ability to load line number and other debugging

View file

@ -35,6 +35,7 @@
typedef struct {
qboolean cow; // Turn constants into variables if written to
qboolean crc; // Write progsdef.h crc to progs.dat
qboolean debug; // Generate debug info for the engine
qboolean short_circuit; // short circuit logic for && and ||
qboolean fast_float; // use floats directly in ifs

View file

@ -184,6 +184,7 @@ code_usage (void)
printf (
" [no-]cow Allow assignment to initialized globals.\n"
" [no-]cpp Preprocess all input files with cpp.\n"
" [no-]crc Write progdefs.h crc to progs.dat.\n"
" [no-]debug Generate debug information.\n"
" [no-]fast-float Use float values directly in \"if\" statements.\n"
" help Display his text.\n"
@ -274,6 +275,7 @@ DecodeArgs (int argc, char **argv)
options.code.short_circuit = -1;
options.code.local_merging = -1;
options.code.vector_components = -1;
options.code.crc = -1;
options.code.fast_float = true;
options.warnings.uninited_variable = true;
options.warnings.unused = true;
@ -381,6 +383,8 @@ DecodeArgs (int argc, char **argv)
options.code.cow = flag;
} else if (!(strcasecmp (temp, "cpp"))) {
cpp_name = flag ? CPP_NAME : 0;
} else if (!(strcasecmp (temp, "crc"))) {
options.code.crc = flag;
} else if (!(strcasecmp (temp, "debug"))) {
options.code.debug = flag;
} else if (!(strcasecmp (temp, "fast-float"))) {
@ -580,8 +584,14 @@ DecodeArgs (int argc, char **argv)
if (options.code.vector_components == (qboolean) -1)
options.code.vector_components = false;
}
if (options.code.progsversion == PROG_ID_VERSION)
if (options.code.progsversion == PROG_ID_VERSION) {
add_cpp_def ("-D__VERSION6__=1");
if (options.code.crc == (qboolean) -1)
options.code.crc = true;
} else {
if (options.code.crc == (qboolean) -1)
options.code.crc = false;
}
// add the default paths
if (!options.no_default_paths) {

View file

@ -378,8 +378,12 @@ finish_link (void)
//finish_compilation ();
// write progdefs.h
if (options.progdefs_h)
progs->crc = WriteProgdefs (progs, "progdefs.h");
if (options.code.crc || options.progdefs_h) {
const char *progdefs_h = "progdefs.h";
if (!options.progdefs_h)
progdefs_h = 0;
progs->crc = WriteProgdefs (progs, progdefs_h);
}
WriteProgs (progs, size);
if (options.code.debug) {