mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-05 23:22:25 +00:00
Uppercase internal SYSTEM.H types address, int*, uint*. Completed.
This commit is contained in:
parent
baeb2db81f
commit
a17c087a41
56 changed files with 299 additions and 379 deletions
|
|
@ -86,20 +86,6 @@ typedef void* SYSTEM_PTR;
|
|||
#endif
|
||||
|
||||
|
||||
// Temporary build support - which changing lowercase int* and address to uppercase
|
||||
|
||||
#define int8 INT8
|
||||
#define int16 INT16
|
||||
#define int32 INT32
|
||||
#define int64 INT64
|
||||
#define uint8 UINT8
|
||||
#define uint16 UINT16
|
||||
#define uint32 UINT32
|
||||
#define uint64 UINT64
|
||||
#define address ADDRESS
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
@ -179,12 +165,12 @@ static inline int __str_cmp(CHAR *x, CHAR *y){
|
|||
#define __GET(a, x, t) x=*(t*)(ADDRESS)(a)
|
||||
#define __PUT(a, x, t) *(t*)(ADDRESS)(a)=x
|
||||
|
||||
#define __LSHL(x, n, s) ((int##s)((uint##s)(x)<<(n)))
|
||||
#define __LSHR(x, n, s) ((int##s)((uint##s)(x)>>(n)))
|
||||
#define __LSHL(x, n, s) ((INT##s)((UINT##s)(x)<<(n)))
|
||||
#define __LSHR(x, n, s) ((INT##s)((UINT##s)(x)>>(n)))
|
||||
#define __LSH(x, n, s) ((n)>=0? __LSHL(x, n, s): __LSHR(x, -(n), s))
|
||||
|
||||
#define __ROTL(x, n, s) ((int##s)((uint##s)(x)<<(n)|(uint##s)(x)>>(s-(n))))
|
||||
#define __ROTR(x, n, s) ((int##s)((uint##s)(x)>>(n)|(uint##s)(x)<<(s-(n))))
|
||||
#define __ROTL(x, n, s) ((INT##s)((UINT##s)(x)<<(n)|(UINT##s)(x)>>(s-(n))))
|
||||
#define __ROTR(x, n, s) ((INT##s)((UINT##s)(x)>>(n)|(UINT##s)(x)<<(s-(n))))
|
||||
#define __ROT(x, n, s) ((n)>=0? __ROTL(x, n, s): __ROTR(x, -(n), s))
|
||||
|
||||
#define __ASHL(x, n) ((INT64)(x)<<(n))
|
||||
|
|
@ -222,10 +208,10 @@ static inline double SYSTEM_ABSD(double i) {return i >= 0.0 ? i : -i;}
|
|||
#define __CAP(ch) ((CHAR)((ch)&0x5f))
|
||||
#define __ODD(x) ((x)&1)
|
||||
|
||||
#define __IN(x, s, size) (((unsigned int)(x))<size && ((((uint##size)(s))>>(x))&1))
|
||||
#define __IN(x, s, size) (((unsigned int)(x))<size && ((((UINT##size)(s))>>(x))&1))
|
||||
// todo tested versions of SETOF and SETRNG: check that x, l and h fit size
|
||||
#define __SETOF(x, size) ((uint##size)1<<(x))
|
||||
#define __SETRNG(l, h, size) ((~(uint##size)0<<(l))&~(uint##size)0>>(size-1-(h)))
|
||||
#define __SETOF(x, size) ((UINT##size)1<<(x))
|
||||
#define __SETRNG(l, h, size) ((~(UINT##size)0<<(l))&~(UINT##size)0>>(size-1-(h)))
|
||||
|
||||
#define __MASK(x, m) ((x)&~(m))
|
||||
#define __BIT(x, n) (*(UINT64*)(x)>>(n)&1)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ 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
|
||||
#define Files_ToAdr(x) (ADDRESS)x
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INT16 errcode)
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
if (buf->org != f->pos) {
|
||||
error = Platform_Seek(f->fd, buf->org, Platform_SeekSet);
|
||||
}
|
||||
error = Platform_Write(f->fd, (address)buf->data, buf->size);
|
||||
error = Platform_Write(f->fd, (ADDRESS)buf->data, buf->size);
|
||||
if (error != 0) {
|
||||
Files_Err((CHAR*)"error writing file", 19, f, error);
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ void Files_ReadBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min);
|
||||
__MOVE((ADDRESS)buf->data + Files_ToAdr(offset), (ADDRESS)x + Files_ToAdr(xpos), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
xpos += min;
|
||||
|
|
@ -703,7 +703,7 @@ void Files_WriteBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min);
|
||||
__MOVE((ADDRESS)x + Files_ToAdr(xpos), (ADDRESS)buf->data + Files_ToAdr(offset), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
if (offset > buf->size) {
|
||||
|
|
@ -760,15 +760,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
|
|||
__DEL(new);
|
||||
return;
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
while (n > 0) {
|
||||
error = Platform_Write(fdnew, (address)buf, n);
|
||||
error = Platform_Write(fdnew, (ADDRESS)buf, n);
|
||||
if (error != 0) {
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
Files_Err((CHAR*)"cannot move file", 17, NIL, error);
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
}
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
|
|
@ -826,7 +826,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
|
|||
j += 1;
|
||||
}
|
||||
} else {
|
||||
__MOVE((address)src, (address)dest, src__len);
|
||||
__MOVE((ADDRESS)src, (ADDRESS)dest, src__len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ void Files_ReadNum (Files_Rider *R, ADDRESS *R__typ, SYSTEM_BYTE *x, LONGINT x__
|
|||
}
|
||||
q += (INT64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
__ASSERT(x__len <= 8, 0);
|
||||
__MOVE((address)&q, (address)x, x__len);
|
||||
__MOVE((ADDRESS)&q, (ADDRESS)x, x__len);
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, ADDRESS *R__typ, BOOLEAN x)
|
||||
|
|
@ -996,7 +996,7 @@ static void Files_Finalize (SYSTEM_PTR o)
|
|||
{
|
||||
Files_File f = NIL;
|
||||
INT32 res;
|
||||
f = (Files_File)(address)o;
|
||||
f = (Files_File)(ADDRESS)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
if (f->tempFile) {
|
||||
|
|
@ -1009,7 +1009,7 @@ void Files_SetSearchPath (CHAR *path, LONGINT path__len)
|
|||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
if (Strings_Length(path, path__len) != 0) {
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((address)((Strings_Length(path, path__len) + 1))));
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((ADDRESS)((Strings_Length(path, path__len) + 1))));
|
||||
__COPY(path, Files_SearchPath->data, Files_SearchPath->len[0]);
|
||||
} else {
|
||||
Files_SearchPath = NIL;
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, LONGINT a__len);
|
|||
export void Heap_Unlock (void);
|
||||
|
||||
extern void *Heap__init();
|
||||
extern address Platform_MainStackFrame;
|
||||
extern address Platform_OSAllocate(address size);
|
||||
extern ADDRESS Platform_MainStackFrame;
|
||||
extern ADDRESS Platform_OSAllocate(ADDRESS size);
|
||||
#define Heap_HeapModuleInit() Heap__init()
|
||||
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
|
||||
#define Heap_PlatformHalt(code) Platform_Halt(code)
|
||||
|
|
@ -138,7 +138,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
|
|||
__COPY(name, m->name, 20);
|
||||
m->refcnt = 0;
|
||||
m->enumPtrs = enumPtrs;
|
||||
m->next = (Heap_Module)(address)Heap_modules;
|
||||
m->next = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
Heap_modules = (SYSTEM_PTR)m;
|
||||
return (void*)m;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ SYSTEM_PTR Heap_NEWREC (INT32 tag)
|
|||
__PUT(adr + 8, 0, INT32);
|
||||
Heap_allocated += blksz;
|
||||
Heap_Unlock();
|
||||
return (SYSTEM_PTR)(address)(adr + 4);
|
||||
return (SYSTEM_PTR)(ADDRESS)(adr + 4);
|
||||
}
|
||||
|
||||
SYSTEM_PTR Heap_NEWBLK (INT32 size)
|
||||
|
|
@ -322,12 +322,12 @@ SYSTEM_PTR Heap_NEWBLK (INT32 size)
|
|||
SYSTEM_PTR new;
|
||||
Heap_Lock();
|
||||
blksz = __ASHL(__ASHR(size + 31, 4), 4);
|
||||
new = Heap_NEWREC((address)&blksz);
|
||||
tag = ((INT32)(address)new + blksz) - 12;
|
||||
new = Heap_NEWREC((ADDRESS)&blksz);
|
||||
tag = ((INT32)(ADDRESS)new + blksz) - 12;
|
||||
__PUT(tag - 4, 0, INT32);
|
||||
__PUT(tag, blksz, INT32);
|
||||
__PUT(tag + 4, -4, INT32);
|
||||
__PUT((INT32)(address)new - 4, tag, INT32);
|
||||
__PUT((INT32)(ADDRESS)new - 4, tag, INT32);
|
||||
Heap_Unlock();
|
||||
return new;
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ static void Heap_Mark (INT32 q)
|
|||
__GET(tag, offset, INT32);
|
||||
fld = q + offset;
|
||||
__GET(fld, p, INT32);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)n, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)n, SYSTEM_PTR);
|
||||
} else {
|
||||
fld = q + offset;
|
||||
__GET(fld, n, INT32);
|
||||
|
|
@ -364,7 +364,7 @@ static void Heap_Mark (INT32 q)
|
|||
if (!__ODD(tagbits)) {
|
||||
__PUT(n - 4, tagbits + 1, INT32);
|
||||
__PUT(q - 4, tag + 1, INT32);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)p, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)p, SYSTEM_PTR);
|
||||
p = q;
|
||||
q = n;
|
||||
tag = tagbits;
|
||||
|
|
@ -379,7 +379,7 @@ static void Heap_Mark (INT32 q)
|
|||
|
||||
static void Heap_MarkP (SYSTEM_PTR p)
|
||||
{
|
||||
Heap_Mark((INT32)(address)p);
|
||||
Heap_Mark((INT32)(ADDRESS)p);
|
||||
}
|
||||
|
||||
static void Heap_Scan (void)
|
||||
|
|
@ -548,7 +548,7 @@ static void Heap_Finalize (void)
|
|||
} else {
|
||||
prev->next = n->next;
|
||||
}
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
if (prev == NIL) {
|
||||
n = Heap_fin;
|
||||
} else {
|
||||
|
|
@ -567,7 +567,7 @@ void Heap_FINALL (void)
|
|||
while (Heap_fin != NIL) {
|
||||
n = Heap_fin;
|
||||
Heap_fin = Heap_fin->next;
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +584,9 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, LONGINT cand__len)
|
|||
}
|
||||
if (n == 0) {
|
||||
nofcand = 0;
|
||||
sp = (address)&frame;
|
||||
sp = (ADDRESS)&frame;
|
||||
stack0 = Heap_PlatformMainStackFrame();
|
||||
inc = (address)&align.p - (address)&align;
|
||||
inc = (ADDRESS)&align.p - (ADDRESS)&align;
|
||||
if (sp > stack0) {
|
||||
inc = -inc;
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ void Heap_GC (BOOLEAN markStack)
|
|||
INT32 cand[10000];
|
||||
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
|
||||
Heap_Lock();
|
||||
m = (Heap_Module)(address)Heap_modules;
|
||||
m = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
while (m != NIL) {
|
||||
if (m->enumPtrs != NIL) {
|
||||
(*m->enumPtrs)(Heap_MarkP);
|
||||
|
|
@ -694,7 +694,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
|
|||
{
|
||||
Heap_FinNode f;
|
||||
__NEW(f, Heap_FinDesc);
|
||||
f->obj = (INT32)(address)obj;
|
||||
f->obj = (INT32)(ADDRESS)obj;
|
||||
f->finalize = finalize;
|
||||
f->marked = 1;
|
||||
f->next = Heap_fin;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ static void OPB_SetIntType (OPT_Node node)
|
|||
static void OPB_SetSetType (OPT_Node node)
|
||||
{
|
||||
INT32 i32;
|
||||
__GET((address)&node->conval->setval + 4, i32, INT32);
|
||||
__GET((ADDRESS)&node->conval->setval + 4, i32, INT32);
|
||||
if (i32 == 0) {
|
||||
node->typ = OPT_set32typ;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static INT16 OPC_indentLevel;
|
||||
static INT8 OPC_hashtab[105];
|
||||
static CHAR OPC_keytab[60][9];
|
||||
static CHAR OPC_keytab[50][9];
|
||||
static BOOLEAN OPC_GlbPtrs;
|
||||
static CHAR OPC_BodyNameExt[13];
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ void OPC_Ident (OPT_Object obj)
|
|||
OPM_WriteStringVar((void*)obj->name, 256);
|
||||
h = OPC_PerfectHash((void*)obj->name, 256);
|
||||
if (OPC_hashtab[__X(h, 105)] >= 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 60)], obj->name) == 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 50)], obj->name) == 0) {
|
||||
OPM_Write('_');
|
||||
}
|
||||
}
|
||||
|
|
@ -1920,7 +1920,7 @@ static void Enter__47 (CHAR *s, LONGINT s__len)
|
|||
__DUP(s, s__len, CHAR);
|
||||
h = OPC_PerfectHash((void*)s, s__len);
|
||||
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 60)], 9);
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
|
||||
*InitKeywords__46_s->n += 1;
|
||||
__DEL(s);
|
||||
}
|
||||
|
|
@ -1947,15 +1947,6 @@ static void OPC_InitKeywords (void)
|
|||
Enter__47((CHAR*)"UINT32", 7);
|
||||
Enter__47((CHAR*)"UINT64", 7);
|
||||
Enter__47((CHAR*)"UINT8", 6);
|
||||
Enter__47((CHAR*)"address", 8);
|
||||
Enter__47((CHAR*)"int16", 6);
|
||||
Enter__47((CHAR*)"int32", 6);
|
||||
Enter__47((CHAR*)"int64", 6);
|
||||
Enter__47((CHAR*)"int8", 5);
|
||||
Enter__47((CHAR*)"uint16", 7);
|
||||
Enter__47((CHAR*)"uint32", 7);
|
||||
Enter__47((CHAR*)"uint64", 7);
|
||||
Enter__47((CHAR*)"uint8", 6);
|
||||
Enter__47((CHAR*)"asm", 4);
|
||||
Enter__47((CHAR*)"auto", 5);
|
||||
Enter__47((CHAR*)"break", 6);
|
||||
|
|
|
|||
|
|
@ -710,15 +710,15 @@ void OPM_FPrintReal (INT32 *fp, REAL real)
|
|||
{
|
||||
INT16 i;
|
||||
INT32 l;
|
||||
__GET((address)&real, l, INT32);
|
||||
__GET((ADDRESS)&real, l, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
}
|
||||
|
||||
void OPM_FPrintLReal (INT32 *fp, LONGREAL lr)
|
||||
{
|
||||
INT32 l, h;
|
||||
__GET((address)&lr, l, INT32);
|
||||
__GET((address)&lr + 4, h, INT32);
|
||||
__GET((ADDRESS)&lr, l, INT32);
|
||||
__GET((ADDRESS)&lr + 4, h, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPM_Write(')');
|
||||
break;
|
||||
case 24:
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
if (l->class == 1) {
|
||||
OPC_CompleteIdent(l->obj);
|
||||
} else {
|
||||
|
|
@ -830,7 +830,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPC_Ident(n->typ->strobj);
|
||||
OPM_Write(')');
|
||||
if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) {
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
}
|
||||
OPV_expr(l, exprPrec);
|
||||
} else {
|
||||
|
|
@ -1204,7 +1204,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
|
|||
if (x->class == 7) {
|
||||
OPC_IntLiteral(x->conval->intval, OPM_AddressSize);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"((address)(", 12);
|
||||
OPM_WriteString((CHAR*)"((ADDRESS)(", 12);
|
||||
OPV_expr(x, 10);
|
||||
OPM_WriteString((CHAR*)"))", 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ export LONGREAL Out_Ten (INT16 e);
|
|||
static void Out_digit (INT64 n, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
static void Out_prepend (CHAR *t, LONGINT t__len, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
|
||||
#define Out_Entier64(x) (int64)(x)
|
||||
#define Out_Entier64(x) (INT64)(x)
|
||||
|
||||
void Out_Flush (void)
|
||||
{
|
||||
INT16 error;
|
||||
if (Out_in > 0) {
|
||||
error = Platform_Write(1, (address)Out_buf, Out_in);
|
||||
error = Platform_Write(1, (ADDRESS)Out_buf, Out_in);
|
||||
}
|
||||
Out_in = 0;
|
||||
}
|
||||
|
|
@ -74,9 +74,9 @@ void Out_String (CHAR *str, LONGINT str__len)
|
|||
Out_Flush();
|
||||
}
|
||||
if (l > 128) {
|
||||
error = Platform_Write(1, (address)str, l);
|
||||
error = Platform_Write(1, (ADDRESS)str, l);
|
||||
} else {
|
||||
__MOVE((address)str, (address)&Out_buf[__X(Out_in, 128)], l);
|
||||
__MOVE((ADDRESS)str, (ADDRESS)&Out_buf[__X(Out_in, 128)], l);
|
||||
Out_in += (INT16)l;
|
||||
}
|
||||
__DEL(str);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ extern void Heap_InitHeap();
|
|||
#define Platform_statdev() (LONGINT)s.st_dev
|
||||
#define Platform_statino() (LONGINT)s.st_ino
|
||||
#define Platform_statmtime() (LONGINT)s.st_mtime
|
||||
#define Platform_statsize() (address)s.st_size
|
||||
#define Platform_statsize() (ADDRESS)s.st_size
|
||||
#define Platform_structstats() struct stat s
|
||||
#define Platform_system(str, str__len) system((char*)str)
|
||||
#define Platform_tmhour() (LONGINT)time->tm_hour
|
||||
|
|
@ -227,7 +227,7 @@ void Platform_Init (INT32 argc, INT32 argvadr)
|
|||
Platform_ArgVecPtr av = NIL;
|
||||
Platform_MainStackFrame = argvadr;
|
||||
Platform_ArgCount = __VAL(INT16, argc);
|
||||
av = (Platform_ArgVecPtr)(address)argvadr;
|
||||
av = (Platform_ArgVecPtr)(ADDRESS)argvadr;
|
||||
Platform_ArgVector = (*av)[0];
|
||||
Platform_HaltCode = -128;
|
||||
Platform_HeapInitHeap();
|
||||
|
|
@ -258,7 +258,7 @@ void Platform_GetArg (INT16 n, CHAR *val, LONGINT val__len)
|
|||
{
|
||||
Platform_ArgVec av = NIL;
|
||||
if (n < Platform_ArgCount) {
|
||||
av = (Platform_ArgVec)(address)Platform_ArgVector;
|
||||
av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector;
|
||||
__COPY(*(*av)[__X(n, 1024)], val, val__len);
|
||||
}
|
||||
}
|
||||
|
|
@ -488,7 +488,7 @@ INT16 Platform_Read (INT32 h, INT32 p, INT32 l, INT32 *n)
|
|||
|
||||
INT16 Platform_ReadBuf (INT32 h, SYSTEM_BYTE *b, LONGINT b__len, INT32 *n)
|
||||
{
|
||||
*n = Platform_readfile(h, (address)b, b__len);
|
||||
*n = Platform_readfile(h, (ADDRESS)b, b__len);
|
||||
if (*n < 0) {
|
||||
*n = 0;
|
||||
return Platform_err();
|
||||
|
|
@ -696,7 +696,7 @@ static void Platform_TestLittleEndian (void)
|
|||
{
|
||||
INT16 i;
|
||||
i = 1;
|
||||
__GET((address)&i, Platform_LittleEndian, BOOLEAN);
|
||||
__GET((ADDRESS)&i, Platform_LittleEndian, BOOLEAN);
|
||||
}
|
||||
|
||||
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 12), {-4}};
|
||||
|
|
|
|||
|
|
@ -59,23 +59,23 @@ LONGREAL Reals_TenL (INT16 e)
|
|||
INT16 Reals_Expo (REAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 2, i, INT16);
|
||||
__GET((ADDRESS)&x + 2, i, INT16);
|
||||
return __MASK(__ASHR(i, 7), -256);
|
||||
}
|
||||
|
||||
void Reals_SetExpo (REAL *x, INT16 ex)
|
||||
{
|
||||
CHAR c;
|
||||
__GET((address)x + 3, c, CHAR);
|
||||
__PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((address)x + 2, c, CHAR);
|
||||
__PUT((address)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
__GET((ADDRESS)x + 3, c, CHAR);
|
||||
__PUT((ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((ADDRESS)x + 2, c, CHAR);
|
||||
__PUT((ADDRESS)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
}
|
||||
|
||||
INT16 Reals_ExpoL (LONGREAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 6, i, INT16);
|
||||
__GET((ADDRESS)&x + 6, i, INT16);
|
||||
return __MASK(__ASHR(i, 4), -2048);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ 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
|
||||
#define Files_ToAdr(x) (ADDRESS)x
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INT16 errcode)
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
if (buf->org != f->pos) {
|
||||
error = Platform_Seek(f->fd, buf->org, Platform_SeekSet);
|
||||
}
|
||||
error = Platform_Write(f->fd, (address)buf->data, buf->size);
|
||||
error = Platform_Write(f->fd, (ADDRESS)buf->data, buf->size);
|
||||
if (error != 0) {
|
||||
Files_Err((CHAR*)"error writing file", 19, f, error);
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ void Files_ReadBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min);
|
||||
__MOVE((ADDRESS)buf->data + Files_ToAdr(offset), (ADDRESS)x + Files_ToAdr(xpos), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
xpos += min;
|
||||
|
|
@ -703,7 +703,7 @@ void Files_WriteBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min);
|
||||
__MOVE((ADDRESS)x + Files_ToAdr(xpos), (ADDRESS)buf->data + Files_ToAdr(offset), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
if (offset > buf->size) {
|
||||
|
|
@ -760,15 +760,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
|
|||
__DEL(new);
|
||||
return;
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
while (n > 0) {
|
||||
error = Platform_Write(fdnew, (address)buf, n);
|
||||
error = Platform_Write(fdnew, (ADDRESS)buf, n);
|
||||
if (error != 0) {
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
Files_Err((CHAR*)"cannot move file", 17, NIL, error);
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
}
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
|
|
@ -826,7 +826,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
|
|||
j += 1;
|
||||
}
|
||||
} else {
|
||||
__MOVE((address)src, (address)dest, src__len);
|
||||
__MOVE((ADDRESS)src, (ADDRESS)dest, src__len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ void Files_ReadNum (Files_Rider *R, ADDRESS *R__typ, SYSTEM_BYTE *x, LONGINT x__
|
|||
}
|
||||
q += (INT64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
__ASSERT(x__len <= 8, 0);
|
||||
__MOVE((address)&q, (address)x, x__len);
|
||||
__MOVE((ADDRESS)&q, (ADDRESS)x, x__len);
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, ADDRESS *R__typ, BOOLEAN x)
|
||||
|
|
@ -996,7 +996,7 @@ static void Files_Finalize (SYSTEM_PTR o)
|
|||
{
|
||||
Files_File f = NIL;
|
||||
INT32 res;
|
||||
f = (Files_File)(address)o;
|
||||
f = (Files_File)(ADDRESS)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
if (f->tempFile) {
|
||||
|
|
@ -1009,7 +1009,7 @@ void Files_SetSearchPath (CHAR *path, LONGINT path__len)
|
|||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
if (Strings_Length(path, path__len) != 0) {
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((address)((Strings_Length(path, path__len) + 1))));
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((ADDRESS)((Strings_Length(path, path__len) + 1))));
|
||||
__COPY(path, Files_SearchPath->data, Files_SearchPath->len[0]);
|
||||
} else {
|
||||
Files_SearchPath = NIL;
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, LONGINT a__len);
|
|||
export void Heap_Unlock (void);
|
||||
|
||||
extern void *Heap__init();
|
||||
extern address Platform_MainStackFrame;
|
||||
extern address Platform_OSAllocate(address size);
|
||||
extern ADDRESS Platform_MainStackFrame;
|
||||
extern ADDRESS Platform_OSAllocate(ADDRESS size);
|
||||
#define Heap_HeapModuleInit() Heap__init()
|
||||
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
|
||||
#define Heap_PlatformHalt(code) Platform_Halt(code)
|
||||
|
|
@ -138,7 +138,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
|
|||
__COPY(name, m->name, 20);
|
||||
m->refcnt = 0;
|
||||
m->enumPtrs = enumPtrs;
|
||||
m->next = (Heap_Module)(address)Heap_modules;
|
||||
m->next = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
Heap_modules = (SYSTEM_PTR)m;
|
||||
return (void*)m;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ SYSTEM_PTR Heap_NEWREC (INT32 tag)
|
|||
__PUT(adr + 8, 0, INT32);
|
||||
Heap_allocated += blksz;
|
||||
Heap_Unlock();
|
||||
return (SYSTEM_PTR)(address)(adr + 4);
|
||||
return (SYSTEM_PTR)(ADDRESS)(adr + 4);
|
||||
}
|
||||
|
||||
SYSTEM_PTR Heap_NEWBLK (INT32 size)
|
||||
|
|
@ -322,12 +322,12 @@ SYSTEM_PTR Heap_NEWBLK (INT32 size)
|
|||
SYSTEM_PTR new;
|
||||
Heap_Lock();
|
||||
blksz = __ASHL(__ASHR(size + 31, 4), 4);
|
||||
new = Heap_NEWREC((address)&blksz);
|
||||
tag = ((INT32)(address)new + blksz) - 12;
|
||||
new = Heap_NEWREC((ADDRESS)&blksz);
|
||||
tag = ((INT32)(ADDRESS)new + blksz) - 12;
|
||||
__PUT(tag - 4, 0, INT32);
|
||||
__PUT(tag, blksz, INT32);
|
||||
__PUT(tag + 4, -4, INT32);
|
||||
__PUT((INT32)(address)new - 4, tag, INT32);
|
||||
__PUT((INT32)(ADDRESS)new - 4, tag, INT32);
|
||||
Heap_Unlock();
|
||||
return new;
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ static void Heap_Mark (INT32 q)
|
|||
__GET(tag, offset, INT32);
|
||||
fld = q + offset;
|
||||
__GET(fld, p, INT32);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)n, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)n, SYSTEM_PTR);
|
||||
} else {
|
||||
fld = q + offset;
|
||||
__GET(fld, n, INT32);
|
||||
|
|
@ -364,7 +364,7 @@ static void Heap_Mark (INT32 q)
|
|||
if (!__ODD(tagbits)) {
|
||||
__PUT(n - 4, tagbits + 1, INT32);
|
||||
__PUT(q - 4, tag + 1, INT32);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)p, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)p, SYSTEM_PTR);
|
||||
p = q;
|
||||
q = n;
|
||||
tag = tagbits;
|
||||
|
|
@ -379,7 +379,7 @@ static void Heap_Mark (INT32 q)
|
|||
|
||||
static void Heap_MarkP (SYSTEM_PTR p)
|
||||
{
|
||||
Heap_Mark((INT32)(address)p);
|
||||
Heap_Mark((INT32)(ADDRESS)p);
|
||||
}
|
||||
|
||||
static void Heap_Scan (void)
|
||||
|
|
@ -548,7 +548,7 @@ static void Heap_Finalize (void)
|
|||
} else {
|
||||
prev->next = n->next;
|
||||
}
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
if (prev == NIL) {
|
||||
n = Heap_fin;
|
||||
} else {
|
||||
|
|
@ -567,7 +567,7 @@ void Heap_FINALL (void)
|
|||
while (Heap_fin != NIL) {
|
||||
n = Heap_fin;
|
||||
Heap_fin = Heap_fin->next;
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +584,9 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, LONGINT cand__len)
|
|||
}
|
||||
if (n == 0) {
|
||||
nofcand = 0;
|
||||
sp = (address)&frame;
|
||||
sp = (ADDRESS)&frame;
|
||||
stack0 = Heap_PlatformMainStackFrame();
|
||||
inc = (address)&align.p - (address)&align;
|
||||
inc = (ADDRESS)&align.p - (ADDRESS)&align;
|
||||
if (sp > stack0) {
|
||||
inc = -inc;
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ void Heap_GC (BOOLEAN markStack)
|
|||
INT32 cand[10000];
|
||||
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
|
||||
Heap_Lock();
|
||||
m = (Heap_Module)(address)Heap_modules;
|
||||
m = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
while (m != NIL) {
|
||||
if (m->enumPtrs != NIL) {
|
||||
(*m->enumPtrs)(Heap_MarkP);
|
||||
|
|
@ -694,7 +694,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
|
|||
{
|
||||
Heap_FinNode f;
|
||||
__NEW(f, Heap_FinDesc);
|
||||
f->obj = (INT32)(address)obj;
|
||||
f->obj = (INT32)(ADDRESS)obj;
|
||||
f->finalize = finalize;
|
||||
f->marked = 1;
|
||||
f->next = Heap_fin;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ static void OPB_SetIntType (OPT_Node node)
|
|||
static void OPB_SetSetType (OPT_Node node)
|
||||
{
|
||||
INT32 i32;
|
||||
__GET((address)&node->conval->setval + 4, i32, INT32);
|
||||
__GET((ADDRESS)&node->conval->setval + 4, i32, INT32);
|
||||
if (i32 == 0) {
|
||||
node->typ = OPT_set32typ;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static INT16 OPC_indentLevel;
|
||||
static INT8 OPC_hashtab[105];
|
||||
static CHAR OPC_keytab[60][9];
|
||||
static CHAR OPC_keytab[50][9];
|
||||
static BOOLEAN OPC_GlbPtrs;
|
||||
static CHAR OPC_BodyNameExt[13];
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ void OPC_Ident (OPT_Object obj)
|
|||
OPM_WriteStringVar((void*)obj->name, 256);
|
||||
h = OPC_PerfectHash((void*)obj->name, 256);
|
||||
if (OPC_hashtab[__X(h, 105)] >= 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 60)], obj->name) == 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 50)], obj->name) == 0) {
|
||||
OPM_Write('_');
|
||||
}
|
||||
}
|
||||
|
|
@ -1920,7 +1920,7 @@ static void Enter__47 (CHAR *s, LONGINT s__len)
|
|||
__DUP(s, s__len, CHAR);
|
||||
h = OPC_PerfectHash((void*)s, s__len);
|
||||
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 60)], 9);
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
|
||||
*InitKeywords__46_s->n += 1;
|
||||
__DEL(s);
|
||||
}
|
||||
|
|
@ -1947,15 +1947,6 @@ static void OPC_InitKeywords (void)
|
|||
Enter__47((CHAR*)"UINT32", 7);
|
||||
Enter__47((CHAR*)"UINT64", 7);
|
||||
Enter__47((CHAR*)"UINT8", 6);
|
||||
Enter__47((CHAR*)"address", 8);
|
||||
Enter__47((CHAR*)"int16", 6);
|
||||
Enter__47((CHAR*)"int32", 6);
|
||||
Enter__47((CHAR*)"int64", 6);
|
||||
Enter__47((CHAR*)"int8", 5);
|
||||
Enter__47((CHAR*)"uint16", 7);
|
||||
Enter__47((CHAR*)"uint32", 7);
|
||||
Enter__47((CHAR*)"uint64", 7);
|
||||
Enter__47((CHAR*)"uint8", 6);
|
||||
Enter__47((CHAR*)"asm", 4);
|
||||
Enter__47((CHAR*)"auto", 5);
|
||||
Enter__47((CHAR*)"break", 6);
|
||||
|
|
|
|||
|
|
@ -710,15 +710,15 @@ void OPM_FPrintReal (INT32 *fp, REAL real)
|
|||
{
|
||||
INT16 i;
|
||||
INT32 l;
|
||||
__GET((address)&real, l, INT32);
|
||||
__GET((ADDRESS)&real, l, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
}
|
||||
|
||||
void OPM_FPrintLReal (INT32 *fp, LONGREAL lr)
|
||||
{
|
||||
INT32 l, h;
|
||||
__GET((address)&lr, l, INT32);
|
||||
__GET((address)&lr + 4, h, INT32);
|
||||
__GET((ADDRESS)&lr, l, INT32);
|
||||
__GET((ADDRESS)&lr + 4, h, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPM_Write(')');
|
||||
break;
|
||||
case 24:
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
if (l->class == 1) {
|
||||
OPC_CompleteIdent(l->obj);
|
||||
} else {
|
||||
|
|
@ -830,7 +830,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPC_Ident(n->typ->strobj);
|
||||
OPM_Write(')');
|
||||
if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) {
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
}
|
||||
OPV_expr(l, exprPrec);
|
||||
} else {
|
||||
|
|
@ -1204,7 +1204,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
|
|||
if (x->class == 7) {
|
||||
OPC_IntLiteral(x->conval->intval, OPM_AddressSize);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"((address)(", 12);
|
||||
OPM_WriteString((CHAR*)"((ADDRESS)(", 12);
|
||||
OPV_expr(x, 10);
|
||||
OPM_WriteString((CHAR*)"))", 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ export LONGREAL Out_Ten (INT16 e);
|
|||
static void Out_digit (INT64 n, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
static void Out_prepend (CHAR *t, LONGINT t__len, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
|
||||
#define Out_Entier64(x) (int64)(x)
|
||||
#define Out_Entier64(x) (INT64)(x)
|
||||
|
||||
void Out_Flush (void)
|
||||
{
|
||||
INT16 error;
|
||||
if (Out_in > 0) {
|
||||
error = Platform_Write(1, (address)Out_buf, Out_in);
|
||||
error = Platform_Write(1, (ADDRESS)Out_buf, Out_in);
|
||||
}
|
||||
Out_in = 0;
|
||||
}
|
||||
|
|
@ -74,9 +74,9 @@ void Out_String (CHAR *str, LONGINT str__len)
|
|||
Out_Flush();
|
||||
}
|
||||
if (l > 128) {
|
||||
error = Platform_Write(1, (address)str, l);
|
||||
error = Platform_Write(1, (ADDRESS)str, l);
|
||||
} else {
|
||||
__MOVE((address)str, (address)&Out_buf[__X(Out_in, 128)], l);
|
||||
__MOVE((ADDRESS)str, (ADDRESS)&Out_buf[__X(Out_in, 128)], l);
|
||||
Out_in += (INT16)l;
|
||||
}
|
||||
__DEL(str);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ extern void Heap_InitHeap();
|
|||
#define Platform_statdev() (LONGINT)s.st_dev
|
||||
#define Platform_statino() (LONGINT)s.st_ino
|
||||
#define Platform_statmtime() (LONGINT)s.st_mtime
|
||||
#define Platform_statsize() (address)s.st_size
|
||||
#define Platform_statsize() (ADDRESS)s.st_size
|
||||
#define Platform_structstats() struct stat s
|
||||
#define Platform_system(str, str__len) system((char*)str)
|
||||
#define Platform_tmhour() (LONGINT)time->tm_hour
|
||||
|
|
@ -227,7 +227,7 @@ void Platform_Init (INT32 argc, INT32 argvadr)
|
|||
Platform_ArgVecPtr av = NIL;
|
||||
Platform_MainStackFrame = argvadr;
|
||||
Platform_ArgCount = __VAL(INT16, argc);
|
||||
av = (Platform_ArgVecPtr)(address)argvadr;
|
||||
av = (Platform_ArgVecPtr)(ADDRESS)argvadr;
|
||||
Platform_ArgVector = (*av)[0];
|
||||
Platform_HaltCode = -128;
|
||||
Platform_HeapInitHeap();
|
||||
|
|
@ -258,7 +258,7 @@ void Platform_GetArg (INT16 n, CHAR *val, LONGINT val__len)
|
|||
{
|
||||
Platform_ArgVec av = NIL;
|
||||
if (n < Platform_ArgCount) {
|
||||
av = (Platform_ArgVec)(address)Platform_ArgVector;
|
||||
av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector;
|
||||
__COPY(*(*av)[__X(n, 1024)], val, val__len);
|
||||
}
|
||||
}
|
||||
|
|
@ -488,7 +488,7 @@ INT16 Platform_Read (INT32 h, INT32 p, INT32 l, INT32 *n)
|
|||
|
||||
INT16 Platform_ReadBuf (INT32 h, SYSTEM_BYTE *b, LONGINT b__len, INT32 *n)
|
||||
{
|
||||
*n = Platform_readfile(h, (address)b, b__len);
|
||||
*n = Platform_readfile(h, (ADDRESS)b, b__len);
|
||||
if (*n < 0) {
|
||||
*n = 0;
|
||||
return Platform_err();
|
||||
|
|
@ -696,7 +696,7 @@ static void Platform_TestLittleEndian (void)
|
|||
{
|
||||
INT16 i;
|
||||
i = 1;
|
||||
__GET((address)&i, Platform_LittleEndian, BOOLEAN);
|
||||
__GET((ADDRESS)&i, Platform_LittleEndian, BOOLEAN);
|
||||
}
|
||||
|
||||
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 12), {-4}};
|
||||
|
|
|
|||
|
|
@ -59,23 +59,23 @@ LONGREAL Reals_TenL (INT16 e)
|
|||
INT16 Reals_Expo (REAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 2, i, INT16);
|
||||
__GET((ADDRESS)&x + 2, i, INT16);
|
||||
return __MASK(__ASHR(i, 7), -256);
|
||||
}
|
||||
|
||||
void Reals_SetExpo (REAL *x, INT16 ex)
|
||||
{
|
||||
CHAR c;
|
||||
__GET((address)x + 3, c, CHAR);
|
||||
__PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((address)x + 2, c, CHAR);
|
||||
__PUT((address)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
__GET((ADDRESS)x + 3, c, CHAR);
|
||||
__PUT((ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((ADDRESS)x + 2, c, CHAR);
|
||||
__PUT((ADDRESS)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
}
|
||||
|
||||
INT16 Reals_ExpoL (LONGREAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 6, i, INT16);
|
||||
__GET((ADDRESS)&x + 6, i, INT16);
|
||||
return __MASK(__ASHR(i, 4), -2048);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ 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
|
||||
#define Files_ToAdr(x) (ADDRESS)x
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INT16 errcode)
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
if (buf->org != f->pos) {
|
||||
error = Platform_Seek(f->fd, buf->org, Platform_SeekSet);
|
||||
}
|
||||
error = Platform_Write(f->fd, (address)buf->data, buf->size);
|
||||
error = Platform_Write(f->fd, (ADDRESS)buf->data, buf->size);
|
||||
if (error != 0) {
|
||||
Files_Err((CHAR*)"error writing file", 19, f, error);
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ void Files_ReadBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min);
|
||||
__MOVE((ADDRESS)buf->data + Files_ToAdr(offset), (ADDRESS)x + Files_ToAdr(xpos), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
xpos += min;
|
||||
|
|
@ -703,7 +703,7 @@ void Files_WriteBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min);
|
||||
__MOVE((ADDRESS)x + Files_ToAdr(xpos), (ADDRESS)buf->data + Files_ToAdr(offset), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
if (offset > buf->size) {
|
||||
|
|
@ -760,15 +760,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
|
|||
__DEL(new);
|
||||
return;
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
while (n > 0) {
|
||||
error = Platform_Write(fdnew, (address)buf, n);
|
||||
error = Platform_Write(fdnew, (ADDRESS)buf, n);
|
||||
if (error != 0) {
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
Files_Err((CHAR*)"cannot move file", 17, NIL, error);
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
}
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
|
|
@ -826,7 +826,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
|
|||
j += 1;
|
||||
}
|
||||
} else {
|
||||
__MOVE((address)src, (address)dest, src__len);
|
||||
__MOVE((ADDRESS)src, (ADDRESS)dest, src__len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ void Files_ReadNum (Files_Rider *R, ADDRESS *R__typ, SYSTEM_BYTE *x, LONGINT x__
|
|||
}
|
||||
q += (INT64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
__ASSERT(x__len <= 8, 0);
|
||||
__MOVE((address)&q, (address)x, x__len);
|
||||
__MOVE((ADDRESS)&q, (ADDRESS)x, x__len);
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, ADDRESS *R__typ, BOOLEAN x)
|
||||
|
|
@ -996,7 +996,7 @@ static void Files_Finalize (SYSTEM_PTR o)
|
|||
{
|
||||
Files_File f = NIL;
|
||||
INT32 res;
|
||||
f = (Files_File)(address)o;
|
||||
f = (Files_File)(ADDRESS)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
if (f->tempFile) {
|
||||
|
|
@ -1009,7 +1009,7 @@ void Files_SetSearchPath (CHAR *path, LONGINT path__len)
|
|||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
if (Strings_Length(path, path__len) != 0) {
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((address)((Strings_Length(path, path__len) + 1))));
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((ADDRESS)((Strings_Length(path, path__len) + 1))));
|
||||
__COPY(path, Files_SearchPath->data, Files_SearchPath->len[0]);
|
||||
} else {
|
||||
Files_SearchPath = NIL;
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ static void Heap_Sift (INT64 l, INT64 r, INT64 *a, LONGINT a__len);
|
|||
export void Heap_Unlock (void);
|
||||
|
||||
extern void *Heap__init();
|
||||
extern address Platform_MainStackFrame;
|
||||
extern address Platform_OSAllocate(address size);
|
||||
extern ADDRESS Platform_MainStackFrame;
|
||||
extern ADDRESS Platform_OSAllocate(ADDRESS size);
|
||||
#define Heap_HeapModuleInit() Heap__init()
|
||||
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
|
||||
#define Heap_PlatformHalt(code) Platform_Halt(code)
|
||||
|
|
@ -138,7 +138,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
|
|||
__COPY(name, m->name, 20);
|
||||
m->refcnt = 0;
|
||||
m->enumPtrs = enumPtrs;
|
||||
m->next = (Heap_Module)(address)Heap_modules;
|
||||
m->next = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
Heap_modules = (SYSTEM_PTR)m;
|
||||
return (void*)m;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ SYSTEM_PTR Heap_NEWREC (INT64 tag)
|
|||
__PUT(adr + 16, 0, INT64);
|
||||
Heap_allocated += blksz;
|
||||
Heap_Unlock();
|
||||
return (SYSTEM_PTR)(address)(adr + 8);
|
||||
return (SYSTEM_PTR)(ADDRESS)(adr + 8);
|
||||
}
|
||||
|
||||
SYSTEM_PTR Heap_NEWBLK (INT64 size)
|
||||
|
|
@ -322,12 +322,12 @@ SYSTEM_PTR Heap_NEWBLK (INT64 size)
|
|||
SYSTEM_PTR new;
|
||||
Heap_Lock();
|
||||
blksz = __ASHL(__ASHR(size + 63, 5), 5);
|
||||
new = Heap_NEWREC((address)&blksz);
|
||||
tag = ((INT64)(address)new + blksz) - 24;
|
||||
new = Heap_NEWREC((ADDRESS)&blksz);
|
||||
tag = ((INT64)(ADDRESS)new + blksz) - 24;
|
||||
__PUT(tag - 8, 0, INT64);
|
||||
__PUT(tag, blksz, INT64);
|
||||
__PUT(tag + 8, -8, INT64);
|
||||
__PUT((INT64)(address)new - 8, tag, INT64);
|
||||
__PUT((INT64)(ADDRESS)new - 8, tag, INT64);
|
||||
Heap_Unlock();
|
||||
return new;
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ static void Heap_Mark (INT64 q)
|
|||
__GET(tag, offset, INT64);
|
||||
fld = q + offset;
|
||||
__GET(fld, p, INT64);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)n, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)n, SYSTEM_PTR);
|
||||
} else {
|
||||
fld = q + offset;
|
||||
__GET(fld, n, INT64);
|
||||
|
|
@ -364,7 +364,7 @@ static void Heap_Mark (INT64 q)
|
|||
if (!__ODD(tagbits)) {
|
||||
__PUT(n - 8, tagbits + 1, INT64);
|
||||
__PUT(q - 8, tag + 1, INT64);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)p, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)p, SYSTEM_PTR);
|
||||
p = q;
|
||||
q = n;
|
||||
tag = tagbits;
|
||||
|
|
@ -379,7 +379,7 @@ static void Heap_Mark (INT64 q)
|
|||
|
||||
static void Heap_MarkP (SYSTEM_PTR p)
|
||||
{
|
||||
Heap_Mark((INT64)(address)p);
|
||||
Heap_Mark((INT64)(ADDRESS)p);
|
||||
}
|
||||
|
||||
static void Heap_Scan (void)
|
||||
|
|
@ -548,7 +548,7 @@ static void Heap_Finalize (void)
|
|||
} else {
|
||||
prev->next = n->next;
|
||||
}
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
if (prev == NIL) {
|
||||
n = Heap_fin;
|
||||
} else {
|
||||
|
|
@ -567,7 +567,7 @@ void Heap_FINALL (void)
|
|||
while (Heap_fin != NIL) {
|
||||
n = Heap_fin;
|
||||
Heap_fin = Heap_fin->next;
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +584,9 @@ static void Heap_MarkStack (INT64 n, INT64 *cand, LONGINT cand__len)
|
|||
}
|
||||
if (n == 0) {
|
||||
nofcand = 0;
|
||||
sp = (address)&frame;
|
||||
sp = (ADDRESS)&frame;
|
||||
stack0 = Heap_PlatformMainStackFrame();
|
||||
inc = (address)&align.p - (address)&align;
|
||||
inc = (ADDRESS)&align.p - (ADDRESS)&align;
|
||||
if (sp > stack0) {
|
||||
inc = -inc;
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ void Heap_GC (BOOLEAN markStack)
|
|||
INT64 cand[10000];
|
||||
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
|
||||
Heap_Lock();
|
||||
m = (Heap_Module)(address)Heap_modules;
|
||||
m = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
while (m != NIL) {
|
||||
if (m->enumPtrs != NIL) {
|
||||
(*m->enumPtrs)(Heap_MarkP);
|
||||
|
|
@ -694,7 +694,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
|
|||
{
|
||||
Heap_FinNode f;
|
||||
__NEW(f, Heap_FinDesc);
|
||||
f->obj = (INT64)(address)obj;
|
||||
f->obj = (INT64)(ADDRESS)obj;
|
||||
f->finalize = finalize;
|
||||
f->marked = 1;
|
||||
f->next = Heap_fin;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ static void OPB_SetIntType (OPT_Node node)
|
|||
static void OPB_SetSetType (OPT_Node node)
|
||||
{
|
||||
INT32 i32;
|
||||
__GET((address)&node->conval->setval + 4, i32, INT32);
|
||||
__GET((ADDRESS)&node->conval->setval + 4, i32, INT32);
|
||||
if (i32 == 0) {
|
||||
node->typ = OPT_set32typ;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static INT16 OPC_indentLevel;
|
||||
static INT8 OPC_hashtab[105];
|
||||
static CHAR OPC_keytab[60][9];
|
||||
static CHAR OPC_keytab[50][9];
|
||||
static BOOLEAN OPC_GlbPtrs;
|
||||
static CHAR OPC_BodyNameExt[13];
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ void OPC_Ident (OPT_Object obj)
|
|||
OPM_WriteStringVar((void*)obj->name, 256);
|
||||
h = OPC_PerfectHash((void*)obj->name, 256);
|
||||
if (OPC_hashtab[__X(h, 105)] >= 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 60)], obj->name) == 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 50)], obj->name) == 0) {
|
||||
OPM_Write('_');
|
||||
}
|
||||
}
|
||||
|
|
@ -1920,7 +1920,7 @@ static void Enter__47 (CHAR *s, LONGINT s__len)
|
|||
__DUP(s, s__len, CHAR);
|
||||
h = OPC_PerfectHash((void*)s, s__len);
|
||||
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 60)], 9);
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
|
||||
*InitKeywords__46_s->n += 1;
|
||||
__DEL(s);
|
||||
}
|
||||
|
|
@ -1947,15 +1947,6 @@ static void OPC_InitKeywords (void)
|
|||
Enter__47((CHAR*)"UINT32", 7);
|
||||
Enter__47((CHAR*)"UINT64", 7);
|
||||
Enter__47((CHAR*)"UINT8", 6);
|
||||
Enter__47((CHAR*)"address", 8);
|
||||
Enter__47((CHAR*)"int16", 6);
|
||||
Enter__47((CHAR*)"int32", 6);
|
||||
Enter__47((CHAR*)"int64", 6);
|
||||
Enter__47((CHAR*)"int8", 5);
|
||||
Enter__47((CHAR*)"uint16", 7);
|
||||
Enter__47((CHAR*)"uint32", 7);
|
||||
Enter__47((CHAR*)"uint64", 7);
|
||||
Enter__47((CHAR*)"uint8", 6);
|
||||
Enter__47((CHAR*)"asm", 4);
|
||||
Enter__47((CHAR*)"auto", 5);
|
||||
Enter__47((CHAR*)"break", 6);
|
||||
|
|
|
|||
|
|
@ -710,15 +710,15 @@ void OPM_FPrintReal (INT32 *fp, REAL real)
|
|||
{
|
||||
INT16 i;
|
||||
INT32 l;
|
||||
__GET((address)&real, l, INT32);
|
||||
__GET((ADDRESS)&real, l, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
}
|
||||
|
||||
void OPM_FPrintLReal (INT32 *fp, LONGREAL lr)
|
||||
{
|
||||
INT32 l, h;
|
||||
__GET((address)&lr, l, INT32);
|
||||
__GET((address)&lr + 4, h, INT32);
|
||||
__GET((ADDRESS)&lr, l, INT32);
|
||||
__GET((ADDRESS)&lr + 4, h, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPM_Write(')');
|
||||
break;
|
||||
case 24:
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
if (l->class == 1) {
|
||||
OPC_CompleteIdent(l->obj);
|
||||
} else {
|
||||
|
|
@ -830,7 +830,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPC_Ident(n->typ->strobj);
|
||||
OPM_Write(')');
|
||||
if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) {
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
}
|
||||
OPV_expr(l, exprPrec);
|
||||
} else {
|
||||
|
|
@ -1204,7 +1204,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
|
|||
if (x->class == 7) {
|
||||
OPC_IntLiteral(x->conval->intval, OPM_AddressSize);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"((address)(", 12);
|
||||
OPM_WriteString((CHAR*)"((ADDRESS)(", 12);
|
||||
OPV_expr(x, 10);
|
||||
OPM_WriteString((CHAR*)"))", 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ export LONGREAL Out_Ten (INT16 e);
|
|||
static void Out_digit (INT64 n, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
static void Out_prepend (CHAR *t, LONGINT t__len, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
|
||||
#define Out_Entier64(x) (int64)(x)
|
||||
#define Out_Entier64(x) (INT64)(x)
|
||||
|
||||
void Out_Flush (void)
|
||||
{
|
||||
INT16 error;
|
||||
if (Out_in > 0) {
|
||||
error = Platform_Write(1, (address)Out_buf, Out_in);
|
||||
error = Platform_Write(1, (ADDRESS)Out_buf, Out_in);
|
||||
}
|
||||
Out_in = 0;
|
||||
}
|
||||
|
|
@ -74,9 +74,9 @@ void Out_String (CHAR *str, LONGINT str__len)
|
|||
Out_Flush();
|
||||
}
|
||||
if (l > 128) {
|
||||
error = Platform_Write(1, (address)str, l);
|
||||
error = Platform_Write(1, (ADDRESS)str, l);
|
||||
} else {
|
||||
__MOVE((address)str, (address)&Out_buf[__X(Out_in, 128)], l);
|
||||
__MOVE((ADDRESS)str, (ADDRESS)&Out_buf[__X(Out_in, 128)], l);
|
||||
Out_in += (INT16)l;
|
||||
}
|
||||
__DEL(str);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ extern void Heap_InitHeap();
|
|||
#define Platform_statdev() (LONGINT)s.st_dev
|
||||
#define Platform_statino() (LONGINT)s.st_ino
|
||||
#define Platform_statmtime() (LONGINT)s.st_mtime
|
||||
#define Platform_statsize() (address)s.st_size
|
||||
#define Platform_statsize() (ADDRESS)s.st_size
|
||||
#define Platform_structstats() struct stat s
|
||||
#define Platform_system(str, str__len) system((char*)str)
|
||||
#define Platform_tmhour() (LONGINT)time->tm_hour
|
||||
|
|
@ -227,7 +227,7 @@ void Platform_Init (INT32 argc, INT64 argvadr)
|
|||
Platform_ArgVecPtr av = NIL;
|
||||
Platform_MainStackFrame = argvadr;
|
||||
Platform_ArgCount = __VAL(INT16, argc);
|
||||
av = (Platform_ArgVecPtr)(address)argvadr;
|
||||
av = (Platform_ArgVecPtr)(ADDRESS)argvadr;
|
||||
Platform_ArgVector = (*av)[0];
|
||||
Platform_HaltCode = -128;
|
||||
Platform_HeapInitHeap();
|
||||
|
|
@ -258,7 +258,7 @@ void Platform_GetArg (INT16 n, CHAR *val, LONGINT val__len)
|
|||
{
|
||||
Platform_ArgVec av = NIL;
|
||||
if (n < Platform_ArgCount) {
|
||||
av = (Platform_ArgVec)(address)Platform_ArgVector;
|
||||
av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector;
|
||||
__COPY(*(*av)[__X(n, 1024)], val, val__len);
|
||||
}
|
||||
}
|
||||
|
|
@ -488,7 +488,7 @@ INT16 Platform_Read (INT32 h, INT64 p, INT32 l, INT32 *n)
|
|||
|
||||
INT16 Platform_ReadBuf (INT32 h, SYSTEM_BYTE *b, LONGINT b__len, INT32 *n)
|
||||
{
|
||||
*n = Platform_readfile(h, (address)b, b__len);
|
||||
*n = Platform_readfile(h, (ADDRESS)b, b__len);
|
||||
if (*n < 0) {
|
||||
*n = 0;
|
||||
return Platform_err();
|
||||
|
|
@ -696,7 +696,7 @@ static void Platform_TestLittleEndian (void)
|
|||
{
|
||||
INT16 i;
|
||||
i = 1;
|
||||
__GET((address)&i, Platform_LittleEndian, BOOLEAN);
|
||||
__GET((ADDRESS)&i, Platform_LittleEndian, BOOLEAN);
|
||||
}
|
||||
|
||||
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 12), {-8}};
|
||||
|
|
|
|||
|
|
@ -59,23 +59,23 @@ LONGREAL Reals_TenL (INT16 e)
|
|||
INT16 Reals_Expo (REAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 2, i, INT16);
|
||||
__GET((ADDRESS)&x + 2, i, INT16);
|
||||
return __MASK(__ASHR(i, 7), -256);
|
||||
}
|
||||
|
||||
void Reals_SetExpo (REAL *x, INT16 ex)
|
||||
{
|
||||
CHAR c;
|
||||
__GET((address)x + 3, c, CHAR);
|
||||
__PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((address)x + 2, c, CHAR);
|
||||
__PUT((address)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
__GET((ADDRESS)x + 3, c, CHAR);
|
||||
__PUT((ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((ADDRESS)x + 2, c, CHAR);
|
||||
__PUT((ADDRESS)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
}
|
||||
|
||||
INT16 Reals_ExpoL (LONGREAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 6, i, INT16);
|
||||
__GET((ADDRESS)&x + 6, i, INT16);
|
||||
return __MASK(__ASHR(i, 4), -2048);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ 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
|
||||
#define Files_ToAdr(x) (ADDRESS)x
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INT16 errcode)
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
if (buf->org != f->pos) {
|
||||
error = Platform_Seek(f->fd, buf->org, Platform_SeekSet);
|
||||
}
|
||||
error = Platform_Write(f->fd, (address)buf->data, buf->size);
|
||||
error = Platform_Write(f->fd, (ADDRESS)buf->data, buf->size);
|
||||
if (error != 0) {
|
||||
Files_Err((CHAR*)"error writing file", 19, f, error);
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ void Files_ReadBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min);
|
||||
__MOVE((ADDRESS)buf->data + Files_ToAdr(offset), (ADDRESS)x + Files_ToAdr(xpos), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
xpos += min;
|
||||
|
|
@ -703,7 +703,7 @@ void Files_WriteBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min);
|
||||
__MOVE((ADDRESS)x + Files_ToAdr(xpos), (ADDRESS)buf->data + Files_ToAdr(offset), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
if (offset > buf->size) {
|
||||
|
|
@ -760,15 +760,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
|
|||
__DEL(new);
|
||||
return;
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
while (n > 0) {
|
||||
error = Platform_Write(fdnew, (address)buf, n);
|
||||
error = Platform_Write(fdnew, (ADDRESS)buf, n);
|
||||
if (error != 0) {
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
Files_Err((CHAR*)"cannot move file", 17, NIL, error);
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
}
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
|
|
@ -826,7 +826,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
|
|||
j += 1;
|
||||
}
|
||||
} else {
|
||||
__MOVE((address)src, (address)dest, src__len);
|
||||
__MOVE((ADDRESS)src, (ADDRESS)dest, src__len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ void Files_ReadNum (Files_Rider *R, ADDRESS *R__typ, SYSTEM_BYTE *x, LONGINT x__
|
|||
}
|
||||
q += (INT64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
__ASSERT(x__len <= 8, 0);
|
||||
__MOVE((address)&q, (address)x, x__len);
|
||||
__MOVE((ADDRESS)&q, (ADDRESS)x, x__len);
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, ADDRESS *R__typ, BOOLEAN x)
|
||||
|
|
@ -996,7 +996,7 @@ static void Files_Finalize (SYSTEM_PTR o)
|
|||
{
|
||||
Files_File f = NIL;
|
||||
INT32 res;
|
||||
f = (Files_File)(address)o;
|
||||
f = (Files_File)(ADDRESS)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
if (f->tempFile) {
|
||||
|
|
@ -1009,7 +1009,7 @@ void Files_SetSearchPath (CHAR *path, LONGINT path__len)
|
|||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
if (Strings_Length(path, path__len) != 0) {
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((address)((Strings_Length(path, path__len) + 1))));
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((ADDRESS)((Strings_Length(path, path__len) + 1))));
|
||||
__COPY(path, Files_SearchPath->data, Files_SearchPath->len[0]);
|
||||
} else {
|
||||
Files_SearchPath = NIL;
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, LONGINT a__len);
|
|||
export void Heap_Unlock (void);
|
||||
|
||||
extern void *Heap__init();
|
||||
extern address Platform_MainStackFrame;
|
||||
extern address Platform_OSAllocate(address size);
|
||||
extern ADDRESS Platform_MainStackFrame;
|
||||
extern ADDRESS Platform_OSAllocate(ADDRESS size);
|
||||
#define Heap_HeapModuleInit() Heap__init()
|
||||
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
|
||||
#define Heap_PlatformHalt(code) Platform_Halt(code)
|
||||
|
|
@ -138,7 +138,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
|
|||
__COPY(name, m->name, 20);
|
||||
m->refcnt = 0;
|
||||
m->enumPtrs = enumPtrs;
|
||||
m->next = (Heap_Module)(address)Heap_modules;
|
||||
m->next = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
Heap_modules = (SYSTEM_PTR)m;
|
||||
return (void*)m;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ SYSTEM_PTR Heap_NEWREC (INT32 tag)
|
|||
__PUT(adr + 8, 0, INT32);
|
||||
Heap_allocated += blksz;
|
||||
Heap_Unlock();
|
||||
return (SYSTEM_PTR)(address)(adr + 4);
|
||||
return (SYSTEM_PTR)(ADDRESS)(adr + 4);
|
||||
}
|
||||
|
||||
SYSTEM_PTR Heap_NEWBLK (INT32 size)
|
||||
|
|
@ -322,12 +322,12 @@ SYSTEM_PTR Heap_NEWBLK (INT32 size)
|
|||
SYSTEM_PTR new;
|
||||
Heap_Lock();
|
||||
blksz = __ASHL(__ASHR(size + 31, 4), 4);
|
||||
new = Heap_NEWREC((address)&blksz);
|
||||
tag = ((INT32)(address)new + blksz) - 12;
|
||||
new = Heap_NEWREC((ADDRESS)&blksz);
|
||||
tag = ((INT32)(ADDRESS)new + blksz) - 12;
|
||||
__PUT(tag - 4, 0, INT32);
|
||||
__PUT(tag, blksz, INT32);
|
||||
__PUT(tag + 4, -4, INT32);
|
||||
__PUT((INT32)(address)new - 4, tag, INT32);
|
||||
__PUT((INT32)(ADDRESS)new - 4, tag, INT32);
|
||||
Heap_Unlock();
|
||||
return new;
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ static void Heap_Mark (INT32 q)
|
|||
__GET(tag, offset, INT32);
|
||||
fld = q + offset;
|
||||
__GET(fld, p, INT32);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)n, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)n, SYSTEM_PTR);
|
||||
} else {
|
||||
fld = q + offset;
|
||||
__GET(fld, n, INT32);
|
||||
|
|
@ -364,7 +364,7 @@ static void Heap_Mark (INT32 q)
|
|||
if (!__ODD(tagbits)) {
|
||||
__PUT(n - 4, tagbits + 1, INT32);
|
||||
__PUT(q - 4, tag + 1, INT32);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)p, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)p, SYSTEM_PTR);
|
||||
p = q;
|
||||
q = n;
|
||||
tag = tagbits;
|
||||
|
|
@ -379,7 +379,7 @@ static void Heap_Mark (INT32 q)
|
|||
|
||||
static void Heap_MarkP (SYSTEM_PTR p)
|
||||
{
|
||||
Heap_Mark((INT32)(address)p);
|
||||
Heap_Mark((INT32)(ADDRESS)p);
|
||||
}
|
||||
|
||||
static void Heap_Scan (void)
|
||||
|
|
@ -548,7 +548,7 @@ static void Heap_Finalize (void)
|
|||
} else {
|
||||
prev->next = n->next;
|
||||
}
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
if (prev == NIL) {
|
||||
n = Heap_fin;
|
||||
} else {
|
||||
|
|
@ -567,7 +567,7 @@ void Heap_FINALL (void)
|
|||
while (Heap_fin != NIL) {
|
||||
n = Heap_fin;
|
||||
Heap_fin = Heap_fin->next;
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +584,9 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, LONGINT cand__len)
|
|||
}
|
||||
if (n == 0) {
|
||||
nofcand = 0;
|
||||
sp = (address)&frame;
|
||||
sp = (ADDRESS)&frame;
|
||||
stack0 = Heap_PlatformMainStackFrame();
|
||||
inc = (address)&align.p - (address)&align;
|
||||
inc = (ADDRESS)&align.p - (ADDRESS)&align;
|
||||
if (sp > stack0) {
|
||||
inc = -inc;
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ void Heap_GC (BOOLEAN markStack)
|
|||
INT32 cand[10000];
|
||||
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
|
||||
Heap_Lock();
|
||||
m = (Heap_Module)(address)Heap_modules;
|
||||
m = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
while (m != NIL) {
|
||||
if (m->enumPtrs != NIL) {
|
||||
(*m->enumPtrs)(Heap_MarkP);
|
||||
|
|
@ -694,7 +694,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
|
|||
{
|
||||
Heap_FinNode f;
|
||||
__NEW(f, Heap_FinDesc);
|
||||
f->obj = (INT32)(address)obj;
|
||||
f->obj = (INT32)(ADDRESS)obj;
|
||||
f->finalize = finalize;
|
||||
f->marked = 1;
|
||||
f->next = Heap_fin;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ static void OPB_SetIntType (OPT_Node node)
|
|||
static void OPB_SetSetType (OPT_Node node)
|
||||
{
|
||||
INT32 i32;
|
||||
__GET((address)&node->conval->setval + 4, i32, INT32);
|
||||
__GET((ADDRESS)&node->conval->setval + 4, i32, INT32);
|
||||
if (i32 == 0) {
|
||||
node->typ = OPT_set32typ;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static INT16 OPC_indentLevel;
|
||||
static INT8 OPC_hashtab[105];
|
||||
static CHAR OPC_keytab[60][9];
|
||||
static CHAR OPC_keytab[50][9];
|
||||
static BOOLEAN OPC_GlbPtrs;
|
||||
static CHAR OPC_BodyNameExt[13];
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ void OPC_Ident (OPT_Object obj)
|
|||
OPM_WriteStringVar((void*)obj->name, 256);
|
||||
h = OPC_PerfectHash((void*)obj->name, 256);
|
||||
if (OPC_hashtab[__X(h, 105)] >= 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 60)], obj->name) == 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 50)], obj->name) == 0) {
|
||||
OPM_Write('_');
|
||||
}
|
||||
}
|
||||
|
|
@ -1920,7 +1920,7 @@ static void Enter__47 (CHAR *s, LONGINT s__len)
|
|||
__DUP(s, s__len, CHAR);
|
||||
h = OPC_PerfectHash((void*)s, s__len);
|
||||
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 60)], 9);
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
|
||||
*InitKeywords__46_s->n += 1;
|
||||
__DEL(s);
|
||||
}
|
||||
|
|
@ -1947,15 +1947,6 @@ static void OPC_InitKeywords (void)
|
|||
Enter__47((CHAR*)"UINT32", 7);
|
||||
Enter__47((CHAR*)"UINT64", 7);
|
||||
Enter__47((CHAR*)"UINT8", 6);
|
||||
Enter__47((CHAR*)"address", 8);
|
||||
Enter__47((CHAR*)"int16", 6);
|
||||
Enter__47((CHAR*)"int32", 6);
|
||||
Enter__47((CHAR*)"int64", 6);
|
||||
Enter__47((CHAR*)"int8", 5);
|
||||
Enter__47((CHAR*)"uint16", 7);
|
||||
Enter__47((CHAR*)"uint32", 7);
|
||||
Enter__47((CHAR*)"uint64", 7);
|
||||
Enter__47((CHAR*)"uint8", 6);
|
||||
Enter__47((CHAR*)"asm", 4);
|
||||
Enter__47((CHAR*)"auto", 5);
|
||||
Enter__47((CHAR*)"break", 6);
|
||||
|
|
|
|||
|
|
@ -710,15 +710,15 @@ void OPM_FPrintReal (INT32 *fp, REAL real)
|
|||
{
|
||||
INT16 i;
|
||||
INT32 l;
|
||||
__GET((address)&real, l, INT32);
|
||||
__GET((ADDRESS)&real, l, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
}
|
||||
|
||||
void OPM_FPrintLReal (INT32 *fp, LONGREAL lr)
|
||||
{
|
||||
INT32 l, h;
|
||||
__GET((address)&lr, l, INT32);
|
||||
__GET((address)&lr + 4, h, INT32);
|
||||
__GET((ADDRESS)&lr, l, INT32);
|
||||
__GET((ADDRESS)&lr + 4, h, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPM_Write(')');
|
||||
break;
|
||||
case 24:
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
if (l->class == 1) {
|
||||
OPC_CompleteIdent(l->obj);
|
||||
} else {
|
||||
|
|
@ -830,7 +830,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPC_Ident(n->typ->strobj);
|
||||
OPM_Write(')');
|
||||
if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) {
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
}
|
||||
OPV_expr(l, exprPrec);
|
||||
} else {
|
||||
|
|
@ -1204,7 +1204,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
|
|||
if (x->class == 7) {
|
||||
OPC_IntLiteral(x->conval->intval, OPM_AddressSize);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"((address)(", 12);
|
||||
OPM_WriteString((CHAR*)"((ADDRESS)(", 12);
|
||||
OPV_expr(x, 10);
|
||||
OPM_WriteString((CHAR*)"))", 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ export LONGREAL Out_Ten (INT16 e);
|
|||
static void Out_digit (INT64 n, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
static void Out_prepend (CHAR *t, LONGINT t__len, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
|
||||
#define Out_Entier64(x) (int64)(x)
|
||||
#define Out_Entier64(x) (INT64)(x)
|
||||
|
||||
void Out_Flush (void)
|
||||
{
|
||||
INT16 error;
|
||||
if (Out_in > 0) {
|
||||
error = Platform_Write(Platform_StdOut, (address)Out_buf, Out_in);
|
||||
error = Platform_Write(Platform_StdOut, (ADDRESS)Out_buf, Out_in);
|
||||
}
|
||||
Out_in = 0;
|
||||
}
|
||||
|
|
@ -74,9 +74,9 @@ void Out_String (CHAR *str, LONGINT str__len)
|
|||
Out_Flush();
|
||||
}
|
||||
if (l > 128) {
|
||||
error = Platform_Write(Platform_StdOut, (address)str, l);
|
||||
error = Platform_Write(Platform_StdOut, (ADDRESS)str, l);
|
||||
} else {
|
||||
__MOVE((address)str, (address)&Out_buf[__X(Out_in, 128)], l);
|
||||
__MOVE((ADDRESS)str, (ADDRESS)&Out_buf[__X(Out_in, 128)], l);
|
||||
Out_in += (INT16)l;
|
||||
}
|
||||
__DEL(str);
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ void Platform_Init (INT32 argc, INT32 argvadr)
|
|||
Platform_ArgVecPtr av = NIL;
|
||||
Platform_MainStackFrame = argvadr;
|
||||
Platform_ArgCount = __VAL(INT16, argc);
|
||||
av = (Platform_ArgVecPtr)(address)argvadr;
|
||||
av = (Platform_ArgVecPtr)(ADDRESS)argvadr;
|
||||
Platform_ArgVector = (*av)[0];
|
||||
Platform_HaltCode = -128;
|
||||
Platform_HeapInitHeap();
|
||||
|
|
@ -275,7 +275,7 @@ void Platform_GetArg (INT16 n, CHAR *val, LONGINT val__len)
|
|||
{
|
||||
Platform_ArgVec av = NIL;
|
||||
if (n < Platform_ArgCount) {
|
||||
av = (Platform_ArgVec)(address)Platform_ArgVector;
|
||||
av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector;
|
||||
__COPY(*(*av)[__X(n, 1024)], val, val__len);
|
||||
}
|
||||
}
|
||||
|
|
@ -518,7 +518,7 @@ INT16 Platform_ReadBuf (INT32 h, SYSTEM_BYTE *b, LONGINT b__len, INT32 *n)
|
|||
{
|
||||
INT16 result;
|
||||
INT32 lengthread;
|
||||
result = Platform_readfile(h, (address)b, b__len, &lengthread);
|
||||
result = Platform_readfile(h, (ADDRESS)b, b__len, &lengthread);
|
||||
if (result == 0) {
|
||||
*n = 0;
|
||||
return Platform_err();
|
||||
|
|
@ -742,7 +742,7 @@ static void Platform_TestLittleEndian (void)
|
|||
{
|
||||
INT16 i;
|
||||
i = 1;
|
||||
__GET((address)&i, Platform_LittleEndian, BOOLEAN);
|
||||
__GET((ADDRESS)&i, Platform_LittleEndian, BOOLEAN);
|
||||
}
|
||||
|
||||
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 20), {-4}};
|
||||
|
|
|
|||
|
|
@ -59,23 +59,23 @@ LONGREAL Reals_TenL (INT16 e)
|
|||
INT16 Reals_Expo (REAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 2, i, INT16);
|
||||
__GET((ADDRESS)&x + 2, i, INT16);
|
||||
return __MASK(__ASHR(i, 7), -256);
|
||||
}
|
||||
|
||||
void Reals_SetExpo (REAL *x, INT16 ex)
|
||||
{
|
||||
CHAR c;
|
||||
__GET((address)x + 3, c, CHAR);
|
||||
__PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((address)x + 2, c, CHAR);
|
||||
__PUT((address)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
__GET((ADDRESS)x + 3, c, CHAR);
|
||||
__PUT((ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((ADDRESS)x + 2, c, CHAR);
|
||||
__PUT((ADDRESS)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
}
|
||||
|
||||
INT16 Reals_ExpoL (LONGREAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 6, i, INT16);
|
||||
__GET((ADDRESS)&x + 6, i, INT16);
|
||||
return __MASK(__ASHR(i, 4), -2048);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ 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
|
||||
#define Files_ToAdr(x) (ADDRESS)x
|
||||
|
||||
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INT16 errcode)
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ static void Files_Flush (Files_Buffer buf)
|
|||
if (buf->org != f->pos) {
|
||||
error = Platform_Seek(f->fd, buf->org, Platform_SeekSet);
|
||||
}
|
||||
error = Platform_Write(f->fd, (address)buf->data, buf->size);
|
||||
error = Platform_Write(f->fd, (ADDRESS)buf->data, buf->size);
|
||||
if (error != 0) {
|
||||
Files_Err((CHAR*)"error writing file", 19, f, error);
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ void Files_ReadBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT x
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)buf->data + Files_ToAdr(offset), (address)x + Files_ToAdr(xpos), min);
|
||||
__MOVE((ADDRESS)buf->data + Files_ToAdr(offset), (ADDRESS)x + Files_ToAdr(xpos), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
xpos += min;
|
||||
|
|
@ -703,7 +703,7 @@ void Files_WriteBytes (Files_Rider *r, ADDRESS *r__typ, SYSTEM_BYTE *x, LONGINT
|
|||
} else {
|
||||
min = n;
|
||||
}
|
||||
__MOVE((address)x + Files_ToAdr(xpos), (address)buf->data + Files_ToAdr(offset), min);
|
||||
__MOVE((ADDRESS)x + Files_ToAdr(xpos), (ADDRESS)buf->data + Files_ToAdr(offset), min);
|
||||
offset += min;
|
||||
(*r).offset = offset;
|
||||
if (offset > buf->size) {
|
||||
|
|
@ -760,15 +760,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
|
|||
__DEL(new);
|
||||
return;
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
while (n > 0) {
|
||||
error = Platform_Write(fdnew, (address)buf, n);
|
||||
error = Platform_Write(fdnew, (ADDRESS)buf, n);
|
||||
if (error != 0) {
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
Files_Err((CHAR*)"cannot move file", 17, NIL, error);
|
||||
}
|
||||
error = Platform_Read(fdold, (address)buf, 4096, &n);
|
||||
error = Platform_Read(fdold, (ADDRESS)buf, 4096, &n);
|
||||
}
|
||||
ignore = Platform_Close(fdold);
|
||||
ignore = Platform_Close(fdnew);
|
||||
|
|
@ -826,7 +826,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
|
|||
j += 1;
|
||||
}
|
||||
} else {
|
||||
__MOVE((address)src, (address)dest, src__len);
|
||||
__MOVE((ADDRESS)src, (ADDRESS)dest, src__len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ void Files_ReadNum (Files_Rider *R, ADDRESS *R__typ, SYSTEM_BYTE *x, LONGINT x__
|
|||
}
|
||||
q += (INT64)__ASH((__MASK(b, -64) - __ASHL(__ASHR(b, 6), 6)), s);
|
||||
__ASSERT(x__len <= 8, 0);
|
||||
__MOVE((address)&q, (address)x, x__len);
|
||||
__MOVE((ADDRESS)&q, (ADDRESS)x, x__len);
|
||||
}
|
||||
|
||||
void Files_WriteBool (Files_Rider *R, ADDRESS *R__typ, BOOLEAN x)
|
||||
|
|
@ -996,7 +996,7 @@ static void Files_Finalize (SYSTEM_PTR o)
|
|||
{
|
||||
Files_File f = NIL;
|
||||
INT32 res;
|
||||
f = (Files_File)(address)o;
|
||||
f = (Files_File)(ADDRESS)o;
|
||||
if (f->fd >= 0) {
|
||||
Files_CloseOSFile(f);
|
||||
if (f->tempFile) {
|
||||
|
|
@ -1009,7 +1009,7 @@ void Files_SetSearchPath (CHAR *path, LONGINT path__len)
|
|||
{
|
||||
__DUP(path, path__len, CHAR);
|
||||
if (Strings_Length(path, path__len) != 0) {
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((address)((Strings_Length(path, path__len) + 1))));
|
||||
Files_SearchPath = __NEWARR(NIL, 1, 1, 1, 1, ((ADDRESS)((Strings_Length(path, path__len) + 1))));
|
||||
__COPY(path, Files_SearchPath->data, Files_SearchPath->len[0]);
|
||||
} else {
|
||||
Files_SearchPath = NIL;
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ static void Heap_Sift (INT64 l, INT64 r, INT64 *a, LONGINT a__len);
|
|||
export void Heap_Unlock (void);
|
||||
|
||||
extern void *Heap__init();
|
||||
extern address Platform_MainStackFrame;
|
||||
extern address Platform_OSAllocate(address size);
|
||||
extern ADDRESS Platform_MainStackFrame;
|
||||
extern ADDRESS Platform_OSAllocate(ADDRESS size);
|
||||
#define Heap_HeapModuleInit() Heap__init()
|
||||
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
|
||||
#define Heap_PlatformHalt(code) Platform_Halt(code)
|
||||
|
|
@ -138,7 +138,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
|
|||
__COPY(name, m->name, 20);
|
||||
m->refcnt = 0;
|
||||
m->enumPtrs = enumPtrs;
|
||||
m->next = (Heap_Module)(address)Heap_modules;
|
||||
m->next = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
Heap_modules = (SYSTEM_PTR)m;
|
||||
return (void*)m;
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ SYSTEM_PTR Heap_NEWREC (INT64 tag)
|
|||
__PUT(adr + 16, 0, INT64);
|
||||
Heap_allocated += blksz;
|
||||
Heap_Unlock();
|
||||
return (SYSTEM_PTR)(address)(adr + 8);
|
||||
return (SYSTEM_PTR)(ADDRESS)(adr + 8);
|
||||
}
|
||||
|
||||
SYSTEM_PTR Heap_NEWBLK (INT64 size)
|
||||
|
|
@ -322,12 +322,12 @@ SYSTEM_PTR Heap_NEWBLK (INT64 size)
|
|||
SYSTEM_PTR new;
|
||||
Heap_Lock();
|
||||
blksz = __ASHL(__ASHR(size + 63, 5), 5);
|
||||
new = Heap_NEWREC((address)&blksz);
|
||||
tag = ((INT64)(address)new + blksz) - 24;
|
||||
new = Heap_NEWREC((ADDRESS)&blksz);
|
||||
tag = ((INT64)(ADDRESS)new + blksz) - 24;
|
||||
__PUT(tag - 8, 0, INT64);
|
||||
__PUT(tag, blksz, INT64);
|
||||
__PUT(tag + 8, -8, INT64);
|
||||
__PUT((INT64)(address)new - 8, tag, INT64);
|
||||
__PUT((INT64)(ADDRESS)new - 8, tag, INT64);
|
||||
Heap_Unlock();
|
||||
return new;
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ static void Heap_Mark (INT64 q)
|
|||
__GET(tag, offset, INT64);
|
||||
fld = q + offset;
|
||||
__GET(fld, p, INT64);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)n, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)n, SYSTEM_PTR);
|
||||
} else {
|
||||
fld = q + offset;
|
||||
__GET(fld, n, INT64);
|
||||
|
|
@ -364,7 +364,7 @@ static void Heap_Mark (INT64 q)
|
|||
if (!__ODD(tagbits)) {
|
||||
__PUT(n - 8, tagbits + 1, INT64);
|
||||
__PUT(q - 8, tag + 1, INT64);
|
||||
__PUT(fld, (SYSTEM_PTR)(address)p, SYSTEM_PTR);
|
||||
__PUT(fld, (SYSTEM_PTR)(ADDRESS)p, SYSTEM_PTR);
|
||||
p = q;
|
||||
q = n;
|
||||
tag = tagbits;
|
||||
|
|
@ -379,7 +379,7 @@ static void Heap_Mark (INT64 q)
|
|||
|
||||
static void Heap_MarkP (SYSTEM_PTR p)
|
||||
{
|
||||
Heap_Mark((INT64)(address)p);
|
||||
Heap_Mark((INT64)(ADDRESS)p);
|
||||
}
|
||||
|
||||
static void Heap_Scan (void)
|
||||
|
|
@ -548,7 +548,7 @@ static void Heap_Finalize (void)
|
|||
} else {
|
||||
prev->next = n->next;
|
||||
}
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
if (prev == NIL) {
|
||||
n = Heap_fin;
|
||||
} else {
|
||||
|
|
@ -567,7 +567,7 @@ void Heap_FINALL (void)
|
|||
while (Heap_fin != NIL) {
|
||||
n = Heap_fin;
|
||||
Heap_fin = Heap_fin->next;
|
||||
(*n->finalize)((SYSTEM_PTR)(address)n->obj);
|
||||
(*n->finalize)((SYSTEM_PTR)(ADDRESS)n->obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +584,9 @@ static void Heap_MarkStack (INT64 n, INT64 *cand, LONGINT cand__len)
|
|||
}
|
||||
if (n == 0) {
|
||||
nofcand = 0;
|
||||
sp = (address)&frame;
|
||||
sp = (ADDRESS)&frame;
|
||||
stack0 = Heap_PlatformMainStackFrame();
|
||||
inc = (address)&align.p - (address)&align;
|
||||
inc = (ADDRESS)&align.p - (ADDRESS)&align;
|
||||
if (sp > stack0) {
|
||||
inc = -inc;
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ void Heap_GC (BOOLEAN markStack)
|
|||
INT64 cand[10000];
|
||||
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
|
||||
Heap_Lock();
|
||||
m = (Heap_Module)(address)Heap_modules;
|
||||
m = (Heap_Module)(ADDRESS)Heap_modules;
|
||||
while (m != NIL) {
|
||||
if (m->enumPtrs != NIL) {
|
||||
(*m->enumPtrs)(Heap_MarkP);
|
||||
|
|
@ -694,7 +694,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
|
|||
{
|
||||
Heap_FinNode f;
|
||||
__NEW(f, Heap_FinDesc);
|
||||
f->obj = (INT64)(address)obj;
|
||||
f->obj = (INT64)(ADDRESS)obj;
|
||||
f->finalize = finalize;
|
||||
f->marked = 1;
|
||||
f->next = Heap_fin;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ static void OPB_SetIntType (OPT_Node node)
|
|||
static void OPB_SetSetType (OPT_Node node)
|
||||
{
|
||||
INT32 i32;
|
||||
__GET((address)&node->conval->setval + 4, i32, INT32);
|
||||
__GET((ADDRESS)&node->conval->setval + 4, i32, INT32);
|
||||
if (i32 == 0) {
|
||||
node->typ = OPT_set32typ;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static INT16 OPC_indentLevel;
|
||||
static INT8 OPC_hashtab[105];
|
||||
static CHAR OPC_keytab[60][9];
|
||||
static CHAR OPC_keytab[50][9];
|
||||
static BOOLEAN OPC_GlbPtrs;
|
||||
static CHAR OPC_BodyNameExt[13];
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ void OPC_Ident (OPT_Object obj)
|
|||
OPM_WriteStringVar((void*)obj->name, 256);
|
||||
h = OPC_PerfectHash((void*)obj->name, 256);
|
||||
if (OPC_hashtab[__X(h, 105)] >= 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 60)], obj->name) == 0) {
|
||||
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 50)], obj->name) == 0) {
|
||||
OPM_Write('_');
|
||||
}
|
||||
}
|
||||
|
|
@ -1920,7 +1920,7 @@ static void Enter__47 (CHAR *s, LONGINT s__len)
|
|||
__DUP(s, s__len, CHAR);
|
||||
h = OPC_PerfectHash((void*)s, s__len);
|
||||
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 60)], 9);
|
||||
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
|
||||
*InitKeywords__46_s->n += 1;
|
||||
__DEL(s);
|
||||
}
|
||||
|
|
@ -1947,15 +1947,6 @@ static void OPC_InitKeywords (void)
|
|||
Enter__47((CHAR*)"UINT32", 7);
|
||||
Enter__47((CHAR*)"UINT64", 7);
|
||||
Enter__47((CHAR*)"UINT8", 6);
|
||||
Enter__47((CHAR*)"address", 8);
|
||||
Enter__47((CHAR*)"int16", 6);
|
||||
Enter__47((CHAR*)"int32", 6);
|
||||
Enter__47((CHAR*)"int64", 6);
|
||||
Enter__47((CHAR*)"int8", 5);
|
||||
Enter__47((CHAR*)"uint16", 7);
|
||||
Enter__47((CHAR*)"uint32", 7);
|
||||
Enter__47((CHAR*)"uint64", 7);
|
||||
Enter__47((CHAR*)"uint8", 6);
|
||||
Enter__47((CHAR*)"asm", 4);
|
||||
Enter__47((CHAR*)"auto", 5);
|
||||
Enter__47((CHAR*)"break", 6);
|
||||
|
|
|
|||
|
|
@ -710,15 +710,15 @@ void OPM_FPrintReal (INT32 *fp, REAL real)
|
|||
{
|
||||
INT16 i;
|
||||
INT32 l;
|
||||
__GET((address)&real, l, INT32);
|
||||
__GET((ADDRESS)&real, l, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
}
|
||||
|
||||
void OPM_FPrintLReal (INT32 *fp, LONGREAL lr)
|
||||
{
|
||||
INT32 l, h;
|
||||
__GET((address)&lr, l, INT32);
|
||||
__GET((address)&lr + 4, h, INT32);
|
||||
__GET((ADDRESS)&lr, l, INT32);
|
||||
__GET((ADDRESS)&lr + 4, h, INT32);
|
||||
OPM_FPrint(&*fp, l);
|
||||
OPM_FPrint(&*fp, h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPM_Write(')');
|
||||
break;
|
||||
case 24:
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
if (l->class == 1) {
|
||||
OPC_CompleteIdent(l->obj);
|
||||
} else {
|
||||
|
|
@ -830,7 +830,7 @@ static void OPV_expr (OPT_Node n, INT16 prec)
|
|||
OPC_Ident(n->typ->strobj);
|
||||
OPM_Write(')');
|
||||
if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) {
|
||||
OPM_WriteString((CHAR*)"(address)", 10);
|
||||
OPM_WriteString((CHAR*)"(ADDRESS)", 10);
|
||||
}
|
||||
OPV_expr(l, exprPrec);
|
||||
} else {
|
||||
|
|
@ -1204,7 +1204,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
|
|||
if (x->class == 7) {
|
||||
OPC_IntLiteral(x->conval->intval, OPM_AddressSize);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"((address)(", 12);
|
||||
OPM_WriteString((CHAR*)"((ADDRESS)(", 12);
|
||||
OPV_expr(x, 10);
|
||||
OPM_WriteString((CHAR*)"))", 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ export LONGREAL Out_Ten (INT16 e);
|
|||
static void Out_digit (INT64 n, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
static void Out_prepend (CHAR *t, LONGINT t__len, CHAR *s, LONGINT s__len, INT16 *i);
|
||||
|
||||
#define Out_Entier64(x) (int64)(x)
|
||||
#define Out_Entier64(x) (INT64)(x)
|
||||
|
||||
void Out_Flush (void)
|
||||
{
|
||||
INT16 error;
|
||||
if (Out_in > 0) {
|
||||
error = Platform_Write(Platform_StdOut, (address)Out_buf, Out_in);
|
||||
error = Platform_Write(Platform_StdOut, (ADDRESS)Out_buf, Out_in);
|
||||
}
|
||||
Out_in = 0;
|
||||
}
|
||||
|
|
@ -74,9 +74,9 @@ void Out_String (CHAR *str, LONGINT str__len)
|
|||
Out_Flush();
|
||||
}
|
||||
if (l > 128) {
|
||||
error = Platform_Write(Platform_StdOut, (address)str, l);
|
||||
error = Platform_Write(Platform_StdOut, (ADDRESS)str, l);
|
||||
} else {
|
||||
__MOVE((address)str, (address)&Out_buf[__X(Out_in, 128)], l);
|
||||
__MOVE((ADDRESS)str, (ADDRESS)&Out_buf[__X(Out_in, 128)], l);
|
||||
Out_in += (INT16)l;
|
||||
}
|
||||
__DEL(str);
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ void Platform_Init (INT32 argc, INT64 argvadr)
|
|||
Platform_ArgVecPtr av = NIL;
|
||||
Platform_MainStackFrame = argvadr;
|
||||
Platform_ArgCount = __VAL(INT16, argc);
|
||||
av = (Platform_ArgVecPtr)(address)argvadr;
|
||||
av = (Platform_ArgVecPtr)(ADDRESS)argvadr;
|
||||
Platform_ArgVector = (*av)[0];
|
||||
Platform_HaltCode = -128;
|
||||
Platform_HeapInitHeap();
|
||||
|
|
@ -275,7 +275,7 @@ void Platform_GetArg (INT16 n, CHAR *val, LONGINT val__len)
|
|||
{
|
||||
Platform_ArgVec av = NIL;
|
||||
if (n < Platform_ArgCount) {
|
||||
av = (Platform_ArgVec)(address)Platform_ArgVector;
|
||||
av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector;
|
||||
__COPY(*(*av)[__X(n, 1024)], val, val__len);
|
||||
}
|
||||
}
|
||||
|
|
@ -518,7 +518,7 @@ INT16 Platform_ReadBuf (INT32 h, SYSTEM_BYTE *b, LONGINT b__len, INT32 *n)
|
|||
{
|
||||
INT16 result;
|
||||
INT32 lengthread;
|
||||
result = Platform_readfile(h, (address)b, b__len, &lengthread);
|
||||
result = Platform_readfile(h, (ADDRESS)b, b__len, &lengthread);
|
||||
if (result == 0) {
|
||||
*n = 0;
|
||||
return Platform_err();
|
||||
|
|
@ -742,7 +742,7 @@ static void Platform_TestLittleEndian (void)
|
|||
{
|
||||
INT16 i;
|
||||
i = 1;
|
||||
__GET((address)&i, Platform_LittleEndian, BOOLEAN);
|
||||
__GET((ADDRESS)&i, Platform_LittleEndian, BOOLEAN);
|
||||
}
|
||||
|
||||
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 20), {-8}};
|
||||
|
|
|
|||
|
|
@ -59,23 +59,23 @@ LONGREAL Reals_TenL (INT16 e)
|
|||
INT16 Reals_Expo (REAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 2, i, INT16);
|
||||
__GET((ADDRESS)&x + 2, i, INT16);
|
||||
return __MASK(__ASHR(i, 7), -256);
|
||||
}
|
||||
|
||||
void Reals_SetExpo (REAL *x, INT16 ex)
|
||||
{
|
||||
CHAR c;
|
||||
__GET((address)x + 3, c, CHAR);
|
||||
__PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((address)x + 2, c, CHAR);
|
||||
__PUT((address)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
__GET((ADDRESS)x + 3, c, CHAR);
|
||||
__PUT((ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
|
||||
__GET((ADDRESS)x + 2, c, CHAR);
|
||||
__PUT((ADDRESS)x + 2, (CHAR)(__MASK((INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
|
||||
}
|
||||
|
||||
INT16 Reals_ExpoL (LONGREAL x)
|
||||
{
|
||||
INT16 i;
|
||||
__GET((address)&x + 6, i, INT16);
|
||||
__GET((ADDRESS)&x + 6, i, INT16);
|
||||
return __MASK(__ASHR(i, 4), -2048);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,10 @@ Most Oberon systems have implicitly or explicitly assumed that LONGINT is large
|
|||
machine addresses. With the requirement to support 32 bit LONGINT on 64 bit systems, this is no
|
||||
longer possible.
|
||||
|
||||
The type SYSTEM.ADDRESS is added, a signed integer type equivalent to either SYSTEM.INT32 or SYSTEM.INT64 according to the system address size.
|
||||
The type SYSTEM.ADDRESS is added, a signed integer type equivalent to either SYSTEM.INT32 or SYSTEM.INT64
|
||||
according to the system address size. As a general purpose integer type it can be used not just to
|
||||
store machine addresses, but also for any arithmetic purpose related to machine addresses, such as
|
||||
lengths of memory objects or offsets into memory objects.
|
||||
|
||||
The following SYSTEM module predefined functions and procedures now use SYSTEM.ADDRESS instead of LONGINT.
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
|||
VAR
|
||||
indentLevel: INTEGER;
|
||||
hashtab: ARRAY 105 OF SHORTINT;
|
||||
keytab: ARRAY 60 (*50*), 9 OF CHAR;
|
||||
keytab: ARRAY 50, 9 OF CHAR;
|
||||
GlbPtrs: BOOLEAN;
|
||||
BodyNameExt: ARRAY 13 OF CHAR;
|
||||
|
||||
|
|
@ -1275,16 +1275,6 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
|||
Enter("UINT64"); (* pseudo keyword used by voc *)
|
||||
Enter("UINT8"); (* pseudo keyword used by voc *)
|
||||
|
||||
Enter("address"); (* pseudo keyword used by voc *)
|
||||
Enter("int16"); (* pseudo keyword used by voc *)
|
||||
Enter("int32"); (* pseudo keyword used by voc *)
|
||||
Enter("int64"); (* pseudo keyword used by voc *)
|
||||
Enter("int8"); (* pseudo keyword used by voc *)
|
||||
Enter("uint16"); (* pseudo keyword used by voc *)
|
||||
Enter("uint32"); (* pseudo keyword used by voc *)
|
||||
Enter("uint64"); (* pseudo keyword used by voc *)
|
||||
Enter("uint8"); (* pseudo keyword used by voc *)
|
||||
|
||||
Enter("asm");
|
||||
Enter("auto");
|
||||
Enter("break");
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
expr(l, MinPrec); OPM.Write(CloseParen)
|
||||
| OPT.cap: OPM.WriteString("__CAP("); expr(l, MinPrec); OPM.Write(CloseParen)
|
||||
| OPT.odd: OPM.WriteString("__ODD("); expr(l, MinPrec); OPM.Write(CloseParen)
|
||||
| OPT.adr: OPM.WriteString("(address)"); (*SYSTEM*)
|
||||
| OPT.adr: OPM.WriteString("(ADDRESS)"); (*SYSTEM*)
|
||||
IF l^.class = OPT.Nvarpar THEN OPC.CompleteIdent(l^.obj)
|
||||
ELSE
|
||||
IF (l^.typ^.form # OPT.String) & ~(l^.typ^.comp IN {OPT.Array, OPT.DynArr}) THEN OPM.Write("&") END ;
|
||||
|
|
@ -515,7 +515,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
THEN
|
||||
OPM.Write(OpenParen); OPC.Ident(n^.typ^.strobj); OPM.Write(CloseParen);
|
||||
IF (n^.typ^.form IN {OPT.Pointer, OPT.ProcTyp}) OR (l^.typ^.form IN {OPT.Pointer, OPT.ProcTyp}) THEN
|
||||
OPM.WriteString("(address)")
|
||||
OPM.WriteString("(ADDRESS)")
|
||||
END;
|
||||
expr(l, exprPrec)
|
||||
ELSE
|
||||
|
|
@ -736,7 +736,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
IF typ^.comp = OPT.DynArr THEN
|
||||
IF x^.class = OPT.Nconst THEN
|
||||
OPC.IntLiteral(x.conval.intval, OPM.AddressSize)
|
||||
ELSE OPM.WriteString("((address)("); expr(x, 10); OPM.WriteString("))")
|
||||
ELSE OPM.WriteString("((ADDRESS)("); expr(x, 10); OPM.WriteString("))")
|
||||
END ;
|
||||
x := x^.link
|
||||
ELSE
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files
|
|||
|
||||
|
||||
PROCEDURE -IdxTrap "__HALT(-1)";
|
||||
PROCEDURE -ToAdr(x: SYSTEM.INT64): SYSTEM.ADDRESS "(address)x";
|
||||
PROCEDURE -ToAdr(x: SYSTEM.INT64): SYSTEM.ADDRESS "(ADDRESS)x";
|
||||
|
||||
PROCEDURE^ Finalize(o: SYSTEM.PTR);
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ MODULE Heap;
|
|||
END INCREF;
|
||||
|
||||
|
||||
PROCEDURE -ExternPlatformOSAllocate "extern address Platform_OSAllocate(address size);";
|
||||
PROCEDURE -ExternPlatformOSAllocate "extern ADDRESS Platform_OSAllocate(ADDRESS size);";
|
||||
PROCEDURE -OSAllocate(size: S.ADDRESS): S.ADDRESS "Platform_OSAllocate(size)";
|
||||
|
||||
PROCEDURE NewChunk(blksz: S.ADDRESS): S.ADDRESS;
|
||||
|
|
@ -317,25 +317,25 @@ MODULE Heap;
|
|||
VAR p, tag, offset, fld, n, tagbits: S.ADDRESS;
|
||||
BEGIN
|
||||
IF q # 0 THEN
|
||||
S.GET(q - SZA, tagbits); (* Load the tag for the record at q *)
|
||||
IF ~ODD(tagbits) THEN (* If it has not already been marked *)
|
||||
S.GET(q - SZA, tagbits); (* Load the tag for the record at q *)
|
||||
IF ~ODD(tagbits) THEN (* If it has not already been marked *)
|
||||
S.PUT(q - SZA, tagbits + 1); (* Mark it *)
|
||||
p := 0;
|
||||
tag := tagbits + SZA; (* Tag addresses first offset *)
|
||||
tag := tagbits + SZA; (* Tag addresses first offset *)
|
||||
LOOP
|
||||
S.GET(tag, offset); (* Get next ptr field offset *)
|
||||
IF offset < 0 THEN (* Sentinel reached: Value is -8*(#fields+1) *)
|
||||
IF offset < 0 THEN (* Sentinel reached: Value is -8*(#fields+1) *)
|
||||
S.PUT(q - SZA, tag + offset + 1); (* Rotate base ptr into tag *)
|
||||
IF p = 0 THEN EXIT END ;
|
||||
n := q; q := p;
|
||||
S.GET(q - SZA, tag); DEC(tag, 1);
|
||||
S.GET(tag, offset); fld := q + offset;
|
||||
S.GET(fld, p); S.PUT(fld, S.VAL(S.PTR, n))
|
||||
ELSE (* offset references a ptr field *)
|
||||
fld := q + offset; (* S.ADDRESS the pointer *)
|
||||
S.GET(fld, n); (* Load the pointer *)
|
||||
IF n # 0 THEN (* If pointer is not NIL *)
|
||||
S.GET(n - SZA, tagbits); (* Consider record pointed to by this field *)
|
||||
ELSE (* offset references a ptr field *)
|
||||
fld := q + offset; (* S.ADDRESS the pointer *)
|
||||
S.GET(fld, n); (* Load the pointer *)
|
||||
IF n # 0 THEN (* If pointer is not NIL *)
|
||||
S.GET(n - SZA, tagbits); (* Consider record pointed to by this field *)
|
||||
IF ~ODD(tagbits) THEN
|
||||
S.PUT(n - SZA, tagbits + 1);
|
||||
S.PUT(q - SZA, tag + 1);
|
||||
|
|
@ -483,7 +483,7 @@ MODULE Heap;
|
|||
END
|
||||
END FINALL;
|
||||
|
||||
PROCEDURE -ExternMainStackFrame "extern address Platform_MainStackFrame;";
|
||||
PROCEDURE -ExternMainStackFrame "extern ADDRESS Platform_MainStackFrame;";
|
||||
PROCEDURE -PlatformMainStackFrame(): S.ADDRESS "Platform_MainStackFrame";
|
||||
|
||||
PROCEDURE MarkStack(n: S.ADDRESS; VAR cand: ARRAY OF S.ADDRESS);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ BEGIN r := 1.0D0; power := 1.0D1;
|
|||
RETURN r
|
||||
END Ten;
|
||||
|
||||
PROCEDURE -Entier64(x: LONGREAL): SYSTEM.INT64 "(int64)(x)";
|
||||
PROCEDURE -Entier64(x: LONGREAL): SYSTEM.INT64 "(INT64)(x)";
|
||||
|
||||
PROCEDURE RealP(x: LONGREAL; n: INTEGER; long: BOOLEAN);
|
||||
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ PROCEDURE -structstats "struct stat s";
|
|||
PROCEDURE -statdev(): LONGINT "(LONGINT)s.st_dev";
|
||||
PROCEDURE -statino(): LONGINT "(LONGINT)s.st_ino";
|
||||
PROCEDURE -statmtime(): LONGINT "(LONGINT)s.st_mtime";
|
||||
PROCEDURE -statsize(): LONGINT "(address)s.st_size";
|
||||
PROCEDURE -statsize(): LONGINT "(ADDRESS)s.st_size";
|
||||
|
||||
PROCEDURE Identify*(h: FileHandle; VAR identity: FileIdentity): ErrorCode;
|
||||
BEGIN
|
||||
|
|
|
|||
|
|
@ -86,20 +86,6 @@ typedef void* SYSTEM_PTR;
|
|||
#endif
|
||||
|
||||
|
||||
// Temporary build support - which changing lowercase int* and address to uppercase
|
||||
|
||||
#define int8 INT8
|
||||
#define int16 INT16
|
||||
#define int32 INT32
|
||||
#define int64 INT64
|
||||
#define uint8 UINT8
|
||||
#define uint16 UINT16
|
||||
#define uint32 UINT32
|
||||
#define uint64 UINT64
|
||||
#define address ADDRESS
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
@ -179,12 +165,12 @@ static inline int __str_cmp(CHAR *x, CHAR *y){
|
|||
#define __GET(a, x, t) x=*(t*)(ADDRESS)(a)
|
||||
#define __PUT(a, x, t) *(t*)(ADDRESS)(a)=x
|
||||
|
||||
#define __LSHL(x, n, s) ((int##s)((uint##s)(x)<<(n)))
|
||||
#define __LSHR(x, n, s) ((int##s)((uint##s)(x)>>(n)))
|
||||
#define __LSHL(x, n, s) ((INT##s)((UINT##s)(x)<<(n)))
|
||||
#define __LSHR(x, n, s) ((INT##s)((UINT##s)(x)>>(n)))
|
||||
#define __LSH(x, n, s) ((n)>=0? __LSHL(x, n, s): __LSHR(x, -(n), s))
|
||||
|
||||
#define __ROTL(x, n, s) ((int##s)((uint##s)(x)<<(n)|(uint##s)(x)>>(s-(n))))
|
||||
#define __ROTR(x, n, s) ((int##s)((uint##s)(x)>>(n)|(uint##s)(x)<<(s-(n))))
|
||||
#define __ROTL(x, n, s) ((INT##s)((UINT##s)(x)<<(n)|(UINT##s)(x)>>(s-(n))))
|
||||
#define __ROTR(x, n, s) ((INT##s)((UINT##s)(x)>>(n)|(UINT##s)(x)<<(s-(n))))
|
||||
#define __ROT(x, n, s) ((n)>=0? __ROTL(x, n, s): __ROTR(x, -(n), s))
|
||||
|
||||
#define __ASHL(x, n) ((INT64)(x)<<(n))
|
||||
|
|
@ -222,10 +208,10 @@ static inline double SYSTEM_ABSD(double i) {return i >= 0.0 ? i : -i;}
|
|||
#define __CAP(ch) ((CHAR)((ch)&0x5f))
|
||||
#define __ODD(x) ((x)&1)
|
||||
|
||||
#define __IN(x, s, size) (((unsigned int)(x))<size && ((((uint##size)(s))>>(x))&1))
|
||||
#define __IN(x, s, size) (((unsigned int)(x))<size && ((((UINT##size)(s))>>(x))&1))
|
||||
// todo tested versions of SETOF and SETRNG: check that x, l and h fit size
|
||||
#define __SETOF(x, size) ((uint##size)1<<(x))
|
||||
#define __SETRNG(l, h, size) ((~(uint##size)0<<(l))&~(uint##size)0>>(size-1-(h)))
|
||||
#define __SETOF(x, size) ((UINT##size)1<<(x))
|
||||
#define __SETRNG(l, h, size) ((~(UINT##size)0<<(l))&~(UINT##size)0>>(size-1-(h)))
|
||||
|
||||
#define __MASK(x, m) ((x)&~(m))
|
||||
#define __BIT(x, n) (*(UINT64*)(x)>>(n)&1)
|
||||
|
|
|
|||
|
|
@ -430,10 +430,10 @@ void writeConfigurationMod() {
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Make sure SYSTEM.h has set up our core data types correctly.
|
||||
assert(sizeof(int8) == 1, "sizeof(int8) is not 1.");
|
||||
assert(sizeof(int16) == 2, "sizeof(int16) is not 2.");
|
||||
assert(sizeof(int32) == 4, "sizeof(int32) is not 4.");
|
||||
assert(sizeof(int64) == 8, "sizeof(int64) is not 8.");
|
||||
assert(sizeof(INT8) == 1, "sizeof(INT8) is not 1.");
|
||||
assert(sizeof(INT16) == 2, "sizeof(INT16) is not 2.");
|
||||
assert(sizeof(INT32) == 4, "sizeof(INT32) is not 4.");
|
||||
assert(sizeof(INT64) == 8, "sizeof(INT64) is not 8.");
|
||||
|
||||
oname = getenv("ONAME"); if (!oname) oname = macrotostring(O_NAME);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ OPM_ResourceDir
|
|||
__MOVE.* cmd,
|
||||
OPM_(IntSize|PointerSize|Alignment) =
|
||||
Strings_Append.+void\*\)(cmd|OPM_OBERON|extTools_comp)
|
||||
__COPY\("(gcc|clang|msc|i686-w64-mingw)
|
||||
__COPY\("(gcc|clang|msc|i686-w64-mingw|x86_64-w64-mingw)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue