ioquake3 porting

This commit is contained in:
OM 2023-05-24 19:03:05 +02:00
parent 2704b798e2
commit ca3340b158
449 changed files with 104109 additions and 77701 deletions

View file

@ -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" };
@ -19,6 +19,15 @@ int ifdepth;
int ifsatisfied[NIF];
int skipping;
time_t reproducible_time()
{
char *source_date_epoch;
time_t t;
if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
(t = (time_t)strtol(source_date_epoch, NULL, 10)) <= 0)
return time(NULL);
return t;
}
int
main(int argc, char **argv)
@ -28,7 +37,7 @@ main(int argc, char **argv)
char ebuf[BUFSIZ];
setbuf(stderr, ebuf);
t = time(NULL);
t = reproducible_time();
curtime = ctime(&t);
maketokenrow(3, &tr);
expandlex();
@ -51,7 +60,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;
}
@ -204,9 +213,14 @@ control(Tokenrow *trp)
error(WARNING, "Syntax error in #endif");
break;
case KWARNING:
trp->tp = tp+1;
error(WARNING, "#warning directive: %r", trp);
break;
case KERROR:
trp->tp = tp+1;
error(WARNING, "#error directive: %r", trp);
error(ERROR, "#error directive: %r", trp);
break;
case KLINE:
@ -245,7 +259,6 @@ control(Tokenrow *trp)
break;
}
setempty(trp);
return;
}
void *