mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 02:52:24 +00:00
Uppercase internal SYSTEM.H types address, int*, uint*. Phase 1.
This commit is contained in:
parent
1935f63cd6
commit
baeb2db81f
205 changed files with 8388 additions and 8311 deletions
|
|
@ -1,9 +1,9 @@
|
|||
/* voc 1.95 [2016/10/28]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
/* voc 1.95 [2016/11/08]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
|
||||
|
||||
#define SHORTINT int8
|
||||
#define INTEGER int16
|
||||
#define LONGINT int32
|
||||
#define SET uint32
|
||||
#define SHORTINT INT8
|
||||
#define INTEGER INT16
|
||||
#define LONGINT INT32
|
||||
#define SET UINT32
|
||||
|
||||
#include "SYSTEM.h"
|
||||
#include "Heap.h"
|
||||
|
|
@ -18,7 +18,7 @@ typedef
|
|||
struct Files_BufDesc {
|
||||
Files_File f;
|
||||
BOOLEAN chg;
|
||||
int32 org, size;
|
||||
INT32 org, size;
|
||||
SYSTEM_BYTE data[4096];
|
||||
} Files_BufDesc;
|
||||
|
||||
|
|
@ -33,85 +33,85 @@ typedef
|
|||
Files_FileName workName, registerName;
|
||||
BOOLEAN tempFile;
|
||||
Platform_FileIdentity identity;
|
||||
int32 fd, len, pos;
|
||||
INT32 fd, len, pos;
|
||||
Files_Buffer bufs[4];
|
||||
int16 swapper, state;
|
||||
INT16 swapper, state;
|
||||
Files_File next;
|
||||
} Files_FileDesc;
|
||||
|
||||
typedef
|
||||
struct Files_Rider {
|
||||
int32 res;
|
||||
INT32 res;
|
||||
BOOLEAN eof;
|
||||
Files_Buffer buf;
|
||||
int32 org, offset;
|
||||
INT32 org, offset;
|
||||
} Files_Rider;
|
||||
|
||||
|
||||
static Files_File Files_files;
|
||||
static int16 Files_tempno;
|
||||
static INT16 Files_tempno;
|
||||
static CHAR Files_HOME[1024];
|
||||
static struct {
|
||||
LONGINT len[1];
|
||||
CHAR data[1];
|
||||
} *Files_SearchPath;
|
||||
|
||||
export address *Files_FileDesc__typ;
|
||||
export address *Files_BufDesc__typ;
|
||||
export address *Files_Rider__typ;
|
||||
export ADDRESS *Files_FileDesc__typ;
|
||||
export ADDRESS *Files_BufDesc__typ;
|
||||
export ADDRESS *Files_Rider__typ;
|
||||
|
||||
export Files_File Files_Base (Files_Rider *r, address *r__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, int16 *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, int16 *res);
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 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, int32 *t, int32 *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 int32 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 int32 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_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, 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);
|
||||
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_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, 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);
|
||||
export void Files_Register (Files_File f);
|
||||
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_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, 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_WriteReal (Files_Rider *R, address *R__typ, REAL x);
|
||||
export void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x);
|
||||
export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__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, 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_WriteReal (Files_Rider *R, ADDRESS *R__typ, REAL x);
|
||||
export void Files_WriteSet (Files_Rider *R, ADDRESS *R__typ, UINT32 x);
|
||||
export void Files_WriteString (Files_Rider *R, ADDRESS *R__typ, CHAR *x, LONGINT x__len);
|
||||
|
||||
#define Files_IdxTrap() __HALT(-1)
|
||||
#define Files_ToAdr(x) (address)x
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode)
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INT16 errcode)
|
||||
{
|
||||
__DUP(s, s__len, CHAR);
|
||||
Out_Ln();
|
||||
|
|
@ -140,7 +140,7 @@ static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode)
|
|||
|
||||
static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len)
|
||||
{
|
||||
int16 i, j;
|
||||
INT16 i, j;
|
||||
__DUP(dir, dir__len, CHAR);
|
||||
__DUP(name, name__len, CHAR);
|
||||
i = 0;
|
||||
|
|
@ -165,7 +165,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)
|
||||
{
|
||||
int32 n, i, j;
|
||||
INT32 n, i, j;
|
||||
__DUP(finalName, finalName__len, CHAR);
|
||||
Files_tempno += 1;
|
||||
n = Files_tempno;
|
||||
|
|
@ -217,7 +217,7 @@ static void Files_Create (Files_File f)
|
|||
{
|
||||
Platform_FileIdentity identity;
|
||||
BOOLEAN done;
|
||||
int16 error;
|
||||
INT16 error;
|
||||
CHAR err[32];
|
||||
if (f->fd == -1) {
|
||||
if (f->state == 1) {
|
||||
|
|
@ -254,7 +254,7 @@ static void Files_Create (Files_File f)
|
|||
|
||||
static void Files_Flush (Files_Buffer buf)
|
||||
{
|
||||
int16 error;
|
||||
INT16 error;
|
||||
Files_File f = NIL;
|
||||
if (buf->chg) {
|
||||
f = buf->f;
|
||||
|
|
@ -278,7 +278,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
static void Files_CloseOSFile (Files_File f)
|
||||
{
|
||||
Files_File prev = NIL;
|
||||
int16 error;
|
||||
INT16 error;
|
||||
if (Files_files == f) {
|
||||
Files_files = f->next;
|
||||
} else {
|
||||
|
|
@ -298,8 +298,8 @@ static void Files_CloseOSFile (Files_File f)
|
|||
|
||||
void Files_Close (Files_File f)
|
||||
{
|
||||
int32 i;
|
||||
int16 error;
|
||||
INT32 i;
|
||||
INT16 error;
|
||||
if (f->state != 1 || f->registerName[0] != 0x00) {
|
||||
Files_Create(f);
|
||||
i = 0;
|
||||
|
|
@ -315,7 +315,7 @@ void Files_Close (Files_File f)
|
|||
}
|
||||
}
|
||||
|
||||
int32 Files_Length (Files_File f)
|
||||
INT32 Files_Length (Files_File f)
|
||||
{
|
||||
return f->len;
|
||||
}
|
||||
|
|
@ -336,9 +336,9 @@ Files_File Files_New (CHAR *name, LONGINT name__len)
|
|||
return f;
|
||||
}
|
||||
|
||||
static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len)
|
||||
static void Files_ScanPath (INT16 *pos, CHAR *dir, LONGINT dir__len)
|
||||
{
|
||||
int16 i;
|
||||
INT16 i;
|
||||
CHAR ch;
|
||||
i = 0;
|
||||
if (Files_SearchPath == NIL) {
|
||||
|
|
@ -381,7 +381,7 @@ static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len)
|
|||
|
||||
static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len)
|
||||
{
|
||||
int16 i;
|
||||
INT16 i;
|
||||
CHAR ch;
|
||||
i = 0;
|
||||
ch = name[0];
|
||||
|
|
@ -395,7 +395,7 @@ static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len)
|
|||
static Files_File Files_CacheEntry (Platform_FileIdentity identity)
|
||||
{
|
||||
Files_File f = NIL;
|
||||
int16 i, error;
|
||||
INT16 i, error;
|
||||
f = Files_files;
|
||||
while (f != NIL) {
|
||||
if (Platform_SameFile(identity, f->identity)) {
|
||||
|
|
@ -422,11 +422,11 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity)
|
|||
Files_File Files_Old (CHAR *name, LONGINT name__len)
|
||||
{
|
||||
Files_File f = NIL;
|
||||
int32 fd;
|
||||
int16 pos;
|
||||
INT32 fd;
|
||||
INT16 pos;
|
||||
BOOLEAN done;
|
||||
CHAR dir[256], path[256];
|
||||
int16 error;
|
||||
INT16 error;
|
||||
Platform_FileIdentity identity;
|
||||
__DUP(name, name__len, CHAR);
|
||||
if (name[0] != 0x00) {
|
||||
|
|
@ -497,9 +497,9 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
|
|||
|
||||
void Files_Purge (Files_File f)
|
||||
{
|
||||
int16 i;
|
||||
INT16 i;
|
||||
Platform_FileIdentity identity;
|
||||
int16 error;
|
||||
INT16 error;
|
||||
i = 0;
|
||||
while (i < 4) {
|
||||
if (f->bufs[i] != NIL) {
|
||||
|
|
@ -519,25 +519,25 @@ void Files_Purge (Files_File f)
|
|||
Platform_SetMTime(&f->identity, Platform_FileIdentity__typ, identity);
|
||||
}
|
||||
|
||||
void Files_GetDate (Files_File f, int32 *t, int32 *d)
|
||||
void Files_GetDate (Files_File f, INT32 *t, INT32 *d)
|
||||
{
|
||||
Platform_FileIdentity identity;
|
||||
int16 error;
|
||||
INT16 error;
|
||||
Files_Create(f);
|
||||
error = Platform_Identify(f->fd, &identity, Platform_FileIdentity__typ);
|
||||
Platform_MTimeAsClock(identity, &*t, &*d);
|
||||
}
|
||||
|
||||
int32 Files_Pos (Files_Rider *r, address *r__typ)
|
||||
INT32 Files_Pos (Files_Rider *r, ADDRESS *r__typ)
|
||||
{
|
||||
return (*r).org + (*r).offset;
|
||||
}
|
||||
|
||||
void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos)
|
||||
void Files_Set (Files_Rider *r, ADDRESS *r__typ, Files_File f, INT32 pos)
|
||||
{
|
||||
int32 org, offset, i, n;
|
||||
INT32 org, offset, i, n;
|
||||
Files_Buffer buf = NIL;
|
||||
int16 error;
|
||||
INT16 error;
|
||||
if (f != NIL) {
|
||||
if (pos > f->len) {
|
||||
pos = f->len;
|
||||
|
|
@ -595,9 +595,9 @@ void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos)
|
|||
(*r).res = 0;
|
||||
}
|
||||
|
||||
void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x)
|
||||
void Files_Read (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x)
|
||||
{
|
||||
int32 offset;
|
||||
INT32 offset;
|
||||
Files_Buffer buf = NIL;
|
||||
buf = (*r).buf;
|
||||
offset = (*r).offset;
|
||||
|
|
@ -619,9 +619,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, int32 n)
|
||||
void Files_ReadBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x__len, INT32 n)
|
||||
{
|
||||
int32 xpos, min, restInBuf, offset;
|
||||
INT32 xpos, min, restInBuf, offset;
|
||||
Files_Buffer buf = NIL;
|
||||
if (n > x__len) {
|
||||
Files_IdxTrap();
|
||||
|
|
@ -655,15 +655,15 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
(*r).eof = 0;
|
||||
}
|
||||
|
||||
Files_File Files_Base (Files_Rider *r, address *r__typ)
|
||||
Files_File Files_Base (Files_Rider *r, ADDRESS *r__typ)
|
||||
{
|
||||
return (*r).buf->f;
|
||||
}
|
||||
|
||||
void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x)
|
||||
void Files_Write (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE x)
|
||||
{
|
||||
Files_Buffer buf = NIL;
|
||||
int32 offset;
|
||||
INT32 offset;
|
||||
buf = (*r).buf;
|
||||
offset = (*r).offset;
|
||||
if ((*r).org != buf->org || offset >= 4096) {
|
||||
|
|
@ -681,9 +681,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, int32 n)
|
||||
void Files_WriteBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x__len, INT32 n)
|
||||
{
|
||||
int32 xpos, min, restInBuf, offset;
|
||||
INT32 xpos, min, restInBuf, offset;
|
||||
Files_Buffer buf = NIL;
|
||||
if (n > x__len) {
|
||||
Files_IdxTrap();
|
||||
|
|
@ -717,17 +717,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, int16 *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, int16 *res)
|
||||
void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT16 *res)
|
||||
{
|
||||
int32 fdold, fdnew, n;
|
||||
int16 error, ignore;
|
||||
INT32 fdold, fdnew, n;
|
||||
INT16 error, ignore;
|
||||
Platform_FileIdentity oldidentity, newidentity;
|
||||
CHAR buf[4096];
|
||||
__DUP(old, old__len, CHAR);
|
||||
|
|
@ -788,7 +788,7 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int
|
|||
|
||||
void Files_Register (Files_File f)
|
||||
{
|
||||
int16 idx, errcode;
|
||||
INT16 idx, errcode;
|
||||
Files_File f1 = NIL;
|
||||
CHAR file[104];
|
||||
if ((f->state == 1 && f->registerName[0] != 0x00)) {
|
||||
|
|
@ -807,7 +807,7 @@ void Files_Register (Files_File f)
|
|||
}
|
||||
}
|
||||
|
||||
void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res)
|
||||
void Files_ChangeDirectory (CHAR *path, LONGINT path__len, INT16 *res)
|
||||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
*res = Platform_Chdir((void*)path, path__len);
|
||||
|
|
@ -816,7 +816,7 @@ void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res)
|
|||
|
||||
static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len)
|
||||
{
|
||||
int32 i, j;
|
||||
INT32 i, j;
|
||||
if (!Platform_LittleEndian) {
|
||||
i = src__len;
|
||||
j = 0;
|
||||
|
|
@ -830,51 +830,51 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
|
|||
}
|
||||
}
|
||||
|
||||
void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x)
|
||||
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, int16 *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 = (int16)b[0] + __ASHL((int16)b[1], 8);
|
||||
*x = (INT16)b[0] + __ASHL((INT16)b[1], 8);
|
||||
}
|
||||
|
||||
void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *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 = (((int16)b[0] + __ASHL((int16)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, uint32 *x)
|
||||
void Files_ReadSet (Files_Rider *R, ADDRESS *R__typ, UINT32 *x)
|
||||
{
|
||||
CHAR b[4];
|
||||
int32 l;
|
||||
INT32 l;
|
||||
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
|
||||
*x = (uint32)l;
|
||||
l = (((INT16)b[0] + __ASHL((INT16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
|
||||
*x = (UINT32)l;
|
||||
}
|
||||
|
||||
void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x)
|
||||
void Files_ReadReal (Files_Rider *R, ADDRESS *R__typ, REAL *x)
|
||||
{
|
||||
CHAR b[4];
|
||||
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
Files_FlipBytes((void*)b, 4, (void*)&*x, 4);
|
||||
}
|
||||
|
||||
void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x)
|
||||
void Files_ReadLReal (Files_Rider *R, ADDRESS *R__typ, LONGREAL *x)
|
||||
{
|
||||
CHAR b[8];
|
||||
Files_ReadBytes(&*R, R__typ, (void*)b, 8, 8);
|
||||
Files_FlipBytes((void*)b, 8, (void*)&*x, 8);
|
||||
}
|
||||
|
||||
void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
||||
void Files_ReadString (Files_Rider *R, ADDRESS *R__typ, CHAR *x, LONGINT x__len)
|
||||
{
|
||||
int16 i;
|
||||
INT16 i;
|
||||
CHAR ch;
|
||||
i = 0;
|
||||
do {
|
||||
|
|
@ -884,9 +884,9 @@ void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
|||
} while (!(ch == 0x00));
|
||||
}
|
||||
|
||||
void Files_ReadLine (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)
|
||||
{
|
||||
int16 i;
|
||||
INT16 i;
|
||||
CHAR ch;
|
||||
BOOLEAN b;
|
||||
i = 0;
|
||||
|
|
@ -902,29 +902,29 @@ 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, 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;
|
||||
INT8 s, b;
|
||||
INT64 q;
|
||||
s = 0;
|
||||
q = 0;
|
||||
Files_Read(&*R, R__typ, (void*)&b);
|
||||
while (b < 0) {
|
||||
q += (int64)__ASH(((int16)b + 128), s);
|
||||
q += (INT64)__ASH(((INT16)b + 128), s);
|
||||
s += 7;
|
||||
Files_Read(&*R, R__typ, (void*)&b);
|
||||
}
|
||||
q += (int64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
q += (INT64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
__ASSERT(x__len <= 8, 0);
|
||||
__MOVE((address)&q, (address)x, x__len);
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x)
|
||||
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, int16 x)
|
||||
void Files_WriteInt (Files_Rider *R, ADDRESS *R__typ, INT16 x)
|
||||
{
|
||||
CHAR b[2];
|
||||
b[0] = (CHAR)x;
|
||||
|
|
@ -932,7 +932,7 @@ void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x)
|
|||
Files_WriteBytes(&*R, R__typ, (void*)b, 2, 2);
|
||||
}
|
||||
|
||||
void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x)
|
||||
void Files_WriteLInt (Files_Rider *R, ADDRESS *R__typ, INT32 x)
|
||||
{
|
||||
CHAR b[4];
|
||||
b[0] = (CHAR)x;
|
||||
|
|
@ -942,11 +942,11 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x)
|
|||
Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
}
|
||||
|
||||
void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x)
|
||||
void Files_WriteSet (Files_Rider *R, ADDRESS *R__typ, UINT32 x)
|
||||
{
|
||||
CHAR b[4];
|
||||
int32 i;
|
||||
i = (int32)x;
|
||||
INT32 i;
|
||||
i = (INT32)x;
|
||||
b[0] = (CHAR)i;
|
||||
b[1] = (CHAR)__ASHR(i, 8);
|
||||
b[2] = (CHAR)__ASHR(i, 16);
|
||||
|
|
@ -954,23 +954,23 @@ void Files_WriteSet (Files_Rider *R, address *R__typ, uint32 x)
|
|||
Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
}
|
||||
|
||||
void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x)
|
||||
void Files_WriteReal (Files_Rider *R, ADDRESS *R__typ, REAL x)
|
||||
{
|
||||
CHAR b[4];
|
||||
Files_FlipBytes((void*)&x, 4, (void*)b, 4);
|
||||
Files_WriteBytes(&*R, R__typ, (void*)b, 4, 4);
|
||||
}
|
||||
|
||||
void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x)
|
||||
void Files_WriteLReal (Files_Rider *R, ADDRESS *R__typ, LONGREAL x)
|
||||
{
|
||||
CHAR b[8];
|
||||
Files_FlipBytes((void*)&x, 8, (void*)b, 8);
|
||||
Files_WriteBytes(&*R, R__typ, (void*)b, 8, 8);
|
||||
}
|
||||
|
||||
void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len)
|
||||
void Files_WriteString (Files_Rider *R, ADDRESS *R__typ, CHAR *x, LONGINT x__len)
|
||||
{
|
||||
int16 i;
|
||||
INT16 i;
|
||||
i = 0;
|
||||
while (x[i] != 0x00) {
|
||||
i += 1;
|
||||
|
|
@ -978,7 +978,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, INT64 x)
|
||||
{
|
||||
while (x < -64 || x > 63) {
|
||||
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
|
||||
|
|
@ -995,7 +995,7 @@ void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
|
|||
static void Files_Finalize (SYSTEM_PTR o)
|
||||
{
|
||||
Files_File f = NIL;
|
||||
int32 res;
|
||||
INT32 res;
|
||||
f = (Files_File)(address)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue