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:
parent
8f33bb5c4f
commit
183514d103
32
src/reader.c
32
src/reader.c
|
@ -72,7 +72,7 @@ reader_read_identifier_or_number (int c)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING];
|
char buf[MAX_STRING];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int n = 0;
|
long n = 0;
|
||||||
int negative_p = 0;
|
int negative_p = 0;
|
||||||
if (c == '+' && isdigit (peekchar ()))
|
if (c == '+' && isdigit (peekchar ()))
|
||||||
c = readchar ();
|
c = readchar ();
|
||||||
|
@ -338,12 +338,12 @@ reader_read_character ()
|
||||||
SCM
|
SCM
|
||||||
reader_read_binary ()
|
reader_read_binary ()
|
||||||
{
|
{
|
||||||
int n = 0;
|
long n = 0;
|
||||||
int c = peekchar ();
|
int c = peekchar ();
|
||||||
int s = 1;
|
int negative_p = 0;
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
{
|
{
|
||||||
s = -1;
|
negative_p = 1;
|
||||||
readchar ();
|
readchar ();
|
||||||
c = peekchar ();
|
c = peekchar ();
|
||||||
}
|
}
|
||||||
|
@ -354,18 +354,20 @@ reader_read_binary ()
|
||||||
readchar ();
|
readchar ();
|
||||||
c = peekchar ();
|
c = peekchar ();
|
||||||
}
|
}
|
||||||
return MAKE_NUMBER (s*n);
|
if (negative_p)
|
||||||
|
n = 0 - n;
|
||||||
|
return MAKE_NUMBER (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
reader_read_octal ()
|
reader_read_octal ()
|
||||||
{
|
{
|
||||||
int n = 0;
|
long n = 0;
|
||||||
int c = peekchar ();
|
int c = peekchar ();
|
||||||
int s = 1;
|
int negative_p = 0;
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
{
|
{
|
||||||
s = -1;
|
negative_p = 1;
|
||||||
readchar ();
|
readchar ();
|
||||||
c = peekchar ();
|
c = peekchar ();
|
||||||
}
|
}
|
||||||
|
@ -376,18 +378,20 @@ reader_read_octal ()
|
||||||
readchar ();
|
readchar ();
|
||||||
c = peekchar ();
|
c = peekchar ();
|
||||||
}
|
}
|
||||||
return MAKE_NUMBER (s*n);
|
if (negative_p)
|
||||||
|
n = 0 - n;
|
||||||
|
return MAKE_NUMBER (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
reader_read_hex ()
|
reader_read_hex ()
|
||||||
{
|
{
|
||||||
int n = 0;
|
long n = 0;
|
||||||
int c = peekchar ();
|
int c = peekchar ();
|
||||||
int s = 1;
|
int negative_p = 0;
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
{
|
{
|
||||||
s = -1;
|
negative_p = 1;
|
||||||
readchar ();
|
readchar ();
|
||||||
c = peekchar ();
|
c = peekchar ();
|
||||||
}
|
}
|
||||||
|
@ -405,7 +409,9 @@ reader_read_hex ()
|
||||||
readchar ();
|
readchar ();
|
||||||
c = peekchar ();
|
c = peekchar ();
|
||||||
}
|
}
|
||||||
return MAKE_NUMBER (s*n);
|
if (negative_p)
|
||||||
|
n = 0 - n;
|
||||||
|
return MAKE_NUMBER (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
|
|
Loading…
Reference in New Issue