mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 06:22: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));
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ import void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x);
|
|||
import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x);
|
||||
import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x);
|
||||
import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len);
|
||||
import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x);
|
||||
import void Files_ReadNum64 (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x__len);
|
||||
import void Files_ReadNum (Files_Rider *R, address *R__typ, SYSTEM_BYTE *x, LONGINT x__len);
|
||||
import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x);
|
||||
import void Files_ReadSet (Files_Rider *R, address *R__typ, uint32 *x);
|
||||
import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len);
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ int32 OPM_SymRInt (void)
|
|||
{
|
||||
int32 _o_result;
|
||||
int32 k;
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, &k);
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (void*)&k, 4);
|
||||
_o_result = k;
|
||||
return _o_result;
|
||||
}
|
||||
|
|
@ -754,19 +754,19 @@ int64 OPM_SymRInt64 (void)
|
|||
{
|
||||
int64 _o_result;
|
||||
int64 k;
|
||||
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, (void*)&k, 8);
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (void*)&k, 8);
|
||||
_o_result = k;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
void OPM_SymRSet64 (uint64 *s)
|
||||
{
|
||||
Files_ReadNum64(&OPM_oldSF, Files_Rider__typ, (void*)&*s, 8);
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (void*)&*s, 8);
|
||||
}
|
||||
|
||||
void OPM_SymRSet (uint32 *s)
|
||||
{
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s);
|
||||
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (void*)&*s, 4);
|
||||
}
|
||||
|
||||
void OPM_SymRReal (REAL *r)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN
|
|||
|
||||
static void extTools_InitialiseCompilerCommand (CHAR *s, LONGINT s__len)
|
||||
{
|
||||
__COPY("gcc -g -O1", s, s__len);
|
||||
__COPY("gcc -g", s, s__len);
|
||||
Strings_Append((CHAR*)" -I \"", 6, (void*)s, s__len);
|
||||
Strings_Append(OPM_ResourceDir, 1024, (void*)s, s__len);
|
||||
Strings_Append((CHAR*)"/include\" ", 11, (void*)s, s__len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue