core: reader: Support 64 bit.

* src/reader.c (reader_read_identifier_or_number): Support 64 bit.
(reader_read_binary): Likewise.
(reader_read_octal): Likewise.
(reader_read_hex): Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-07 00:58:31 +02:00
parent 8f33bb5c4f
commit 183514d103
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 19 additions and 13 deletions

View File

@ -72,7 +72,7 @@ reader_read_identifier_or_number (int c)
{
char buf[MAX_STRING];
int i = 0;
int n = 0;
long n = 0;
int negative_p = 0;
if (c == '+' && isdigit (peekchar ()))
c = readchar ();
@ -338,12 +338,12 @@ reader_read_character ()
SCM
reader_read_binary ()
{
int n = 0;
long n = 0;
int c = peekchar ();
int s = 1;
int negative_p = 0;
if (c == '-')
{
s = -1;
negative_p = 1;
readchar ();
c = peekchar ();
}
@ -354,18 +354,20 @@ reader_read_binary ()
readchar ();
c = peekchar ();
}
return MAKE_NUMBER (s*n);
if (negative_p)
n = 0 - n;
return MAKE_NUMBER (n);
}
SCM
reader_read_octal ()
{
int n = 0;
long n = 0;
int c = peekchar ();
int s = 1;
int negative_p = 0;
if (c == '-')
{
s = -1;
negative_p = 1;
readchar ();
c = peekchar ();
}
@ -376,18 +378,20 @@ reader_read_octal ()
readchar ();
c = peekchar ();
}
return MAKE_NUMBER (s*n);
if (negative_p)
n = 0 - n;
return MAKE_NUMBER (n);
}
SCM
reader_read_hex ()
{
int n = 0;
long n = 0;
int c = peekchar ();
int s = 1;
int negative_p = 0;
if (c == '-')
{
s = -1;
negative_p = 1;
readchar ();
c = peekchar ();
}
@ -405,7 +409,9 @@ reader_read_hex ()
readchar ();
c = peekchar ();
}
return MAKE_NUMBER (s*n);
if (negative_p)
n = 0 - n;
return MAKE_NUMBER (n);
}
SCM