mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 04:02:25 +00:00
Fix generalised ReadNum and use for Sym reading.
This commit is contained in:
parent
3dc5049d5a
commit
1fa182c7ce
24 changed files with 59 additions and 163 deletions
|
|
@ -88,8 +88,7 @@ export void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x);
|
|||
export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x);
|
||||
export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x);
|
||||
export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len);
|
||||
export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x);
|
||||
export void Files_ReadNum64 (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x__len);
|
||||
export void Files_ReadNum (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x__len);
|
||||
export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x);
|
||||
export void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x);
|
||||
export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len);
|
||||
|
|
@ -915,15 +914,15 @@ void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
|||
} while (!b);
|
||||
}
|
||||
|
||||
void Files_ReadNum64 (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x__len)
|
||||
void Files_ReadNum (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x__len)
|
||||
{
|
||||
int8 s, b;
|
||||
int64 q;
|
||||
s = 0;
|
||||
q = 0;
|
||||
Files_Read(&*R, R__typ, (void*)&b);
|
||||
while ((int16)b >= 128) {
|
||||
q += (int64)__ASH(((int16)b - 128), s);
|
||||
while (b < 0) {
|
||||
q += (int64)__ASH(((int16)b + 128), s);
|
||||
s += 7;
|
||||
Files_Read(&*R, R__typ, (void*)&b);
|
||||
}
|
||||
|
|
@ -932,23 +931,6 @@ void Files_ReadNum64 (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
__MOVE((address)&q, (address)x, x__len);
|
||||
}
|
||||
|
||||
void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x)
|
||||
{
|
||||
int8 s;
|
||||
CHAR ch;
|
||||
int32 n;
|
||||
s = 0;
|
||||
n = 0;
|
||||
Files_Read(&*R, R__typ, (void*)&ch);
|
||||
while ((int16)ch >= 128) {
|
||||
n += __ASH(((int16)ch - 128), s);
|
||||
s += 7;
|
||||
Files_Read(&*R, R__typ, (void*)&ch);
|
||||
}
|
||||
n += __ASH((__MASK((int16)ch, -64) - __ASHL(__ASHR((int16)ch, 6), 6)), s);
|
||||
*x = n;
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x)
|
||||
{
|
||||
Files_Write(&*R, R__typ, __VAL(CHAR, x));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue