mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 06:22:25 +00:00
uintptr for alloc/free, some sys fns from LONGINT to int64.
This commit is contained in:
parent
fdaa5ec81b
commit
11de6b8512
214 changed files with 850 additions and 698 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
|
||||
|
||||
|
|
@ -13,6 +13,6 @@ export void *Configuration__init(void)
|
|||
__DEFMOD;
|
||||
__REGMOD("Configuration", 0);
|
||||
/* BEGIN */
|
||||
__MOVE("1.95 [2016/09/01] for gcc LP64 on cygwin", Configuration_versionLong, 41);
|
||||
__MOVE("1.95 [2016/09/02] for gcc LP64 on cygwin", Configuration_versionLong, 41);
|
||||
__ENDMOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Configuration__h
|
||||
#define Configuration__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Platform.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Console__h
|
||||
#define Console__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin tspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin tspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Configuration.h"
|
||||
#include "Console.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin tspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin tspkaSfF */
|
||||
|
||||
#ifndef Files__h
|
||||
#define Files__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin tskSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin tskSfF */
|
||||
#include "SYSTEM.h"
|
||||
|
||||
struct Heap__1 {
|
||||
|
|
@ -100,7 +100,7 @@ export void Heap_Unlock (void);
|
|||
|
||||
extern void *Heap__init();
|
||||
extern LONGINT Platform_MainStackFrame;
|
||||
extern LONGINT Platform_OSAllocate(LONGINT size);
|
||||
extern uintptr Platform_OSAllocate(uintptr size);
|
||||
#define Heap_FetchAddress(pointer) (LONGINT)(SYSTEM_ADRINT)(*((void**)((SYSTEM_ADRINT)pointer)))
|
||||
#define Heap_HeapModuleInit() Heap__init()
|
||||
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin tskSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin tskSfF */
|
||||
|
||||
#ifndef Heap__h
|
||||
#define Heap__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Console.h"
|
||||
#include "Heap.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Modules__h
|
||||
#define Modules__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "OPM.h"
|
||||
#include "OPS.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef OPB__h
|
||||
#define OPB__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Configuration.h"
|
||||
#include "OPM.h"
|
||||
|
|
@ -200,8 +200,12 @@ void OPC_Ident (OPT_Object obj)
|
|||
}
|
||||
}
|
||||
} else if ((mode == 5 && obj->typ->form == 4)) {
|
||||
OPM_WriteString((CHAR*)"int", 4);
|
||||
OPM_WriteInt(__ASHL(obj->typ->size, 3));
|
||||
if (obj->typ == OPT_pinttyp || obj->typ == OPT_ainttyp) {
|
||||
OPM_WriteString((CHAR*)"uintptr", 8);
|
||||
} else {
|
||||
OPM_WriteString((CHAR*)"int", 4);
|
||||
OPM_WriteInt(__ASHL(obj->typ->size, 3));
|
||||
}
|
||||
} else {
|
||||
if (mode != 5 || obj->linkadr != 2) {
|
||||
if (mode == 13) {
|
||||
|
|
@ -215,7 +219,7 @@ void OPC_Ident (OPT_Object obj)
|
|||
OPM_WriteStringVar((void*)OPM_modName, 32);
|
||||
}
|
||||
OPM_Write('_');
|
||||
} else if ((obj == OPT_sysptrtyp->strobj || obj == OPT_ainttyp->strobj) || obj == OPT_bytetyp->strobj) {
|
||||
} else if (obj == OPT_sysptrtyp->strobj || obj == OPT_bytetyp->strobj) {
|
||||
OPM_WriteString((CHAR*)"SYSTEM_", 8);
|
||||
}
|
||||
OPM_WriteStringVar((void*)obj->name, 256);
|
||||
|
|
@ -2080,6 +2084,7 @@ static void OPC_InitKeywords (void)
|
|||
Enter__49((CHAR*)"struct", 7);
|
||||
Enter__49((CHAR*)"switch", 7);
|
||||
Enter__49((CHAR*)"typedef", 8);
|
||||
Enter__49((CHAR*)"uintptr", 8);
|
||||
Enter__49((CHAR*)"uint16", 7);
|
||||
Enter__49((CHAR*)"uint32", 7);
|
||||
Enter__49((CHAR*)"uint64", 7);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef OPC__h
|
||||
#define OPC__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Configuration.h"
|
||||
#include "Console.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef OPM__h
|
||||
#define OPM__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "OPB.h"
|
||||
#include "OPM.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef OPP__h
|
||||
#define OPP__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin tspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin tspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "OPM.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin tspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin tspkaSfF */
|
||||
|
||||
#ifndef OPS__h
|
||||
#define OPS__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "OPM.h"
|
||||
#include "OPS.h"
|
||||
|
|
@ -83,7 +83,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_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, 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_pinttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
|
||||
export int8 OPT_nofGmod;
|
||||
export OPT_Object OPT_GlbMod[64];
|
||||
export OPS_Name OPT_SelfName;
|
||||
|
|
@ -1767,6 +1767,7 @@ static void EnumPtrs(void (*P)(void*))
|
|||
P(OPT_sinttyp);
|
||||
P(OPT_inttyp);
|
||||
P(OPT_linttyp);
|
||||
P(OPT_pinttyp);
|
||||
P(OPT_ainttyp);
|
||||
P(OPT_int8typ);
|
||||
P(OPT_int16typ);
|
||||
|
|
@ -1849,6 +1850,7 @@ export void *OPT__init(void)
|
|||
OPT_InitStruct(&OPT_niltyp, 9);
|
||||
OPT_EnterTyp((CHAR*)"BYTE", 1, OPM_ByteSize, &OPT_bytetyp);
|
||||
OPT_EnterTyp((CHAR*)"PTR", 11, OPM_PointerSize, &OPT_sysptrtyp);
|
||||
OPT_EnterTyp((CHAR*)"UINTPTR", 4, OPM_PointerSize, &OPT_pinttyp);
|
||||
OPT_EnterTyp((CHAR*)"ADRINT", 4, OPM_PointerSize, &OPT_ainttyp);
|
||||
OPT_EnterTyp((CHAR*)"INT8", 4, 1, &OPT_int8typ);
|
||||
OPT_EnterTyp((CHAR*)"INT16", 4, 2, &OPT_int16typ);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef OPT__h
|
||||
#define OPT__h
|
||||
|
|
@ -67,7 +67,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_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, 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_pinttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
|
||||
import int8 OPT_nofGmod;
|
||||
import OPT_Object OPT_GlbMod[64];
|
||||
import OPS_Name OPT_SelfName;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "OPC.h"
|
||||
#include "OPM.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_pinttyp->strobj->linkadr = 2;
|
||||
OPT_ainttyp->strobj->linkadr = 2;
|
||||
OPT_int8typ->strobj->linkadr = 2;
|
||||
OPT_int16typ->strobj->linkadr = 2;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef OPV__h
|
||||
#define OPV__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
|
||||
typedef
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Platform__h
|
||||
#define Platform__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Reals__h
|
||||
#define Reals__h
|
||||
|
|
|
|||
|
|
@ -18,8 +18,11 @@
|
|||
#include <signal.h>
|
||||
|
||||
|
||||
LONGINT SYSTEM_XCHK(LONGINT i, LONGINT ub) {return __X(i, ub);}
|
||||
LONGINT SYSTEM_RCHK(LONGINT i, LONGINT ub) {return __R(i, ub);}
|
||||
// Procedure verions of SYSTEM.H versions used when a multiply accessed
|
||||
// parameter has side effects.
|
||||
|
||||
int64 SYSTEM_XCHK(uint64 i, uint64 ub) {return __X(i, ub);}
|
||||
int64 SYSTEM_RCHK(uint64 i, uint64 ub) {return __R(i, ub);}
|
||||
LONGINT SYSTEM_ASH (LONGINT i, LONGINT n) {return __ASH(i, n);}
|
||||
LONGINT SYSTEM_ABS (LONGINT i) {return __ABS(i);}
|
||||
double SYSTEM_ABSD(double i) {return __ABS(i);}
|
||||
|
|
@ -35,7 +38,7 @@ void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0)
|
|||
void SYSTEM_ENUMP(void *adr, LONGINT n, void (*P)())
|
||||
{
|
||||
while (n > 0) {
|
||||
P((LONGINT)(SYSTEM_ADRINT)(*((void**)(adr))));
|
||||
P((uintptr)(*((void**)(adr))));
|
||||
adr = ((void**)adr) + 1;
|
||||
n--;
|
||||
}
|
||||
|
|
@ -48,20 +51,20 @@ void SYSTEM_ENUMR(void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)())
|
|||
while (n > 0) {
|
||||
t = typ;
|
||||
off = *t;
|
||||
while (off >= 0) {P(*(LONGINT*)((char*)adr+off)); t++; off = *t;}
|
||||
while (off >= 0) {P(*(uintptr*)((char*)adr+off)); t++; off = *t;}
|
||||
adr = ((char*)adr) + size;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
LONGINT SYSTEM_DIV(uLONGINT x, uLONGINT y)
|
||||
{ if ((LONGINT) x >= 0) return (x / y);
|
||||
LONGINT SYSTEM_DIV(uint64 x, uint64 y)
|
||||
{ if ((int64) x >= 0) return (x / y);
|
||||
else return -((y - 1 - x) / y);
|
||||
}
|
||||
|
||||
LONGINT SYSTEM_MOD(uLONGINT x, uLONGINT y)
|
||||
{ uLONGINT m;
|
||||
if ((LONGINT) x >= 0) return (x % y);
|
||||
LONGINT SYSTEM_MOD(uint64 x, uint64 y)
|
||||
{ uint64 m;
|
||||
if ((int64) x >= 0) return (x % y);
|
||||
else { m = (-x) % y;
|
||||
if (m != 0) return (y - m); else return 0;
|
||||
}
|
||||
|
|
@ -106,7 +109,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_ADRINT)x[-1];
|
||||
p = (LONGINT*)(uintptr)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 +122,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_ADRINT)x[- 1];
|
||||
p = (LONGINT*)(uintptr)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 +158,7 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler
|
|||
// (Ignore other signals)
|
||||
}
|
||||
|
||||
void SystemSetHandler(int s, SYSTEM_ADRINT h) {
|
||||
void SystemSetHandler(int s, uintptr h) {
|
||||
if (s >= 2 && s <= 4) {
|
||||
int needtosetsystemhandler = handler[s-2] == 0;
|
||||
handler[s-2] = (SystemSignalHandler)h;
|
||||
|
|
@ -194,12 +197,12 @@ typedef void (*SystemSignalHandler)(INTEGER); // = Platform_SignalHandler
|
|||
}
|
||||
}
|
||||
|
||||
void SystemSetInterruptHandler(SYSTEM_ADRINT h) {
|
||||
void SystemSetInterruptHandler(uintptr h) {
|
||||
EnsureConsoleCtrlHandler();
|
||||
SystemInterruptHandler = (SystemSignalHandler)h;
|
||||
}
|
||||
|
||||
void SystemSetQuitHandler(SYSTEM_ADRINT h) {
|
||||
void SystemSetQuitHandler(uintptr h) {
|
||||
EnsureConsoleCtrlHandler();
|
||||
SystemQuitHandler = (SystemSignalHandler)h;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,27 @@
|
|||
#ifndef SYSTEM__h
|
||||
#define SYSTEM__h
|
||||
|
||||
// Declare memcpy in a way compatible with C compilers intrinsic
|
||||
// built in implementations.
|
||||
|
||||
#if (__SIZEOF_POINTER__ == 8) || defined(_WIN64) || defined(__LP64__)
|
||||
#if defined(_WIN64)
|
||||
typedef unsigned long long size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
#else
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
|
||||
#define _SIZE_T_DECLARED // For FreeBSD
|
||||
#define _SIZE_T_DEFINED_ // For OpenBSD
|
||||
|
||||
void *memcpy(void *dest, const void *source, size_t size);
|
||||
|
||||
|
||||
// Declare fixed size versions of basic intger types
|
||||
|
||||
#if defined(_WIN64)
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
|
|
@ -18,20 +39,7 @@ typedef unsigned short int uint16;
|
|||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
|
||||
#if (__SIZEOF_POINTER__ == 8) || defined(_WIN64) || defined(__LP64__)
|
||||
#if defined(_WIN64)
|
||||
typedef unsigned long long size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
#else
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
|
||||
#define _SIZE_T_DECLARED // For FreeBSD
|
||||
#define _SIZE_T_DEFINED_ // For OpenBSD
|
||||
|
||||
void *memcpy(void *dest, const void *source, size_t size);
|
||||
#define uintptr size_t
|
||||
|
||||
|
||||
// The compiler uses 'import' and 'export' which translate to 'extern' and
|
||||
|
|
@ -46,7 +54,7 @@ void *memcpy(void *dest, const void *source, size_t size);
|
|||
|
||||
#define NIL ((void*)0)
|
||||
#define __MAXEXT 16
|
||||
#define POINTER__typ ((LONGINT*)(1)) // not NIL and not a valid type
|
||||
#define POINTER__typ ((uintptr*)(1)) // not NIL and not a valid type
|
||||
|
||||
|
||||
// Oberon types
|
||||
|
|
@ -60,7 +68,7 @@ typedef float REAL;
|
|||
typedef double LONGREAL;
|
||||
typedef void* SYSTEM_PTR;
|
||||
|
||||
typedef size_t SYSTEM_ADRINT;
|
||||
typedef uintptr SYSTEM_ADRINT;
|
||||
|
||||
|
||||
// For 32 bit builds, the size of LONGINT depends on a make option:
|
||||
|
|
@ -68,18 +76,19 @@ typedef size_t SYSTEM_ADRINT;
|
|||
#if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64)
|
||||
typedef int32 INTEGER;
|
||||
typedef int64 LONGINT;
|
||||
typedef uint64 uLONGINT;
|
||||
typedef uint64 SET;
|
||||
typedef uint64 uSET;
|
||||
#else
|
||||
typedef int16 INTEGER;
|
||||
typedef int32 LONGINT;
|
||||
typedef uint32 uLONGINT;
|
||||
typedef uint32 SET;
|
||||
typedef uint32 uSET;
|
||||
#endif
|
||||
|
||||
// Unsigned variants are for use by shift and rotate macros.
|
||||
|
||||
typedef uLONGINT SET;
|
||||
typedef uLONGINT uSET;
|
||||
// Temporary defs while bootstrapping
|
||||
|
||||
#define uLONGINT uint64
|
||||
|
||||
|
||||
|
||||
|
|
@ -90,32 +99,32 @@ typedef uLONGINT uSET;
|
|||
|
||||
// OS Memory allocation interfaces are in PlatformXXX.Mod
|
||||
|
||||
extern LONGINT Platform_OSAllocate (LONGINT size);
|
||||
extern void Platform_OSFree (LONGINT addr);
|
||||
extern uintptr Platform_OSAllocate (uintptr size);
|
||||
extern void Platform_OSFree (uintptr addr);
|
||||
|
||||
|
||||
// Run time system routines in SYSTEM.c
|
||||
|
||||
extern LONGINT SYSTEM_XCHK (LONGINT i, LONGINT ub);
|
||||
extern LONGINT SYSTEM_RCHK (LONGINT i, LONGINT ub);
|
||||
extern int64 SYSTEM_XCHK (uint64 i, uint64 ub);
|
||||
extern int64 SYSTEM_RCHK (uint64 i, uint64 ub);
|
||||
extern LONGINT SYSTEM_ASH (LONGINT i, LONGINT n);
|
||||
extern LONGINT SYSTEM_ABS (LONGINT i);
|
||||
extern double SYSTEM_ABSD (double i);
|
||||
extern void SYSTEM_INHERIT(LONGINT *t, LONGINT *t0);
|
||||
extern void SYSTEM_ENUMP (void *adr, LONGINT n, void (*P)());
|
||||
extern void SYSTEM_ENUMR (void *adr, LONGINT *typ, LONGINT size, LONGINT n, void (*P)());
|
||||
extern LONGINT SYSTEM_DIV (uLONGINT x, uLONGINT y);
|
||||
extern LONGINT SYSTEM_MOD (uLONGINT x, uLONGINT y);
|
||||
extern LONGINT SYSTEM_DIV (uint64 x, uint64 y);
|
||||
extern LONGINT SYSTEM_MOD (uint64 x, uint64 y);
|
||||
extern LONGINT SYSTEM_ENTIER (double x);
|
||||
|
||||
|
||||
// Signal handling in SYSTEM.c
|
||||
|
||||
#ifndef _WIN32
|
||||
extern void SystemSetHandler(int s, SYSTEM_ADRINT h);
|
||||
extern void SystemSetHandler(int s, uintptr h);
|
||||
#else
|
||||
extern void SystemSetInterruptHandler(SYSTEM_ADRINT h);
|
||||
extern void SystemSetQuitHandler (SYSTEM_ADRINT h);
|
||||
extern void SystemSetInterruptHandler(uintptr h);
|
||||
extern void SystemSetQuitHandler (uintptr h);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -138,11 +147,18 @@ 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_ADRINT)Platform_OSAllocate(l*sizeof(t)),x,l*sizeof(t))
|
||||
#define __DUP(x, l, t) x=(void*)memcpy((void*)(uintptr)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_ADRINT)x)
|
||||
#define __DEL(x) Platform_OSFree((LONGINT)(uintptr)x)
|
||||
|
||||
|
||||
// Index and range checks
|
||||
|
||||
#define __X(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-2),0))
|
||||
#define __XF(i, ub) SYSTEM_XCHK((uint64)(i), (uint64)(ub))
|
||||
|
||||
#define __R(i, ub) (((uint64)(i)<(uint64)(ub))?i:(__HALT(-8),0))
|
||||
#define __RF(i, ub) SYSTEM_RCHK((uint64)(i),(uint64)(ub))
|
||||
|
||||
|
||||
/* SYSTEM ops */
|
||||
|
|
@ -150,24 +166,24 @@ static int __str_cmp(CHAR *x, CHAR *y){
|
|||
#define __VAL(t, x) (*(t*)&(x))
|
||||
|
||||
|
||||
#define __GET(a, x, t) x= *(t*)(SYSTEM_ADRINT)(a)
|
||||
#define __PUT(a, x, t) *(t*)(SYSTEM_ADRINT)(a)=x
|
||||
#define __GET(a, x, t) x= *(t*)(uintptr)(a)
|
||||
#define __PUT(a, x, t) *(t*)(uintptr)(a)=x
|
||||
|
||||
#define __LSHL(x, n, t) ((t)((u##t)(x)<<(n)))
|
||||
#define __LSHR(x, n, t) ((t)((u##t)(x)>>(n)))
|
||||
#define __LSH(x, n, t) ((n)>=0? __LSHL(x, n, t): __LSHR(x, -(n), t))
|
||||
|
||||
#define __ASHL(x, n) ((LONGINT)(x)<<(n))
|
||||
#define __ASHR(x, n) ((LONGINT)(x)>>(n))
|
||||
#define __ASH(x, n) ((n)>=0?__ASHL(x,n):__ASHR(x,-(n)))
|
||||
|
||||
#define __ROTL(x, n, t) ((t)((u##t)(x)<<(n)|(u##t)(x)>>(8*sizeof(t)-(n))))
|
||||
#define __ROTR(x, n, t) ((t)((u##t)(x)>>(n)|(u##t)(x)<<(8*sizeof(t)-(n))))
|
||||
#define __ROT(x, n, t) ((n)>=0? __ROTL(x, n, t): __ROTR(x, -(n), t))
|
||||
|
||||
#define __BIT(x, n) (*(uLONGINT*)(x)>>(n)&1)
|
||||
#define __MOVE(s, d, n) memcpy((char*)(SYSTEM_ADRINT)(d),(char*)(SYSTEM_ADRINT)(s),n)
|
||||
#define __ASHL(x, n) ((LONGINT)(x)<<(n))
|
||||
#define __ASHR(x, n) ((LONGINT)(x)>>(n))
|
||||
#define __ASH(x, n) ((n)>=0?__ASHL(x,n):__ASHR(x,-(n)))
|
||||
#define __ASHF(x, n) SYSTEM_ASH((LONGINT)(x), (LONGINT)(n))
|
||||
|
||||
#define __BIT(x, n) (*(uint64*)(x)>>(n)&1)
|
||||
#define __MOVE(s, d, n) memcpy((char*)(uintptr)(d),(char*)(uintptr)(s),n)
|
||||
#define __SHORT(x, y) ((int)((uLONGINT)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0)))
|
||||
#define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y)))
|
||||
#define __CHR(x) ((CHAR)__R(x, 256))
|
||||
|
|
@ -191,10 +207,6 @@ static int __str_cmp(CHAR *x, CHAR *y){
|
|||
|
||||
// Runtime checks
|
||||
|
||||
#define __X(i, ub) (((uLONGINT)(i)<(uLONGINT)(ub))?i:(__HALT(-2),0))
|
||||
#define __XF(i, ub) SYSTEM_XCHK((LONGINT)(i), (LONGINT)(ub))
|
||||
#define __R(i, ub) (((uLONGINT)(i)<(uLONGINT)(ub))?i:(__HALT(-8),0))
|
||||
#define __RF(i, ub) SYSTEM_RCHK((LONGINT)(i),(LONGINT)(ub))
|
||||
#define __RETCHK __retchk: __HALT(-3); return 0;
|
||||
#define __CASECHK __HALT(-4)
|
||||
#define __WITHCHK __HALT(-7)
|
||||
|
|
@ -227,7 +239,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_ADRINT)&argv);
|
||||
#define __INIT(argc, argv) static void *m; Platform_Init((INTEGER)argc, (LONGINT)(uintptr)&argv);
|
||||
#define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum)
|
||||
#define __FINI Heap_FINALL(); return 0
|
||||
|
||||
|
|
@ -248,7 +260,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_ADRINT)t##__typ)
|
||||
#define __NEW(p, t) p = Heap_NEWREC((LONGINT)(uintptr)t##__typ)
|
||||
#define __NEWARR SYSTEM_NEWARR
|
||||
|
||||
|
||||
|
|
@ -279,20 +291,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_ADRINT)t##__typ; \
|
||||
t##__desc.module = (LONGINT)(SYSTEM_ADRINT)m; \
|
||||
t##__desc.basep[level] = (LONGINT)(uintptr)t##__typ; \
|
||||
t##__desc.module = (LONGINT)(uintptr)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_ADRINT)&t##__desc.next); \
|
||||
Heap_REGTYP(m, (LONGINT)(uintptr)&t##__desc.next); \
|
||||
SYSTEM_INHERIT(t##__typ, t0##__typ)
|
||||
|
||||
#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(SYSTEM_ADRINT)typ##__typ)
|
||||
#define __TYPEOF(p) ((LONGINT*)(SYSTEM_ADRINT)(*(((LONGINT*)(p))-1)))
|
||||
#define __IS(tag, typ, level) (*(tag-(__BASEOFF-level))==(LONGINT)(uintptr)typ##__typ)
|
||||
#define __TYPEOF(p) ((LONGINT*)(uintptr)(*(((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_ADRINT)proc
|
||||
#define __SEND(typ, num, funtyp, parlist) ((funtyp)((SYSTEM_ADRINT)*(typ-(__TPROC0OFF+num))))parlist
|
||||
#define __INITBP(t, proc, num) *(t##__typ-(__TPROC0OFF+num))=(LONGINT)(uintptr)proc
|
||||
#define __SEND(typ, num, funtyp, parlist) ((funtyp)((uintptr)*(typ-(__TPROC0OFF+num))))parlist
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Strings__h
|
||||
#define Strings__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Files.h"
|
||||
#include "Modules.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef Texts__h
|
||||
#define Texts__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkamSf */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkamSf */
|
||||
#include "SYSTEM.h"
|
||||
#include "Configuration.h"
|
||||
#include "Heap.h"
|
||||
|
|
@ -81,7 +81,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_PointerSize;
|
||||
OPT_pinttyp->size = OPM_PointerSize;
|
||||
OPT_lrltyp->size = OPM_LRealSize;
|
||||
OPT_sinttyp->size = OPM_SIntSize;
|
||||
OPT_booltyp->size = OPM_BoolSize;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
|
||||
typedef
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef errors__h
|
||||
#define errors__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Configuration.h"
|
||||
#include "Console.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef extTools__h
|
||||
#define extTools__h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
#include "SYSTEM.h"
|
||||
#include "Console.h"
|
||||
#include "Strings.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 1.95 [2016/09/01] for gcc LP64 on cygwin xtspkaSfF */
|
||||
/* voc 1.95 [2016/09/02] for gcc LP64 on cygwin xtspkaSfF */
|
||||
|
||||
#ifndef vt100__h
|
||||
#define vt100__h
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue