Add basic SYSTEM.ADRINT type.

This commit is contained in:
David Brown 2016-08-26 16:28:07 +01:00
parent da88496c5f
commit b6385f8b8c
214 changed files with 680 additions and 649 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
@ -14,6 +14,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("1.95 [2016/08/23] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__MOVE("1.95 [2016/08/26] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Configuration__h
#define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Platform.h"
@ -22,7 +22,7 @@ export void Console_String (CHAR *s, LONGINT s__len);
void Console_Flush (void)
{
INTEGER error;
error = Platform_Write(((LONGINT)(1)), (LONGINT)(SYSTEM_ADDRESS)Console_line, Console_pos);
error = Platform_Write(((LONGINT)(1)), (LONGINT)(SYSTEM_ADRINT)Console_line, Console_pos);
Console_pos = 0;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Console__h
#define Console__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Configuration.h"
@ -258,7 +258,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, (LONGINT)(SYSTEM_ADDRESS)buf->data, buf->size);
error = Platform_Write(f->fd, (LONGINT)(SYSTEM_ADRINT)buf->data, buf->size);
if (error != 0) {
Files_Err((CHAR*)"error writing file", (LONGINT)19, f, error);
}
@ -657,7 +657,7 @@ void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x
} else {
min = n;
}
__MOVE((LONGINT)(SYSTEM_ADDRESS)buf->data + offset, (LONGINT)(SYSTEM_ADDRESS)x + xpos, min);
__MOVE((LONGINT)(SYSTEM_ADRINT)buf->data + offset, (LONGINT)(SYSTEM_ADRINT)x + xpos, min);
offset += min;
(*r).offset = offset;
xpos += min;
@ -722,7 +722,7 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT
} else {
min = n;
}
__MOVE((LONGINT)(SYSTEM_ADDRESS)x + xpos, (LONGINT)(SYSTEM_ADDRESS)buf->data + offset, min);
__MOVE((LONGINT)(SYSTEM_ADRINT)x + xpos, (LONGINT)(SYSTEM_ADRINT)buf->data + offset, min);
offset += min;
(*r).offset = offset;
if (offset > buf->size) {
@ -773,15 +773,15 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
*res = 3;
return;
}
error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n);
error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADRINT)buf, ((LONGINT)(4096)), &n);
while (n > 0) {
error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADDRESS)buf, n);
error = Platform_Write(fdnew, (LONGINT)(SYSTEM_ADRINT)buf, n);
if (error != 0) {
ignore = Platform_Close(fdold);
ignore = Platform_Close(fdnew);
Files_Err((CHAR*)"cannot move file", (LONGINT)17, NIL, error);
}
error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADDRESS)buf, ((LONGINT)(4096)), &n);
error = Platform_Read(fdold, (LONGINT)(SYSTEM_ADRINT)buf, ((LONGINT)(4096)), &n);
}
ignore = Platform_Close(fdold);
ignore = Platform_Close(fdnew);
@ -839,7 +839,7 @@ static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *de
j += 1;
}
} else {
__MOVE((LONGINT)(SYSTEM_ADDRESS)src, (LONGINT)(SYSTEM_ADDRESS)dest, src__len);
__MOVE((LONGINT)(SYSTEM_ADRINT)src, (LONGINT)(SYSTEM_ADRINT)dest, src__len);
}
}
@ -1009,7 +1009,7 @@ static void Files_Finalize (SYSTEM_PTR o)
{
Files_File f = NIL;
LONGINT res;
f = (Files_File)(SYSTEM_ADDRESS)o;
f = (Files_File)(SYSTEM_ADRINT)o;
if (f->fd >= 0) {
Files_CloseOSFile(f);
if (f->tempFile) {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */
#define LARGE
#include "SYSTEM.h"
@ -102,7 +102,7 @@ export void Heap_Unlock (void);
extern void *Heap__init();
extern LONGINT Platform_MainStackFrame;
extern LONGINT Platform_OSAllocate(LONGINT size);
#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADDRESS)(*((void**)((SYSTEM_ADDRESS)pointer)))
#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADRINT)(*((void**)((SYSTEM_ADRINT)pointer)))
#define Heap_HeapModuleInit() Heap__init()
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
#define Heap_PlatformHalt(code) Platform_Halt(code)
@ -135,7 +135,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
__COPY(name, m->name, ((LONGINT)(20)));
m->refcnt = 0;
m->enumPtrs = enumPtrs;
m->next = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules;
m->next = (Heap_Module)(SYSTEM_ADRINT)Heap_modules;
Heap_modules = (SYSTEM_PTR)m;
_o_result = (void*)m;
return _o_result;
@ -316,7 +316,7 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
__PUT(adr + 16, 0, LONGINT);
Heap_allocated += blksz;
Heap_Unlock();
_o_result = (SYSTEM_PTR)(SYSTEM_ADDRESS)(adr + 8);
_o_result = (SYSTEM_PTR)(SYSTEM_ADRINT)(adr + 8);
return _o_result;
}
@ -327,12 +327,12 @@ SYSTEM_PTR Heap_NEWBLK (LONGINT size)
SYSTEM_PTR new;
Heap_Lock();
blksz = __ASHL(__ASHR(size + 63, 5), 5);
new = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)&blksz);
tag = ((LONGINT)(SYSTEM_ADDRESS)new + blksz) - 24;
new = Heap_NEWREC((LONGINT)(SYSTEM_ADRINT)&blksz);
tag = ((LONGINT)(SYSTEM_ADRINT)new + blksz) - 24;
__PUT(tag - 8, 0, LONGINT);
__PUT(tag, blksz, LONGINT);
__PUT(tag + 8, -8, LONGINT);
__PUT((LONGINT)(SYSTEM_ADDRESS)new - 8, tag, LONGINT);
__PUT((LONGINT)(SYSTEM_ADRINT)new - 8, tag, LONGINT);
Heap_Unlock();
_o_result = new;
return _o_result;
@ -361,7 +361,7 @@ static void Heap_Mark (LONGINT q)
__GET(tag, offset, LONGINT);
fld = q + offset;
p = Heap_FetchAddress(fld);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)n, SYSTEM_PTR);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADRINT)n, SYSTEM_PTR);
} else {
fld = q + offset;
n = Heap_FetchAddress(fld);
@ -370,7 +370,7 @@ static void Heap_Mark (LONGINT q)
if (!__ODD(tagbits)) {
__PUT(n - 8, tagbits + 1, LONGINT);
__PUT(q - 8, tag + 1, LONGINT);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADDRESS)p, SYSTEM_PTR);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADRINT)p, SYSTEM_PTR);
p = q;
q = n;
tag = tagbits;
@ -385,7 +385,7 @@ static void Heap_Mark (LONGINT q)
static void Heap_MarkP (SYSTEM_PTR p)
{
Heap_Mark((LONGINT)(SYSTEM_ADDRESS)p);
Heap_Mark((LONGINT)(SYSTEM_ADRINT)p);
}
static void Heap_Scan (void)
@ -554,7 +554,7 @@ static void Heap_Finalize (void)
} else {
prev->next = n->next;
}
(*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj);
(*n->finalize)((SYSTEM_PTR)(SYSTEM_ADRINT)n->obj);
if (prev == NIL) {
n = Heap_fin;
} else {
@ -573,7 +573,7 @@ void Heap_FINALL (void)
while (Heap_fin != NIL) {
n = Heap_fin;
Heap_fin = Heap_fin->next;
(*n->finalize)((SYSTEM_PTR)(SYSTEM_ADDRESS)n->obj);
(*n->finalize)((SYSTEM_PTR)(SYSTEM_ADRINT)n->obj);
}
}
@ -590,9 +590,9 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len)
}
if (n == 0) {
nofcand = 0;
sp = (LONGINT)(SYSTEM_ADDRESS)&frame;
sp = (LONGINT)(SYSTEM_ADRINT)&frame;
stack0 = Heap_PlatformMainStackFrame();
inc = (LONGINT)(SYSTEM_ADDRESS)&align.p - (LONGINT)(SYSTEM_ADDRESS)&align;
inc = (LONGINT)(SYSTEM_ADRINT)&align.p - (LONGINT)(SYSTEM_ADRINT)&align;
if (sp > stack0) {
inc = -inc;
}
@ -623,7 +623,7 @@ void Heap_GC (BOOLEAN markStack)
LONGINT cand[10000];
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
Heap_Lock();
m = (Heap_Module)(SYSTEM_ADDRESS)Heap_modules;
m = (Heap_Module)(SYSTEM_ADRINT)Heap_modules;
while (m != NIL) {
if (m->enumPtrs != NIL) {
(*m->enumPtrs)(Heap_MarkP);
@ -700,7 +700,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
{
Heap_FinNode f;
__NEW(f, Heap_FinDesc);
f->obj = (LONGINT)(SYSTEM_ADDRESS)obj;
f->obj = (LONGINT)(SYSTEM_ADRINT)obj;
f->finalize = finalize;
f->marked = 1;
f->next = Heap_fin;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tskSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tskSfF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Console.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "OPM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPB__h
#define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Configuration.h"
@ -212,7 +212,7 @@ void OPC_Ident (OPT_Object obj)
OPM_WriteStringVar((void*)OPM_modName, ((LONGINT)(32)));
}
OPM_Write('_');
} else if (obj == OPT_sysptrtyp->strobj || obj == OPT_bytetyp->strobj) {
} else if ((obj == OPT_sysptrtyp->strobj || obj == OPT_ainttyp->strobj) || obj == OPT_bytetyp->strobj) {
OPM_WriteString((CHAR*)"SYSTEM_", (LONGINT)8);
}
OPM_WriteStringVar((void*)obj->name, ((LONGINT)(256)));

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPC__h
#define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Configuration.h"
@ -545,7 +545,7 @@ void OPM_FPrintReal (LONGINT *fp, REAL real)
{
INTEGER i;
LONGINT l;
__GET((LONGINT)(SYSTEM_ADDRESS)&real, i, INTEGER);
__GET((LONGINT)(SYSTEM_ADRINT)&real, i, INTEGER);
l = i;
OPM_FPrint(&*fp, l);
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPM__h
#define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "OPB.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "OPM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin tspkaSfF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "OPM.h"
@ -84,7 +84,7 @@ typedef
export void (*OPT_typSize)(OPT_Struct);
export OPT_Object OPT_topScope;
export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
export SHORTINT OPT_nofGmod;
export OPT_Object OPT_GlbMod[64];
export OPS_Name OPT_SelfName;
@ -1719,6 +1719,7 @@ static void EnumPtrs(void (*P)(void*))
P(OPT_sinttyp);
P(OPT_inttyp);
P(OPT_linttyp);
P(OPT_ainttyp);
P(OPT_realtyp);
P(OPT_lrltyp);
P(OPT_settyp);
@ -1795,6 +1796,7 @@ export void *OPT__init(void)
OPT_undftyp->BaseTyp = OPT_undftyp;
OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp);
OPT_EnterTyp((CHAR*)"PTR", 13, OPM_PointerSize, &OPT_sysptrtyp);
OPT_EnterTyp((CHAR*)"ADRINT", 5, OPM_LIntSize, &OPT_ainttyp);
OPT_EnterProc((CHAR*)"ADR", 20);
OPT_EnterProc((CHAR*)"CC", 21);
OPT_EnterProc((CHAR*)"LSH", 22);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPT__h
#define OPT__h
@ -68,7 +68,7 @@ typedef
import void (*OPT_typSize)(OPT_Struct);
import OPT_Object OPT_topScope;
import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
import SHORTINT OPT_nofGmod;
import OPT_Object OPT_GlbMod[64];
import OPS_Name OPT_SelfName;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "OPC.h"
@ -285,6 +285,7 @@ void OPV_AdrAndSize (OPT_Object topScope)
OPT_realtyp->strobj->linkadr = 2;
OPT_inttyp->strobj->linkadr = 2;
OPT_linttyp->strobj->linkadr = 2;
OPT_ainttyp->strobj->linkadr = 2;
OPT_lrltyp->strobj->linkadr = 2;
OPT_sinttyp->strobj->linkadr = 2;
OPT_booltyp->strobj->linkadr = 2;
@ -932,7 +933,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec)
OPM_Write(')');
break;
case 24:
OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADDRESS)", (LONGINT)26);
OPM_WriteString((CHAR*)"(LONGINT)(SYSTEM_ADRINT)", (LONGINT)25);
if (l->class == 1) {
OPC_CompleteIdent(l->obj);
} else {
@ -948,7 +949,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec)
OPC_Ident(n->typ->strobj);
OPM_Write(')');
if (__IN(n->typ->form, 0x6000) || __IN(l->typ->form, 0x6000)) {
OPM_WriteString((CHAR*)"(SYSTEM_ADDRESS)", (LONGINT)17);
OPM_WriteString((CHAR*)"(SYSTEM_ADRINT)", (LONGINT)16);
}
OPV_expr(l, exprPrec);
} else {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPV__h
#define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
@ -119,14 +119,14 @@ export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT
#define Platform_EXDEV() EXDEV
extern void Heap_InitHeap();
#define Platform_HeapInitHeap() Heap_InitHeap()
#define Platform_allocate(size) (LONGINT)(SYSTEM_ADDRESS)((void*)malloc((size_t)size))
#define Platform_allocate(size) (LONGINT)(SYSTEM_ADRINT)((void*)malloc((size_t)size))
#define Platform_chdir(n, n__len) chdir((char*)n)
#define Platform_closefile(fd) close(fd)
#define Platform_err() errno
#define Platform_errc(c) write(1, &c, 1)
#define Platform_errstring(s, s__len) write(1, s, s__len-1)
#define Platform_exit(code) exit(code)
#define Platform_free(address) free((void*)(SYSTEM_ADDRESS)address)
#define Platform_free(address) free((void*)(SYSTEM_ADRINT)address)
#define Platform_fstat(fd) fstat(fd, &s)
#define Platform_fsync(fd) fsync(fd)
#define Platform_ftruncate(fd, l) ftruncate(fd, l)
@ -139,13 +139,13 @@ extern void Heap_InitHeap();
#define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664)
#define Platform_openro(n, n__len) open((char*)n, O_RDONLY)
#define Platform_openrw(n, n__len) open((char*)n, O_RDWR)
#define Platform_readfile(fd, p, l) read(fd, (void*)(SYSTEM_ADDRESS)(p), l)
#define Platform_readfile(fd, p, l) read(fd, (void*)(SYSTEM_ADRINT)(p), l)
#define Platform_rename(o, o__len, n, n__len) rename((char*)o, (char*)n)
#define Platform_sectotm(s) struct tm *time = localtime((time_t*)&s)
#define Platform_seekcur() SEEK_CUR
#define Platform_seekend() SEEK_END
#define Platform_seekset() SEEK_SET
#define Platform_sethandler(s, h) SystemSetHandler(s, (SYSTEM_ADDRESS)h)
#define Platform_sethandler(s, h) SystemSetHandler(s, (SYSTEM_ADRINT)h)
#define Platform_stat(n, n__len) stat((char*)n, &s)
#define Platform_statdev() (LONGINT)s.st_dev
#define Platform_statino() (LONGINT)s.st_ino
@ -162,7 +162,7 @@ extern void Heap_InitHeap();
#define Platform_tvsec() tv.tv_sec
#define Platform_tvusec() tv.tv_usec
#define Platform_unlink(n, n__len) unlink((char*)n)
#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADDRESS)(p), l)
#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADRINT)(p), l)
BOOLEAN Platform_TooManyFiles (INTEGER e)
{
@ -230,7 +230,7 @@ void Platform_Init (INTEGER argc, LONGINT argvadr)
Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr;
Platform_ArgCount = argc;
av = (Platform_ArgVecPtr)(SYSTEM_ADDRESS)argvadr;
av = (Platform_ArgVecPtr)(SYSTEM_ADRINT)argvadr;
Platform_ArgVector = (*av)[0];
Platform_HaltCode = -128;
Platform_HeapInitHeap();
@ -263,7 +263,7 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len)
{
Platform_ArgVec av = NIL;
if (n < Platform_ArgCount) {
av = (Platform_ArgVec)(SYSTEM_ADDRESS)Platform_ArgVector;
av = (Platform_ArgVec)(SYSTEM_ADRINT)Platform_ArgVector;
__COPY(*(*av)[__X(n, ((LONGINT)(1024)))], val, val__len);
}
}
@ -530,7 +530,7 @@ INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n)
INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n)
{
INTEGER _o_result;
*n = Platform_readfile(h, (LONGINT)(SYSTEM_ADDRESS)b, b__len);
*n = Platform_readfile(h, (LONGINT)(SYSTEM_ADRINT)b, b__len);
if (*n < 0) {
*n = 0;
_o_result = Platform_err();
@ -766,7 +766,7 @@ static void Platform_TestLittleEndian (void)
{
INTEGER i;
i = 1;
__GET((LONGINT)(SYSTEM_ADDRESS)&i, Platform_LittleEndian, BOOLEAN);
__GET((LONGINT)(SYSTEM_ADRINT)&i, Platform_LittleEndian, BOOLEAN);
}
__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 24), {-8}};

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
@ -59,7 +59,7 @@ INTEGER Reals_Expo (REAL x)
{
INTEGER _o_result;
INTEGER i;
__GET((LONGINT)(SYSTEM_ADDRESS)&x + 2, i, INTEGER);
__GET((LONGINT)(SYSTEM_ADRINT)&x + 2, i, INTEGER);
_o_result = __MASK(__ASHR(i, 7), -256);
return _o_result;
}
@ -67,17 +67,17 @@ INTEGER Reals_Expo (REAL x)
void Reals_SetExpo (REAL *x, INTEGER ex)
{
CHAR c;
__GET((LONGINT)(SYSTEM_ADDRESS)x + 3, c, CHAR);
__PUT((LONGINT)(SYSTEM_ADDRESS)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
__GET((LONGINT)(SYSTEM_ADDRESS)x + 2, c, CHAR);
__PUT((LONGINT)(SYSTEM_ADDRESS)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
__GET((LONGINT)(SYSTEM_ADRINT)x + 3, c, CHAR);
__PUT((LONGINT)(SYSTEM_ADRINT)x + 3, (CHAR)(__ASHL(__ASHR((int)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
__GET((LONGINT)(SYSTEM_ADRINT)x + 2, c, CHAR);
__PUT((LONGINT)(SYSTEM_ADRINT)x + 2, (CHAR)(__MASK((int)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
}
INTEGER Reals_ExpoL (LONGREAL x)
{
INTEGER _o_result;
INTEGER i;
__GET((LONGINT)(SYSTEM_ADDRESS)&x + 6, i, INTEGER);
__GET((LONGINT)(SYSTEM_ADRINT)&x + 6, i, INTEGER);
_o_result = __MASK(__ASHR(i, 4), -2048);
return _o_result;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Reals__h
#define Reals__h

View file

@ -35,7 +35,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0)
void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)())
{
while (n > 0) {
P((LONGINT)(SYSTEM_ADDRESS)(*((void**)(adr))));
P((LONGINT)(SYSTEM_ADRINT)(*((void**)(adr))));
adr = ((void**)adr) + 1;
n--;
}
@ -106,7 +106,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim,
else if (typ == (LONGINT*)POINTER__typ) {
/* element type is a pointer */
x = Heap_NEWBLK(size + nofelems * sizeof(LONGINT));
p = (LONGINT*)(SYSTEM_ADDRESS)x[-1];
p = (LONGINT*)(SYSTEM_ADRINT)x[-1];
p[-nofelems] = *p; /* build new type desc in situ: 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */
p -= nofelems - 1; n = 1; /* n =1 for skipping the size field */
while (n <= nofelems) {*p = n*sizeof(LONGINT); p++; n++;}
@ -119,7 +119,7 @@ SYSTEM_PTR SYSTEM_NEWARR(LONGINT *typ, LONGINT elemsz, int elemalgn, int nofdim,
while (ptab[nofptrs] >= 0) {nofptrs++;} /* number of pointers per element */
nptr = nofelems * nofptrs; /* total number of pointers */
x = Heap_NEWBLK(size + nptr * sizeof(LONGINT));
p = (LONGINT*)(SYSTEM_ADDRESS)x[- 1];
p = (LONGINT*)(SYSTEM_ADRINT)x[- 1];
p[-nptr] = *p; /* build new type desc in situ; 1. copy block size; 2. setup ptr tab; 3. set sentinel; 4. patch tag */
p -= nptr - 1; n = 0; off = dataoff;
while (n < nofelems) {i = 0;
@ -155,7 +155,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler
// (Ignore other signals)
}
void SystemSetHandler(int s, SYSTEM_ADDRESS h) {
void SystemSetHandler(int s, SYSTEM_ADRINT h) {
if (s >= 2 && s <= 4) {
int needtosetsystemhandler = handler[s-2] == 0;
handler[s-2] = (SystemSignalHandler)h;
@ -194,12 +194,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler
}
}
void SystemSetInterruptHandler(SYSTEM_ADDRESS h) {
void SystemSetInterruptHandler(SYSTEM_ADRINT h) {
EnsureConsoleCtrlHandler();
SystemInterruptHandler = (SystemSignalHandler)h;
}
void SystemSetQuitHandler(SYSTEM_ADDRESS h) {
void SystemSetQuitHandler(SYSTEM_ADRINT h) {
EnsureConsoleCtrlHandler();
SystemQuitHandler = (SystemSignalHandler)h;
}

View file

@ -26,11 +26,12 @@ typedef unsigned char SYSTEM_CARD8;
typedef unsigned int size_t;
#endif
#define SYSTEM_ADDRESS size_t
#define SYSTEM_ADRINT size_t
#define SYSTEM_ADDRESS size_t // Temporarily for bootstrap
#define _SIZE_T_DECLARED // For FreeBSD
#define _SIZE_T_DEFINED_ // For OpenBSD
void *memcpy(void *dest, const void *source, SYSTEM_ADDRESS size);
void *memcpy(void *dest, const void *source, SYSTEM_ADRINT size);
@ -107,10 +108,10 @@ extern LONGINT SYSTEM_ENTIER (double x);
// Signal handling in SYSTEM.c
#ifndef _WIN32
extern void SystemSetHandler(int s, SYSTEM_ADDRESS h);
extern void SystemSetHandler(int s, SYSTEM_ADRINT h);
#else
extern void SystemSetInterruptHandler(SYSTEM_ADDRESS h);
extern void SystemSetQuitHandler (SYSTEM_ADDRESS h);
extern void SystemSetInterruptHandler(SYSTEM_ADRINT h);
extern void SystemSetQuitHandler (SYSTEM_ADRINT h);
#endif
@ -133,9 +134,9 @@ static int __str_cmp(CHAR *x, CHAR *y){
#define __COPY(s, d, n) {char*_a=(void*)s,*_b=(void*)d; LONGINT _i=0,_t=n-1; \
while(_i<_t&&((_b[_i]=_a[_i])!=0)){_i++;};_b[_i]=0;}
#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADDRESS)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t))
#define __DUP(x, l, t) x=(void*)memcpy((void*)(SYSTEM_ADRINT)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t))
#define __DUPARR(v, t) v=(void*)memcpy(v##__copy,v,sizeof(t))
#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADDRESS)x)
#define __DEL(x) Platform_OSFree((LONGINT)(SYSTEM_ADRINT)x)
@ -145,8 +146,8 @@ static int __str_cmp(CHAR *x, CHAR *y){
#define __VAL(t, x) (*(t*)&(x))
#define __GET(a, x, t) x= *(t*)(SYSTEM_ADDRESS)(a)
#define __PUT(a, x, t) *(t*)(SYSTEM_ADDRESS)(a)=x
#define __GET(a, x, t) x= *(t*)(SYSTEM_ADRINT)(a)
#define __PUT(a, x, t) *(t*)(SYSTEM_ADRINT)(a)=x
#define __LSHL(x, n, t) ((t)((U_##t)(x)<<(n)))
#define __LSHR(x, n, t) ((t)((U_##t)(x)>>(n)))
@ -161,7 +162,7 @@ static int __str_cmp(CHAR *x, CHAR *y){
#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t))
#define __BIT(x, n) (*(U_LONGINT*)(x)>>(n)&1)
#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADDRESS)(d),(char*)(SYSTEM_ADDRESS)(s),n)
#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADRINT)(d),(char*)(SYSTEM_ADRINT)(s),n)
#define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n))
#define __SHORT(x, y) ((int)((U_LONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0)))
#define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y)))
@ -222,7 +223,7 @@ extern void Heap_INCREF();
extern void Platform_Init(INTEGER argc, LONGINT argv);
extern void Heap_FINALL();
#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADDRESS)&argv);
#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(SYSTEM_ADRINT)&argv);
#define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum)
#define __FINI Heap_FINALL(); return 0
@ -243,7 +244,7 @@ extern SYSTEM_PTR Heap_NEWREC (LONGINT tag);
extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...);
#define __SYSNEW(p, len) p = Heap_NEWBLK((LONGINT)(len))
#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADDRESS)t##__typ)
#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(SYSTEM_ADRINT)t##__typ)
#define __NEWARR SYSTEM_NEWARR
@ -274,20 +275,20 @@ extern SYSTEM_PTR SYSTEM_NEWARR(LONGINT*, LONGINT, int, int, int, ...);
#define __INITYP(t, t0, level) \
t##__typ = (LONGINT*)&t##__desc.blksz; \
memcpy(t##__desc.basep, t0##__typ - __BASEOFF, level*sizeof(LONGINT)); \
t##__desc.basep[level] = (LONGINT)(SYSTEM_ADDRESS)t##__typ; \
t##__desc.module = (LONGINT)(SYSTEM_ADDRESS)m; \
t##__desc.basep[level] = (LONGINT)(SYSTEM_ADRINT)t##__typ; \
t##__desc.module = (LONGINT)(SYSTEM_ADRINT)m; \
if(t##__desc.blksz!=sizeof(struct t)) __HALT(-15); \
t##__desc.blksz = (t##__desc.blksz+5*sizeof(LONGINT)-1)/(4*sizeof(LONGINT))*(4*sizeof(LONGINT)); \
Heap_REGTYP(m, (LONGINT)(SYSTEM_ADDRESS)&t##__desc.next); \
Heap_REGTYP(m, (LONGINT)(SYSTEM_ADRINT)&t##__desc.next); \
SYSTEM_INHERIT(t##__typ, t0##__typ)
#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADDRESS)typ##__typ)
#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADDRESS)(*(((LONGINT*)(p))-1)))
#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADRINT)typ##__typ)
#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADRINT)(*(((LONGINT*)(p))-1)))
#define __ISP(p, typ, level) __IS(__TYPEOF(p),typ,level)
// Oberon-2 type bound procedures support
#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADDRESS)proc
#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADDRESS)*(typ-(__TPROC0OFF+num))))parlist
#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(SYSTEM_ADRINT)proc
#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADRINT)*(typ-(__TPROC0OFF+num))))parlist

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Files.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkamSf */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkamSf */
#define LARGE
#include "SYSTEM.h"
#include "Configuration.h"
@ -82,6 +82,7 @@ static void Vishap_PropagateElementaryTypeSizes (void)
OPT_realtyp->size = OPM_RealSize;
OPT_inttyp->size = OPM_IntSize;
OPT_linttyp->size = OPM_LIntSize;
OPT_ainttyp->size = OPM_LIntSize;
OPT_lrltyp->size = OPM_LRealSize;
OPT_sinttyp->size = OPM_SIntSize;
OPT_booltyp->size = OPM_BoolSize;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef errors__h
#define errors__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Configuration.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#define LARGE
#include "SYSTEM.h"
#include "Console.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/23] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/26] for gcc LP64 on cygwin xtspkaSfF */
#ifndef vt100__h
#define vt100__h