parent
f19d97a5a8
commit
dc21a504a1
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: read.c,v 1.74 2021/12/19 10:29:06 rillig Exp $ */
|
/* $NetBSD: read.c,v 1.75 2021/12/19 10:42:36 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: read.c,v 1.74 2021/12/19 10:29:06 rillig Exp $");
|
__RCSID("$NetBSD: read.c,v 1.75 2021/12/19 10:42:36 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -342,13 +342,13 @@ again:
|
||||||
case 's':
|
case 's':
|
||||||
ai = xalloc(sizeof(*ai));
|
ai = xalloc(sizeof(*ai));
|
||||||
ai->a_num = parse_int(&cp);
|
ai->a_num = parse_int(&cp);
|
||||||
if (c == 'z') {
|
if (c == 'z')
|
||||||
ai->a_pcon = ai->a_zero = true;
|
ai->a_pcon = ai->a_zero = true;
|
||||||
} else if (c == 'p') {
|
else if (c == 'p')
|
||||||
ai->a_pcon = true;
|
ai->a_pcon = true;
|
||||||
} else if (c == 'n') {
|
else if (c == 'n')
|
||||||
ai->a_ncon = true;
|
ai->a_ncon = true;
|
||||||
} else {
|
else {
|
||||||
ai->a_fmt = true;
|
ai->a_fmt = true;
|
||||||
ai->a_fstrg = inpqstrg(cp, &cp);
|
ai->a_fstrg = inpqstrg(cp, &cp);
|
||||||
}
|
}
|
||||||
|
@ -522,10 +522,9 @@ decldef(pos_t pos, const char *cp)
|
||||||
symp->s_type == sym.s_type &&
|
symp->s_type == sym.s_type &&
|
||||||
((symp->s_def == DECL && sym.s_def == DECL) ||
|
((symp->s_def == DECL && sym.s_def == DECL) ||
|
||||||
(!sflag && symp->s_def == TDEF && sym.s_def == TDEF)) &&
|
(!sflag && symp->s_def == TDEF && sym.s_def == TDEF)) &&
|
||||||
!symp->s_static && !sym.s_static) {
|
!symp->s_static && !sym.s_static)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (symp == NULL) {
|
if (symp == NULL) {
|
||||||
if (sym.s_check_only_first_args ||
|
if (sym.s_check_only_first_args ||
|
||||||
|
@ -697,11 +696,10 @@ inptype(const char *cp, const char **epp)
|
||||||
if (i == narg - 1 && *cp == 'E') {
|
if (i == narg - 1 && *cp == 'E') {
|
||||||
tp->t_vararg = true;
|
tp->t_vararg = true;
|
||||||
cp++;
|
cp++;
|
||||||
} else {
|
} else
|
||||||
tp->t_args[i] = TP(inptype(cp, &cp));
|
tp->t_args[i] = TP(inptype(cp, &cp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
tp->t_subt = TP(inptype(cp, &cp));
|
tp->t_subt = TP(inptype(cp, &cp));
|
||||||
break;
|
break;
|
||||||
case ENUM:
|
case ENUM:
|
||||||
|
@ -780,59 +778,52 @@ gettlen(const char *cp, const char **epp)
|
||||||
t = BOOL;
|
t = BOOL;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (s == 's') {
|
if (s == 's')
|
||||||
t = SCHAR;
|
t = SCHAR;
|
||||||
} else if (s == 'u') {
|
else if (s == 'u')
|
||||||
t = UCHAR;
|
t = UCHAR;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = CHAR;
|
t = CHAR;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (s == 'u') {
|
if (s == 'u')
|
||||||
t = USHORT;
|
t = USHORT;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = SHORT;
|
t = SHORT;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
if (s == 'u') {
|
if (s == 'u')
|
||||||
t = UINT;
|
t = UINT;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = INT;
|
t = INT;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
if (s == 'u') {
|
if (s == 'u')
|
||||||
t = ULONG;
|
t = ULONG;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = LONG;
|
t = LONG;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
if (s == 'u') {
|
if (s == 'u')
|
||||||
t = UQUAD;
|
t = UQUAD;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = QUAD;
|
t = QUAD;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#ifdef INT128_SIZE
|
#ifdef INT128_SIZE
|
||||||
case 'J':
|
case 'J':
|
||||||
if (s == 'u') {
|
if (s == 'u')
|
||||||
t = UINT128;
|
t = UINT128;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = INT128;
|
t = INT128;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'D':
|
case 'D':
|
||||||
if (s == 's') {
|
if (s == 's')
|
||||||
t = FLOAT;
|
t = FLOAT;
|
||||||
} else if (s == 'l') {
|
else if (s == 'l')
|
||||||
t = LDOUBLE;
|
t = LDOUBLE;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = DOUBLE;
|
t = DOUBLE;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
if (s == '\0')
|
if (s == '\0')
|
||||||
|
@ -852,22 +843,20 @@ gettlen(const char *cp, const char **epp)
|
||||||
t = FUNC;
|
t = FUNC;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
if (s == 'e') {
|
if (s == 'e')
|
||||||
t = ENUM;
|
t = ENUM;
|
||||||
} else if (s == 's') {
|
else if (s == 's')
|
||||||
t = STRUCT;
|
t = STRUCT;
|
||||||
} else if (s == 'u') {
|
else if (s == 'u')
|
||||||
t = UNION;
|
t = UNION;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
if (s == 's') {
|
if (s == 's')
|
||||||
t = FCOMPLEX;
|
t = FCOMPLEX;
|
||||||
} else if (s == 'l') {
|
else if (s == 'l')
|
||||||
t = LCOMPLEX;
|
t = LCOMPLEX;
|
||||||
} else if (s == '\0') {
|
else if (s == '\0')
|
||||||
t = DCOMPLEX;
|
t = DCOMPLEX;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -889,13 +878,12 @@ gettlen(const char *cp, const char **epp)
|
||||||
if (ch_isdigit(c)) {
|
if (ch_isdigit(c)) {
|
||||||
narg = parse_int(&cp);
|
narg = parse_int(&cp);
|
||||||
for (i = 0; i < narg; i++) {
|
for (i = 0; i < narg; i++) {
|
||||||
if (i == narg - 1 && *cp == 'E') {
|
if (i == narg - 1 && *cp == 'E')
|
||||||
cp++;
|
cp++;
|
||||||
} else {
|
else
|
||||||
(void)gettlen(cp, &cp);
|
(void)gettlen(cp, &cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
(void)gettlen(cp, &cp);
|
(void)gettlen(cp, &cp);
|
||||||
break;
|
break;
|
||||||
case ENUM:
|
case ENUM:
|
||||||
|
|
Loading…
Reference in New Issue