bootstrap sources.

This commit is contained in:
Norayr Chilingarian 2025-06-24 18:27:35 +04:00
parent dac6504f12
commit a9465ccfc6
187 changed files with 1390 additions and 443 deletions

View file

@ -116,9 +116,11 @@ extern void Modules_AssertFail(INT32 x);
// Index checking
static inline INT64 __XF(UINT64 i, UINT64 ub) {if (i >= ub) {__HALT(-2);} return i;}
#define __X(i, ub) (((i)<(ub))?i:(__HALT(-2),0))
static inline INT64 __XF(INT64 i, UINT64 ub) {
if (i < 0 || (UINT64)i >= ub) __HALT(-2);
return i;
}
#define __X(i, ub) (((i) >= 0 && (i) < (ub)) ? (i) : (__HALT(-2),0))
// Range checking, and checked SHORT and CHR functions

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspamS */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspamS */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 76);
__MOVE("2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 76);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Configuration__h
#define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPB__h
#define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -618,31 +618,33 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty)
{
if (obj != NIL) {
OPC_DefineTProcMacros(obj->left, &*empty);
if ((((obj->mode == 13 && obj == OPC_BaseTProc(obj))) && (OPM_currFile != 0 || obj->vis == 1))) {
OPM_WriteString((CHAR*)"#define __", 11);
OPC_Ident(obj);
OPC_DeclareParams(obj->link, 1);
OPM_WriteString((CHAR*)" __SEND(", 9);
if (obj->link->typ->form == 11) {
OPM_WriteString((CHAR*)"__TYPEOF(", 10);
OPC_Ident(obj->link);
if ((obj->mode == 13 && obj == OPC_BaseTProc(obj))) {
if (OPM_currFile == 1 || (OPM_currFile == 0 && obj->vis == 1)) {
OPM_WriteString((CHAR*)"#define __", 11);
OPC_Ident(obj);
OPC_DeclareParams(obj->link, 1);
OPM_WriteString((CHAR*)" __SEND(", 9);
if (obj->link->typ->form == 11) {
OPM_WriteString((CHAR*)"__TYPEOF(", 10);
OPC_Ident(obj->link);
OPM_Write(')');
} else {
OPC_Ident(obj->link);
OPM_WriteString((CHAR*)"__typ", 6);
}
OPC_Str1((CHAR*)", #, ", 6, __ASHR(obj->adr, 16));
if (obj->typ == OPT_notyp) {
OPM_WriteString((CHAR*)"void", 5);
} else {
OPC_Ident(obj->typ->strobj);
}
OPM_WriteString((CHAR*)"(*)", 4);
OPC_AnsiParamList(obj->link, 0);
OPM_WriteString((CHAR*)", ", 3);
OPC_DeclareParams(obj->link, 1);
OPM_Write(')');
} else {
OPC_Ident(obj->link);
OPM_WriteString((CHAR*)"__typ", 6);
OPM_WriteLn();
}
OPC_Str1((CHAR*)", #, ", 6, __ASHR(obj->adr, 16));
if (obj->typ == OPT_notyp) {
OPM_WriteString((CHAR*)"void", 5);
} else {
OPC_Ident(obj->typ->strobj);
}
OPM_WriteString((CHAR*)"(*)", 4);
OPC_AnsiParamList(obj->link, 0);
OPM_WriteString((CHAR*)", ", 3);
OPC_DeclareParams(obj->link, 1);
OPM_Write(')');
OPM_WriteLn();
}
OPC_DefineTProcMacros(obj->right, &*empty);
}
@ -652,7 +654,7 @@ static void OPC_DefineType (OPT_Struct str)
{
OPT_Object obj = NIL, field = NIL, par = NIL;
BOOLEAN empty;
if (OPM_currFile == 1 || str->ref < 255) {
if ((OPM_currFile == 1 || str->ref < 255) || (((OPM_currFile == 0 && str->strobj != NIL)) && str->strobj->vis == 1)) {
obj = str->strobj;
if (obj == NIL || OPC_Undefined(obj)) {
if (obj != NIL) {
@ -719,6 +721,13 @@ static void OPC_DefineType (OPT_Struct str)
if (!empty) {
OPM_WriteLn();
}
} else if ((obj->typ->form == 11 && obj->typ->BaseTyp->comp == 4)) {
empty = 1;
OPC_DeclareTProcs(obj->typ->BaseTyp->link, &empty);
OPC_DefineTProcMacros(obj->typ->BaseTyp->link, &empty);
if (!empty) {
OPM_WriteLn();
}
}
}
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPC__h
#define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,8 @@ typedef
CHAR OPM_FileName[32];
static CHAR OPM_currentComment[256];
static BOOLEAN OPM_hasComment;
static CHAR OPM_SourceFileName[256];
static CHAR OPM_GlobalModel[10];
export CHAR OPM_Model[10];
@ -59,6 +61,7 @@ static void OPM_FindInstallDir (void);
static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos);
static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len);
export void OPM_Get (CHAR *ch);
export void OPM_GetComment (CHAR *text, ADDRESS text__len);
export void OPM_Init (BOOLEAN *done);
export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n);
@ -82,6 +85,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len);
static void OPM_ShowLine (INT64 pos);
export INT64 OPM_SignedMaximum (INT32 bytecount);
export INT64 OPM_SignedMinimum (INT32 bytecount);
export void OPM_StoreComment (CHAR *text, ADDRESS text__len);
export void OPM_SymRCh (CHAR *ch);
export INT32 OPM_SymRInt (void);
export INT64 OPM_SymRInt64 (void);
@ -157,6 +161,36 @@ void OPM_LogCompiling (CHAR *modname, ADDRESS modname__len)
__DEL(modname);
}
void OPM_StoreComment (CHAR *text, ADDRESS text__len)
{
INT16 i;
__DUP(text, text__len, CHAR);
i = 0;
while ((i < 255 && text[__X(i, text__len)] != 0x00)) {
OPM_currentComment[__X(i, 256)] = text[__X(i, text__len)];
i += 1;
}
OPM_currentComment[__X(i, 256)] = 0x00;
OPM_hasComment = 1;
__DEL(text);
}
void OPM_GetComment (CHAR *text, ADDRESS text__len)
{
INT16 i;
if (OPM_hasComment) {
i = 0;
while ((((i < text__len && i < 256)) && OPM_currentComment[__X(i, 256)] != 0x00)) {
text[__X(i, text__len)] = OPM_currentComment[__X(i, 256)];
i += 1;
}
text[__X(i, text__len)] = 0x00;
OPM_hasComment = 0;
} else {
text[0] = 0x00;
}
}
INT64 OPM_SignedMaximum (INT32 bytecount)
{
INT64 result;
@ -763,7 +797,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done)
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x83) {
if (tag != 0xf7 || ver != 0x84) {
if (!__IN(4, OPM_Options, 32)) {
OPM_err(-306);
}
@ -834,7 +868,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x83);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x84);
} else {
OPM_err(153);
}
@ -1143,5 +1177,7 @@ export void *OPM__init(void)
OPM_MinReal = -OPM_MaxReal;
OPM_MinLReal = -OPM_MaxLReal;
OPM_FindInstallDir();
OPM_hasComment = 0;
OPM_currentComment[0] = 0x00;
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPM__h
#define OPM__h
@ -30,6 +30,7 @@ import void OPM_FPrintLReal (INT32 *fp, LONGREAL val);
import void OPM_FPrintReal (INT32 *fp, REAL val);
import void OPM_FPrintSet (INT32 *fp, UINT64 val);
import void OPM_Get (CHAR *ch);
import void OPM_GetComment (CHAR *text, ADDRESS text__len);
import void OPM_Init (BOOLEAN *done);
import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n);
@ -48,6 +49,7 @@ import BOOLEAN OPM_OpenPar (void);
import void OPM_RegisterNewSym (void);
import INT64 OPM_SignedMaximum (INT32 bytecount);
import INT64 OPM_SignedMinimum (INT32 bytecount);
import void OPM_StoreComment (CHAR *text, ADDRESS text__len);
import void OPM_SymRCh (CHAR *ch);
import INT32 OPM_SymRInt (void);
import INT64 OPM_SymRInt64 (void);

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -279,32 +279,74 @@ static void Comment__2 (void);
static void Comment__2 (void)
{
BOOLEAN isExported;
CHAR commentText[256];
INT16 i, nestLevel;
CHAR prevCh, nextCh;
i = 0;
while (i <= 255) {
commentText[__X(i, 256)] = 0x00;
i += 1;
}
isExported = 0;
i = 0;
nestLevel = 1;
prevCh = 0x00;
OPM_Get(&OPS_ch);
for (;;) {
for (;;) {
while (OPS_ch == '(') {
if (OPS_ch == '*') {
isExported = 1;
OPM_Get(&OPS_ch);
if (OPS_ch == ')') {
commentText[0] = 0x00;
OPM_StoreComment(commentText, 256);
OPM_Get(&OPS_ch);
return;
}
}
while ((nestLevel > 0 && OPS_ch != 0x00)) {
if ((prevCh == '(' && OPS_ch == '*')) {
nestLevel += 1;
prevCh = 0x00;
} else if ((prevCh == '*' && OPS_ch == ')')) {
nestLevel -= 1;
if (nestLevel == 0) {
OPM_Get(&OPS_ch);
if (OPS_ch == '*') {
Comment__2();
} else {
prevCh = 0x00;
}
} else {
if ((((isExported && nestLevel == 1)) && prevCh != 0x00)) {
if (i < 255) {
commentText[__X(i, 256)] = prevCh;
i += 1;
}
}
if (OPS_ch == '*') {
OPM_Get(&OPS_ch);
break;
}
if (OPS_ch == 0x00) {
break;
}
prevCh = OPS_ch;
}
if (nestLevel > 0) {
OPM_Get(&OPS_ch);
}
if (OPS_ch == ')') {
OPM_Get(&OPS_ch);
break;
}
if (OPS_ch == 0x00) {
OPS_err(5);
}
if ((((((isExported && nestLevel == 0)) && prevCh != 0x00)) && prevCh != '*')) {
if (i < 255) {
commentText[__X(i, 256)] = prevCh;
i += 1;
} else {
OPM_LogWStr((CHAR*)"Truncating final comment character", 35);
OPM_LogWLn();
}
if (OPS_ch == 0x00) {
OPS_err(5);
break;
}
if (isExported) {
if (i >= 256) {
OPM_LogWStr((CHAR*)"Warning: commentText overflow", 30);
OPM_LogWLn();
i = 255;
}
commentText[__X(i, 256)] = 0x00;
OPM_StoreComment(commentText, 256);
}
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -83,6 +83,7 @@ typedef
OPT_Const conval;
INT32 adr, linkadr;
INT16 x;
OPT_ConstExt comment;
} OPT_ObjDesc;
typedef
@ -173,6 +174,7 @@ static void OPT_OutObj (OPT_Object obj);
static void OPT_OutSign (OPT_Struct result, OPT_Object par);
static void OPT_OutStr (OPT_Struct typ);
static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj);
static void OPT_OutTruncatedName (CHAR *text, ADDRESS text__len);
export OPT_Struct OPT_SetType (INT32 size);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INT16 dir);
export INT32 OPT_SizeAlignment (INT32 size);
@ -388,6 +390,10 @@ OPT_Object OPT_NewObj (void)
{
OPT_Object obj = NIL;
__NEW(obj, OPT_ObjDesc);
obj->typ = NIL;
obj->conval = NIL;
obj->comment = NIL;
obj->name[0] = 0x00;
return obj;
}
@ -554,6 +560,8 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
OPT_Object ob0 = NIL, ob1 = NIL;
BOOLEAN left;
INT8 mnolev;
CHAR commentText[256];
INT16 j;
ob0 = OPT_topScope;
ob1 = ob0->right;
left = 0;
@ -585,6 +593,16 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
__COPY(name, ob1->name, 256);
mnolev = OPT_topScope->mnolev;
ob1->mnolev = mnolev;
OPM_GetComment((void*)commentText, 256);
if (commentText[0] != 0x00) {
ob1->comment = __NEWARR(NIL, 1, 1, 1, 0, 256);
j = 0;
while ((j < 255 && commentText[__X(j, 256)] != 0x00)) {
(*ob1->comment)[__X(j, 256)] = commentText[__X(j, 256)];
j += 1;
}
(*ob1->comment)[__X(j, 256)] = 0x00;
}
break;
}
}
@ -1103,6 +1121,13 @@ static void OPT_InSign (INT8 mno, OPT_Struct *res, OPT_Object *par)
tag = OPM_SymRInt();
last = NIL;
while (tag != 18) {
if (tag < 0 || tag > 100) {
OPM_LogWStr((CHAR*)"ERROR: Invalid tag value in InSign: ", 37);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return;
}
new = OPT_NewObj();
new->mnolev = -mno;
if (last == NIL) {
@ -1381,7 +1406,37 @@ static OPT_Object OPT_InObj (INT8 mno)
OPT_Struct typ = NIL;
INT32 tag;
OPT_ConstExt ext = NIL;
OPS_Name commentText;
BOOLEAN hasComment;
INT16 j;
INT32 len;
tag = OPT_impCtxt.nextTag;
hasComment = 0;
while (tag == 41) {
len = OPM_SymRInt();
if (len < 0) {
len = 0;
}
if (len > 255) {
len = 255;
}
i = 0;
while (i < len) {
OPM_SymRCh(&commentText[__X(i, 256)]);
i += 1;
}
commentText[__X(i, 256)] = 0x00;
hasComment = 1;
tag = OPM_SymRInt();
}
OPT_impCtxt.nextTag = tag;
if (tag < 0 || tag > 50) {
OPM_LogWStr((CHAR*)"ERROR: Invalid tag in InObj: ", 30);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
}
if (tag == 19) {
OPT_InStruct(&typ);
obj = typ->strobj;
@ -1397,7 +1452,7 @@ static OPT_Object OPT_InObj (INT8 mno)
obj->conval = OPT_NewConst();
OPT_InConstant(tag, obj->conval);
obj->typ = OPT_InTyp(tag);
} else if (tag >= 31) {
} else if ((tag >= 31 && tag <= 33)) {
obj->conval = OPT_NewConst();
obj->conval->intval = -1;
OPT_InSign(mno, &obj->typ, &obj->link);
@ -1424,20 +1479,37 @@ static OPT_Object OPT_InObj (INT8 mno)
OPM_LogWStr((CHAR*)"unhandled case at InObj, tag = ", 32);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
break;
}
} else if (tag == 20) {
obj->mode = 5;
OPT_InStruct(&obj->typ);
} else {
} else if (tag == 21 || tag == 22) {
obj->mode = 1;
if (tag == 22) {
obj->vis = 2;
}
OPT_InStruct(&obj->typ);
} else {
OPM_LogWStr((CHAR*)"ERROR: Unexpected tag in InObj: ", 33);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
}
OPT_InName((void*)obj->name, 256);
}
if ((hasComment && obj != NIL)) {
obj->comment = __NEWARR(NIL, 1, 1, 1, 0, 256);
j = 0;
while ((((j < 255 && j < len)) && commentText[__X(j, 256)] != 0x00)) {
(*obj->comment)[__X(j, 256)] = commentText[__X(j, 256)];
j += 1;
}
(*obj->comment)[__X(j, 256)] = 0x00;
}
OPT_FPrintObj(obj);
if ((obj->mode == 1 && (obj->typ->strobj == NIL || obj->typ->strobj->name[0] == 0x00))) {
OPM_FPrint(&OPT_impCtxt.reffp, obj->typ->ref - 255);
@ -1780,13 +1852,40 @@ static void OPT_OutConstant (OPT_Object obj)
}
}
static void OPT_OutTruncatedName (CHAR *text, ADDRESS text__len)
{
INT16 i;
__DUP(text, text__len, CHAR);
i = 0;
while ((i < 255 && text[__X(i, text__len)] != 0x00)) {
OPM_SymWCh(text[__X(i, text__len)]);
i += 1;
}
OPM_SymWCh(0x00);
__DEL(text);
}
static void OPT_OutObj (OPT_Object obj)
{
INT16 i, j;
OPT_ConstExt ext = NIL;
INT16 k, l;
if (obj != NIL) {
OPT_OutObj(obj->left);
if (__IN(obj->mode, 0x06ea, 32)) {
if (obj->comment != NIL) {
OPM_SymWInt(41);
k = 0;
while ((k < 255 && (*obj->comment)[__X(k, 256)] != 0x00)) {
k += 1;
}
OPM_SymWInt(k);
l = 0;
while (l < k) {
OPM_SymWCh((*obj->comment)[__X(l, 256)]);
l += 1;
}
}
if (obj->history == 4) {
OPT_FPrintErr(obj, 250);
} else if (obj->vis != 0) {
@ -2026,7 +2125,7 @@ static void EnumPtrs(void (*P)(void*))
}
__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 32), {0, -8}};
__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}};
__TDESC(OPT_ObjDesc, 1, 7) = {__TDFLDS("ObjDesc", 308), {0, 4, 8, 12, 284, 288, 304, -32}};
__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}};
__TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}};
__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 3140), {16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76,

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPT__h
#define OPT__h
@ -61,6 +61,7 @@ typedef
OPT_Const conval;
INT32 adr, linkadr;
INT16 x;
OPT_ConstExt comment;
} OPT_ObjDesc;
typedef

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPV__h
#define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Out__h
#define Out__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Reals__h
#define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef VT100__h
#define VT100__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -73,7 +73,7 @@ static void extTools_execute (CHAR *title, ADDRESS title__len, CHAR *cmd, ADDRES
static void extTools_InitialiseCompilerCommand (CHAR *s, ADDRESS s__len, CHAR *additionalopts, ADDRESS additionalopts__len)
{
__DUP(additionalopts, additionalopts__len, CHAR);
__COPY("gcc -fPIC -g", s, s__len);
__COPY("gcc -fPIC -g -Wno-stringop-overflow", s, s__len);
Strings_Append((CHAR*)" -I \"", 6, (void*)s, s__len);
Strings_Append(OPM_ResourceDir, 1024, (void*)s, s__len);
Strings_Append((CHAR*)"/include\" ", 11, (void*)s, s__len);

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspamS */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspamS */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 76);
__MOVE("2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 76);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Configuration__h
#define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPB__h
#define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -618,31 +618,33 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty)
{
if (obj != NIL) {
OPC_DefineTProcMacros(obj->left, &*empty);
if ((((obj->mode == 13 && obj == OPC_BaseTProc(obj))) && (OPM_currFile != 0 || obj->vis == 1))) {
OPM_WriteString((CHAR*)"#define __", 11);
OPC_Ident(obj);
OPC_DeclareParams(obj->link, 1);
OPM_WriteString((CHAR*)" __SEND(", 9);
if (obj->link->typ->form == 11) {
OPM_WriteString((CHAR*)"__TYPEOF(", 10);
OPC_Ident(obj->link);
if ((obj->mode == 13 && obj == OPC_BaseTProc(obj))) {
if (OPM_currFile == 1 || (OPM_currFile == 0 && obj->vis == 1)) {
OPM_WriteString((CHAR*)"#define __", 11);
OPC_Ident(obj);
OPC_DeclareParams(obj->link, 1);
OPM_WriteString((CHAR*)" __SEND(", 9);
if (obj->link->typ->form == 11) {
OPM_WriteString((CHAR*)"__TYPEOF(", 10);
OPC_Ident(obj->link);
OPM_Write(')');
} else {
OPC_Ident(obj->link);
OPM_WriteString((CHAR*)"__typ", 6);
}
OPC_Str1((CHAR*)", #, ", 6, __ASHR(obj->adr, 16));
if (obj->typ == OPT_notyp) {
OPM_WriteString((CHAR*)"void", 5);
} else {
OPC_Ident(obj->typ->strobj);
}
OPM_WriteString((CHAR*)"(*)", 4);
OPC_AnsiParamList(obj->link, 0);
OPM_WriteString((CHAR*)", ", 3);
OPC_DeclareParams(obj->link, 1);
OPM_Write(')');
} else {
OPC_Ident(obj->link);
OPM_WriteString((CHAR*)"__typ", 6);
OPM_WriteLn();
}
OPC_Str1((CHAR*)", #, ", 6, __ASHR(obj->adr, 16));
if (obj->typ == OPT_notyp) {
OPM_WriteString((CHAR*)"void", 5);
} else {
OPC_Ident(obj->typ->strobj);
}
OPM_WriteString((CHAR*)"(*)", 4);
OPC_AnsiParamList(obj->link, 0);
OPM_WriteString((CHAR*)", ", 3);
OPC_DeclareParams(obj->link, 1);
OPM_Write(')');
OPM_WriteLn();
}
OPC_DefineTProcMacros(obj->right, &*empty);
}
@ -652,7 +654,7 @@ static void OPC_DefineType (OPT_Struct str)
{
OPT_Object obj = NIL, field = NIL, par = NIL;
BOOLEAN empty;
if (OPM_currFile == 1 || str->ref < 255) {
if ((OPM_currFile == 1 || str->ref < 255) || (((OPM_currFile == 0 && str->strobj != NIL)) && str->strobj->vis == 1)) {
obj = str->strobj;
if (obj == NIL || OPC_Undefined(obj)) {
if (obj != NIL) {
@ -719,6 +721,13 @@ static void OPC_DefineType (OPT_Struct str)
if (!empty) {
OPM_WriteLn();
}
} else if ((obj->typ->form == 11 && obj->typ->BaseTyp->comp == 4)) {
empty = 1;
OPC_DeclareTProcs(obj->typ->BaseTyp->link, &empty);
OPC_DefineTProcMacros(obj->typ->BaseTyp->link, &empty);
if (!empty) {
OPM_WriteLn();
}
}
}
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPC__h
#define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,8 @@ typedef
CHAR OPM_FileName[32];
static CHAR OPM_currentComment[256];
static BOOLEAN OPM_hasComment;
static CHAR OPM_SourceFileName[256];
static CHAR OPM_GlobalModel[10];
export CHAR OPM_Model[10];
@ -59,6 +61,7 @@ static void OPM_FindInstallDir (void);
static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos);
static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len);
export void OPM_Get (CHAR *ch);
export void OPM_GetComment (CHAR *text, ADDRESS text__len);
export void OPM_Init (BOOLEAN *done);
export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n);
@ -82,6 +85,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len);
static void OPM_ShowLine (INT64 pos);
export INT64 OPM_SignedMaximum (INT32 bytecount);
export INT64 OPM_SignedMinimum (INT32 bytecount);
export void OPM_StoreComment (CHAR *text, ADDRESS text__len);
export void OPM_SymRCh (CHAR *ch);
export INT32 OPM_SymRInt (void);
export INT64 OPM_SymRInt64 (void);
@ -157,6 +161,36 @@ void OPM_LogCompiling (CHAR *modname, ADDRESS modname__len)
__DEL(modname);
}
void OPM_StoreComment (CHAR *text, ADDRESS text__len)
{
INT16 i;
__DUP(text, text__len, CHAR);
i = 0;
while ((i < 255 && text[__X(i, text__len)] != 0x00)) {
OPM_currentComment[__X(i, 256)] = text[__X(i, text__len)];
i += 1;
}
OPM_currentComment[__X(i, 256)] = 0x00;
OPM_hasComment = 1;
__DEL(text);
}
void OPM_GetComment (CHAR *text, ADDRESS text__len)
{
INT16 i;
if (OPM_hasComment) {
i = 0;
while ((((i < text__len && i < 256)) && OPM_currentComment[__X(i, 256)] != 0x00)) {
text[__X(i, text__len)] = OPM_currentComment[__X(i, 256)];
i += 1;
}
text[__X(i, text__len)] = 0x00;
OPM_hasComment = 0;
} else {
text[0] = 0x00;
}
}
INT64 OPM_SignedMaximum (INT32 bytecount)
{
INT64 result;
@ -763,7 +797,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done)
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x83) {
if (tag != 0xf7 || ver != 0x84) {
if (!__IN(4, OPM_Options, 32)) {
OPM_err(-306);
}
@ -834,7 +868,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x83);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x84);
} else {
OPM_err(153);
}
@ -1143,5 +1177,7 @@ export void *OPM__init(void)
OPM_MinReal = -OPM_MaxReal;
OPM_MinLReal = -OPM_MaxLReal;
OPM_FindInstallDir();
OPM_hasComment = 0;
OPM_currentComment[0] = 0x00;
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPM__h
#define OPM__h
@ -30,6 +30,7 @@ import void OPM_FPrintLReal (INT32 *fp, LONGREAL val);
import void OPM_FPrintReal (INT32 *fp, REAL val);
import void OPM_FPrintSet (INT32 *fp, UINT64 val);
import void OPM_Get (CHAR *ch);
import void OPM_GetComment (CHAR *text, ADDRESS text__len);
import void OPM_Init (BOOLEAN *done);
import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n);
@ -48,6 +49,7 @@ import BOOLEAN OPM_OpenPar (void);
import void OPM_RegisterNewSym (void);
import INT64 OPM_SignedMaximum (INT32 bytecount);
import INT64 OPM_SignedMinimum (INT32 bytecount);
import void OPM_StoreComment (CHAR *text, ADDRESS text__len);
import void OPM_SymRCh (CHAR *ch);
import INT32 OPM_SymRInt (void);
import INT64 OPM_SymRInt64 (void);

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -279,32 +279,74 @@ static void Comment__2 (void);
static void Comment__2 (void)
{
BOOLEAN isExported;
CHAR commentText[256];
INT16 i, nestLevel;
CHAR prevCh, nextCh;
i = 0;
while (i <= 255) {
commentText[__X(i, 256)] = 0x00;
i += 1;
}
isExported = 0;
i = 0;
nestLevel = 1;
prevCh = 0x00;
OPM_Get(&OPS_ch);
for (;;) {
for (;;) {
while (OPS_ch == '(') {
if (OPS_ch == '*') {
isExported = 1;
OPM_Get(&OPS_ch);
if (OPS_ch == ')') {
commentText[0] = 0x00;
OPM_StoreComment(commentText, 256);
OPM_Get(&OPS_ch);
return;
}
}
while ((nestLevel > 0 && OPS_ch != 0x00)) {
if ((prevCh == '(' && OPS_ch == '*')) {
nestLevel += 1;
prevCh = 0x00;
} else if ((prevCh == '*' && OPS_ch == ')')) {
nestLevel -= 1;
if (nestLevel == 0) {
OPM_Get(&OPS_ch);
if (OPS_ch == '*') {
Comment__2();
} else {
prevCh = 0x00;
}
} else {
if ((((isExported && nestLevel == 1)) && prevCh != 0x00)) {
if (i < 255) {
commentText[__X(i, 256)] = prevCh;
i += 1;
}
}
if (OPS_ch == '*') {
OPM_Get(&OPS_ch);
break;
}
if (OPS_ch == 0x00) {
break;
}
prevCh = OPS_ch;
}
if (nestLevel > 0) {
OPM_Get(&OPS_ch);
}
if (OPS_ch == ')') {
OPM_Get(&OPS_ch);
break;
}
if (OPS_ch == 0x00) {
OPS_err(5);
}
if ((((((isExported && nestLevel == 0)) && prevCh != 0x00)) && prevCh != '*')) {
if (i < 255) {
commentText[__X(i, 256)] = prevCh;
i += 1;
} else {
OPM_LogWStr((CHAR*)"Truncating final comment character", 35);
OPM_LogWLn();
}
if (OPS_ch == 0x00) {
OPS_err(5);
break;
}
if (isExported) {
if (i >= 256) {
OPM_LogWStr((CHAR*)"Warning: commentText overflow", 30);
OPM_LogWLn();
i = 255;
}
commentText[__X(i, 256)] = 0x00;
OPM_StoreComment(commentText, 256);
}
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -83,6 +83,7 @@ typedef
OPT_Const conval;
INT32 adr, linkadr;
INT16 x;
OPT_ConstExt comment;
} OPT_ObjDesc;
typedef
@ -173,6 +174,7 @@ static void OPT_OutObj (OPT_Object obj);
static void OPT_OutSign (OPT_Struct result, OPT_Object par);
static void OPT_OutStr (OPT_Struct typ);
static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj);
static void OPT_OutTruncatedName (CHAR *text, ADDRESS text__len);
export OPT_Struct OPT_SetType (INT32 size);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INT16 dir);
export INT32 OPT_SizeAlignment (INT32 size);
@ -388,6 +390,10 @@ OPT_Object OPT_NewObj (void)
{
OPT_Object obj = NIL;
__NEW(obj, OPT_ObjDesc);
obj->typ = NIL;
obj->conval = NIL;
obj->comment = NIL;
obj->name[0] = 0x00;
return obj;
}
@ -554,6 +560,8 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
OPT_Object ob0 = NIL, ob1 = NIL;
BOOLEAN left;
INT8 mnolev;
CHAR commentText[256];
INT16 j;
ob0 = OPT_topScope;
ob1 = ob0->right;
left = 0;
@ -585,6 +593,16 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
__COPY(name, ob1->name, 256);
mnolev = OPT_topScope->mnolev;
ob1->mnolev = mnolev;
OPM_GetComment((void*)commentText, 256);
if (commentText[0] != 0x00) {
ob1->comment = __NEWARR(NIL, 1, 1, 1, 0, 256);
j = 0;
while ((j < 255 && commentText[__X(j, 256)] != 0x00)) {
(*ob1->comment)[__X(j, 256)] = commentText[__X(j, 256)];
j += 1;
}
(*ob1->comment)[__X(j, 256)] = 0x00;
}
break;
}
}
@ -1103,6 +1121,13 @@ static void OPT_InSign (INT8 mno, OPT_Struct *res, OPT_Object *par)
tag = OPM_SymRInt();
last = NIL;
while (tag != 18) {
if (tag < 0 || tag > 100) {
OPM_LogWStr((CHAR*)"ERROR: Invalid tag value in InSign: ", 37);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return;
}
new = OPT_NewObj();
new->mnolev = -mno;
if (last == NIL) {
@ -1381,7 +1406,37 @@ static OPT_Object OPT_InObj (INT8 mno)
OPT_Struct typ = NIL;
INT32 tag;
OPT_ConstExt ext = NIL;
OPS_Name commentText;
BOOLEAN hasComment;
INT16 j;
INT32 len;
tag = OPT_impCtxt.nextTag;
hasComment = 0;
while (tag == 41) {
len = OPM_SymRInt();
if (len < 0) {
len = 0;
}
if (len > 255) {
len = 255;
}
i = 0;
while (i < len) {
OPM_SymRCh(&commentText[__X(i, 256)]);
i += 1;
}
commentText[__X(i, 256)] = 0x00;
hasComment = 1;
tag = OPM_SymRInt();
}
OPT_impCtxt.nextTag = tag;
if (tag < 0 || tag > 50) {
OPM_LogWStr((CHAR*)"ERROR: Invalid tag in InObj: ", 30);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
}
if (tag == 19) {
OPT_InStruct(&typ);
obj = typ->strobj;
@ -1397,7 +1452,7 @@ static OPT_Object OPT_InObj (INT8 mno)
obj->conval = OPT_NewConst();
OPT_InConstant(tag, obj->conval);
obj->typ = OPT_InTyp(tag);
} else if (tag >= 31) {
} else if ((tag >= 31 && tag <= 33)) {
obj->conval = OPT_NewConst();
obj->conval->intval = -1;
OPT_InSign(mno, &obj->typ, &obj->link);
@ -1424,20 +1479,37 @@ static OPT_Object OPT_InObj (INT8 mno)
OPM_LogWStr((CHAR*)"unhandled case at InObj, tag = ", 32);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
break;
}
} else if (tag == 20) {
obj->mode = 5;
OPT_InStruct(&obj->typ);
} else {
} else if (tag == 21 || tag == 22) {
obj->mode = 1;
if (tag == 22) {
obj->vis = 2;
}
OPT_InStruct(&obj->typ);
} else {
OPM_LogWStr((CHAR*)"ERROR: Unexpected tag in InObj: ", 33);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
}
OPT_InName((void*)obj->name, 256);
}
if ((hasComment && obj != NIL)) {
obj->comment = __NEWARR(NIL, 1, 1, 1, 0, 256);
j = 0;
while ((((j < 255 && j < len)) && commentText[__X(j, 256)] != 0x00)) {
(*obj->comment)[__X(j, 256)] = commentText[__X(j, 256)];
j += 1;
}
(*obj->comment)[__X(j, 256)] = 0x00;
}
OPT_FPrintObj(obj);
if ((obj->mode == 1 && (obj->typ->strobj == NIL || obj->typ->strobj->name[0] == 0x00))) {
OPM_FPrint(&OPT_impCtxt.reffp, obj->typ->ref - 255);
@ -1780,13 +1852,40 @@ static void OPT_OutConstant (OPT_Object obj)
}
}
static void OPT_OutTruncatedName (CHAR *text, ADDRESS text__len)
{
INT16 i;
__DUP(text, text__len, CHAR);
i = 0;
while ((i < 255 && text[__X(i, text__len)] != 0x00)) {
OPM_SymWCh(text[__X(i, text__len)]);
i += 1;
}
OPM_SymWCh(0x00);
__DEL(text);
}
static void OPT_OutObj (OPT_Object obj)
{
INT16 i, j;
OPT_ConstExt ext = NIL;
INT16 k, l;
if (obj != NIL) {
OPT_OutObj(obj->left);
if (__IN(obj->mode, 0x06ea, 32)) {
if (obj->comment != NIL) {
OPM_SymWInt(41);
k = 0;
while ((k < 255 && (*obj->comment)[__X(k, 256)] != 0x00)) {
k += 1;
}
OPM_SymWInt(k);
l = 0;
while (l < k) {
OPM_SymWCh((*obj->comment)[__X(l, 256)]);
l += 1;
}
}
if (obj->history == 4) {
OPT_FPrintErr(obj, 250);
} else if (obj->vis != 0) {
@ -2026,7 +2125,7 @@ static void EnumPtrs(void (*P)(void*))
}
__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -8}};
__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 304), {0, 4, 8, 12, 284, 288, -28}};
__TDESC(OPT_ObjDesc, 1, 7) = {__TDFLDS("ObjDesc", 308), {0, 4, 8, 12, 284, 288, 304, -32}};
__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 56), {44, 48, 52, -16}};
__TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 28), {0, 4, 8, 16, 20, 24, -28}};
__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 3140), {16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76,

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPT__h
#define OPT__h
@ -61,6 +61,7 @@ typedef
OPT_Const conval;
INT32 adr, linkadr;
INT16 x;
OPT_ConstExt comment;
} OPT_ObjDesc;
typedef

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPV__h
#define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Out__h
#define Out__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Reals__h
#define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef VT100__h
#define VT100__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -73,7 +73,7 @@ static void extTools_execute (CHAR *title, ADDRESS title__len, CHAR *cmd, ADDRES
static void extTools_InitialiseCompilerCommand (CHAR *s, ADDRESS s__len, CHAR *additionalopts, ADDRESS additionalopts__len)
{
__DUP(additionalopts, additionalopts__len, CHAR);
__COPY("gcc -fPIC -g", s, s__len);
__COPY("gcc -fPIC -g -Wno-stringop-overflow", s, s__len);
Strings_Append((CHAR*)" -I \"", 6, (void*)s, s__len);
Strings_Append(OPM_ResourceDir, 1024, (void*)s, s__len);
Strings_Append((CHAR*)"/include\" ", 11, (void*)s, s__len);

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspamS */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspamS */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 76);
__MOVE("2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 76);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Configuration__h
#define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. rtsSF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPB__h
#define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -618,31 +618,33 @@ static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty)
{
if (obj != NIL) {
OPC_DefineTProcMacros(obj->left, &*empty);
if ((((obj->mode == 13 && obj == OPC_BaseTProc(obj))) && (OPM_currFile != 0 || obj->vis == 1))) {
OPM_WriteString((CHAR*)"#define __", 11);
OPC_Ident(obj);
OPC_DeclareParams(obj->link, 1);
OPM_WriteString((CHAR*)" __SEND(", 9);
if (obj->link->typ->form == 11) {
OPM_WriteString((CHAR*)"__TYPEOF(", 10);
OPC_Ident(obj->link);
if ((obj->mode == 13 && obj == OPC_BaseTProc(obj))) {
if (OPM_currFile == 1 || (OPM_currFile == 0 && obj->vis == 1)) {
OPM_WriteString((CHAR*)"#define __", 11);
OPC_Ident(obj);
OPC_DeclareParams(obj->link, 1);
OPM_WriteString((CHAR*)" __SEND(", 9);
if (obj->link->typ->form == 11) {
OPM_WriteString((CHAR*)"__TYPEOF(", 10);
OPC_Ident(obj->link);
OPM_Write(')');
} else {
OPC_Ident(obj->link);
OPM_WriteString((CHAR*)"__typ", 6);
}
OPC_Str1((CHAR*)", #, ", 6, __ASHR(obj->adr, 16));
if (obj->typ == OPT_notyp) {
OPM_WriteString((CHAR*)"void", 5);
} else {
OPC_Ident(obj->typ->strobj);
}
OPM_WriteString((CHAR*)"(*)", 4);
OPC_AnsiParamList(obj->link, 0);
OPM_WriteString((CHAR*)", ", 3);
OPC_DeclareParams(obj->link, 1);
OPM_Write(')');
} else {
OPC_Ident(obj->link);
OPM_WriteString((CHAR*)"__typ", 6);
OPM_WriteLn();
}
OPC_Str1((CHAR*)", #, ", 6, __ASHR(obj->adr, 16));
if (obj->typ == OPT_notyp) {
OPM_WriteString((CHAR*)"void", 5);
} else {
OPC_Ident(obj->typ->strobj);
}
OPM_WriteString((CHAR*)"(*)", 4);
OPC_AnsiParamList(obj->link, 0);
OPM_WriteString((CHAR*)", ", 3);
OPC_DeclareParams(obj->link, 1);
OPM_Write(')');
OPM_WriteLn();
}
OPC_DefineTProcMacros(obj->right, &*empty);
}
@ -652,7 +654,7 @@ static void OPC_DefineType (OPT_Struct str)
{
OPT_Object obj = NIL, field = NIL, par = NIL;
BOOLEAN empty;
if (OPM_currFile == 1 || str->ref < 255) {
if ((OPM_currFile == 1 || str->ref < 255) || (((OPM_currFile == 0 && str->strobj != NIL)) && str->strobj->vis == 1)) {
obj = str->strobj;
if (obj == NIL || OPC_Undefined(obj)) {
if (obj != NIL) {
@ -719,6 +721,13 @@ static void OPC_DefineType (OPT_Struct str)
if (!empty) {
OPM_WriteLn();
}
} else if ((obj->typ->form == 11 && obj->typ->BaseTyp->comp == 4)) {
empty = 1;
OPC_DeclareTProcs(obj->typ->BaseTyp->link, &empty);
OPC_DefineTProcMacros(obj->typ->BaseTyp->link, &empty);
if (!empty) {
OPM_WriteLn();
}
}
}
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPC__h
#define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -19,6 +19,8 @@ typedef
CHAR OPM_FileName[32];
static CHAR OPM_currentComment[256];
static BOOLEAN OPM_hasComment;
static CHAR OPM_SourceFileName[256];
static CHAR OPM_GlobalModel[10];
export CHAR OPM_Model[10];
@ -59,6 +61,7 @@ static void OPM_FindInstallDir (void);
static void OPM_FindLine (Files_File f, Files_Rider *r, ADDRESS *r__typ, INT64 pos);
static void OPM_FingerprintBytes (INT32 *fp, SYSTEM_BYTE *bytes, ADDRESS bytes__len);
export void OPM_Get (CHAR *ch);
export void OPM_GetComment (CHAR *text, ADDRESS text__len);
export void OPM_Init (BOOLEAN *done);
export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n);
@ -82,6 +85,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len);
static void OPM_ShowLine (INT64 pos);
export INT64 OPM_SignedMaximum (INT32 bytecount);
export INT64 OPM_SignedMinimum (INT32 bytecount);
export void OPM_StoreComment (CHAR *text, ADDRESS text__len);
export void OPM_SymRCh (CHAR *ch);
export INT32 OPM_SymRInt (void);
export INT64 OPM_SymRInt64 (void);
@ -157,6 +161,36 @@ void OPM_LogCompiling (CHAR *modname, ADDRESS modname__len)
__DEL(modname);
}
void OPM_StoreComment (CHAR *text, ADDRESS text__len)
{
INT16 i;
__DUP(text, text__len, CHAR);
i = 0;
while ((i < 255 && text[__X(i, text__len)] != 0x00)) {
OPM_currentComment[__X(i, 256)] = text[__X(i, text__len)];
i += 1;
}
OPM_currentComment[__X(i, 256)] = 0x00;
OPM_hasComment = 1;
__DEL(text);
}
void OPM_GetComment (CHAR *text, ADDRESS text__len)
{
INT16 i;
if (OPM_hasComment) {
i = 0;
while ((((i < text__len && i < 256)) && OPM_currentComment[__X(i, 256)] != 0x00)) {
text[__X(i, text__len)] = OPM_currentComment[__X(i, 256)];
i += 1;
}
text[__X(i, text__len)] = 0x00;
OPM_hasComment = 0;
} else {
text[0] = 0x00;
}
}
INT64 OPM_SignedMaximum (INT32 bytecount)
{
INT64 result;
@ -763,7 +797,7 @@ void OPM_OldSym (CHAR *modName, ADDRESS modName__len, BOOLEAN *done)
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x83) {
if (tag != 0xf7 || ver != 0x84) {
if (!__IN(4, OPM_Options, 32)) {
OPM_err(-306);
}
@ -834,7 +868,7 @@ void OPM_NewSym (CHAR *modName, ADDRESS modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x83);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x84);
} else {
OPM_err(153);
}
@ -1143,5 +1177,7 @@ export void *OPM__init(void)
OPM_MinReal = -OPM_MaxReal;
OPM_MinLReal = -OPM_MaxLReal;
OPM_FindInstallDir();
OPM_hasComment = 0;
OPM_currentComment[0] = 0x00;
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPM__h
#define OPM__h
@ -30,6 +30,7 @@ import void OPM_FPrintLReal (INT32 *fp, LONGREAL val);
import void OPM_FPrintReal (INT32 *fp, REAL val);
import void OPM_FPrintSet (INT32 *fp, UINT64 val);
import void OPM_Get (CHAR *ch);
import void OPM_GetComment (CHAR *text, ADDRESS text__len);
import void OPM_Init (BOOLEAN *done);
import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n);
@ -48,6 +49,7 @@ import BOOLEAN OPM_OpenPar (void);
import void OPM_RegisterNewSym (void);
import INT64 OPM_SignedMaximum (INT32 bytecount);
import INT64 OPM_SignedMinimum (INT32 bytecount);
import void OPM_StoreComment (CHAR *text, ADDRESS text__len);
import void OPM_SymRCh (CHAR *ch);
import INT32 OPM_SymRInt (void);
import INT64 OPM_SymRInt64 (void);

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -279,32 +279,74 @@ static void Comment__2 (void);
static void Comment__2 (void)
{
BOOLEAN isExported;
CHAR commentText[256];
INT16 i, nestLevel;
CHAR prevCh, nextCh;
i = 0;
while (i <= 255) {
commentText[__X(i, 256)] = 0x00;
i += 1;
}
isExported = 0;
i = 0;
nestLevel = 1;
prevCh = 0x00;
OPM_Get(&OPS_ch);
for (;;) {
for (;;) {
while (OPS_ch == '(') {
if (OPS_ch == '*') {
isExported = 1;
OPM_Get(&OPS_ch);
if (OPS_ch == ')') {
commentText[0] = 0x00;
OPM_StoreComment(commentText, 256);
OPM_Get(&OPS_ch);
return;
}
}
while ((nestLevel > 0 && OPS_ch != 0x00)) {
if ((prevCh == '(' && OPS_ch == '*')) {
nestLevel += 1;
prevCh = 0x00;
} else if ((prevCh == '*' && OPS_ch == ')')) {
nestLevel -= 1;
if (nestLevel == 0) {
OPM_Get(&OPS_ch);
if (OPS_ch == '*') {
Comment__2();
} else {
prevCh = 0x00;
}
} else {
if ((((isExported && nestLevel == 1)) && prevCh != 0x00)) {
if (i < 255) {
commentText[__X(i, 256)] = prevCh;
i += 1;
}
}
if (OPS_ch == '*') {
OPM_Get(&OPS_ch);
break;
}
if (OPS_ch == 0x00) {
break;
}
prevCh = OPS_ch;
}
if (nestLevel > 0) {
OPM_Get(&OPS_ch);
}
if (OPS_ch == ')') {
OPM_Get(&OPS_ch);
break;
}
if (OPS_ch == 0x00) {
OPS_err(5);
}
if ((((((isExported && nestLevel == 0)) && prevCh != 0x00)) && prevCh != '*')) {
if (i < 255) {
commentText[__X(i, 256)] = prevCh;
i += 1;
} else {
OPM_LogWStr((CHAR*)"Truncating final comment character", 35);
OPM_LogWLn();
}
if (OPS_ch == 0x00) {
OPS_err(5);
break;
}
if (isExported) {
if (i >= 256) {
OPM_LogWStr((CHAR*)"Warning: commentText overflow", 30);
OPM_LogWLn();
i = 255;
}
commentText[__X(i, 256)] = 0x00;
OPM_StoreComment(commentText, 256);
}
}

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -83,6 +83,7 @@ typedef
OPT_Const conval;
INT32 adr, linkadr;
INT16 x;
OPT_ConstExt comment;
} OPT_ObjDesc;
typedef
@ -173,6 +174,7 @@ static void OPT_OutObj (OPT_Object obj);
static void OPT_OutSign (OPT_Struct result, OPT_Object par);
static void OPT_OutStr (OPT_Struct typ);
static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj);
static void OPT_OutTruncatedName (CHAR *text, ADDRESS text__len);
export OPT_Struct OPT_SetType (INT32 size);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INT16 dir);
export INT32 OPT_SizeAlignment (INT32 size);
@ -388,6 +390,10 @@ OPT_Object OPT_NewObj (void)
{
OPT_Object obj = NIL;
__NEW(obj, OPT_ObjDesc);
obj->typ = NIL;
obj->conval = NIL;
obj->comment = NIL;
obj->name[0] = 0x00;
return obj;
}
@ -554,6 +560,8 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
OPT_Object ob0 = NIL, ob1 = NIL;
BOOLEAN left;
INT8 mnolev;
CHAR commentText[256];
INT16 j;
ob0 = OPT_topScope;
ob1 = ob0->right;
left = 0;
@ -585,6 +593,16 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
__COPY(name, ob1->name, 256);
mnolev = OPT_topScope->mnolev;
ob1->mnolev = mnolev;
OPM_GetComment((void*)commentText, 256);
if (commentText[0] != 0x00) {
ob1->comment = __NEWARR(NIL, 1, 1, 1, 0, ((INT64)(256)));
j = 0;
while ((j < 255 && commentText[__X(j, 256)] != 0x00)) {
(*ob1->comment)[__X(j, 256)] = commentText[__X(j, 256)];
j += 1;
}
(*ob1->comment)[__X(j, 256)] = 0x00;
}
break;
}
}
@ -1103,6 +1121,13 @@ static void OPT_InSign (INT8 mno, OPT_Struct *res, OPT_Object *par)
tag = OPM_SymRInt();
last = NIL;
while (tag != 18) {
if (tag < 0 || tag > 100) {
OPM_LogWStr((CHAR*)"ERROR: Invalid tag value in InSign: ", 37);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return;
}
new = OPT_NewObj();
new->mnolev = -mno;
if (last == NIL) {
@ -1381,7 +1406,37 @@ static OPT_Object OPT_InObj (INT8 mno)
OPT_Struct typ = NIL;
INT32 tag;
OPT_ConstExt ext = NIL;
OPS_Name commentText;
BOOLEAN hasComment;
INT16 j;
INT32 len;
tag = OPT_impCtxt.nextTag;
hasComment = 0;
while (tag == 41) {
len = OPM_SymRInt();
if (len < 0) {
len = 0;
}
if (len > 255) {
len = 255;
}
i = 0;
while (i < len) {
OPM_SymRCh(&commentText[__X(i, 256)]);
i += 1;
}
commentText[__X(i, 256)] = 0x00;
hasComment = 1;
tag = OPM_SymRInt();
}
OPT_impCtxt.nextTag = tag;
if (tag < 0 || tag > 50) {
OPM_LogWStr((CHAR*)"ERROR: Invalid tag in InObj: ", 30);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
}
if (tag == 19) {
OPT_InStruct(&typ);
obj = typ->strobj;
@ -1397,7 +1452,7 @@ static OPT_Object OPT_InObj (INT8 mno)
obj->conval = OPT_NewConst();
OPT_InConstant(tag, obj->conval);
obj->typ = OPT_InTyp(tag);
} else if (tag >= 31) {
} else if ((tag >= 31 && tag <= 33)) {
obj->conval = OPT_NewConst();
obj->conval->intval = -1;
OPT_InSign(mno, &obj->typ, &obj->link);
@ -1424,20 +1479,37 @@ static OPT_Object OPT_InObj (INT8 mno)
OPM_LogWStr((CHAR*)"unhandled case at InObj, tag = ", 32);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
break;
}
} else if (tag == 20) {
obj->mode = 5;
OPT_InStruct(&obj->typ);
} else {
} else if (tag == 21 || tag == 22) {
obj->mode = 1;
if (tag == 22) {
obj->vis = 2;
}
OPT_InStruct(&obj->typ);
} else {
OPM_LogWStr((CHAR*)"ERROR: Unexpected tag in InObj: ", 33);
OPM_LogWNum(tag, 0);
OPM_LogWLn();
OPM_err(155);
return NIL;
}
OPT_InName((void*)obj->name, 256);
}
if ((hasComment && obj != NIL)) {
obj->comment = __NEWARR(NIL, 1, 1, 1, 0, ((INT64)(256)));
j = 0;
while ((((j < 255 && j < len)) && commentText[__X(j, 256)] != 0x00)) {
(*obj->comment)[__X(j, 256)] = commentText[__X(j, 256)];
j += 1;
}
(*obj->comment)[__X(j, 256)] = 0x00;
}
OPT_FPrintObj(obj);
if ((obj->mode == 1 && (obj->typ->strobj == NIL || obj->typ->strobj->name[0] == 0x00))) {
OPM_FPrint(&OPT_impCtxt.reffp, obj->typ->ref - 255);
@ -1780,13 +1852,40 @@ static void OPT_OutConstant (OPT_Object obj)
}
}
static void OPT_OutTruncatedName (CHAR *text, ADDRESS text__len)
{
INT16 i;
__DUP(text, text__len, CHAR);
i = 0;
while ((i < 255 && text[__X(i, text__len)] != 0x00)) {
OPM_SymWCh(text[__X(i, text__len)]);
i += 1;
}
OPM_SymWCh(0x00);
__DEL(text);
}
static void OPT_OutObj (OPT_Object obj)
{
INT16 i, j;
OPT_ConstExt ext = NIL;
INT16 k, l;
if (obj != NIL) {
OPT_OutObj(obj->left);
if (__IN(obj->mode, 0x06ea, 32)) {
if (obj->comment != NIL) {
OPM_SymWInt(41);
k = 0;
while ((k < 255 && (*obj->comment)[__X(k, 256)] != 0x00)) {
k += 1;
}
OPM_SymWInt(k);
l = 0;
while (l < k) {
OPM_SymWCh((*obj->comment)[__X(l, 256)]);
l += 1;
}
}
if (obj->history == 4) {
OPT_FPrintErr(obj, 250);
} else if (obj->vis != 0) {
@ -2026,7 +2125,7 @@ static void EnumPtrs(void (*P)(void*))
}
__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -16}};
__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 336), {0, 8, 16, 24, 304, 312, -56}};
__TDESC(OPT_ObjDesc, 1, 7) = {__TDFLDS("ObjDesc", 344), {0, 8, 16, 24, 304, 312, 336, -64}};
__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 72), {48, 56, 64, -32}};
__TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 56), {0, 8, 16, 32, 40, 48, -56}};
__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 5184), {16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136,

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPT__h
#define OPT__h
@ -61,6 +61,7 @@ typedef
OPT_Const conval;
INT32 adr, linkadr;
INT16 x;
OPT_ConstExt comment;
} OPT_ObjDesc;
typedef

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef OPV__h
#define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

@ -1,4 +1,4 @@
/* voc 2.1.0 [2024/08/23]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
/* voc 2.1.0 [2025/06/24]. Bootstrapping compiler for address size 8, alignment 8. xrtspaSF */
#ifndef Out__h
#define Out__h

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