Update bootstrap C sources.

This commit is contained in:
David Brown 2016-12-12 18:43:32 +00:00
parent 4444d06e4e
commit d9fb831fcf
185 changed files with 1040 additions and 695 deletions

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__MOVE("2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -84,6 +84,7 @@ static void Heap_CheckFin (void);
static void Heap_ExtendHeap (INT32 blksz);
export void Heap_FINALL (void);
static void Heap_Finalize (void);
export INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len);
export void Heap_GC (BOOLEAN markStack);
static void Heap_HeapSort (INT32 n, INT32 *a, ADDRESS a__len);
export void Heap_INCREF (Heap_Module m);
@ -143,6 +144,35 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
return (void*)m;
}
INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len)
{
Heap_Module m, p;
__DUP(name, name__len, CHAR);
m = (Heap_Module)(ADDRESS)Heap_modules;
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
p = m;
m = m->next;
}
if ((m != NIL && m->refcnt == 0)) {
if (m == (Heap_Module)(ADDRESS)Heap_modules) {
Heap_modules = (SYSTEM_PTR)m->next;
} else {
p->next = m->next;
}
__DEL(name);
return 0;
} else {
if (m == NIL) {
__DEL(name);
return -1;
} else {
__DEL(name);
return m->refcnt;
}
}
__RETCHK;
}
void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd)
{
Heap_Cmd c;

View file

@ -1,16 +1,26 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#ifndef Heap__h
#define Heap__h
#include "SYSTEM.h"
typedef
struct Heap_CmdDesc *Heap_Cmd;
typedef
CHAR Heap_CmdName[24];
typedef
void (*Heap_Command)(void);
typedef
struct Heap_CmdDesc {
Heap_Cmd next;
Heap_CmdName name;
Heap_Command cmd;
} Heap_CmdDesc;
typedef
void (*Heap_EnumProc)(void(*)(SYSTEM_PTR));
@ -21,13 +31,18 @@ typedef
struct Heap_ModuleDesc *Heap_Module;
typedef
struct Heap_ModuleDesc {
INT32 _prvt0;
char _prvt1[44];
} Heap_ModuleDesc;
CHAR Heap_ModuleName[20];
typedef
CHAR Heap_ModuleName[20];
struct Heap_ModuleDesc {
Heap_Module next;
Heap_ModuleName name;
INT32 refcnt;
Heap_Cmd cmds;
INT32 types;
Heap_EnumProc enumPtrs;
char _prvt0[8];
} Heap_ModuleDesc;
import SYSTEM_PTR Heap_modules;
@ -35,8 +50,10 @@ import INT32 Heap_allocated, Heap_heapsize;
import INT16 Heap_FileCount;
import ADDRESS *Heap_ModuleDesc__typ;
import ADDRESS *Heap_CmdDesc__typ;
import void Heap_FINALL (void);
import INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len);
import void Heap_GC (BOOLEAN markStack);
import void Heap_INCREF (Heap_Module m);
import void Heap_InitHeap (void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -9,47 +9,15 @@
#include "Heap.h"
#include "Platform.h"
typedef
struct Modules_CmdDesc *Modules_Cmd;
typedef
void (*Modules_Command)(void);
typedef
struct Modules_CmdDesc {
Modules_Cmd next;
CHAR name[24];
Modules_Command cmd;
} Modules_CmdDesc;
typedef
struct Modules_ModuleDesc *Modules_Module;
typedef
CHAR Modules_ModuleName[20];
typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
INT32 refcnt;
Modules_Cmd cmds;
INT32 types;
void (*enumPtrs)(void(*)(INT32));
INT32 reserved1, reserved2;
} Modules_ModuleDesc;
export INT16 Modules_res;
export CHAR Modules_resMsg[256];
export Modules_ModuleName Modules_imported, Modules_importing;
export Heap_ModuleName Modules_imported, Modules_importing;
export INT32 Modules_MainStackFrame;
export INT16 Modules_ArgCount;
export INT32 Modules_ArgVector;
export CHAR Modules_BinaryDir[1024];
export ADDRESS *Modules_ModuleDesc__typ;
export ADDRESS *Modules_CmdDesc__typ;
static void Modules_Append (CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
static void Modules_AppendPart (CHAR c, CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
@ -68,8 +36,8 @@ export void Modules_Init (INT32 argc, INT32 argvadr);
static BOOLEAN Modules_IsAbsolute (CHAR *d, ADDRESS d__len);
static BOOLEAN Modules_IsFilePresent (CHAR *s, ADDRESS s__len);
static BOOLEAN Modules_IsOneOf (CHAR c, CHAR *s, ADDRESS s__len);
export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len);
export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
export Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len);
export Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
static void Modules_Trim (CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
static void Modules_errch (CHAR c);
static void Modules_errint (INT32 l);
@ -79,8 +47,7 @@ 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
#define Modules_modules() (Heap_Module)Heap_modules
void Modules_Init (INT32 argc, INT32 argvadr)
{
@ -334,11 +301,11 @@ static void Modules_FindBinaryDir (CHAR *binarydir, ADDRESS binarydir__len)
}
}
Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
{
Modules_Module m = NIL;
Heap_Module m = NIL;
CHAR bodyname[64];
Modules_Command body;
Heap_Command body;
__DUP(name, name__len, CHAR);
m = Modules_modules();
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
@ -358,9 +325,9 @@ Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
return m;
}
Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len)
Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len)
{
Modules_Cmd c = NIL;
Heap_Cmd c = NIL;
__DUP(name, name__len, CHAR);
c = mod->cmds;
while ((c != NIL && __STRCMP(c->name, name) != 0)) {
@ -387,31 +354,24 @@ Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS nam
void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all)
{
Modules_Module m = NIL, p = NIL;
Heap_Module m = NIL, p = NIL;
INT32 refcount;
__DUP(name, name__len, CHAR);
m = Modules_modules();
if (all) {
Modules_res = 1;
__MOVE("unloading \"all\" not yet supported", Modules_resMsg, 34);
} else {
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
p = m;
m = m->next;
}
if ((m != NIL && m->refcnt == 0)) {
if (m == Modules_modules()) {
Modules_setmodules(m->next);
} else {
p->next = m->next;
}
refcount = Heap_FreeModule(name, name__len);
if (refcount == 0) {
Modules_res = 0;
} else {
Modules_res = 1;
if (m == NIL) {
if (refcount < 0) {
__MOVE("module not found", Modules_resMsg, 17);
} else {
__MOVE("clients of this module exist", Modules_resMsg, 29);
}
Modules_res = 1;
}
}
__DEL(name);
@ -533,8 +493,6 @@ void Modules_AssertFail (INT32 code)
}
}
__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 48), {0, 28, -12}};
__TDESC(Modules_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 32), {0, -8}};
export void *Modules__init(void)
{
@ -542,8 +500,6 @@ export void *Modules__init(void)
__MODULE_IMPORT(Heap);
__MODULE_IMPORT(Platform);
__REGMOD("Modules", 0);
__INITYP(Modules_ModuleDesc, Modules_ModuleDesc, 0);
__INITYP(Modules_CmdDesc, Modules_CmdDesc, 0);
/* BEGIN */
Modules_FindBinaryDir((void*)Modules_BinaryDir, 1024);
__ENDMOD;

View file

@ -1,51 +1,20 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Modules__h
#define Modules__h
#include "SYSTEM.h"
typedef
struct Modules_CmdDesc *Modules_Cmd;
typedef
void (*Modules_Command)(void);
typedef
struct Modules_CmdDesc {
Modules_Cmd next;
CHAR name[24];
Modules_Command cmd;
} Modules_CmdDesc;
typedef
struct Modules_ModuleDesc *Modules_Module;
typedef
CHAR Modules_ModuleName[20];
typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
INT32 refcnt;
Modules_Cmd cmds;
INT32 types;
void (*enumPtrs)(void(*)(INT32));
char _prvt0[8];
} Modules_ModuleDesc;
#include "Heap.h"
import INT16 Modules_res;
import CHAR Modules_resMsg[256];
import Modules_ModuleName Modules_imported, Modules_importing;
import Heap_ModuleName Modules_imported, Modules_importing;
import INT32 Modules_MainStackFrame;
import INT16 Modules_ArgCount;
import INT32 Modules_ArgVector;
import CHAR Modules_BinaryDir[1024];
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);
@ -54,8 +23,8 @@ 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 Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len);
import Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
import void *Modules__init(void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -6,6 +6,7 @@
#define SET UINT32
#include "SYSTEM.h"
#include "Heap.h"
#include "Platform.h"
@ -13,8 +14,11 @@ export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128];
static INT16 Out_in;
static ADDRESS *typedesc__5__typ;
export void Out_Char (CHAR ch);
static void Out_DumpModule (Heap_Module m);
export void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len);
export void Out_Flush (void);
export void Out_Hex (INT64 x, INT64 n);
export void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len);
@ -203,6 +207,94 @@ void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len)
Out_HexDumpAdr((ADDRESS)m, 0, m__len);
}
static void Out_DumpModule (Heap_Module m)
{
Out_String((CHAR*)" next: ", 13);
Out_Hex((INT32)(ADDRESS)m->next, 1);
Out_Ln();
Out_String((CHAR*)" name: ", 13);
Out_String(m->name, 20);
Out_Ln();
Out_String((CHAR*)" refcnt: ", 13);
Out_Hex(m->refcnt, 1);
Out_Ln();
Out_String((CHAR*)" cmds: ", 13);
Out_Hex((INT32)(ADDRESS)m->cmds, 1);
Out_Ln();
Out_String((CHAR*)" types: ", 13);
Out_Hex(m->types, 1);
Out_Ln();
Out_String((CHAR*)" enumPtrs: ", 13);
Out_Hex((INT32)(ADDRESS)m->enumPtrs, 1);
Out_Ln();
}
typedef
struct typedesc__5 *tag__4;
typedef
struct typedesc__5 {
INT32 tag, next, level, module;
CHAR name[24];
INT32 bases[16];
INT32 reserved, blksz, ptr0;
} typedesc__5;
void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len)
{
INT32 addr;
tag__4 desc = NIL;
INT16 i;
__GET((ADDRESS)o - 4, addr, INT32);
Out_String((CHAR*)"obj tag: ", 11);
Out_Hex(addr, 1);
Out_Ln();
desc = (tag__4)(ADDRESS)(addr - 108);
Out_String((CHAR*)"desc at: ", 11);
Out_Hex((INT32)(ADDRESS)desc, 1);
Out_Ln();
Out_String((CHAR*)"desc contains:", 15);
Out_Ln();
Out_String((CHAR*)"tag: ", 11);
Out_Hex(desc->tag, 1);
Out_Ln();
Out_String((CHAR*)"next: ", 11);
Out_Hex(desc->next, 1);
Out_Ln();
Out_String((CHAR*)"level: ", 11);
Out_Hex(desc->level, 1);
Out_Ln();
Out_String((CHAR*)"module: ", 11);
Out_Hex(desc->module, 1);
Out_Ln();
Out_DumpModule((Heap_Module)(ADDRESS)desc->module);
Out_String((CHAR*)"name: ", 11);
Out_String(desc->name, 24);
Out_Ln();
Out_String((CHAR*)"bases: ", 11);
i = 0;
while (i < 16) {
Out_Hex(desc->bases[__X(i, 16)], 8);
if (__MASK(i, -4) == 3) {
Out_Ln();
Out_String((CHAR*)" ", 11);
} else {
Out_Char(' ');
}
i += 1;
}
Out_Ln();
Out_String((CHAR*)"reserved: ", 11);
Out_Hex(desc->reserved, 1);
Out_Ln();
Out_String((CHAR*)"blksz: ", 11);
Out_Hex(desc->blksz, 1);
Out_Ln();
Out_String((CHAR*)"ptr0: ", 11);
Out_Hex(desc->ptr0, 1);
Out_Ln();
}
static void Out_digit (INT64 n, CHAR *s, ADDRESS s__len, INT16 *i)
{
*i -= 1;
@ -380,15 +472,18 @@ void Out_LongReal (LONGREAL x, INT16 n)
Out_RealP(x, n, 1);
}
__TDESC(typedesc__5, 1, 0) = {__TDFLDS("typedesc__5", 116), {-4}};
export void *Out__init(void)
{
__DEFMOD;
__MODULE_IMPORT(Heap);
__MODULE_IMPORT(Platform);
__REGMOD("Out", 0);
__REGCMD("Flush", Out_Flush);
__REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open);
__INITYP(typedesc__5, typedesc__5, 0);
/* BEGIN */
Out_IsConsole = Platform_IsConsole(1);
Out_in = 0;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Out__h
#define Out__h
@ -10,6 +10,7 @@ import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch);
import void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len);
import void Out_Flush (void);
import void Out_Hex (INT64 x, INT64 n);
import void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -390,6 +390,7 @@ void Texts_DumpReader (Texts_Reader re)
Texts_DumpRun(re.run);
}
}
Out_DumpType((void*)&*re.run, 20);
}
static Texts_FontsFont Texts_FontsThis (CHAR *name, ADDRESS name__len)
@ -1566,8 +1567,8 @@ static void LoadElem__22 (Files_Rider *r, ADDRESS *r__typ, INT32 pos, INT32 span
static void LoadElem__22 (Files_Rider *r, ADDRESS *r__typ, INT32 pos, INT32 span, Texts_Elem *e)
{
Modules_Module M = NIL;
Modules_Command Cmd;
Heap_Module M = NIL;
Heap_Command Cmd;
Texts_Alien a = NIL;
INT32 org, ew, eh;
INT8 eno;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__MOVE("2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -84,6 +84,7 @@ static void Heap_CheckFin (void);
static void Heap_ExtendHeap (INT32 blksz);
export void Heap_FINALL (void);
static void Heap_Finalize (void);
export INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len);
export void Heap_GC (BOOLEAN markStack);
static void Heap_HeapSort (INT32 n, INT32 *a, ADDRESS a__len);
export void Heap_INCREF (Heap_Module m);
@ -143,6 +144,35 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
return (void*)m;
}
INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len)
{
Heap_Module m, p;
__DUP(name, name__len, CHAR);
m = (Heap_Module)(ADDRESS)Heap_modules;
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
p = m;
m = m->next;
}
if ((m != NIL && m->refcnt == 0)) {
if (m == (Heap_Module)(ADDRESS)Heap_modules) {
Heap_modules = (SYSTEM_PTR)m->next;
} else {
p->next = m->next;
}
__DEL(name);
return 0;
} else {
if (m == NIL) {
__DEL(name);
return -1;
} else {
__DEL(name);
return m->refcnt;
}
}
__RETCHK;
}
void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd)
{
Heap_Cmd c;

View file

@ -1,16 +1,26 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#ifndef Heap__h
#define Heap__h
#include "SYSTEM.h"
typedef
struct Heap_CmdDesc *Heap_Cmd;
typedef
CHAR Heap_CmdName[24];
typedef
void (*Heap_Command)(void);
typedef
struct Heap_CmdDesc {
Heap_Cmd next;
Heap_CmdName name;
Heap_Command cmd;
} Heap_CmdDesc;
typedef
void (*Heap_EnumProc)(void(*)(SYSTEM_PTR));
@ -21,13 +31,18 @@ typedef
struct Heap_ModuleDesc *Heap_Module;
typedef
struct Heap_ModuleDesc {
INT32 _prvt0;
char _prvt1[44];
} Heap_ModuleDesc;
CHAR Heap_ModuleName[20];
typedef
CHAR Heap_ModuleName[20];
struct Heap_ModuleDesc {
Heap_Module next;
Heap_ModuleName name;
INT32 refcnt;
Heap_Cmd cmds;
INT32 types;
Heap_EnumProc enumPtrs;
char _prvt0[8];
} Heap_ModuleDesc;
import SYSTEM_PTR Heap_modules;
@ -35,8 +50,10 @@ import INT32 Heap_allocated, Heap_heapsize;
import INT16 Heap_FileCount;
import ADDRESS *Heap_ModuleDesc__typ;
import ADDRESS *Heap_CmdDesc__typ;
import void Heap_FINALL (void);
import INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len);
import void Heap_GC (BOOLEAN markStack);
import void Heap_INCREF (Heap_Module m);
import void Heap_InitHeap (void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -9,47 +9,15 @@
#include "Heap.h"
#include "Platform.h"
typedef
struct Modules_CmdDesc *Modules_Cmd;
typedef
void (*Modules_Command)(void);
typedef
struct Modules_CmdDesc {
Modules_Cmd next;
CHAR name[24];
Modules_Command cmd;
} Modules_CmdDesc;
typedef
struct Modules_ModuleDesc *Modules_Module;
typedef
CHAR Modules_ModuleName[20];
typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
INT32 refcnt;
Modules_Cmd cmds;
INT32 types;
void (*enumPtrs)(void(*)(INT32));
INT32 reserved1, reserved2;
} Modules_ModuleDesc;
export INT16 Modules_res;
export CHAR Modules_resMsg[256];
export Modules_ModuleName Modules_imported, Modules_importing;
export Heap_ModuleName Modules_imported, Modules_importing;
export INT32 Modules_MainStackFrame;
export INT16 Modules_ArgCount;
export INT32 Modules_ArgVector;
export CHAR Modules_BinaryDir[1024];
export ADDRESS *Modules_ModuleDesc__typ;
export ADDRESS *Modules_CmdDesc__typ;
static void Modules_Append (CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
static void Modules_AppendPart (CHAR c, CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
@ -68,8 +36,8 @@ export void Modules_Init (INT32 argc, INT32 argvadr);
static BOOLEAN Modules_IsAbsolute (CHAR *d, ADDRESS d__len);
static BOOLEAN Modules_IsFilePresent (CHAR *s, ADDRESS s__len);
static BOOLEAN Modules_IsOneOf (CHAR c, CHAR *s, ADDRESS s__len);
export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len);
export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
export Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len);
export Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
static void Modules_Trim (CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
static void Modules_errch (CHAR c);
static void Modules_errint (INT32 l);
@ -79,8 +47,7 @@ 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
#define Modules_modules() (Heap_Module)Heap_modules
void Modules_Init (INT32 argc, INT32 argvadr)
{
@ -334,11 +301,11 @@ static void Modules_FindBinaryDir (CHAR *binarydir, ADDRESS binarydir__len)
}
}
Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
{
Modules_Module m = NIL;
Heap_Module m = NIL;
CHAR bodyname[64];
Modules_Command body;
Heap_Command body;
__DUP(name, name__len, CHAR);
m = Modules_modules();
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
@ -358,9 +325,9 @@ Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
return m;
}
Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len)
Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len)
{
Modules_Cmd c = NIL;
Heap_Cmd c = NIL;
__DUP(name, name__len, CHAR);
c = mod->cmds;
while ((c != NIL && __STRCMP(c->name, name) != 0)) {
@ -387,31 +354,24 @@ Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS nam
void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all)
{
Modules_Module m = NIL, p = NIL;
Heap_Module m = NIL, p = NIL;
INT32 refcount;
__DUP(name, name__len, CHAR);
m = Modules_modules();
if (all) {
Modules_res = 1;
__MOVE("unloading \"all\" not yet supported", Modules_resMsg, 34);
} else {
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
p = m;
m = m->next;
}
if ((m != NIL && m->refcnt == 0)) {
if (m == Modules_modules()) {
Modules_setmodules(m->next);
} else {
p->next = m->next;
}
refcount = Heap_FreeModule(name, name__len);
if (refcount == 0) {
Modules_res = 0;
} else {
Modules_res = 1;
if (m == NIL) {
if (refcount < 0) {
__MOVE("module not found", Modules_resMsg, 17);
} else {
__MOVE("clients of this module exist", Modules_resMsg, 29);
}
Modules_res = 1;
}
}
__DEL(name);
@ -533,8 +493,6 @@ void Modules_AssertFail (INT32 code)
}
}
__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 48), {0, 28, -12}};
__TDESC(Modules_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 32), {0, -8}};
export void *Modules__init(void)
{
@ -542,8 +500,6 @@ export void *Modules__init(void)
__MODULE_IMPORT(Heap);
__MODULE_IMPORT(Platform);
__REGMOD("Modules", 0);
__INITYP(Modules_ModuleDesc, Modules_ModuleDesc, 0);
__INITYP(Modules_CmdDesc, Modules_CmdDesc, 0);
/* BEGIN */
Modules_FindBinaryDir((void*)Modules_BinaryDir, 1024);
__ENDMOD;

View file

@ -1,51 +1,20 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Modules__h
#define Modules__h
#include "SYSTEM.h"
typedef
struct Modules_CmdDesc *Modules_Cmd;
typedef
void (*Modules_Command)(void);
typedef
struct Modules_CmdDesc {
Modules_Cmd next;
CHAR name[24];
Modules_Command cmd;
} Modules_CmdDesc;
typedef
struct Modules_ModuleDesc *Modules_Module;
typedef
CHAR Modules_ModuleName[20];
typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
INT32 refcnt;
Modules_Cmd cmds;
INT32 types;
void (*enumPtrs)(void(*)(INT32));
char _prvt0[8];
} Modules_ModuleDesc;
#include "Heap.h"
import INT16 Modules_res;
import CHAR Modules_resMsg[256];
import Modules_ModuleName Modules_imported, Modules_importing;
import Heap_ModuleName Modules_imported, Modules_importing;
import INT32 Modules_MainStackFrame;
import INT16 Modules_ArgCount;
import INT32 Modules_ArgVector;
import CHAR Modules_BinaryDir[1024];
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);
@ -54,8 +23,8 @@ 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 Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len);
import Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
import void *Modules__init(void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -6,6 +6,7 @@
#define SET UINT32
#include "SYSTEM.h"
#include "Heap.h"
#include "Platform.h"
@ -13,8 +14,11 @@ export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128];
static INT16 Out_in;
static ADDRESS *typedesc__5__typ;
export void Out_Char (CHAR ch);
static void Out_DumpModule (Heap_Module m);
export void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len);
export void Out_Flush (void);
export void Out_Hex (INT64 x, INT64 n);
export void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len);
@ -203,6 +207,94 @@ void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len)
Out_HexDumpAdr((ADDRESS)m, 0, m__len);
}
static void Out_DumpModule (Heap_Module m)
{
Out_String((CHAR*)" next: ", 13);
Out_Hex((INT32)(ADDRESS)m->next, 1);
Out_Ln();
Out_String((CHAR*)" name: ", 13);
Out_String(m->name, 20);
Out_Ln();
Out_String((CHAR*)" refcnt: ", 13);
Out_Hex(m->refcnt, 1);
Out_Ln();
Out_String((CHAR*)" cmds: ", 13);
Out_Hex((INT32)(ADDRESS)m->cmds, 1);
Out_Ln();
Out_String((CHAR*)" types: ", 13);
Out_Hex(m->types, 1);
Out_Ln();
Out_String((CHAR*)" enumPtrs: ", 13);
Out_Hex((INT32)(ADDRESS)m->enumPtrs, 1);
Out_Ln();
}
typedef
struct typedesc__5 *tag__4;
typedef
struct typedesc__5 {
INT32 tag, next, level, module;
CHAR name[24];
INT32 bases[16];
INT32 reserved, blksz, ptr0;
} typedesc__5;
void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len)
{
INT32 addr;
tag__4 desc = NIL;
INT16 i;
__GET((ADDRESS)o - 4, addr, INT32);
Out_String((CHAR*)"obj tag: ", 11);
Out_Hex(addr, 1);
Out_Ln();
desc = (tag__4)(ADDRESS)(addr - 108);
Out_String((CHAR*)"desc at: ", 11);
Out_Hex((INT32)(ADDRESS)desc, 1);
Out_Ln();
Out_String((CHAR*)"desc contains:", 15);
Out_Ln();
Out_String((CHAR*)"tag: ", 11);
Out_Hex(desc->tag, 1);
Out_Ln();
Out_String((CHAR*)"next: ", 11);
Out_Hex(desc->next, 1);
Out_Ln();
Out_String((CHAR*)"level: ", 11);
Out_Hex(desc->level, 1);
Out_Ln();
Out_String((CHAR*)"module: ", 11);
Out_Hex(desc->module, 1);
Out_Ln();
Out_DumpModule((Heap_Module)(ADDRESS)desc->module);
Out_String((CHAR*)"name: ", 11);
Out_String(desc->name, 24);
Out_Ln();
Out_String((CHAR*)"bases: ", 11);
i = 0;
while (i < 16) {
Out_Hex(desc->bases[__X(i, 16)], 8);
if (__MASK(i, -4) == 3) {
Out_Ln();
Out_String((CHAR*)" ", 11);
} else {
Out_Char(' ');
}
i += 1;
}
Out_Ln();
Out_String((CHAR*)"reserved: ", 11);
Out_Hex(desc->reserved, 1);
Out_Ln();
Out_String((CHAR*)"blksz: ", 11);
Out_Hex(desc->blksz, 1);
Out_Ln();
Out_String((CHAR*)"ptr0: ", 11);
Out_Hex(desc->ptr0, 1);
Out_Ln();
}
static void Out_digit (INT64 n, CHAR *s, ADDRESS s__len, INT16 *i)
{
*i -= 1;
@ -380,15 +472,18 @@ void Out_LongReal (LONGREAL x, INT16 n)
Out_RealP(x, n, 1);
}
__TDESC(typedesc__5, 1, 0) = {__TDFLDS("typedesc__5", 116), {-4}};
export void *Out__init(void)
{
__DEFMOD;
__MODULE_IMPORT(Heap);
__MODULE_IMPORT(Platform);
__REGMOD("Out", 0);
__REGCMD("Flush", Out_Flush);
__REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open);
__INITYP(typedesc__5, typedesc__5, 0);
/* BEGIN */
Out_IsConsole = Platform_IsConsole(1);
Out_in = 0;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Out__h
#define Out__h
@ -10,6 +10,7 @@ import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch);
import void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len);
import void Out_Flush (void);
import void Out_Hex (INT64 x, INT64 n);
import void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -390,6 +390,7 @@ void Texts_DumpReader (Texts_Reader re)
Texts_DumpRun(re.run);
}
}
Out_DumpType((void*)&*re.run, 20);
}
static Texts_FontsFont Texts_FontsThis (CHAR *name, ADDRESS name__len)
@ -1566,8 +1567,8 @@ static void LoadElem__22 (Files_Rider *r, ADDRESS *r__typ, INT32 pos, INT32 span
static void LoadElem__22 (Files_Rider *r, ADDRESS *r__typ, INT32 pos, INT32 span, Texts_Elem *e)
{
Modules_Module M = NIL;
Modules_Command Cmd;
Heap_Module M = NIL;
Heap_Command Cmd;
Texts_Alien a = NIL;
INT32 org, ew, eh;
INT8 eno;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__MOVE("2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -84,6 +84,7 @@ static void Heap_CheckFin (void);
static void Heap_ExtendHeap (INT64 blksz);
export void Heap_FINALL (void);
static void Heap_Finalize (void);
export INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len);
export void Heap_GC (BOOLEAN markStack);
static void Heap_HeapSort (INT64 n, INT64 *a, ADDRESS a__len);
export void Heap_INCREF (Heap_Module m);
@ -143,6 +144,35 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
return (void*)m;
}
INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len)
{
Heap_Module m, p;
__DUP(name, name__len, CHAR);
m = (Heap_Module)(ADDRESS)Heap_modules;
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
p = m;
m = m->next;
}
if ((m != NIL && m->refcnt == 0)) {
if (m == (Heap_Module)(ADDRESS)Heap_modules) {
Heap_modules = (SYSTEM_PTR)m->next;
} else {
p->next = m->next;
}
__DEL(name);
return 0;
} else {
if (m == NIL) {
__DEL(name);
return -1;
} else {
__DEL(name);
return m->refcnt;
}
}
__RETCHK;
}
void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd)
{
Heap_Cmd c;

View file

@ -1,16 +1,26 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#ifndef Heap__h
#define Heap__h
#include "SYSTEM.h"
typedef
struct Heap_CmdDesc *Heap_Cmd;
typedef
CHAR Heap_CmdName[24];
typedef
void (*Heap_Command)(void);
typedef
struct Heap_CmdDesc {
Heap_Cmd next;
Heap_CmdName name;
Heap_Command cmd;
} Heap_CmdDesc;
typedef
void (*Heap_EnumProc)(void(*)(SYSTEM_PTR));
@ -21,13 +31,18 @@ typedef
struct Heap_ModuleDesc *Heap_Module;
typedef
struct Heap_ModuleDesc {
INT64 _prvt0;
char _prvt1[56];
} Heap_ModuleDesc;
CHAR Heap_ModuleName[20];
typedef
CHAR Heap_ModuleName[20];
struct Heap_ModuleDesc {
Heap_Module next;
Heap_ModuleName name;
INT32 refcnt;
Heap_Cmd cmds;
INT64 types;
Heap_EnumProc enumPtrs;
char _prvt0[8];
} Heap_ModuleDesc;
import SYSTEM_PTR Heap_modules;
@ -35,8 +50,10 @@ import INT64 Heap_allocated, Heap_heapsize;
import INT16 Heap_FileCount;
import ADDRESS *Heap_ModuleDesc__typ;
import ADDRESS *Heap_CmdDesc__typ;
import void Heap_FINALL (void);
import INT32 Heap_FreeModule (CHAR *name, ADDRESS name__len);
import void Heap_GC (BOOLEAN markStack);
import void Heap_INCREF (Heap_Module m);
import void Heap_InitHeap (void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -9,47 +9,15 @@
#include "Heap.h"
#include "Platform.h"
typedef
struct Modules_CmdDesc *Modules_Cmd;
typedef
void (*Modules_Command)(void);
typedef
struct Modules_CmdDesc {
Modules_Cmd next;
CHAR name[24];
Modules_Command cmd;
} Modules_CmdDesc;
typedef
struct Modules_ModuleDesc *Modules_Module;
typedef
CHAR Modules_ModuleName[20];
typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
INT32 refcnt;
Modules_Cmd cmds;
INT32 types;
void (*enumPtrs)(void(*)(INT32));
INT32 reserved1, reserved2;
} Modules_ModuleDesc;
export INT16 Modules_res;
export CHAR Modules_resMsg[256];
export Modules_ModuleName Modules_imported, Modules_importing;
export Heap_ModuleName Modules_imported, Modules_importing;
export INT64 Modules_MainStackFrame;
export INT16 Modules_ArgCount;
export INT64 Modules_ArgVector;
export CHAR Modules_BinaryDir[1024];
export ADDRESS *Modules_ModuleDesc__typ;
export ADDRESS *Modules_CmdDesc__typ;
static void Modules_Append (CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
static void Modules_AppendPart (CHAR c, CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
@ -68,8 +36,8 @@ export void Modules_Init (INT32 argc, INT64 argvadr);
static BOOLEAN Modules_IsAbsolute (CHAR *d, ADDRESS d__len);
static BOOLEAN Modules_IsFilePresent (CHAR *s, ADDRESS s__len);
static BOOLEAN Modules_IsOneOf (CHAR c, CHAR *s, ADDRESS s__len);
export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len);
export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
export Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len);
export Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
static void Modules_Trim (CHAR *s, ADDRESS s__len, CHAR *d, ADDRESS d__len);
static void Modules_errch (CHAR c);
static void Modules_errint (INT32 l);
@ -79,8 +47,7 @@ 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
#define Modules_modules() (Heap_Module)Heap_modules
void Modules_Init (INT32 argc, INT64 argvadr)
{
@ -334,11 +301,11 @@ static void Modules_FindBinaryDir (CHAR *binarydir, ADDRESS binarydir__len)
}
}
Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
{
Modules_Module m = NIL;
Heap_Module m = NIL;
CHAR bodyname[64];
Modules_Command body;
Heap_Command body;
__DUP(name, name__len, CHAR);
m = Modules_modules();
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
@ -358,9 +325,9 @@ Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len)
return m;
}
Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len)
Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len)
{
Modules_Cmd c = NIL;
Heap_Cmd c = NIL;
__DUP(name, name__len, CHAR);
c = mod->cmds;
while ((c != NIL && __STRCMP(c->name, name) != 0)) {
@ -387,31 +354,24 @@ Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS nam
void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all)
{
Modules_Module m = NIL, p = NIL;
Heap_Module m = NIL, p = NIL;
INT32 refcount;
__DUP(name, name__len, CHAR);
m = Modules_modules();
if (all) {
Modules_res = 1;
__MOVE("unloading \"all\" not yet supported", Modules_resMsg, 34);
} else {
while ((m != NIL && __STRCMP(m->name, name) != 0)) {
p = m;
m = m->next;
}
if ((m != NIL && m->refcnt == 0)) {
if (m == Modules_modules()) {
Modules_setmodules(m->next);
} else {
p->next = m->next;
}
refcount = Heap_FreeModule(name, name__len);
if (refcount == 0) {
Modules_res = 0;
} else {
Modules_res = 1;
if (m == NIL) {
if (refcount < 0) {
__MOVE("module not found", Modules_resMsg, 17);
} else {
__MOVE("clients of this module exist", Modules_resMsg, 29);
}
Modules_res = 1;
}
}
__DEL(name);
@ -533,8 +493,6 @@ void Modules_AssertFail (INT32 code)
}
}
__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 64), {0, 32, -24}};
__TDESC(Modules_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 40), {0, -16}};
export void *Modules__init(void)
{
@ -542,8 +500,6 @@ export void *Modules__init(void)
__MODULE_IMPORT(Heap);
__MODULE_IMPORT(Platform);
__REGMOD("Modules", 0);
__INITYP(Modules_ModuleDesc, Modules_ModuleDesc, 0);
__INITYP(Modules_CmdDesc, Modules_CmdDesc, 0);
/* BEGIN */
Modules_FindBinaryDir((void*)Modules_BinaryDir, 1024);
__ENDMOD;

View file

@ -1,51 +1,20 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Modules__h
#define Modules__h
#include "SYSTEM.h"
typedef
struct Modules_CmdDesc *Modules_Cmd;
typedef
void (*Modules_Command)(void);
typedef
struct Modules_CmdDesc {
Modules_Cmd next;
CHAR name[24];
Modules_Command cmd;
} Modules_CmdDesc;
typedef
struct Modules_ModuleDesc *Modules_Module;
typedef
CHAR Modules_ModuleName[20];
typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
INT32 refcnt;
Modules_Cmd cmds;
INT32 types;
void (*enumPtrs)(void(*)(INT32));
char _prvt0[8];
} Modules_ModuleDesc;
#include "Heap.h"
import INT16 Modules_res;
import CHAR Modules_resMsg[256];
import Modules_ModuleName Modules_imported, Modules_importing;
import Heap_ModuleName Modules_imported, Modules_importing;
import INT64 Modules_MainStackFrame;
import INT16 Modules_ArgCount;
import INT64 Modules_ArgVector;
import CHAR Modules_BinaryDir[1024];
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);
@ -54,8 +23,8 @@ 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, INT64 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 Heap_Command Modules_ThisCommand (Heap_Module mod, CHAR *name, ADDRESS name__len);
import Heap_Module Modules_ThisMod (CHAR *name, ADDRESS name__len);
import void *Modules__init(void);

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. 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/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -6,6 +6,7 @@
#define SET UINT32
#include "SYSTEM.h"
#include "Heap.h"
#include "Platform.h"
@ -13,8 +14,11 @@ export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128];
static INT16 Out_in;
static ADDRESS *typedesc__5__typ;
export void Out_Char (CHAR ch);
static void Out_DumpModule (Heap_Module m);
export void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len);
export void Out_Flush (void);
export void Out_Hex (INT64 x, INT64 n);
export void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len);
@ -203,6 +207,94 @@ void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len)
Out_HexDumpAdr((ADDRESS)m, 0, m__len);
}
static void Out_DumpModule (Heap_Module m)
{
Out_String((CHAR*)" next: ", 13);
Out_Hex((INT64)(ADDRESS)m->next, 1);
Out_Ln();
Out_String((CHAR*)" name: ", 13);
Out_String(m->name, 20);
Out_Ln();
Out_String((CHAR*)" refcnt: ", 13);
Out_Hex(m->refcnt, 1);
Out_Ln();
Out_String((CHAR*)" cmds: ", 13);
Out_Hex((INT64)(ADDRESS)m->cmds, 1);
Out_Ln();
Out_String((CHAR*)" types: ", 13);
Out_Hex(m->types, 1);
Out_Ln();
Out_String((CHAR*)" enumPtrs: ", 13);
Out_Hex((INT64)(ADDRESS)m->enumPtrs, 1);
Out_Ln();
}
typedef
struct typedesc__5 *tag__4;
typedef
struct typedesc__5 {
INT64 tag, next, level, module;
CHAR name[24];
INT64 bases[16];
INT64 reserved, blksz, ptr0;
} typedesc__5;
void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len)
{
INT64 addr;
tag__4 desc = NIL;
INT16 i;
__GET((ADDRESS)o - 8, addr, INT64);
Out_String((CHAR*)"obj tag: ", 11);
Out_Hex(addr, 1);
Out_Ln();
desc = (tag__4)(ADDRESS)(addr - 192);
Out_String((CHAR*)"desc at: ", 11);
Out_Hex((INT64)(ADDRESS)desc, 1);
Out_Ln();
Out_String((CHAR*)"desc contains:", 15);
Out_Ln();
Out_String((CHAR*)"tag: ", 11);
Out_Hex(desc->tag, 1);
Out_Ln();
Out_String((CHAR*)"next: ", 11);
Out_Hex(desc->next, 1);
Out_Ln();
Out_String((CHAR*)"level: ", 11);
Out_Hex(desc->level, 1);
Out_Ln();
Out_String((CHAR*)"module: ", 11);
Out_Hex(desc->module, 1);
Out_Ln();
Out_DumpModule((Heap_Module)(ADDRESS)desc->module);
Out_String((CHAR*)"name: ", 11);
Out_String(desc->name, 24);
Out_Ln();
Out_String((CHAR*)"bases: ", 11);
i = 0;
while (i < 16) {
Out_Hex(desc->bases[__X(i, 16)], 16);
if (__MASK(i, -4) == 3) {
Out_Ln();
Out_String((CHAR*)" ", 11);
} else {
Out_Char(' ');
}
i += 1;
}
Out_Ln();
Out_String((CHAR*)"reserved: ", 11);
Out_Hex(desc->reserved, 1);
Out_Ln();
Out_String((CHAR*)"blksz: ", 11);
Out_Hex(desc->blksz, 1);
Out_Ln();
Out_String((CHAR*)"ptr0: ", 11);
Out_Hex(desc->ptr0, 1);
Out_Ln();
}
static void Out_digit (INT64 n, CHAR *s, ADDRESS s__len, INT16 *i)
{
*i -= 1;
@ -380,15 +472,18 @@ void Out_LongReal (LONGREAL x, INT16 n)
Out_RealP(x, n, 1);
}
__TDESC(typedesc__5, 1, 0) = {__TDFLDS("typedesc__5", 208), {-8}};
export void *Out__init(void)
{
__DEFMOD;
__MODULE_IMPORT(Heap);
__MODULE_IMPORT(Platform);
__REGMOD("Out", 0);
__REGCMD("Flush", Out_Flush);
__REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open);
__INITYP(typedesc__5, typedesc__5, 0);
/* BEGIN */
Out_IsConsole = Platform_IsConsole(1);
Out_in = 0;

View file

@ -1,4 +1,4 @@
/* voc 2.00 [2016/12/11]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
/* voc 2.00 [2016/12/12]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Out__h
#define Out__h
@ -10,6 +10,7 @@ import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch);
import void Out_DumpType (SYSTEM_BYTE *o, ADDRESS o__len);
import void Out_Flush (void);
import void Out_Hex (INT64 x, INT64 n);
import void Out_HexDump (SYSTEM_BYTE *m, ADDRESS m__len);

View file

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

Some files were not shown because too many files have changed in this diff Show more