Update C bootstrap source.

This commit is contained in:
David Brown 2016-12-01 18:40:01 +00:00
parent c65b89daf3
commit 62c6d5c2a4
186 changed files with 854 additions and 870 deletions

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__MOVE("2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Configuration__h
#define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -237,7 +237,7 @@ static void Files_Deregister (CHAR *name, ADDRESS name__len)
if (osfile != NIL) {
__ASSERT(!osfile->tempFile, 0);
__ASSERT(osfile->fd >= 0, 0);
__COPY(osfile->workName, osfile->registerName, 101);
__MOVE(osfile->workName, osfile->registerName, 101);
Files_GetTempName(osfile->registerName, 101, (void*)osfile->workName, 101);
osfile->tempFile = 1;
osfile->state = 0;
@ -262,7 +262,7 @@ static void Files_Create (Files_File f)
} else {
__ASSERT(f->state == 2, 0);
Files_Deregister(f->registerName, 101);
__COPY(f->registerName, f->workName, 101);
__MOVE(f->registerName, f->workName, 101);
f->registerName[0] = 0x00;
f->tempFile = 0;
}
@ -823,7 +823,7 @@ void Files_Register (Files_File f)
if (errcode != 0) {
Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode);
}
__COPY(f->registerName, f->workName, 101);
__MOVE(f->registerName, f->workName, 101);
f->registerName[0] = 0x00;
f->tempFile = 0;
}

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -105,12 +105,12 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, ADDRESS a__len);
export void Heap_Unlock (void);
extern void *Heap__init();
extern ADDRESS Platform_MainStackFrame;
extern ADDRESS Modules_MainStackFrame;
extern ADDRESS Platform_OSAllocate(ADDRESS size);
#define Heap_HeapModuleInit() Heap__init()
#define Heap_ModulesHalt(code) Modules_Halt(code)
#define Heap_ModulesMainStackFrame() Modules_MainStackFrame
#define Heap_OSAllocate(size) Platform_OSAllocate(size)
#define Heap_PlatformMainStackFrame() Platform_MainStackFrame
void Heap_Lock (void)
{
@ -599,7 +599,7 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, ADDRESS cand__len)
if (n == 0) {
nofcand = 0;
sp = (ADDRESS)&frame;
stack0 = Heap_PlatformMainStackFrame();
stack0 = Heap_ModulesMainStackFrame();
inc = (ADDRESS)&align.p - (ADDRESS)&align;
if (sp > stack0) {
inc = -inc;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -43,24 +43,105 @@ typedef
export INT16 Modules_res;
export CHAR Modules_resMsg[256];
export Modules_ModuleName Modules_imported, Modules_importing;
export INT32 Modules_MainStackFrame;
export INT16 Modules_ArgCount;
export INT32 Modules_ArgVector;
export ADDRESS *Modules_ModuleDesc__typ;
export ADDRESS *Modules_CmdDesc__typ;
static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len);
export INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len);
export void Modules_AssertFail (INT32 code);
static void Modules_DisplayHaltCode (INT32 code);
export void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all);
export void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len);
export void Modules_GetIntArg (INT16 n, INT32 *val);
export void Modules_Halt (INT32 code);
export void Modules_Init (INT32 argc, INT32 argvadr);
export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len);
export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
static void Modules_errch (CHAR c);
static void Modules_errint (INT32 l);
static void Modules_errstring (CHAR *s, ADDRESS s__len);
extern void Heap_InitHeap();
extern void *Modules__init(void);
#define Modules_InitHeap() Heap_InitHeap()
#define Modules_ModulesInit() Modules__init()
#define Modules_modules() (Modules_Module)Heap_modules
#define Modules_setmodules(m) Heap_modules = m
typedef
INT32 (*ArgVecPtr__14)[1];
void Modules_Init (INT32 argc, INT32 argvadr)
{
ArgVecPtr__14 av = NIL;
Modules_MainStackFrame = argvadr;
Modules_ArgCount = __VAL(INT16, argc);
av = (ArgVecPtr__14)(ADDRESS)argvadr;
Modules_ArgVector = (*av)[0];
Modules_InitHeap();
Modules_ModulesInit();
}
typedef
CHAR (*ArgPtr__9)[1024];
typedef
ArgPtr__9 (*ArgVec__10)[1024];
void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len)
{
ArgVec__10 av = NIL;
if (n < Modules_ArgCount) {
av = (ArgVec__10)(ADDRESS)Modules_ArgVector;
__COPY(*(*av)[__X(n, 1024)], val, val__len);
}
}
void Modules_GetIntArg (INT16 n, INT32 *val)
{
CHAR s[64];
INT32 k, d, i;
s[0] = 0x00;
Modules_GetArg(n, (void*)s, 64);
i = 0;
if (s[0] == '-') {
i = 1;
}
k = 0;
d = (INT16)s[__X(i, 64)] - 48;
while ((d >= 0 && d <= 9)) {
k = k * 10 + d;
i += 1;
d = (INT16)s[__X(i, 64)] - 48;
}
if (s[0] == '-') {
k = -k;
i -= 1;
}
if (i > 0) {
*val = k;
}
}
INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len)
{
INT16 i;
CHAR arg[256];
__DUP(s, s__len, CHAR);
i = 0;
Modules_GetArg(i, (void*)arg, 256);
while ((i < Modules_ArgCount && __STRCMP(s, arg) != 0)) {
i += 1;
Modules_GetArg(i, (void*)arg, 256);
}
__DEL(s);
return i;
}
static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len)
{
INT16 i, j;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Modules__h
#define Modules__h
@ -39,13 +39,20 @@ typedef
import INT16 Modules_res;
import CHAR Modules_resMsg[256];
import Modules_ModuleName Modules_imported, Modules_importing;
import INT32 Modules_MainStackFrame;
import INT16 Modules_ArgCount;
import INT32 Modules_ArgVector;
import ADDRESS *Modules_ModuleDesc__typ;
import ADDRESS *Modules_CmdDesc__typ;
import INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len);
import void Modules_AssertFail (INT32 code);
import void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all);
import void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len);
import void Modules_GetIntArg (INT16 n, INT32 *val);
import void Modules_Halt (INT32 code);
import void Modules_Init (INT32 argc, INT32 argvadr);
import Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len);
import Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
import void *Modules__init(void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -253,7 +253,7 @@ OPT_Node OPB_NewString (OPS_String str, INT64 len)
x->conval->intval = -1;
x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256);
__MOVE(str, *x->conval->ext, 256);
return x;
}
@ -1624,23 +1624,19 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
g = 8;
}
if (x == y) {
} else if ((((y->comp == 2 && y->BaseTyp == x->BaseTyp)) && y->n <= x->n)) {
} else if ((y->comp == 3 && y->BaseTyp == x->BaseTyp)) {
} else if (x->BaseTyp == OPT_chartyp) {
if (g == 8) {
if (ynode->conval->intval2 > x->n) {
OPB_err(114);
}
} else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) {
} else {
OPB_err(113);
}
} else {
OPB_err(113);
}
} else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) {
if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) {
} else {
OPB_err(113);
}
} else if (x->comp == 4) {
if (x == y) {
} else if (y->comp == 4) {
@ -2536,7 +2532,6 @@ void OPB_Return (OPT_Node *x, OPT_Object proc)
void OPB_Assign (OPT_Node *x, OPT_Node y)
{
OPT_Node z = NIL;
INT8 subcl;
if ((*x)->class >= 7) {
OPB_err(56);
}
@ -2562,13 +2557,8 @@ void OPB_Assign (OPT_Node *x, OPT_Node y)
y->conval->intval = 0;
OPB_Index(&*x, OPB_NewIntConst(0));
}
if ((((((__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 32))) && y->typ->BaseTyp == OPT_chartyp)) {
subcl = 18;
} else {
subcl = 0;
}
OPB_BindNodes(19, OPT_notyp, &*x, y);
(*x)->subcl = subcl;
(*x)->subcl = 0;
}
void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ)

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPB__h
#define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPC__h
#define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -8,6 +8,7 @@
#include "SYSTEM.h"
#include "Configuration.h"
#include "Files.h"
#include "Modules.h"
#include "Out.h"
#include "Platform.h"
#include "Strings.h"
@ -266,7 +267,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len)
BOOLEAN OPM_OpenPar (void)
{
CHAR s[256];
if (Platform_ArgCount == 1) {
if (Modules_ArgCount == 1) {
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20);
OPM_LogWStr(Configuration_versionLong, 75);
@ -362,16 +363,16 @@ BOOLEAN OPM_OpenPar (void)
OPM_Options = 0xa9;
OPM_S = 1;
s[0] = 0x00;
Platform_GetArg(OPM_S, (void*)s, 256);
Modules_GetArg(OPM_S, (void*)s, 256);
while (s[0] == '-') {
OPM_ScanOptions(s, 256);
OPM_S += 1;
s[0] = 0x00;
Platform_GetArg(OPM_S, (void*)s, 256);
Modules_GetArg(OPM_S, (void*)s, 256);
}
OPM_GlobalAddressSize = OPM_AddressSize;
OPM_GlobalAlignment = OPM_Alignment;
__COPY(OPM_Model, OPM_GlobalModel, 10);
__MOVE(OPM_Model, OPM_GlobalModel, 10);
OPM_GlobalOptions = OPM_Options;
return 1;
}
@ -410,16 +411,16 @@ void OPM_InitOptions (void)
CHAR searchpath[1024], modules[1024];
CHAR MODULES[1024];
OPM_Options = OPM_GlobalOptions;
__COPY(OPM_GlobalModel, OPM_Model, 10);
__MOVE(OPM_GlobalModel, OPM_Model, 10);
OPM_Alignment = OPM_GlobalAlignment;
OPM_AddressSize = OPM_GlobalAddressSize;
s[0] = 0x00;
Platform_GetArg(OPM_S, (void*)s, 256);
Modules_GetArg(OPM_S, (void*)s, 256);
while (s[0] == '-') {
OPM_ScanOptions(s, 256);
OPM_S += 1;
s[0] = 0x00;
Platform_GetArg(OPM_S, (void*)s, 256);
Modules_GetArg(OPM_S, (void*)s, 256);
}
if (__IN(15, OPM_Options, 32)) {
OPM_Options |= __SETOF(10,32);
@ -472,11 +473,11 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len)
CHAR s[256];
*done = 0;
OPM_curpos = 0;
if (OPM_S >= Platform_ArgCount) {
if (OPM_S >= Modules_ArgCount) {
return;
}
s[0] = 0x00;
Platform_GetArg(OPM_S, (void*)s, 256);
Modules_GetArg(OPM_S, (void*)s, 256);
__NEW(T, Texts_TextDesc);
Texts_Open(T, s, 256);
OPM_LogWStr(s, 256);
@ -1070,6 +1071,7 @@ export void *OPM__init(void)
__DEFMOD;
__MODULE_IMPORT(Configuration);
__MODULE_IMPORT(Files);
__MODULE_IMPORT(Modules);
__MODULE_IMPORT(Out);
__MODULE_IMPORT(Platform);
__MODULE_IMPORT(Strings);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPM__h
#define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -527,7 +527,7 @@ static void OPP_selector (OPT_Node *x)
} else if (OPP_sym == 18) {
OPS_Get(&OPP_sym);
if (OPP_sym == 38) {
__COPY(OPS_name, name, 256);
__MOVE(OPS_name, name, 256);
OPS_Get(&OPP_sym);
if ((*x)->typ != NIL) {
if ((*x)->typ->form == 11) {
@ -867,7 +867,7 @@ static void OPP_Receiver (INT8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct
} else {
*mode = 1;
}
__COPY(OPS_name, name, 256);
__MOVE(OPS_name, name, 256);
OPP_CheckSym(38);
OPP_CheckSym(20);
if (OPP_sym == 38) {
@ -1030,7 +1030,7 @@ static void TProcDecl__23 (void)
}
OPP_Receiver(&objMode, objName, &objTyp, &recTyp);
if (OPP_sym == 38) {
__COPY(OPS_name, *ProcedureDeclaration__16_s->name, 256);
__MOVE(OPS_name, *ProcedureDeclaration__16_s->name, 256);
OPP_CheckMark(&*ProcedureDeclaration__16_s->vis);
OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp, &*ProcedureDeclaration__16_s->fwd);
OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp->BaseTyp, &baseProc);
@ -1129,7 +1129,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x)
TProcDecl__23();
} else if (OPP_sym == 38) {
OPT_Find(&fwd);
__COPY(OPS_name, name, 256);
__MOVE(OPS_name, name, 256);
OPP_CheckMark(&vis);
if ((vis != 0 && mode == 6)) {
mode = 7;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -434,8 +434,8 @@ void OPT_Init (OPS_Name name, UINT32 opt)
OPT_topScope = OPT_universe;
OPT_OpenScope(0, NIL);
OPT_SYSimported = 0;
__COPY(name, OPT_SelfName, 256);
__COPY(name, OPT_topScope->name, 256);
__MOVE(name, OPT_SelfName, 256);
__MOVE(name, OPT_topScope->name, 256);
OPT_GlbMod[0] = OPT_topScope;
OPT_nofGmod = 1;
OPT_newsf = __IN(4, opt, 32);
@ -1186,7 +1186,7 @@ static void OPT_InStruct (OPT_Struct *typ)
}
*typ = OPT_NewStr(0, 1);
} else {
__COPY(name, obj->name, 256);
__MOVE(name, obj->name, 256);
OPT_InsertImport(obj, &OPT_GlbMod[__X(mno, 64)]->right, &old);
if (old != NIL) {
OPT_FPrintObj(old);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPT__h
#define OPT__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -163,7 +163,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte
}
scope = obj->scope;
scope->leaf = 1;
__COPY(obj->name, scope->name, 256);
__MOVE(obj->name, scope->name, 256);
OPV_Stamp(scope->name);
if (mode == 9) {
obj->adr = 1;
@ -1286,7 +1286,17 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPM_WriteString((CHAR*)", ", 3);
if (r->typ == OPT_stringtyp) {
OPM_WriteInt(r->conval->intval2);
} else if (r->typ->comp == 3) {
OPM_WriteString((CHAR*)"__X(", 5);
OPC_Len(r->obj, r->typ, 0);
OPM_WriteString((CHAR*)" * ", 4);
OPM_WriteInt(r->typ->BaseTyp->size);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(l->typ->size);
OPM_Write(')');
} else {
__ASSERT(r->typ->comp == 2, 0);
__ASSERT(r->typ->size <= l->typ->size, 0);
OPM_WriteInt(r->typ->size);
}
OPM_Write(')');

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPV__h
#define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Out__h
#define Out__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -7,37 +7,18 @@
#include "SYSTEM.h"
typedef
CHAR (*Platform_ArgPtr)[1024];
typedef
Platform_ArgPtr (*Platform_ArgVec)[1024];
typedef
INT32 (*Platform_ArgVecPtr)[1];
typedef
CHAR (*Platform_EnvPtr)[1024];
typedef
struct Platform_FileIdentity {
INT32 volume, index, mtime;
} Platform_FileIdentity;
typedef
void (*Platform_HaltProcedure)(INT32);
typedef
void (*Platform_SignalHandler)(INT32);
export BOOLEAN Platform_LittleEndian;
export INT32 Platform_MainStackFrame;
export INT16 Platform_PID;
export CHAR Platform_CWD[256];
export INT16 Platform_ArgCount;
export INT32 Platform_ArgVector;
static Platform_HaltProcedure Platform_HaltHandler;
static INT32 Platform_TimeStart;
export INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
export CHAR Platform_NL[3];
@ -45,7 +26,6 @@ export CHAR Platform_NL[3];
export ADDRESS *Platform_FileIdentity__typ;
export BOOLEAN Platform_Absent (INT16 e);
export INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len);
export INT16 Platform_Chdir (CHAR *n, ADDRESS n__len);
export INT16 Platform_Close (INT32 h);
export BOOLEAN Platform_ConnectionFailed (INT16 e);
@ -53,15 +33,12 @@ export void Platform_Delay (INT32 ms);
export BOOLEAN Platform_DifferentFilesystems (INT16 e);
export INT16 Platform_Error (void);
export void Platform_Exit (INT32 code);
export void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len);
export void Platform_GetClock (INT32 *t, INT32 *d);
export void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len);
export void Platform_GetIntArg (INT16 n, INT32 *val);
export void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec);
export INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ);
export INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ);
export BOOLEAN Platform_Inaccessible (INT16 e);
export void Platform_Init (INT32 argc, INT32 argvadr);
export BOOLEAN Platform_Interrupted (INT16 e);
export BOOLEAN Platform_IsConsole (INT32 h);
export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
@ -117,8 +94,6 @@ export BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS
#define Platform_EROFS() EROFS
#define Platform_ETIMEDOUT() ETIMEDOUT
#define Platform_EXDEV() EXDEV
extern void Heap_InitHeap();
#define Platform_HeapInitHeap() Heap_InitHeap()
#define Platform_allocate(size) (ADDRESS)((void*)malloc((size_t)size))
#define Platform_chdir(n, n__len) chdir((char*)n)
#define Platform_closefile(fd) close(fd)
@ -129,7 +104,7 @@ extern void Heap_InitHeap();
#define Platform_fsync(fd) fsync(fd)
#define Platform_ftruncate(fd, l) ftruncate(fd, l)
#define Platform_getcwd(cwd, cwd__len) getcwd((char*)cwd, cwd__len)
#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var)
#define Platform_getenv(var, var__len) getenv((char*)var)
#define Platform_getpid() (INTEGER)getpid()
#define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0)
#define Platform_isatty(fd) isatty(fd)
@ -213,21 +188,14 @@ void Platform_OSFree (INT32 address)
Platform_free(address);
}
void Platform_Init (INT32 argc, INT32 argvadr)
{
Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr;
Platform_ArgCount = __VAL(INT16, argc);
av = (Platform_ArgVecPtr)(ADDRESS)argvadr;
Platform_ArgVector = (*av)[0];
Platform_HeapInitHeap();
}
typedef
CHAR (*EnvPtr__78)[1024];
BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len)
{
Platform_EnvPtr p = NIL;
EnvPtr__78 p = NIL;
__DUP(var, var__len, CHAR);
p = Platform_getenv(var, var__len);
p = (EnvPtr__78)(ADDRESS)Platform_getenv(var, var__len);
if (p != NIL) {
__COPY(*p, val, val__len);
}
@ -244,56 +212,6 @@ void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len)
__DEL(var);
}
void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len)
{
Platform_ArgVec av = NIL;
if (n < Platform_ArgCount) {
av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector;
__COPY(*(*av)[__X(n, 1024)], val, val__len);
}
}
void Platform_GetIntArg (INT16 n, INT32 *val)
{
CHAR s[64];
INT32 k, d, i;
s[0] = 0x00;
Platform_GetArg(n, (void*)s, 64);
i = 0;
if (s[0] == '-') {
i = 1;
}
k = 0;
d = (INT16)s[__X(i, 64)] - 48;
while ((d >= 0 && d <= 9)) {
k = k * 10 + d;
i += 1;
d = (INT16)s[__X(i, 64)] - 48;
}
if (s[0] == '-') {
k = -k;
i -= 1;
}
if (i > 0) {
*val = k;
}
}
INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len)
{
INT16 i;
CHAR arg[256];
__DUP(s, s__len, CHAR);
i = 0;
Platform_GetArg(i, (void*)arg, 256);
while ((i < Platform_ArgCount && __STRCMP(s, arg) != 0)) {
i += 1;
Platform_GetArg(i, (void*)arg, 256);
}
__DEL(s);
return i;
}
void Platform_SetInterruptHandler (Platform_SignalHandler handler)
{
Platform_sethandler(2, handler);
@ -587,7 +505,6 @@ export void *Platform__init(void)
__INITYP(Platform_FileIdentity, Platform_FileIdentity, 0);
/* BEGIN */
Platform_TestLittleEndian();
Platform_HaltHandler = NIL;
Platform_TimeStart = 0;
Platform_TimeStart = Platform_Time();
Platform_PID = Platform_getpid();

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Platform__h
#define Platform__h
@ -16,18 +16,14 @@ typedef
import BOOLEAN Platform_LittleEndian;
import INT32 Platform_MainStackFrame;
import INT16 Platform_PID;
import CHAR Platform_CWD[256];
import INT16 Platform_ArgCount;
import INT32 Platform_ArgVector;
import INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
import CHAR Platform_NL[3];
import ADDRESS *Platform_FileIdentity__typ;
import BOOLEAN Platform_Absent (INT16 e);
import INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len);
import INT16 Platform_Chdir (CHAR *n, ADDRESS n__len);
import INT16 Platform_Close (INT32 h);
import BOOLEAN Platform_ConnectionFailed (INT16 e);
@ -35,15 +31,12 @@ import void Platform_Delay (INT32 ms);
import BOOLEAN Platform_DifferentFilesystems (INT16 e);
import INT16 Platform_Error (void);
import void Platform_Exit (INT32 code);
import void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len);
import void Platform_GetClock (INT32 *t, INT32 *d);
import void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len);
import void Platform_GetIntArg (INT16 n, INT32 *val);
import void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec);
import INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ);
import INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ);
import BOOLEAN Platform_Inaccessible (INT16 e);
import void Platform_Init (INT32 argc, INT32 argvadr);
import BOOLEAN Platform_Interrupted (INT16 e);
import BOOLEAN Platform_IsConsole (INT32 h);
import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Reals__h
#define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -394,8 +394,8 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, ADDRESS *msg__t
e->file = (*(Texts_Alien*)&E)->file;
e->org = (*(Texts_Alien*)&E)->org;
e->span = (*(Texts_Alien*)&E)->span;
__COPY((*(Texts_Alien*)&E)->mod, e->mod, 32);
__COPY((*(Texts_Alien*)&E)->proc, e->proc, 32);
__MOVE((*(Texts_Alien*)&E)->mod, e->mod, 32);
__MOVE((*(Texts_Alien*)&E)->proc, e->proc, 32);
(*msg__).e = (Texts_Elem)e;
} else __WITHCHK;
} else if (__IS(msg__typ, Texts_IdentifyMsg, 1)) {

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef VT100__h
#define VT100__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef extTools__h
#define extTools__h