Use the QVM build toolchain from ioq3

This commit is contained in:
Izuru Yakumo
2025-07-15 15:09:05 -03:00
parent 733fac10f2
commit e8a6db7830
32 changed files with 1982 additions and 1955 deletions

View File

@@ -70,12 +70,32 @@ static char buf[BUFSIZ], *bp = buf;
static int ppercent = 0;
static int code = 0;
static void crlf_to_lf(char *buf, int bufmax) {
int i, count;
count = 0;
for (i = 0; i < bufmax; i++) {
if (buf[i] == '\r' && buf[i+1] == '\n') {
// skip '\r'
continue;
}
buf[count++] = buf[i];
if (buf[i] == '\0') {
break;
}
}
}
static int get(void) {
if (*bp == 0) {
bp = buf;
*bp = 0;
if (fgets(buf, sizeof buf, infp) == NULL)
return EOF;
crlf_to_lf(buf, sizeof buf);
yylineno++;
while (buf[0] == '%' && buf[1] == '{' && buf[2] == '\n') {
for (;;) {
@@ -83,6 +103,7 @@ static int get(void) {
yywarn("unterminated %{...%}\n");
return EOF;
}
crlf_to_lf(buf, sizeof buf);
yylineno++;
if (strcmp(buf, "%}\n") == 0)
break;
@@ -90,6 +111,7 @@ static int get(void) {
}
if (fgets(buf, sizeof buf, infp) == NULL)
return EOF;
crlf_to_lf(buf, sizeof buf);
yylineno++;
}
}
@@ -199,4 +221,5 @@ void yywarn(char *fmt, ...) {
fprintf(stderr, "line %d: ", yylineno);
fprintf(stderr, "warning: ");
vfprintf(stderr, fmt, ap);
va_end(ap);
}