add --qccx-escapes to resolve the conflicts in escape sequences and document the escape sequences supported by qfcc.

This commit is contained in:
Bill Currie 2009-12-25 07:59:25 +00:00 committed by Jeff Teunissen
parent fb5b0dc5c3
commit c3f47efb07
4 changed files with 116 additions and 13 deletions

View file

@ -113,6 +113,10 @@ In \fBprogs.src\fP mode, this overrides the output file in \*[progs.src].
File to use instead of \*[progs.src].
No effect in separate compilation mode.
.TP
.B \-P, \-\-qccx\-escapes FILE
Use QCCX escape sequences instead of standard C/QuakeForge sequences in
strings. See \fBESCAPE SEQUENCES\fP for details.
.TP
.B \-p, \-\-strip\-path NUM
Strip NUM leading path elements from file names.
eg. -p 3 will strip the
@ -420,6 +424,91 @@ overridden using \fB--traditional\fP.
When using \*[cpp], each source file is passed through the preprocessor
individually.
Each file is truly independent of any other file on the command line.
.SH "ESCAPE SEQUENCES"
\*[qfcc] supports a variety of string escape sequences. This includes those of
\fBqcc\fP (which are a subset of those in standard C), standard C and
\fBqccx\fP. There are some conflicts between the escape sequences, but
\fB\-\-qccx\-escapes\fP selects which set to use.
.TP
.B \(rs\(rs
Backslash.
.TP
.B \(rsn
Line feed.
.TP
.B \(rs"
Double quote.
.TP
.B \(rs\'
Single quote.
.TP
.B \(rs0-7
Octal character code, up to three digits.
.TP
.B \(rsx0-9A-Fa-f
Hexadecimal character code, any number of digits, but only the least significant byte will be used.
.TP
.B \(rsa
Bell character (not in quake engines). Equivalent to \(rsx07.
.TP
.B \(rsb
Backspace character (not in quake engines). Equivalent to \(rsx08. This
conflicts with \fBqccx\fP. In \fBqccx\fP, this toggles bronze characters. Use
\fB\-\-qccx\-escapes\fP to select \fBqccx\fP behaviour.
.TP
.B \(rse
Escape character (not in quake engines). Equivalent to \(rsx1b (dull 9).
.TP
.B \(rsf
Formfeed character (not in quake engines). Equivalent to \(rsx0c.
.TP
.B \(rsr
Carriage return. Equivalent to \(rsx0d.
.TP
.B \(rst
Tab character. Equivalent to \(rsx09.
.TP
.B \(rsv
Vertical tab. Equivalent to \(rsx0b.
.TP
.B \(rs^
Make the next character "bold" (add 0x80).
.TP
.B \(rs[
Gold [ character. Equivalent to \(rsx90.
.TP
.B \(rs]
Gold ] character. Equivalent to \(rsx91.
.TP
.B \(rs.
Center dot. Equivalent to \(rsx1c.
.TP
.B \(rs<
Turn on "bold" characters (add 0x80). This conflicts with \fBqccx\fP. In
\fBqccx\fP, this produces the brown left end. Equivalent to \(rsx1d. Use
\fB\-\-qccx\-escapes\fP to select \fBqccx\fP behaviour.
.TP
.B \(rs\-
Brown center bit. Equivalent to \(rsx1e.
.TP
.B \(rs>
Turn off "bold" characters (add 0x80). This conflicts with \fBqccx\fP. In
\fBqccx\fP, this produces the brown right end. Equivalent to \(rsx1f. Use
\fB\-\-qccx\-escapes\fP to select \fBqccx\fP behaviour.
.TP
.B \(rs(
Left slider end. Equivalent to \(rsx80.
.TP
.B \(rs=
Slider center. Equivalent to \(rsx81.
.TP
.B \(rs)
Right slider end. Equivalent to \(rsx82.
.TP
.B \(rs{0-255}
Decimal character code.
.P
\fB\-\-qccx\-escapes\fP has no effect on sequences that do not conflict.
.SH TRADITIONAL VS ADVANCED
Compared to \fBqcc\fP, \*[qfcc] has many advanced features and is much stricter
about type checking.

View file

@ -77,6 +77,7 @@ typedef struct {
qboolean save_temps; // save temporary files
qboolean files_dat; // generate files.dat
qboolean progdefs_h; // generate progdefs.h
qboolean qccx_escapes; // use qccx escapes instead of standard C
qboolean traditional; // behave more like qcc
qboolean advanced; // behold the power of Ruamoko
qboolean compile; // serparate compilation mode

View file

@ -65,6 +65,7 @@ enum {
OPT_CPP,
OPT_INCLUDE,
OPT_PROGDEFS,
OPT_QCCX_ESCAPES,
OPT_TRADITIONAL,
};
@ -80,6 +81,7 @@ static struct option const long_options[] = {
{"output-file", required_argument, 0, 'o'},
{"progdefs", no_argument, 0, OPT_PROGDEFS},
{"progs-src", required_argument, 0, 'P'},
{"qccx-escapes", no_argument, 0, OPT_QCCX_ESCAPES},
{"quiet", no_argument, 0, 'q'},
{"relocatable", no_argument, 0, 'r'},
{"save-temps", no_argument, 0, 'S'},
@ -151,6 +153,8 @@ usage (int status)
" -P, --progs-src FILE File to use instead of progs.src\n"
" -p, --strip-path NUM Strip NUM leading path elements from file\n"
" names\n"
" --qccx-escapes Use QCCX escape sequences instead of standard\n"
" C/QuakeForge sequences.\n"
" -q, --quiet Inhibit usual output\n"
" -r, --relocatable Incremental linking\n"
" -S, --save-temps Do not delete temporary files\n"
@ -324,6 +328,9 @@ DecodeArgs (int argc, char **argv)
case OPT_PROGDEFS:
options.progdefs_h = true;
break;
case OPT_QCCX_ESCAPES:
options.qccx_escapes = true;
break;
case 'q': // quiet
options.verbosity -= 1;
break;

View file

@ -542,8 +542,10 @@ make_string (char *token, char **end)
c = '\a';
break;
case 'b':
//XXX mask ^= 0x80;
c = '\b';
if (options.qccx_escapes)
mask ^= 0x80;
else
c = '\b';
break;
case 'e':
c = '\033';
@ -566,33 +568,37 @@ make_string (char *token, char **end)
boldnext = 1;
continue;
case '[':
c = 0x90;
c = 0x90; // gold [
break;
case ']':
c = 0x91;
c = 0x91; // gold ]
break;
case '.':
c = 28;
c = 28; // center dot
break;
case '<':
//XXX c = 29;
mask = 0x80;
if (options.qccx_escapes)
c = 29; // brown left end
else
mask = 0x80;
continue;
case '-':
c = 30;
c = 30; // brown center bit
break;
case '>':
//XXX c = 31;
mask = 0x00;
if (options.qccx_escapes)
c = 31; // broun right end
else
mask = 0x00;
continue;
case '(':
c = 128;
c = 128; // left slider end
break;
case '=':
c = 129;
c = 129; // slider center
break;
case ')':
c = 130;
c = 130; // right slider end
break;
case '{':
c = 0;