Added LONGCARD as a local extension

This commit is contained in:
ceriel
1996-08-14 07:42:40 +00:00
parent 1592c3638c
commit efacd02ffd
9 changed files with 59 additions and 18 deletions

View File

@@ -529,12 +529,30 @@ lexwarning(W_ORDINARY, "character constant out of range");
return tk->tk_symb = INTEGER;
}
if (ch == 'D' && base == 10) {
if (options['l']) {
/* Local extension: LONGCARD exists,
so internally also longintorcard_type
exists.
*/
toktype = longcard_type;
if (ovfl == 0 && tk->TOK_INT >= 0 &&
tk->TOK_INT<=max_int[(int)long_size]) {
toktype = longintorcard_type;
}
else if (! chk_bounds(tk->TOK_INT,
full_mask[(int)long_size],
T_CARDINAL)) {
ovfl = 1;
}
}
else {
if (ovfl != 0 ||
tk->TOK_INT > max_int[(int)long_size] ||
tk->TOK_INT < 0) {
ovfl = 1;
}
toktype = longint_type;
}
}
else if (ovfl == 0 && tk->TOK_INT >= 0 &&
tk->TOK_INT<=max_int[(int)int_size]) {
@@ -543,7 +561,7 @@ lexwarning(W_ORDINARY, "character constant out of range");
else if (! chk_bounds(tk->TOK_INT,
full_mask[(int)int_size],
T_CARDINAL)) {
ovfl = 1;
ovfl = 1;
}
if (ovfl)
lexwarning(W_ORDINARY, "overflow in constant");