mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 02:52:24 +00:00
Use SYSTEM.ADDRESS in libraries. Build all with -O2. Support INC(a,b) for any int a,b that support a:=a+b.
This commit is contained in:
parent
f1cbbdba28
commit
22a4f8e263
92 changed files with 2752 additions and 2695 deletions
|
|
@ -1,8 +1,8 @@
|
|||
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
|
||||
|
||||
#define INTEGER int32
|
||||
#define LONGINT int64
|
||||
#define SET uint64
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
#define SET uint32
|
||||
|
||||
#include "SYSTEM.h"
|
||||
#include "Configuration.h"
|
||||
|
|
@ -18,7 +18,7 @@ typedef
|
|||
struct Files_BufDesc {
|
||||
Files_File f;
|
||||
BOOLEAN chg;
|
||||
int64 org, size;
|
||||
int32 org, size;
|
||||
SYSTEM_BYTE data[4096];
|
||||
} Files_BufDesc;
|
||||
|
||||
|
|
@ -33,23 +33,23 @@ typedef
|
|||
Files_FileName workName, registerName;
|
||||
BOOLEAN tempFile;
|
||||
Platform_FileIdentity identity;
|
||||
int64 fd, len, pos;
|
||||
int32 fd, len, pos;
|
||||
Files_Buffer bufs[4];
|
||||
int32 swapper, state;
|
||||
int16 swapper, state;
|
||||
Files_File next;
|
||||
} Files_FileDesc;
|
||||
|
||||
typedef
|
||||
struct Files_Rider {
|
||||
int64 res;
|
||||
int32 res;
|
||||
BOOLEAN eof;
|
||||
Files_Buffer buf;
|
||||
int64 org, offset;
|
||||
int32 org, offset;
|
||||
} Files_Rider;
|
||||
|
||||
|
||||
static Files_File Files_files;
|
||||
static int32 Files_tempno;
|
||||
static int16 Files_tempno;
|
||||
static CHAR Files_HOME[1024];
|
||||
static struct {
|
||||
LONGINT len[1];
|
||||
|
|
@ -62,50 +62,50 @@ export address *Files_Rider__typ;
|
|||
|
||||
export Files_File Files_Base (Files_Rider *r, address *r__typ);
|
||||
static Files_File Files_CacheEntry (Platform_FileIdentity identity);
|
||||
export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res);
|
||||
export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res);
|
||||
export void Files_Close (Files_File f);
|
||||
static void Files_CloseOSFile (Files_File f);
|
||||
static void Files_Create (Files_File f);
|
||||
export void Files_Delete (CHAR *name, LONGINT name__len, int32 *res);
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode);
|
||||
export void Files_Delete (CHAR *name, LONGINT name__len, int16 *res);
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode);
|
||||
static void Files_Finalize (SYSTEM_PTR o);
|
||||
static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len);
|
||||
static void Files_Flush (Files_Buffer buf);
|
||||
export void Files_GetDate (Files_File f, int64 *t, int64 *d);
|
||||
export void Files_GetDate (Files_File f, int32 *t, int32 *d);
|
||||
export void Files_GetName (Files_File f, CHAR *name, LONGINT name__len);
|
||||
static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *name, LONGINT name__len);
|
||||
static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len);
|
||||
export int64 Files_Length (Files_File f);
|
||||
export int32 Files_Length (Files_File f);
|
||||
static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len);
|
||||
export Files_File Files_New (CHAR *name, LONGINT name__len);
|
||||
export Files_File Files_Old (CHAR *name, LONGINT name__len);
|
||||
export int64 Files_Pos (Files_Rider *r, address *r__typ);
|
||||
export int32 Files_Pos (Files_Rider *r, address *r__typ);
|
||||
export void Files_Purge (Files_File f);
|
||||
export void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x);
|
||||
export void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x);
|
||||
export void Files_ReadByte (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len);
|
||||
export void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n);
|
||||
export void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x);
|
||||
export void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x);
|
||||
export void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n);
|
||||
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, int64 *x);
|
||||
export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x);
|
||||
export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x);
|
||||
export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x);
|
||||
export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x);
|
||||
export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len);
|
||||
export void Files_Register (Files_File f);
|
||||
export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res);
|
||||
static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len);
|
||||
export void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos);
|
||||
export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res);
|
||||
static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len);
|
||||
export void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos);
|
||||
export void Files_SetSearchPath (CHAR *path, LONGINT path__len);
|
||||
export void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x);
|
||||
export void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x);
|
||||
export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n);
|
||||
export void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x);
|
||||
export void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x);
|
||||
export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n);
|
||||
export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x);
|
||||
export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x);
|
||||
export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x);
|
||||
export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x);
|
||||
export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x);
|
||||
export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x);
|
||||
export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x);
|
||||
export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x);
|
||||
|
|
@ -113,7 +113,7 @@ export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT
|
|||
|
||||
#define Files_IdxTrap() __HALT(-1)
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode)
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode)
|
||||
{
|
||||
__DUP(s, s__len, CHAR);
|
||||
Console_Ln();
|
||||
|
|
@ -142,7 +142,7 @@ static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode)
|
|||
|
||||
static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len)
|
||||
{
|
||||
int32 i, j;
|
||||
int16 i, j;
|
||||
__DUP(dir, dir__len, CHAR);
|
||||
__DUP(name, name__len, CHAR);
|
||||
i = 0;
|
||||
|
|
@ -167,7 +167,7 @@ static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT
|
|||
|
||||
static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *name, LONGINT name__len)
|
||||
{
|
||||
int64 n, i, j;
|
||||
int32 n, i, j;
|
||||
__DUP(finalName, finalName__len, CHAR);
|
||||
Files_tempno += 1;
|
||||
n = Files_tempno;
|
||||
|
|
@ -199,7 +199,7 @@ static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *na
|
|||
name[i + 5] = '.';
|
||||
i += 6;
|
||||
while (n > 0) {
|
||||
name[i] = (CHAR)(__MOD(n, 10) + 48);
|
||||
name[i] = (CHAR)((int)__MOD(n, 10) + 48);
|
||||
n = __DIV(n, 10);
|
||||
i += 1;
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *na
|
|||
i += 1;
|
||||
n = Platform_PID;
|
||||
while (n > 0) {
|
||||
name[i] = (CHAR)(__MOD(n, 10) + 48);
|
||||
name[i] = (CHAR)((int)__MOD(n, 10) + 48);
|
||||
n = __DIV(n, 10);
|
||||
i += 1;
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ static void Files_Create (Files_File f)
|
|||
{
|
||||
Platform_FileIdentity identity;
|
||||
BOOLEAN done;
|
||||
int32 error;
|
||||
int16 error;
|
||||
CHAR err[32];
|
||||
if (f->fd == -1) {
|
||||
if (f->state == 1) {
|
||||
|
|
@ -256,7 +256,7 @@ static void Files_Create (Files_File f)
|
|||
|
||||
static void Files_Flush (Files_Buffer buf)
|
||||
{
|
||||
int32 error;
|
||||
int16 error;
|
||||
Files_File f = NIL;
|
||||
if (buf->chg) {
|
||||
f = buf->f;
|
||||
|
|
@ -280,7 +280,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
static void Files_CloseOSFile (Files_File f)
|
||||
{
|
||||
Files_File prev = NIL;
|
||||
int32 error;
|
||||
int16 error;
|
||||
if (Files_files == f) {
|
||||
Files_files = f->next;
|
||||
} else {
|
||||
|
|
@ -300,8 +300,8 @@ static void Files_CloseOSFile (Files_File f)
|
|||
|
||||
void Files_Close (Files_File f)
|
||||
{
|
||||
int64 i;
|
||||
int32 error;
|
||||
int32 i;
|
||||
int16 error;
|
||||
if (f->state != 1 || f->registerName[0] != 0x00) {
|
||||
Files_Create(f);
|
||||
i = 0;
|
||||
|
|
@ -317,9 +317,9 @@ void Files_Close (Files_File f)
|
|||
}
|
||||
}
|
||||
|
||||
int64 Files_Length (Files_File f)
|
||||
int32 Files_Length (Files_File f)
|
||||
{
|
||||
int64 _o_result;
|
||||
int32 _o_result;
|
||||
_o_result = f->len;
|
||||
return _o_result;
|
||||
}
|
||||
|
|
@ -342,9 +342,9 @@ Files_File Files_New (CHAR *name, LONGINT name__len)
|
|||
return _o_result;
|
||||
}
|
||||
|
||||
static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len)
|
||||
static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len)
|
||||
{
|
||||
int32 i;
|
||||
int16 i;
|
||||
CHAR ch;
|
||||
i = 0;
|
||||
if (Files_SearchPath == NIL) {
|
||||
|
|
@ -388,7 +388,7 @@ static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len)
|
|||
static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len)
|
||||
{
|
||||
BOOLEAN _o_result;
|
||||
int32 i;
|
||||
int16 i;
|
||||
CHAR ch;
|
||||
i = 0;
|
||||
ch = name[0];
|
||||
|
|
@ -404,7 +404,7 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity)
|
|||
{
|
||||
Files_File _o_result;
|
||||
Files_File f = NIL;
|
||||
int32 i, error;
|
||||
int16 i, error;
|
||||
f = Files_files;
|
||||
while (f != NIL) {
|
||||
if (Platform_SameFile(identity, f->identity)) {
|
||||
|
|
@ -434,11 +434,11 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
|
|||
{
|
||||
Files_File _o_result;
|
||||
Files_File f = NIL;
|
||||
int64 fd;
|
||||
int32 pos;
|
||||
int32 fd;
|
||||
int16 pos;
|
||||
BOOLEAN done;
|
||||
CHAR dir[256], path[256];
|
||||
int32 error;
|
||||
int16 error;
|
||||
Platform_FileIdentity identity;
|
||||
__DUP(name, name__len, CHAR);
|
||||
if (name[0] != 0x00) {
|
||||
|
|
@ -513,9 +513,9 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
|
|||
|
||||
void Files_Purge (Files_File f)
|
||||
{
|
||||
int32 i;
|
||||
int16 i;
|
||||
Platform_FileIdentity identity;
|
||||
int32 error;
|
||||
int16 error;
|
||||
i = 0;
|
||||
while (i < 4) {
|
||||
if (f->bufs[i] != NIL) {
|
||||
|
|
@ -535,27 +535,27 @@ void Files_Purge (Files_File f)
|
|||
Platform_SetMTime(&f->identity, Platform_FileIdentity__typ, identity);
|
||||
}
|
||||
|
||||
void Files_GetDate (Files_File f, int64 *t, int64 *d)
|
||||
void Files_GetDate (Files_File f, int32 *t, int32 *d)
|
||||
{
|
||||
Platform_FileIdentity identity;
|
||||
int32 error;
|
||||
int16 error;
|
||||
Files_Create(f);
|
||||
error = Platform_Identify(f->fd, &identity, Platform_FileIdentity__typ);
|
||||
Platform_MTimeAsClock(identity, &*t, &*d);
|
||||
}
|
||||
|
||||
int64 Files_Pos (Files_Rider *r, address *r__typ)
|
||||
int32 Files_Pos (Files_Rider *r, address *r__typ)
|
||||
{
|
||||
int64 _o_result;
|
||||
int32 _o_result;
|
||||
_o_result = (*r).org + (*r).offset;
|
||||
return _o_result;
|
||||
}
|
||||
|
||||
void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos)
|
||||
void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos)
|
||||
{
|
||||
int64 org, offset, i, n;
|
||||
int32 org, offset, i, n;
|
||||
Files_Buffer buf = NIL;
|
||||
int32 error;
|
||||
int16 error;
|
||||
if (f != NIL) {
|
||||
if (pos > f->len) {
|
||||
pos = f->len;
|
||||
|
|
@ -615,7 +615,7 @@ void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos)
|
|||
|
||||
void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x)
|
||||
{
|
||||
int64 offset;
|
||||
int32 offset;
|
||||
Files_Buffer buf = NIL;
|
||||
buf = (*r).buf;
|
||||
offset = (*r).offset;
|
||||
|
|
@ -637,9 +637,9 @@ void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x)
|
|||
}
|
||||
}
|
||||
|
||||
void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n)
|
||||
void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n)
|
||||
{
|
||||
int64 xpos, min, restInBuf, offset;
|
||||
int32 xpos, min, restInBuf, offset;
|
||||
Files_Buffer buf = NIL;
|
||||
if (n > x__len) {
|
||||
Files_IdxTrap();
|
||||
|
|
@ -663,7 +663,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE(((address)buf->data) + offset, ((address)x) + xpos, min);
|
||||
__MOVE((address)buf->data + (int64)offset, (address)x + (int64)xpos, min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
xpos += min;
|
||||
|
|
@ -688,7 +688,7 @@ Files_File Files_Base (Files_Rider *r, address *r__typ)
|
|||
void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x)
|
||||
{
|
||||
Files_Buffer buf = NIL;
|
||||
int64 offset;
|
||||
int32 offset;
|
||||
buf = (*r).buf;
|
||||
offset = (*r).offset;
|
||||
if ((*r).org != buf->org || offset >= 4096) {
|
||||
|
|
@ -706,9 +706,9 @@ void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x)
|
|||
(*r).res = 0;
|
||||
}
|
||||
|
||||
void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n)
|
||||
void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n)
|
||||
{
|
||||
int64 xpos, min, restInBuf, offset;
|
||||
int32 xpos, min, restInBuf, offset;
|
||||
Files_Buffer buf = NIL;
|
||||
if (n > x__len) {
|
||||
Files_IdxTrap();
|
||||
|
|
@ -728,7 +728,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE(((address)x) + xpos, ((address)buf->data) + offset, min);
|
||||
__MOVE((address)x + (int64)xpos, (address)buf->data + (int64)offset, min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
if (offset > buf->size) {
|
||||
|
|
@ -742,17 +742,17 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
(*r).res = 0;
|
||||
}
|
||||
|
||||
void Files_Delete (CHAR *name, LONGINT name__len, int32 *res)
|
||||
void Files_Delete (CHAR *name, LONGINT name__len, int16 *res)
|
||||
{
|
||||
__DUP(name, name__len, CHAR);
|
||||
*res = Platform_Unlink((void*)name, name__len);
|
||||
__DEL(name);
|
||||
}
|
||||
|
||||
void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res)
|
||||
void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res)
|
||||
{
|
||||
int64 fdold, fdnew, n;
|
||||
int32 error, ignore;
|
||||
int32 fdold, fdnew, n;
|
||||
int16 error, ignore;
|
||||
Platform_FileIdentity oldidentity, newidentity;
|
||||
CHAR buf[4096];
|
||||
__DUP(old, old__len, CHAR);
|
||||
|
|
@ -807,7 +807,7 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int
|
|||
|
||||
void Files_Register (Files_File f)
|
||||
{
|
||||
int32 idx, errcode;
|
||||
int16 idx, errcode;
|
||||
Files_File f1 = NIL;
|
||||
CHAR file[104];
|
||||
if ((f->state == 1 && f->registerName[0] != 0x00)) {
|
||||
|
|
@ -826,7 +826,7 @@ void Files_Register (Files_File f)
|
|||
}
|
||||
}
|
||||
|
||||
void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res)
|
||||
void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res)
|
||||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
*res = Platform_Chdir((void*)path, path__len);
|
||||
|
|
@ -835,7 +835,7 @@ void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res)
|
|||
|
||||
static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len)
|
||||
{
|
||||
int64 i, j;
|
||||
int32 i, j;
|
||||
if (!Platform_LittleEndian) {
|
||||
i = src__len;
|
||||
j = 0;
|
||||
|
|
@ -854,26 +854,26 @@ void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x)
|
|||
Files_Read(&*R, R__typ, (CHAR*)(void*)&*x);
|
||||
}
|
||||
|
||||
void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x)
|
||||
void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x)
|
||||
{
|
||||
CHAR b[2];
|
||||
Files_ReadBytes(&*R, R__typ, (void*)b, 2, 2);
|
||||
*x = b[0] + __ASHL(b[1], 8);
|
||||
*x = (int16)b[0] + __ASHL((int16)b[1], 8);
|
||||
}
|
||||
|
||||
void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x)
|
||||
void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x)
|
||||
{
|
||||
CHAR b[4];
|
||||
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
*x = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
|
||||
*x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
|
||||
}
|
||||
|
||||
void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x)
|
||||
{
|
||||
CHAR b[4];
|
||||
int64 l;
|
||||
int32 l;
|
||||
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
l = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
|
||||
l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
|
||||
*x = (SET)l;
|
||||
}
|
||||
|
||||
|
|
@ -893,7 +893,7 @@ void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x)
|
|||
|
||||
void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
||||
{
|
||||
int32 i;
|
||||
int16 i;
|
||||
CHAR ch;
|
||||
i = 0;
|
||||
do {
|
||||
|
|
@ -905,7 +905,7 @@ void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
|||
|
||||
void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
||||
{
|
||||
int32 i;
|
||||
int16 i;
|
||||
CHAR ch;
|
||||
BOOLEAN b;
|
||||
i = 0;
|
||||
|
|
@ -921,26 +921,26 @@ void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
|||
} while (!b);
|
||||
}
|
||||
|
||||
void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x)
|
||||
void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x)
|
||||
{
|
||||
int8 s;
|
||||
CHAR ch;
|
||||
int64 n;
|
||||
int32 n;
|
||||
s = 0;
|
||||
n = 0;
|
||||
Files_Read(&*R, R__typ, (void*)&ch);
|
||||
while (ch >= 128) {
|
||||
n += __ASH((int64)(ch - 128), s);
|
||||
while ((int16)ch >= 128) {
|
||||
n += __ASH(((int16)ch - 128), s);
|
||||
s += 7;
|
||||
Files_Read(&*R, R__typ, (void*)&ch);
|
||||
}
|
||||
n += __ASH((int64)(__MASK(ch, -64) - __ASHL(__ASHR(ch, 6), 6)), s);
|
||||
n += __ASH((__MASK((int16)ch, -64) - __ASHL(__ASHR((int16)ch, 6), 6)), s);
|
||||
*x = n;
|
||||
}
|
||||
|
||||
void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x)
|
||||
{
|
||||
int64 n;
|
||||
int32 n;
|
||||
Files_ReadNum(&*R, R__typ, &n);
|
||||
*x = n;
|
||||
}
|
||||
|
|
@ -950,7 +950,7 @@ void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x)
|
|||
Files_Write(&*R, R__typ, __VAL(CHAR, x));
|
||||
}
|
||||
|
||||
void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x)
|
||||
void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x)
|
||||
{
|
||||
CHAR b[2];
|
||||
b[0] = (CHAR)x;
|
||||
|
|
@ -958,7 +958,7 @@ void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x)
|
|||
Files_WriteBytes(&*R, R__typ, (void*)b, 2, 2);
|
||||
}
|
||||
|
||||
void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x)
|
||||
void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x)
|
||||
{
|
||||
CHAR b[4];
|
||||
b[0] = (CHAR)x;
|
||||
|
|
@ -971,8 +971,8 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x)
|
|||
void Files_WriteSet (Files_Rider *R, address *R__typ, SET x)
|
||||
{
|
||||
CHAR b[4];
|
||||
int64 i;
|
||||
i = (int64)x;
|
||||
int32 i;
|
||||
i = (int32)x;
|
||||
b[0] = (CHAR)i;
|
||||
b[1] = (CHAR)__ASHR(i, 8);
|
||||
b[2] = (CHAR)__ASHR(i, 16);
|
||||
|
|
@ -996,7 +996,7 @@ void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x)
|
|||
|
||||
void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
||||
{
|
||||
int32 i;
|
||||
int16 i;
|
||||
i = 0;
|
||||
while (x[i] != 0x00) {
|
||||
i += 1;
|
||||
|
|
@ -1004,7 +1004,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len
|
|||
Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1);
|
||||
}
|
||||
|
||||
void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x)
|
||||
void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x)
|
||||
{
|
||||
while (x < -64 || x > 63) {
|
||||
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
|
||||
|
|
@ -1030,7 +1030,7 @@ void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
|
|||
static void Files_Finalize (SYSTEM_PTR o)
|
||||
{
|
||||
Files_File f = NIL;
|
||||
int64 res;
|
||||
int32 res;
|
||||
f = (Files_File)(address)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
|
|
@ -1058,9 +1058,9 @@ static void EnumPtrs(void (*P)(void*))
|
|||
P(Files_SearchPath);
|
||||
}
|
||||
|
||||
__TDESC(Files_FileDesc, 1, 5) = {__TDFLDS("FileDesc", 304), {256, 264, 272, 280, 296, -48}};
|
||||
__TDESC(Files_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 4128), {0, -16}};
|
||||
__TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 40), {16, -16}};
|
||||
__TDESC(Files_FileDesc, 1, 5) = {__TDFLDS("FileDesc", 280), {232, 240, 248, 256, 272, -48}};
|
||||
__TDESC(Files_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 4120), {0, -16}};
|
||||
__TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 24), {8, -16}};
|
||||
|
||||
export void *Files__init(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue