[iortcw] 270/497: All: Various LCC fixes
Simon McVittie
smcv at debian.org
Fri Sep 8 10:37:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 5dec733da58f346e715fd9dad6ec0a22d23f8175
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Thu Jan 8 23:13:38 2015 +0000
All: Various LCC fixes
---
MP/code/tools/lcc/cpp/cpp.c | 4 ++--
MP/code/tools/lcc/cpp/cpp.h | 2 +-
MP/code/tools/lcc/cpp/include.c | 6 +++---
MP/code/tools/lcc/cpp/macro.c | 10 +++++-----
MP/code/tools/lcc/cpp/unix.c | 8 +++++++-
MP/code/tools/lcc/etc/bytecode.c | 4 ++++
MP/code/tools/lcc/etc/lcc.c | 5 +++++
SP/code/tools/lcc/cpp/cpp.c | 4 ++--
SP/code/tools/lcc/cpp/cpp.h | 2 +-
SP/code/tools/lcc/cpp/include.c | 6 +++---
SP/code/tools/lcc/cpp/macro.c | 10 +++++-----
SP/code/tools/lcc/cpp/unix.c | 8 +++++++-
SP/code/tools/lcc/etc/bytecode.c | 4 ++++
SP/code/tools/lcc/etc/lcc.c | 5 +++++
14 files changed, 54 insertions(+), 24 deletions(-)
diff --git a/MP/code/tools/lcc/cpp/cpp.c b/MP/code/tools/lcc/cpp/cpp.c
index b999d21..5c0cfd7 100644
--- a/MP/code/tools/lcc/cpp/cpp.c
+++ b/MP/code/tools/lcc/cpp/cpp.c
@@ -9,7 +9,7 @@ char rcsid[] = "cpp.c - faked rcsid";
#define OUTS 16384
char outbuf[OUTS];
-char *outp = outbuf;
+char *outbufp = outbuf;
Source *cursource;
int nerrs;
struct token nltoken = { NL, 0, 0, 0, 1, (uchar*)"\n" };
@@ -51,7 +51,7 @@ process(Tokenrow *trp)
for (;;) {
if (trp->tp >= trp->lp) {
trp->tp = trp->lp = trp->bp;
- outp = outbuf;
+ outbufp = outbuf;
anymacros |= gettokens(trp, 1);
trp->tp = trp->bp;
}
diff --git a/MP/code/tools/lcc/cpp/cpp.h b/MP/code/tools/lcc/cpp/cpp.h
index 87871d9..ddd7502 100644
--- a/MP/code/tools/lcc/cpp/cpp.h
+++ b/MP/code/tools/lcc/cpp/cpp.h
@@ -143,7 +143,7 @@ void setobjname(char *);
char *basepath( char *fname );
-extern char *outp;
+extern char *outbufp;
extern Token nltoken;
extern Source *cursource;
extern char *curtime;
diff --git a/MP/code/tools/lcc/cpp/include.c b/MP/code/tools/lcc/cpp/include.c
index 54c0b77..5ecd8b3 100644
--- a/MP/code/tools/lcc/cpp/include.c
+++ b/MP/code/tools/lcc/cpp/include.c
@@ -120,7 +120,7 @@ genline(void)
static Tokenrow tr = { &ta, &ta, &ta+1, 1 };
uchar *p;
- ta.t = p = (uchar*)outp;
+ ta.t = p = (uchar*)outbufp;
strcpy((char*)p, "#line ");
p += sizeof("#line ")-1;
p = (uchar*)outnum((char*)p, cursource->line);
@@ -133,8 +133,8 @@ genline(void)
strcpy((char*)p, cursource->filename);
p += strlen((char*)p);
*p++ = '"'; *p++ = '\n';
- ta.len = (char*)p-outp;
- outp = (char*)p;
+ ta.len = (char*)p-outbufp;
+ outbufp = (char*)p;
tr.tp = tr.bp;
puttokens(&tr);
}
diff --git a/MP/code/tools/lcc/cpp/macro.c b/MP/code/tools/lcc/cpp/macro.c
index 7110257..2972083 100644
--- a/MP/code/tools/lcc/cpp/macro.c
+++ b/MP/code/tools/lcc/cpp/macro.c
@@ -470,10 +470,10 @@ builtin(Tokenrow *trp, int biname)
/* most are strings */
tp->type = STRING;
if (tp->wslen) {
- *outp++ = ' ';
+ *outbufp++ = ' ';
tp->wslen = 1;
}
- op = outp;
+ op = outbufp;
*op++ = '"';
switch (biname) {
@@ -508,7 +508,7 @@ builtin(Tokenrow *trp, int biname)
}
if (tp->type==STRING)
*op++ = '"';
- tp->t = (uchar*)outp;
- tp->len = op - outp;
- outp = op;
+ tp->t = (uchar*)outbufp;
+ tp->len = op - outbufp;
+ outbufp = op;
}
diff --git a/MP/code/tools/lcc/cpp/unix.c b/MP/code/tools/lcc/cpp/unix.c
index bd87944..3e70b56 100644
--- a/MP/code/tools/lcc/cpp/unix.c
+++ b/MP/code/tools/lcc/cpp/unix.c
@@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include "cpp.h"
extern int lcc_getopt(int, char *const *, const char *);
@@ -66,7 +67,12 @@ setup(int argc, char **argv)
error(FATAL, "Can't open input file %s", fp);
}
if (optind+1<argc) {
- int fdo = creat(argv[optind+1], 0666);
+ int fdo;
+#ifdef WIN32
+ fdo = creat(argv[optind+1], _S_IREAD | _S_IWRITE);
+#else
+ fdo = creat(argv[optind+1], 0666);
+#endif
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
dup2(fdo, 1);
diff --git a/MP/code/tools/lcc/etc/bytecode.c b/MP/code/tools/lcc/etc/bytecode.c
index b042148..053b754 100644
--- a/MP/code/tools/lcc/etc/bytecode.c
+++ b/MP/code/tools/lcc/etc/bytecode.c
@@ -57,6 +57,10 @@ int option(char *arg) {
cpp[0] = concat(&arg[8], "/q3cpp" BINEXT);
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/q3rcc" BINEXT);
+ } else if (strncmp(arg, "-lcppdir=", 9) == 0) {
+ cpp[0] = concat(&arg[9], "/q3cpp" BINEXT);
+ } else if (strncmp(arg, "-lrccdir=", 9) == 0) {
+ com[0] = concat(&arg[9], "/q3rcc" BINEXT);
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
fprintf( stderr, "no profiling supported, %s ignored.\n", arg);
} else if (strcmp(arg, "-b") == 0)
diff --git a/MP/code/tools/lcc/etc/lcc.c b/MP/code/tools/lcc/etc/lcc.c
index 8595f2b..aa3e789 100644
--- a/MP/code/tools/lcc/etc/lcc.c
+++ b/MP/code/tools/lcc/etc/lcc.c
@@ -11,7 +11,12 @@ static char rcsid[] = "Id: dummy rcsid";
#include <assert.h>
#include <ctype.h>
#include <signal.h>
+#ifdef WIN32
+#include <process.h> /* getpid() */
+#include <io.h> /* access() */
+#else
#include <unistd.h>
+#endif
#ifndef TEMPDIR
#define TEMPDIR "/tmp"
diff --git a/SP/code/tools/lcc/cpp/cpp.c b/SP/code/tools/lcc/cpp/cpp.c
index b999d21..5c0cfd7 100644
--- a/SP/code/tools/lcc/cpp/cpp.c
+++ b/SP/code/tools/lcc/cpp/cpp.c
@@ -9,7 +9,7 @@ char rcsid[] = "cpp.c - faked rcsid";
#define OUTS 16384
char outbuf[OUTS];
-char *outp = outbuf;
+char *outbufp = outbuf;
Source *cursource;
int nerrs;
struct token nltoken = { NL, 0, 0, 0, 1, (uchar*)"\n" };
@@ -51,7 +51,7 @@ process(Tokenrow *trp)
for (;;) {
if (trp->tp >= trp->lp) {
trp->tp = trp->lp = trp->bp;
- outp = outbuf;
+ outbufp = outbuf;
anymacros |= gettokens(trp, 1);
trp->tp = trp->bp;
}
diff --git a/SP/code/tools/lcc/cpp/cpp.h b/SP/code/tools/lcc/cpp/cpp.h
index 87871d9..ddd7502 100644
--- a/SP/code/tools/lcc/cpp/cpp.h
+++ b/SP/code/tools/lcc/cpp/cpp.h
@@ -143,7 +143,7 @@ void setobjname(char *);
char *basepath( char *fname );
-extern char *outp;
+extern char *outbufp;
extern Token nltoken;
extern Source *cursource;
extern char *curtime;
diff --git a/SP/code/tools/lcc/cpp/include.c b/SP/code/tools/lcc/cpp/include.c
index 54c0b77..5ecd8b3 100644
--- a/SP/code/tools/lcc/cpp/include.c
+++ b/SP/code/tools/lcc/cpp/include.c
@@ -120,7 +120,7 @@ genline(void)
static Tokenrow tr = { &ta, &ta, &ta+1, 1 };
uchar *p;
- ta.t = p = (uchar*)outp;
+ ta.t = p = (uchar*)outbufp;
strcpy((char*)p, "#line ");
p += sizeof("#line ")-1;
p = (uchar*)outnum((char*)p, cursource->line);
@@ -133,8 +133,8 @@ genline(void)
strcpy((char*)p, cursource->filename);
p += strlen((char*)p);
*p++ = '"'; *p++ = '\n';
- ta.len = (char*)p-outp;
- outp = (char*)p;
+ ta.len = (char*)p-outbufp;
+ outbufp = (char*)p;
tr.tp = tr.bp;
puttokens(&tr);
}
diff --git a/SP/code/tools/lcc/cpp/macro.c b/SP/code/tools/lcc/cpp/macro.c
index 7110257..2972083 100644
--- a/SP/code/tools/lcc/cpp/macro.c
+++ b/SP/code/tools/lcc/cpp/macro.c
@@ -470,10 +470,10 @@ builtin(Tokenrow *trp, int biname)
/* most are strings */
tp->type = STRING;
if (tp->wslen) {
- *outp++ = ' ';
+ *outbufp++ = ' ';
tp->wslen = 1;
}
- op = outp;
+ op = outbufp;
*op++ = '"';
switch (biname) {
@@ -508,7 +508,7 @@ builtin(Tokenrow *trp, int biname)
}
if (tp->type==STRING)
*op++ = '"';
- tp->t = (uchar*)outp;
- tp->len = op - outp;
- outp = op;
+ tp->t = (uchar*)outbufp;
+ tp->len = op - outbufp;
+ outbufp = op;
}
diff --git a/SP/code/tools/lcc/cpp/unix.c b/SP/code/tools/lcc/cpp/unix.c
index bd87944..3e70b56 100644
--- a/SP/code/tools/lcc/cpp/unix.c
+++ b/SP/code/tools/lcc/cpp/unix.c
@@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include "cpp.h"
extern int lcc_getopt(int, char *const *, const char *);
@@ -66,7 +67,12 @@ setup(int argc, char **argv)
error(FATAL, "Can't open input file %s", fp);
}
if (optind+1<argc) {
- int fdo = creat(argv[optind+1], 0666);
+ int fdo;
+#ifdef WIN32
+ fdo = creat(argv[optind+1], _S_IREAD | _S_IWRITE);
+#else
+ fdo = creat(argv[optind+1], 0666);
+#endif
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
dup2(fdo, 1);
diff --git a/SP/code/tools/lcc/etc/bytecode.c b/SP/code/tools/lcc/etc/bytecode.c
index b042148..053b754 100644
--- a/SP/code/tools/lcc/etc/bytecode.c
+++ b/SP/code/tools/lcc/etc/bytecode.c
@@ -57,6 +57,10 @@ int option(char *arg) {
cpp[0] = concat(&arg[8], "/q3cpp" BINEXT);
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/q3rcc" BINEXT);
+ } else if (strncmp(arg, "-lcppdir=", 9) == 0) {
+ cpp[0] = concat(&arg[9], "/q3cpp" BINEXT);
+ } else if (strncmp(arg, "-lrccdir=", 9) == 0) {
+ com[0] = concat(&arg[9], "/q3rcc" BINEXT);
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
fprintf( stderr, "no profiling supported, %s ignored.\n", arg);
} else if (strcmp(arg, "-b") == 0)
diff --git a/SP/code/tools/lcc/etc/lcc.c b/SP/code/tools/lcc/etc/lcc.c
index 8595f2b..aa3e789 100644
--- a/SP/code/tools/lcc/etc/lcc.c
+++ b/SP/code/tools/lcc/etc/lcc.c
@@ -11,7 +11,12 @@ static char rcsid[] = "Id: dummy rcsid";
#include <assert.h>
#include <ctype.h>
#include <signal.h>
+#ifdef WIN32
+#include <process.h> /* getpid() */
+#include <io.h> /* access() */
+#else
#include <unistd.h>
+#endif
#ifndef TEMPDIR
#define TEMPDIR "/tmp"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list