Move alignment and type size code from OPC to OPT. Remove search path in bootstrap compiler.

This commit is contained in:
David Brown 2016-09-23 19:04:26 +01:00
parent 8017aa445c
commit fb002de0dd
202 changed files with 1628 additions and 1590 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -7,7 +7,7 @@
#include "SYSTEM.h"
export CHAR Configuration_versionLong[41];
export CHAR Configuration_versionLong[75];
@ -18,6 +18,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("1.95 [2016/09/23] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__MOVE("1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Configuration__h
#define Configuration__h
@ -6,7 +6,7 @@
#include "SYSTEM.h"
import CHAR Configuration_versionLong[41];
import CHAR Configuration_versionLong[75];
import void *Configuration__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Console__h
#define Console__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -10,7 +10,6 @@
#include "OPT.h"
export void (*OPB_typSize)(OPT_Struct);
static int16 OPB_exp;
static int64 OPB_maxExp;
@ -1917,7 +1916,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
OPB_err(110);
x = OPB_NewIntConst(1);
} else if (__IN(f, 0x18fe, 32) || __IN(x->typ->comp, 0x14, 32)) {
(*OPB_typSize)(x->typ);
OPT_TypSize(x->typ);
x->typ->pvused = 1;
x = OPB_NewIntConst(x->typ->size);
} else {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPB__h
#define OPB__h
@ -8,7 +8,6 @@
#include "OPT.h"
import void (*OPB_typSize)(OPT_Struct);
import void OPB_Assign (OPT_Node *x, OPT_Node y);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -17,10 +17,8 @@ static BOOLEAN OPC_GlbPtrs;
static CHAR OPC_BodyNameExt[13];
export void OPC_Align (int32 *adr, int32 base);
export void OPC_Andent (OPT_Struct typ);
static void OPC_AnsiParamList (OPT_Object obj, BOOLEAN showParamNames);
export int32 OPC_BaseAlignment (OPT_Struct typ);
export OPT_Object OPC_BaseTProc (OPT_Object obj);
export void OPC_BegBlk (void);
export void OPC_BegStat (void);
@ -79,7 +77,6 @@ static void OPC_PutBase (OPT_Struct typ);
static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt);
static void OPC_RegCmds (OPT_Object obj);
export void OPC_SetInclude (BOOLEAN exclude);
export int32 OPC_SizeAlignment (int32 size);
static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause);
static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x);
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l);
@ -750,7 +747,7 @@ static void OPC_CProcDefs (OPT_Object obj, int16 vis)
{
int16 i;
OPT_ConstExt ext = NIL;
int16 _for__9;
int16 _for__7;
if (obj != NIL) {
OPC_CProcDefs(obj->left, vis);
if ((((obj->mode == 9 && (int16)obj->vis >= vis)) && obj->adr == 1)) {
@ -762,9 +759,9 @@ static void OPC_CProcDefs (OPT_Object obj, int16 vis)
OPC_DeclareParams(obj->link, 1);
OPM_Write(0x09);
}
_for__9 = (int16)(*obj->conval->ext)[0];
_for__7 = (int16)(*obj->conval->ext)[0];
i = i;
while (i <= _for__9) {
while (i <= _for__7) {
OPM_Write((*obj->conval->ext)[__X(i, 256)]);
i += 1;
}
@ -843,64 +840,11 @@ void OPC_InitTDesc (OPT_Struct typ)
}
}
void OPC_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
*adr += __MASK(*adr, -2);
break;
case 4:
*adr += __MASK(-*adr, -4);
break;
case 8:
*adr += __MASK(-*adr, -8);
break;
case 16:
*adr += __MASK(-*adr, -16);
break;
default:
break;
}
}
int32 OPC_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
}
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
}
int32 OPC_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
} else {
alignment = OPC_BaseAlignment(typ->BaseTyp);
}
} else {
alignment = OPC_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
}
static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign)
{
int32 adr;
adr = off;
OPC_Align(&adr, align);
OPT_Align(&adr, align);
if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align;
OPC_BegStat();
@ -955,8 +899,8 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, i
}
} else {
adr = *off;
fldAlign = OPC_BaseAlignment(fld->typ);
OPC_Align(&adr, fldAlign);
fldAlign = OPT_BaseAlignment(fld->typ);
OPT_Align(&adr, fldAlign);
gap = fld->adr - adr;
if (fldAlign > *curAlign) {
*curAlign = fldAlign;
@ -1205,7 +1149,7 @@ static void OPC_GenHeaderMsg (void)
OPM_WriteString((CHAR*)"/* ", 4);
OPM_WriteString((CHAR*)"voc", 4);
OPM_Write(' ');
OPM_WriteString(Configuration_versionLong, 41);
OPM_WriteString(Configuration_versionLong, 75);
OPM_Write(' ');
i = 0;
while (i <= 31) {
@ -1966,84 +1910,84 @@ void OPC_Constant (OPT_Const con, int16 form)
}
}
static struct InitKeywords__48 {
static struct InitKeywords__46 {
int8 *n;
struct InitKeywords__48 *lnk;
} *InitKeywords__48_s;
struct InitKeywords__46 *lnk;
} *InitKeywords__46_s;
static void Enter__49 (CHAR *s, LONGINT s__len);
static void Enter__47 (CHAR *s, LONGINT s__len);
static void Enter__49 (CHAR *s, LONGINT s__len)
static void Enter__47 (CHAR *s, LONGINT s__len)
{
int16 h;
__DUP(s, s__len, CHAR);
h = OPC_PerfectHash((void*)s, s__len);
OPC_hashtab[__X(h, 105)] = *InitKeywords__48_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__48_s->n, 50)], 9);
*InitKeywords__48_s->n += 1;
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
*InitKeywords__46_s->n += 1;
__DEL(s);
}
static void OPC_InitKeywords (void)
{
int8 n, i;
struct InitKeywords__48 _s;
struct InitKeywords__46 _s;
_s.n = &n;
_s.lnk = InitKeywords__48_s;
InitKeywords__48_s = &_s;
_s.lnk = InitKeywords__46_s;
InitKeywords__46_s = &_s;
n = 0;
i = 0;
while (i <= 104) {
OPC_hashtab[__X(i, 105)] = -1;
i += 1;
}
Enter__49((CHAR*)"address", 8);
Enter__49((CHAR*)"asm", 4);
Enter__49((CHAR*)"auto", 5);
Enter__49((CHAR*)"break", 6);
Enter__49((CHAR*)"case", 5);
Enter__49((CHAR*)"char", 5);
Enter__49((CHAR*)"const", 6);
Enter__49((CHAR*)"continue", 9);
Enter__49((CHAR*)"default", 8);
Enter__49((CHAR*)"do", 3);
Enter__49((CHAR*)"double", 7);
Enter__49((CHAR*)"else", 5);
Enter__49((CHAR*)"enum", 5);
Enter__49((CHAR*)"extern", 7);
Enter__49((CHAR*)"export", 7);
Enter__49((CHAR*)"float", 6);
Enter__49((CHAR*)"for", 4);
Enter__49((CHAR*)"fortran", 8);
Enter__49((CHAR*)"goto", 5);
Enter__49((CHAR*)"if", 3);
Enter__49((CHAR*)"import", 7);
Enter__49((CHAR*)"int", 4);
Enter__49((CHAR*)"int16", 6);
Enter__49((CHAR*)"int32", 6);
Enter__49((CHAR*)"int64", 6);
Enter__49((CHAR*)"int8", 5);
Enter__49((CHAR*)"long", 5);
Enter__49((CHAR*)"register", 9);
Enter__49((CHAR*)"return", 7);
Enter__49((CHAR*)"short", 6);
Enter__49((CHAR*)"signed", 7);
Enter__49((CHAR*)"sizeof", 7);
Enter__49((CHAR*)"size_t", 7);
Enter__49((CHAR*)"static", 7);
Enter__49((CHAR*)"struct", 7);
Enter__49((CHAR*)"switch", 7);
Enter__49((CHAR*)"typedef", 8);
Enter__49((CHAR*)"uint16", 7);
Enter__49((CHAR*)"uint32", 7);
Enter__49((CHAR*)"uint64", 7);
Enter__49((CHAR*)"uint8", 6);
Enter__49((CHAR*)"union", 6);
Enter__49((CHAR*)"unsigned", 9);
Enter__49((CHAR*)"void", 5);
Enter__49((CHAR*)"volatile", 9);
Enter__49((CHAR*)"while", 6);
InitKeywords__48_s = _s.lnk;
Enter__47((CHAR*)"address", 8);
Enter__47((CHAR*)"asm", 4);
Enter__47((CHAR*)"auto", 5);
Enter__47((CHAR*)"break", 6);
Enter__47((CHAR*)"case", 5);
Enter__47((CHAR*)"char", 5);
Enter__47((CHAR*)"const", 6);
Enter__47((CHAR*)"continue", 9);
Enter__47((CHAR*)"default", 8);
Enter__47((CHAR*)"do", 3);
Enter__47((CHAR*)"double", 7);
Enter__47((CHAR*)"else", 5);
Enter__47((CHAR*)"enum", 5);
Enter__47((CHAR*)"extern", 7);
Enter__47((CHAR*)"export", 7);
Enter__47((CHAR*)"float", 6);
Enter__47((CHAR*)"for", 4);
Enter__47((CHAR*)"fortran", 8);
Enter__47((CHAR*)"goto", 5);
Enter__47((CHAR*)"if", 3);
Enter__47((CHAR*)"import", 7);
Enter__47((CHAR*)"int", 4);
Enter__47((CHAR*)"int16", 6);
Enter__47((CHAR*)"int32", 6);
Enter__47((CHAR*)"int64", 6);
Enter__47((CHAR*)"int8", 5);
Enter__47((CHAR*)"long", 5);
Enter__47((CHAR*)"register", 9);
Enter__47((CHAR*)"return", 7);
Enter__47((CHAR*)"short", 6);
Enter__47((CHAR*)"signed", 7);
Enter__47((CHAR*)"sizeof", 7);
Enter__47((CHAR*)"size_t", 7);
Enter__47((CHAR*)"static", 7);
Enter__47((CHAR*)"struct", 7);
Enter__47((CHAR*)"switch", 7);
Enter__47((CHAR*)"typedef", 8);
Enter__47((CHAR*)"uint16", 7);
Enter__47((CHAR*)"uint32", 7);
Enter__47((CHAR*)"uint64", 7);
Enter__47((CHAR*)"uint8", 6);
Enter__47((CHAR*)"union", 6);
Enter__47((CHAR*)"unsigned", 9);
Enter__47((CHAR*)"void", 5);
Enter__47((CHAR*)"volatile", 9);
Enter__47((CHAR*)"while", 6);
InitKeywords__46_s = _s.lnk;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPC__h
#define OPC__h
@ -9,9 +9,7 @@
import void OPC_Align (int32 *adr, int32 base);
import void OPC_Andent (OPT_Struct typ);
import int32 OPC_BaseAlignment (OPT_Struct typ);
import OPT_Object OPC_BaseTProc (OPT_Object obj);
import void OPC_BegBlk (void);
import void OPC_BegStat (void);
@ -41,7 +39,6 @@ import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude);
import int32 OPC_SizeAlignment (int32 size);
import void OPC_TDescDecl (OPT_Struct typ);
import void OPC_TypeDefs (OPT_Object obj, int16 vis);
import void OPC_TypeOf (OPT_Object ap);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -223,6 +223,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48;
OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48;
i += 2;
Files_SetSearchPath((CHAR*)"", 1);
}
break;
case 'B':
@ -270,7 +271,7 @@ BOOLEAN OPM_OpenPar (void)
if (Platform_ArgCount == 1) {
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20);
OPM_LogWStr(Configuration_versionLong, 41);
OPM_LogWStr(Configuration_versionLong, 75);
OPM_LogW('.');
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Based on Ofront by Software Templ OEG.", 39);
@ -1118,7 +1119,7 @@ export void *OPM__init(void)
Strings_Append((CHAR*)";.;", 4, (void*)OPM_OBERON, 1024);
Strings_Append(OPM_MODULES, 1024, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)";", 2, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"", 1, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"/sym;", 6, (void*)OPM_OBERON, 1024);
Files_SetSearchPath(OPM_OBERON, 1024);
OPM_AddressSize = 4;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPM__h
#define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -87,7 +87,6 @@ typedef
} OPT_StrDesc;
export void (*OPT_typSize)(OPT_Struct);
export OPT_Object OPT_topScope;
export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj;
@ -100,6 +99,7 @@ static OPT_ImpCtxt OPT_impCtxt;
static OPT_ExpCtxt OPT_expCtxt;
static int32 OPT_nofhdfld;
static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew;
static int32 OPT_recno;
export address *OPT_ConstDesc__typ;
export address *OPT_ObjDesc__typ;
@ -108,6 +108,8 @@ export address *OPT_NodeDesc__typ;
export address *OPT_ImpCtxt__typ;
export address *OPT_ExpCtxt__typ;
export void OPT_Align (int32 *adr, int32 base);
export int32 OPT_BaseAlignment (OPT_Struct typ);
export void OPT_Close (void);
export void OPT_CloseScope (void);
static void OPT_DebugStruct (OPT_Struct btyp);
@ -136,6 +138,7 @@ static void OPT_InStruct (OPT_Struct *typ);
static OPT_Object OPT_InTProc (int8 mno);
static OPT_Struct OPT_InTyp (int32 tag);
export void OPT_Init (OPS_Name name, SET opt);
export void OPT_InitRecno (void);
static void OPT_InitStruct (OPT_Struct *typ, int8 form);
export void OPT_Insert (OPS_Name name, OPT_Object *obj);
export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old);
@ -157,9 +160,16 @@ 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);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
export int32 OPT_SizeAlignment (int32 size);
export void OPT_TypSize (OPT_Struct typ);
static void OPT_err (int16 n);
void OPT_InitRecno (void)
{
OPT_recno = 0;
}
static void OPT_err (int16 n)
{
OPM_err(n);
@ -240,6 +250,130 @@ OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
__RETCHK;
}
void OPT_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
*adr += __MASK(*adr, -2);
break;
case 4:
*adr += __MASK(-*adr, -4);
break;
case 8:
*adr += __MASK(-*adr, -8);
break;
case 16:
*adr += __MASK(-*adr, -16);
break;
default:
break;
}
}
int32 OPT_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
}
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
}
int32 OPT_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
} else {
alignment = OPT_BaseAlignment(typ->BaseTyp);
}
} else {
alignment = OPT_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
}
void OPT_TypSize (OPT_Struct typ)
{
int16 f, c;
int32 offset, size, base, fbase, off0;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
if (typ == OPT_undftyp) {
OPM_err(58);
} else if (typ->size == -1) {
f = typ->form;
c = typ->comp;
if (c == 4) {
btyp = typ->BaseTyp;
if (btyp == NIL) {
offset = 0;
base = 1;
} else {
OPT_TypSize(btyp);
offset = btyp->size - __ASHR(btyp->sysflag, 8);
base = btyp->align;
}
fld = typ->link;
while ((fld != NIL && fld->mode == 4)) {
btyp = fld->typ;
OPT_TypSize(btyp);
size = btyp->size;
fbase = OPT_BaseAlignment(btyp);
OPT_Align(&offset, fbase);
fld->adr = offset;
offset += size;
if (fbase > base) {
base = fbase;
}
fld = fld->link;
}
off0 = offset;
if (offset == 0) {
offset = 1;
}
OPT_Align(&offset, base);
if ((typ->strobj == NIL && __MASK(typ->align, -65536) == 0)) {
OPT_recno += 1;
base += __ASHL(OPT_recno, 16);
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8);
} else if (c == 2) {
OPT_TypSize(typ->BaseTyp);
typ->size = typ->n * typ->BaseTyp->size;
} else if (f == 11) {
typ->size = OPM_AddressSize;
if (typ->BaseTyp == OPT_undftyp) {
OPM_Mark(128, typ->n);
} else {
OPT_TypSize(typ->BaseTyp);
}
} else if (f == 12) {
typ->size = OPM_AddressSize;
} else if (c == 3) {
btyp = typ->BaseTyp;
OPT_TypSize(btyp);
if (btyp->comp == 3) {
typ->size = btyp->size + 4;
} else {
typ->size = 8;
}
}
}
}
OPT_Const OPT_NewConst (void)
{
OPT_Const _o_result;
@ -552,21 +686,21 @@ void OPT_IdFPrint (OPT_Struct typ)
}
}
static struct FPrintStr__13 {
static struct FPrintStr__15 {
int32 *pbfp, *pvfp;
struct FPrintStr__13 *lnk;
} *FPrintStr__13_s;
struct FPrintStr__15 *lnk;
} *FPrintStr__15_s;
static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__18 (OPT_Object obj);
static void FPrintFlds__16 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__18 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__20 (OPT_Object obj);
static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr)
static void FPrintHdFld__18 (OPT_Struct typ, OPT_Object fld, int32 adr)
{
int32 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
FPrintFlds__14(typ->link, adr, 0);
FPrintFlds__16(typ->link, adr, 0);
} else if (typ->comp == 2) {
btyp = typ->BaseTyp;
n = typ->n;
@ -576,53 +710,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr)
}
if (btyp->form == 11 || btyp->comp == 4) {
j = OPT_nofhdfld;
FPrintHdFld__16(btyp, fld, adr);
FPrintHdFld__18(btyp, fld, adr);
if (j != OPT_nofhdfld) {
i = 1;
while ((i < n && OPT_nofhdfld <= 2048)) {
adr += btyp->size;
FPrintHdFld__16(btyp, fld, adr);
FPrintHdFld__18(btyp, fld, adr);
i += 1;
}
}
}
} else if (typ->form == 11 || __STRCMP(fld->name, "@ptr") == 0) {
OPM_FPrint(&*FPrintStr__13_s->pvfp, 11);
OPM_FPrint(&*FPrintStr__13_s->pvfp, adr);
OPM_FPrint(&*FPrintStr__15_s->pvfp, 11);
OPM_FPrint(&*FPrintStr__15_s->pvfp, adr);
OPT_nofhdfld += 1;
}
}
static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible)
static void FPrintFlds__16 (OPT_Object fld, int32 adr, BOOLEAN visible)
{
while ((fld != NIL && fld->mode == 4)) {
if ((fld->vis != 0 && visible)) {
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis);
OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, 256);
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->vis);
OPT_FPrintName(&*FPrintStr__15_s->pbfp, (void*)fld->name, 256);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->adr);
OPT_FPrintStr(fld->typ);
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp);
OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->typ->pbfp);
OPM_FPrint(&*FPrintStr__15_s->pvfp, fld->typ->pvfp);
} else {
FPrintHdFld__16(fld->typ, fld, fld->adr + adr);
FPrintHdFld__18(fld->typ, fld, fld->adr + adr);
}
fld = fld->link;
}
}
static void FPrintTProcs__18 (OPT_Object obj)
static void FPrintTProcs__20 (OPT_Object obj)
{
if (obj != NIL) {
FPrintTProcs__18(obj->left);
FPrintTProcs__20(obj->left);
if (obj->mode == 13) {
if (obj->vis != 0) {
OPM_FPrint(&*FPrintStr__13_s->pbfp, 13);
OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16));
OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link);
OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, 256);
OPM_FPrint(&*FPrintStr__15_s->pbfp, 13);
OPM_FPrint(&*FPrintStr__15_s->pbfp, __ASHR(obj->adr, 16));
OPT_FPrintSign(&*FPrintStr__15_s->pbfp, obj->typ, obj->link);
OPT_FPrintName(&*FPrintStr__15_s->pbfp, (void*)obj->name, 256);
}
}
FPrintTProcs__18(obj->right);
FPrintTProcs__20(obj->right);
}
}
@ -632,11 +766,11 @@ void OPT_FPrintStr (OPT_Struct typ)
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL, bstrobj = NIL;
int32 pbfp, pvfp;
struct FPrintStr__13 _s;
struct FPrintStr__15 _s;
_s.pbfp = &pbfp;
_s.pvfp = &pvfp;
_s.lnk = FPrintStr__13_s;
FPrintStr__13_s = &_s;
_s.lnk = FPrintStr__15_s;
FPrintStr__15_s = &_s;
if (!typ->fpdone) {
OPT_IdFPrint(typ);
pbfp = typ->idfp;
@ -673,11 +807,11 @@ void OPT_FPrintStr (OPT_Struct typ)
OPM_FPrint(&pvfp, typ->align);
OPM_FPrint(&pvfp, typ->n);
OPT_nofhdfld = 0;
FPrintFlds__14(typ->link, 0, 1);
FPrintFlds__16(typ->link, 0, 1);
if (OPT_nofhdfld > 2048) {
OPM_Mark(225, typ->txtpos);
}
FPrintTProcs__18(typ->link);
FPrintTProcs__20(typ->link);
OPM_FPrint(&pvfp, pbfp);
strobj = typ->strobj;
if (strobj == NIL || strobj->name[0] == 0x00) {
@ -687,7 +821,7 @@ void OPT_FPrintStr (OPT_Struct typ)
typ->pbfp = pbfp;
typ->pvfp = pvfp;
}
FPrintStr__13_s = _s.lnk;
FPrintStr__15_s = _s.lnk;
}
void OPT_FPrintObj (OPT_Object obj)
@ -1119,7 +1253,7 @@ static void OPT_InStruct (OPT_Struct *typ)
(*typ)->comp = 2;
OPT_InStruct(&(*typ)->BaseTyp);
(*typ)->n = OPM_SymRInt();
(*OPT_typSize)(*typ);
OPT_TypSize(*typ);
break;
case 38:
(*typ)->form = 13;
@ -1130,7 +1264,7 @@ static void OPT_InStruct (OPT_Struct *typ)
} else {
(*typ)->n = 0;
}
(*OPT_typSize)(*typ);
OPT_TypSize(*typ);
break;
case 39:
(*typ)->form = 13;
@ -1899,6 +2033,7 @@ export void *OPT__init(void)
__REGMOD("OPT", EnumPtrs);
__REGCMD("Close", OPT_Close);
__REGCMD("CloseScope", OPT_CloseScope);
__REGCMD("InitRecno", OPT_InitRecno);
__INITYP(OPT_ConstDesc, OPT_ConstDesc, 0);
__INITYP(OPT_ObjDesc, OPT_ObjDesc, 0);
__INITYP(OPT_StrDesc, OPT_StrDesc, 0);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPT__h
#define OPT__h
@ -66,7 +66,6 @@ typedef
} OPT_StrDesc;
import void (*OPT_typSize)(OPT_Struct);
import OPT_Object OPT_topScope;
import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj;
@ -80,6 +79,8 @@ import address *OPT_ObjDesc__typ;
import address *OPT_StrDesc__typ;
import address *OPT_NodeDesc__typ;
import void OPT_Align (int32 *adr, int32 base);
import int32 OPT_BaseAlignment (OPT_Struct typ);
import void OPT_Close (void);
import void OPT_CloseScope (void);
import void OPT_Export (BOOLEAN *ext, BOOLEAN *new);
@ -92,6 +93,7 @@ import void OPT_FindImport (OPT_Object mod, OPT_Object *res);
import void OPT_IdFPrint (OPT_Struct typ);
import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done);
import void OPT_Init (OPS_Name name, SET opt);
import void OPT_InitRecno (void);
import void OPT_Insert (OPS_Name name, OPT_Object *obj);
import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old);
import int16 OPT_IntSize (int64 n);
@ -103,6 +105,8 @@ import OPT_Object OPT_NewObj (void);
import OPT_Struct OPT_NewStr (int8 form, int8 comp);
import void OPT_OpenScope (int8 level, OPT_Object owner);
import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
import int32 OPT_SizeAlignment (int32 size);
import void OPT_TypSize (OPT_Struct typ);
import void *OPT__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -17,7 +17,6 @@ typedef
static int16 OPV_stamp;
static int32 OPV_recno;
static OPV_ExitInfo OPV_exit;
static int16 OPV_nofExitLabels;
@ -46,88 +45,15 @@ static void OPV_Stamp (OPS_Name s);
static OPT_Object OPV_SuperProc (OPT_Node n);
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported);
static void OPV_TraverseRecord (OPT_Struct typ);
export void OPV_TypSize (OPT_Struct typ);
static void OPV_TypeOf (OPT_Node n);
static void OPV_design (OPT_Node n, int16 prec);
static void OPV_expr (OPT_Node n, int16 prec);
static void OPV_stat (OPT_Node n, OPT_Object outerProc);
void OPV_TypSize (OPT_Struct typ)
{
int16 f, c;
int32 offset, size, base, fbase, off0;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
if (typ == OPT_undftyp) {
OPM_err(58);
} else if (typ->size == -1) {
f = typ->form;
c = typ->comp;
if (c == 4) {
btyp = typ->BaseTyp;
if (btyp == NIL) {
offset = 0;
base = 1;
} else {
OPV_TypSize(btyp);
offset = btyp->size - __ASHR(btyp->sysflag, 8);
base = btyp->align;
}
fld = typ->link;
while ((fld != NIL && fld->mode == 4)) {
btyp = fld->typ;
OPV_TypSize(btyp);
size = btyp->size;
fbase = OPC_BaseAlignment(btyp);
OPC_Align(&offset, fbase);
fld->adr = offset;
offset += size;
if (fbase > base) {
base = fbase;
}
fld = fld->link;
}
off0 = offset;
if (offset == 0) {
offset = 1;
}
OPC_Align(&offset, base);
if ((typ->strobj == NIL && __MASK(typ->align, -65536) == 0)) {
OPV_recno += 1;
base += __ASHL(OPV_recno, 16);
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8);
} else if (c == 2) {
OPV_TypSize(typ->BaseTyp);
typ->size = typ->n * typ->BaseTyp->size;
} else if (f == 11) {
typ->size = OPM_AddressSize;
if (typ->BaseTyp == OPT_undftyp) {
OPM_Mark(128, typ->n);
} else {
OPV_TypSize(typ->BaseTyp);
}
} else if (f == 12) {
typ->size = OPM_AddressSize;
} else if (c == 3) {
btyp = typ->BaseTyp;
OPV_TypSize(btyp);
if (btyp->comp == 3) {
typ->size = btyp->size + 4;
} else {
typ->size = 8;
}
}
}
}
void OPV_Init (void)
{
OPV_stamp = 0;
OPV_recno = 0;
OPV_nofExitLabels = 0;
}
@ -212,7 +138,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte
mode = obj->mode;
if ((mode == 5 && (obj->vis != 0) == exported)) {
typ = obj->typ;
OPV_TypSize(obj->typ);
OPT_TypSize(obj->typ);
if (typ->form == 11) {
typ = typ->BaseTyp;
}
@ -222,7 +148,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte
} else if (mode == 13) {
OPV_GetTProcNum(obj);
} else if (mode == 1) {
OPV_TypSize(obj->typ);
OPT_TypSize(obj->typ);
}
if (!exported) {
if ((__IN(mode, 0x60, 32) && obj->mnolev > 0)) {
@ -548,7 +474,7 @@ static void OPV_design (OPT_Node n, int16 prec)
OPT_Struct typ = NIL;
int16 class, designPrec, comp;
OPT_Node d = NIL, x = NIL;
int16 dims, i, _for__27;
int16 dims, i, _for__26;
comp = n->typ->comp;
obj = n->obj;
class = n->class;
@ -624,9 +550,9 @@ static void OPV_design (OPT_Node n, int16 prec)
}
x = x->left;
}
_for__27 = dims;
_for__26 = dims;
i = 1;
while (i <= _for__27) {
while (i <= _for__26) {
OPM_Write(')');
i += 1;
}
@ -1290,7 +1216,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(base->size);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPC_BaseAlignment(base));
OPM_WriteInt(OPT_BaseAlignment(base));
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(nofdim);
OPM_WriteString((CHAR*)", ", 3);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPV__h
#define OPV__h
@ -12,7 +12,6 @@
import void OPV_AdrAndSize (OPT_Object topScope);
import void OPV_Init (void);
import void OPV_Module (OPT_Node prog);
import void OPV_TypSize (OPT_Struct typ);
import void *OPV__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Reals__h
#define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspamSf */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
#define INTEGER int16
#define LONGINT int32
@ -35,6 +35,7 @@ void Vishap_Module (BOOLEAN *done)
OPP_Module(&p, OPM_opt);
if (OPM_noerr) {
OPV_Init();
OPT_InitRecno();
OPV_AdrAndSize(OPT_topScope);
OPT_Export(&ext, &new);
if (OPM_noerr) {
@ -165,8 +166,6 @@ export int main(int argc, char **argv)
Platform_SetInterruptHandler(Vishap_Trap);
Platform_SetQuitHandler(Vishap_Trap);
Platform_SetBadInstructionHandler(Vishap_Trap);
OPB_typSize = OPV_TypSize;
OPT_typSize = OPV_TypSize;
Vishap_Translate();
__FINI;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef errors__h
#define errors__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -89,7 +89,7 @@ void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN stati
Strings_Append((CHAR*)" -o ", 5, (void*)cmd, 1023);
Strings_Append(moduleName, moduleName__len, (void*)cmd, 1023);
Strings_Append((CHAR*)" -L\"", 5, (void*)cmd, 1023);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)cmd, 1023);
Strings_Append((CHAR*)"", 1, (void*)cmd, 1023);
Strings_Append((CHAR*)"/lib\"", 6, (void*)cmd, 1023);
Strings_Append((CHAR*)" -l voc", 8, (void*)cmd, 1023);
extTools_execute((CHAR*)"Assemble and link: ", 20, cmd, 1023);
@ -108,7 +108,7 @@ export void *extTools__init(void)
__REGMOD("extTools", 0);
/* BEGIN */
Strings_Append((CHAR*)" -I \"", 6, (void*)extTools_compilationOptions, 1023);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)extTools_compilationOptions, 1023);
Strings_Append((CHAR*)"", 1, (void*)extTools_compilationOptions, 1023);
Strings_Append((CHAR*)"/include\" ", 11, (void*)extTools_compilationOptions, 1023);
Platform_GetEnv((CHAR*)"CFLAGS", 7, (void*)extTools_CFLAGS, 1023);
Strings_Append(extTools_CFLAGS, 1023, (void*)extTools_compilationOptions, 1023);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef vt100__h
#define vt100__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -7,7 +7,7 @@
#include "SYSTEM.h"
export CHAR Configuration_versionLong[41];
export CHAR Configuration_versionLong[75];
@ -18,6 +18,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("1.95 [2016/09/23] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__MOVE("1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Configuration__h
#define Configuration__h
@ -6,7 +6,7 @@
#include "SYSTEM.h"
import CHAR Configuration_versionLong[41];
import CHAR Configuration_versionLong[75];
import void *Configuration__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Console__h
#define Console__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -10,7 +10,6 @@
#include "OPT.h"
export void (*OPB_typSize)(OPT_Struct);
static int16 OPB_exp;
static int64 OPB_maxExp;
@ -1917,7 +1916,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
OPB_err(110);
x = OPB_NewIntConst(1);
} else if (__IN(f, 0x18fe, 32) || __IN(x->typ->comp, 0x14, 32)) {
(*OPB_typSize)(x->typ);
OPT_TypSize(x->typ);
x->typ->pvused = 1;
x = OPB_NewIntConst(x->typ->size);
} else {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPB__h
#define OPB__h
@ -8,7 +8,6 @@
#include "OPT.h"
import void (*OPB_typSize)(OPT_Struct);
import void OPB_Assign (OPT_Node *x, OPT_Node y);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -17,10 +17,8 @@ static BOOLEAN OPC_GlbPtrs;
static CHAR OPC_BodyNameExt[13];
export void OPC_Align (int32 *adr, int32 base);
export void OPC_Andent (OPT_Struct typ);
static void OPC_AnsiParamList (OPT_Object obj, BOOLEAN showParamNames);
export int32 OPC_BaseAlignment (OPT_Struct typ);
export OPT_Object OPC_BaseTProc (OPT_Object obj);
export void OPC_BegBlk (void);
export void OPC_BegStat (void);
@ -79,7 +77,6 @@ static void OPC_PutBase (OPT_Struct typ);
static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt);
static void OPC_RegCmds (OPT_Object obj);
export void OPC_SetInclude (BOOLEAN exclude);
export int32 OPC_SizeAlignment (int32 size);
static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause);
static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x);
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l);
@ -750,7 +747,7 @@ static void OPC_CProcDefs (OPT_Object obj, int16 vis)
{
int16 i;
OPT_ConstExt ext = NIL;
int16 _for__9;
int16 _for__7;
if (obj != NIL) {
OPC_CProcDefs(obj->left, vis);
if ((((obj->mode == 9 && (int16)obj->vis >= vis)) && obj->adr == 1)) {
@ -762,9 +759,9 @@ static void OPC_CProcDefs (OPT_Object obj, int16 vis)
OPC_DeclareParams(obj->link, 1);
OPM_Write(0x09);
}
_for__9 = (int16)(*obj->conval->ext)[0];
_for__7 = (int16)(*obj->conval->ext)[0];
i = i;
while (i <= _for__9) {
while (i <= _for__7) {
OPM_Write((*obj->conval->ext)[__X(i, 256)]);
i += 1;
}
@ -843,64 +840,11 @@ void OPC_InitTDesc (OPT_Struct typ)
}
}
void OPC_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
*adr += __MASK(*adr, -2);
break;
case 4:
*adr += __MASK(-*adr, -4);
break;
case 8:
*adr += __MASK(-*adr, -8);
break;
case 16:
*adr += __MASK(-*adr, -16);
break;
default:
break;
}
}
int32 OPC_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
}
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
}
int32 OPC_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
} else {
alignment = OPC_BaseAlignment(typ->BaseTyp);
}
} else {
alignment = OPC_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
}
static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign)
{
int32 adr;
adr = off;
OPC_Align(&adr, align);
OPT_Align(&adr, align);
if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align;
OPC_BegStat();
@ -955,8 +899,8 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, i
}
} else {
adr = *off;
fldAlign = OPC_BaseAlignment(fld->typ);
OPC_Align(&adr, fldAlign);
fldAlign = OPT_BaseAlignment(fld->typ);
OPT_Align(&adr, fldAlign);
gap = fld->adr - adr;
if (fldAlign > *curAlign) {
*curAlign = fldAlign;
@ -1205,7 +1149,7 @@ static void OPC_GenHeaderMsg (void)
OPM_WriteString((CHAR*)"/* ", 4);
OPM_WriteString((CHAR*)"voc", 4);
OPM_Write(' ');
OPM_WriteString(Configuration_versionLong, 41);
OPM_WriteString(Configuration_versionLong, 75);
OPM_Write(' ');
i = 0;
while (i <= 31) {
@ -1966,84 +1910,84 @@ void OPC_Constant (OPT_Const con, int16 form)
}
}
static struct InitKeywords__48 {
static struct InitKeywords__46 {
int8 *n;
struct InitKeywords__48 *lnk;
} *InitKeywords__48_s;
struct InitKeywords__46 *lnk;
} *InitKeywords__46_s;
static void Enter__49 (CHAR *s, LONGINT s__len);
static void Enter__47 (CHAR *s, LONGINT s__len);
static void Enter__49 (CHAR *s, LONGINT s__len)
static void Enter__47 (CHAR *s, LONGINT s__len)
{
int16 h;
__DUP(s, s__len, CHAR);
h = OPC_PerfectHash((void*)s, s__len);
OPC_hashtab[__X(h, 105)] = *InitKeywords__48_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__48_s->n, 50)], 9);
*InitKeywords__48_s->n += 1;
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
*InitKeywords__46_s->n += 1;
__DEL(s);
}
static void OPC_InitKeywords (void)
{
int8 n, i;
struct InitKeywords__48 _s;
struct InitKeywords__46 _s;
_s.n = &n;
_s.lnk = InitKeywords__48_s;
InitKeywords__48_s = &_s;
_s.lnk = InitKeywords__46_s;
InitKeywords__46_s = &_s;
n = 0;
i = 0;
while (i <= 104) {
OPC_hashtab[__X(i, 105)] = -1;
i += 1;
}
Enter__49((CHAR*)"address", 8);
Enter__49((CHAR*)"asm", 4);
Enter__49((CHAR*)"auto", 5);
Enter__49((CHAR*)"break", 6);
Enter__49((CHAR*)"case", 5);
Enter__49((CHAR*)"char", 5);
Enter__49((CHAR*)"const", 6);
Enter__49((CHAR*)"continue", 9);
Enter__49((CHAR*)"default", 8);
Enter__49((CHAR*)"do", 3);
Enter__49((CHAR*)"double", 7);
Enter__49((CHAR*)"else", 5);
Enter__49((CHAR*)"enum", 5);
Enter__49((CHAR*)"extern", 7);
Enter__49((CHAR*)"export", 7);
Enter__49((CHAR*)"float", 6);
Enter__49((CHAR*)"for", 4);
Enter__49((CHAR*)"fortran", 8);
Enter__49((CHAR*)"goto", 5);
Enter__49((CHAR*)"if", 3);
Enter__49((CHAR*)"import", 7);
Enter__49((CHAR*)"int", 4);
Enter__49((CHAR*)"int16", 6);
Enter__49((CHAR*)"int32", 6);
Enter__49((CHAR*)"int64", 6);
Enter__49((CHAR*)"int8", 5);
Enter__49((CHAR*)"long", 5);
Enter__49((CHAR*)"register", 9);
Enter__49((CHAR*)"return", 7);
Enter__49((CHAR*)"short", 6);
Enter__49((CHAR*)"signed", 7);
Enter__49((CHAR*)"sizeof", 7);
Enter__49((CHAR*)"size_t", 7);
Enter__49((CHAR*)"static", 7);
Enter__49((CHAR*)"struct", 7);
Enter__49((CHAR*)"switch", 7);
Enter__49((CHAR*)"typedef", 8);
Enter__49((CHAR*)"uint16", 7);
Enter__49((CHAR*)"uint32", 7);
Enter__49((CHAR*)"uint64", 7);
Enter__49((CHAR*)"uint8", 6);
Enter__49((CHAR*)"union", 6);
Enter__49((CHAR*)"unsigned", 9);
Enter__49((CHAR*)"void", 5);
Enter__49((CHAR*)"volatile", 9);
Enter__49((CHAR*)"while", 6);
InitKeywords__48_s = _s.lnk;
Enter__47((CHAR*)"address", 8);
Enter__47((CHAR*)"asm", 4);
Enter__47((CHAR*)"auto", 5);
Enter__47((CHAR*)"break", 6);
Enter__47((CHAR*)"case", 5);
Enter__47((CHAR*)"char", 5);
Enter__47((CHAR*)"const", 6);
Enter__47((CHAR*)"continue", 9);
Enter__47((CHAR*)"default", 8);
Enter__47((CHAR*)"do", 3);
Enter__47((CHAR*)"double", 7);
Enter__47((CHAR*)"else", 5);
Enter__47((CHAR*)"enum", 5);
Enter__47((CHAR*)"extern", 7);
Enter__47((CHAR*)"export", 7);
Enter__47((CHAR*)"float", 6);
Enter__47((CHAR*)"for", 4);
Enter__47((CHAR*)"fortran", 8);
Enter__47((CHAR*)"goto", 5);
Enter__47((CHAR*)"if", 3);
Enter__47((CHAR*)"import", 7);
Enter__47((CHAR*)"int", 4);
Enter__47((CHAR*)"int16", 6);
Enter__47((CHAR*)"int32", 6);
Enter__47((CHAR*)"int64", 6);
Enter__47((CHAR*)"int8", 5);
Enter__47((CHAR*)"long", 5);
Enter__47((CHAR*)"register", 9);
Enter__47((CHAR*)"return", 7);
Enter__47((CHAR*)"short", 6);
Enter__47((CHAR*)"signed", 7);
Enter__47((CHAR*)"sizeof", 7);
Enter__47((CHAR*)"size_t", 7);
Enter__47((CHAR*)"static", 7);
Enter__47((CHAR*)"struct", 7);
Enter__47((CHAR*)"switch", 7);
Enter__47((CHAR*)"typedef", 8);
Enter__47((CHAR*)"uint16", 7);
Enter__47((CHAR*)"uint32", 7);
Enter__47((CHAR*)"uint64", 7);
Enter__47((CHAR*)"uint8", 6);
Enter__47((CHAR*)"union", 6);
Enter__47((CHAR*)"unsigned", 9);
Enter__47((CHAR*)"void", 5);
Enter__47((CHAR*)"volatile", 9);
Enter__47((CHAR*)"while", 6);
InitKeywords__46_s = _s.lnk;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPC__h
#define OPC__h
@ -9,9 +9,7 @@
import void OPC_Align (int32 *adr, int32 base);
import void OPC_Andent (OPT_Struct typ);
import int32 OPC_BaseAlignment (OPT_Struct typ);
import OPT_Object OPC_BaseTProc (OPT_Object obj);
import void OPC_BegBlk (void);
import void OPC_BegStat (void);
@ -41,7 +39,6 @@ import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude);
import int32 OPC_SizeAlignment (int32 size);
import void OPC_TDescDecl (OPT_Struct typ);
import void OPC_TypeDefs (OPT_Object obj, int16 vis);
import void OPC_TypeOf (OPT_Object ap);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -223,6 +223,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48;
OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48;
i += 2;
Files_SetSearchPath((CHAR*)"", 1);
}
break;
case 'B':
@ -270,7 +271,7 @@ BOOLEAN OPM_OpenPar (void)
if (Platform_ArgCount == 1) {
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20);
OPM_LogWStr(Configuration_versionLong, 41);
OPM_LogWStr(Configuration_versionLong, 75);
OPM_LogW('.');
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Based on Ofront by Software Templ OEG.", 39);
@ -1118,7 +1119,7 @@ export void *OPM__init(void)
Strings_Append((CHAR*)";.;", 4, (void*)OPM_OBERON, 1024);
Strings_Append(OPM_MODULES, 1024, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)";", 2, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"", 1, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"/sym;", 6, (void*)OPM_OBERON, 1024);
Files_SetSearchPath(OPM_OBERON, 1024);
OPM_AddressSize = 4;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPM__h
#define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -87,7 +87,6 @@ typedef
} OPT_StrDesc;
export void (*OPT_typSize)(OPT_Struct);
export OPT_Object OPT_topScope;
export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj;
@ -100,6 +99,7 @@ static OPT_ImpCtxt OPT_impCtxt;
static OPT_ExpCtxt OPT_expCtxt;
static int32 OPT_nofhdfld;
static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew;
static int32 OPT_recno;
export address *OPT_ConstDesc__typ;
export address *OPT_ObjDesc__typ;
@ -108,6 +108,8 @@ export address *OPT_NodeDesc__typ;
export address *OPT_ImpCtxt__typ;
export address *OPT_ExpCtxt__typ;
export void OPT_Align (int32 *adr, int32 base);
export int32 OPT_BaseAlignment (OPT_Struct typ);
export void OPT_Close (void);
export void OPT_CloseScope (void);
static void OPT_DebugStruct (OPT_Struct btyp);
@ -136,6 +138,7 @@ static void OPT_InStruct (OPT_Struct *typ);
static OPT_Object OPT_InTProc (int8 mno);
static OPT_Struct OPT_InTyp (int32 tag);
export void OPT_Init (OPS_Name name, SET opt);
export void OPT_InitRecno (void);
static void OPT_InitStruct (OPT_Struct *typ, int8 form);
export void OPT_Insert (OPS_Name name, OPT_Object *obj);
export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old);
@ -157,9 +160,16 @@ 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);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
export int32 OPT_SizeAlignment (int32 size);
export void OPT_TypSize (OPT_Struct typ);
static void OPT_err (int16 n);
void OPT_InitRecno (void)
{
OPT_recno = 0;
}
static void OPT_err (int16 n)
{
OPM_err(n);
@ -240,6 +250,130 @@ OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
__RETCHK;
}
void OPT_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
*adr += __MASK(*adr, -2);
break;
case 4:
*adr += __MASK(-*adr, -4);
break;
case 8:
*adr += __MASK(-*adr, -8);
break;
case 16:
*adr += __MASK(-*adr, -16);
break;
default:
break;
}
}
int32 OPT_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
}
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
}
int32 OPT_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
} else {
alignment = OPT_BaseAlignment(typ->BaseTyp);
}
} else {
alignment = OPT_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
}
void OPT_TypSize (OPT_Struct typ)
{
int16 f, c;
int32 offset, size, base, fbase, off0;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
if (typ == OPT_undftyp) {
OPM_err(58);
} else if (typ->size == -1) {
f = typ->form;
c = typ->comp;
if (c == 4) {
btyp = typ->BaseTyp;
if (btyp == NIL) {
offset = 0;
base = 1;
} else {
OPT_TypSize(btyp);
offset = btyp->size - __ASHR(btyp->sysflag, 8);
base = btyp->align;
}
fld = typ->link;
while ((fld != NIL && fld->mode == 4)) {
btyp = fld->typ;
OPT_TypSize(btyp);
size = btyp->size;
fbase = OPT_BaseAlignment(btyp);
OPT_Align(&offset, fbase);
fld->adr = offset;
offset += size;
if (fbase > base) {
base = fbase;
}
fld = fld->link;
}
off0 = offset;
if (offset == 0) {
offset = 1;
}
OPT_Align(&offset, base);
if ((typ->strobj == NIL && __MASK(typ->align, -65536) == 0)) {
OPT_recno += 1;
base += __ASHL(OPT_recno, 16);
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8);
} else if (c == 2) {
OPT_TypSize(typ->BaseTyp);
typ->size = typ->n * typ->BaseTyp->size;
} else if (f == 11) {
typ->size = OPM_AddressSize;
if (typ->BaseTyp == OPT_undftyp) {
OPM_Mark(128, typ->n);
} else {
OPT_TypSize(typ->BaseTyp);
}
} else if (f == 12) {
typ->size = OPM_AddressSize;
} else if (c == 3) {
btyp = typ->BaseTyp;
OPT_TypSize(btyp);
if (btyp->comp == 3) {
typ->size = btyp->size + 4;
} else {
typ->size = 8;
}
}
}
}
OPT_Const OPT_NewConst (void)
{
OPT_Const _o_result;
@ -552,21 +686,21 @@ void OPT_IdFPrint (OPT_Struct typ)
}
}
static struct FPrintStr__13 {
static struct FPrintStr__15 {
int32 *pbfp, *pvfp;
struct FPrintStr__13 *lnk;
} *FPrintStr__13_s;
struct FPrintStr__15 *lnk;
} *FPrintStr__15_s;
static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__18 (OPT_Object obj);
static void FPrintFlds__16 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__18 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__20 (OPT_Object obj);
static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr)
static void FPrintHdFld__18 (OPT_Struct typ, OPT_Object fld, int32 adr)
{
int32 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
FPrintFlds__14(typ->link, adr, 0);
FPrintFlds__16(typ->link, adr, 0);
} else if (typ->comp == 2) {
btyp = typ->BaseTyp;
n = typ->n;
@ -576,53 +710,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr)
}
if (btyp->form == 11 || btyp->comp == 4) {
j = OPT_nofhdfld;
FPrintHdFld__16(btyp, fld, adr);
FPrintHdFld__18(btyp, fld, adr);
if (j != OPT_nofhdfld) {
i = 1;
while ((i < n && OPT_nofhdfld <= 2048)) {
adr += btyp->size;
FPrintHdFld__16(btyp, fld, adr);
FPrintHdFld__18(btyp, fld, adr);
i += 1;
}
}
}
} else if (typ->form == 11 || __STRCMP(fld->name, "@ptr") == 0) {
OPM_FPrint(&*FPrintStr__13_s->pvfp, 11);
OPM_FPrint(&*FPrintStr__13_s->pvfp, adr);
OPM_FPrint(&*FPrintStr__15_s->pvfp, 11);
OPM_FPrint(&*FPrintStr__15_s->pvfp, adr);
OPT_nofhdfld += 1;
}
}
static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible)
static void FPrintFlds__16 (OPT_Object fld, int32 adr, BOOLEAN visible)
{
while ((fld != NIL && fld->mode == 4)) {
if ((fld->vis != 0 && visible)) {
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis);
OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, 256);
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->vis);
OPT_FPrintName(&*FPrintStr__15_s->pbfp, (void*)fld->name, 256);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->adr);
OPT_FPrintStr(fld->typ);
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp);
OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->typ->pbfp);
OPM_FPrint(&*FPrintStr__15_s->pvfp, fld->typ->pvfp);
} else {
FPrintHdFld__16(fld->typ, fld, fld->adr + adr);
FPrintHdFld__18(fld->typ, fld, fld->adr + adr);
}
fld = fld->link;
}
}
static void FPrintTProcs__18 (OPT_Object obj)
static void FPrintTProcs__20 (OPT_Object obj)
{
if (obj != NIL) {
FPrintTProcs__18(obj->left);
FPrintTProcs__20(obj->left);
if (obj->mode == 13) {
if (obj->vis != 0) {
OPM_FPrint(&*FPrintStr__13_s->pbfp, 13);
OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16));
OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link);
OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, 256);
OPM_FPrint(&*FPrintStr__15_s->pbfp, 13);
OPM_FPrint(&*FPrintStr__15_s->pbfp, __ASHR(obj->adr, 16));
OPT_FPrintSign(&*FPrintStr__15_s->pbfp, obj->typ, obj->link);
OPT_FPrintName(&*FPrintStr__15_s->pbfp, (void*)obj->name, 256);
}
}
FPrintTProcs__18(obj->right);
FPrintTProcs__20(obj->right);
}
}
@ -632,11 +766,11 @@ void OPT_FPrintStr (OPT_Struct typ)
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL, bstrobj = NIL;
int32 pbfp, pvfp;
struct FPrintStr__13 _s;
struct FPrintStr__15 _s;
_s.pbfp = &pbfp;
_s.pvfp = &pvfp;
_s.lnk = FPrintStr__13_s;
FPrintStr__13_s = &_s;
_s.lnk = FPrintStr__15_s;
FPrintStr__15_s = &_s;
if (!typ->fpdone) {
OPT_IdFPrint(typ);
pbfp = typ->idfp;
@ -673,11 +807,11 @@ void OPT_FPrintStr (OPT_Struct typ)
OPM_FPrint(&pvfp, typ->align);
OPM_FPrint(&pvfp, typ->n);
OPT_nofhdfld = 0;
FPrintFlds__14(typ->link, 0, 1);
FPrintFlds__16(typ->link, 0, 1);
if (OPT_nofhdfld > 2048) {
OPM_Mark(225, typ->txtpos);
}
FPrintTProcs__18(typ->link);
FPrintTProcs__20(typ->link);
OPM_FPrint(&pvfp, pbfp);
strobj = typ->strobj;
if (strobj == NIL || strobj->name[0] == 0x00) {
@ -687,7 +821,7 @@ void OPT_FPrintStr (OPT_Struct typ)
typ->pbfp = pbfp;
typ->pvfp = pvfp;
}
FPrintStr__13_s = _s.lnk;
FPrintStr__15_s = _s.lnk;
}
void OPT_FPrintObj (OPT_Object obj)
@ -1119,7 +1253,7 @@ static void OPT_InStruct (OPT_Struct *typ)
(*typ)->comp = 2;
OPT_InStruct(&(*typ)->BaseTyp);
(*typ)->n = OPM_SymRInt();
(*OPT_typSize)(*typ);
OPT_TypSize(*typ);
break;
case 38:
(*typ)->form = 13;
@ -1130,7 +1264,7 @@ static void OPT_InStruct (OPT_Struct *typ)
} else {
(*typ)->n = 0;
}
(*OPT_typSize)(*typ);
OPT_TypSize(*typ);
break;
case 39:
(*typ)->form = 13;
@ -1899,6 +2033,7 @@ export void *OPT__init(void)
__REGMOD("OPT", EnumPtrs);
__REGCMD("Close", OPT_Close);
__REGCMD("CloseScope", OPT_CloseScope);
__REGCMD("InitRecno", OPT_InitRecno);
__INITYP(OPT_ConstDesc, OPT_ConstDesc, 0);
__INITYP(OPT_ObjDesc, OPT_ObjDesc, 0);
__INITYP(OPT_StrDesc, OPT_StrDesc, 0);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPT__h
#define OPT__h
@ -66,7 +66,6 @@ typedef
} OPT_StrDesc;
import void (*OPT_typSize)(OPT_Struct);
import OPT_Object OPT_topScope;
import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj;
@ -80,6 +79,8 @@ import address *OPT_ObjDesc__typ;
import address *OPT_StrDesc__typ;
import address *OPT_NodeDesc__typ;
import void OPT_Align (int32 *adr, int32 base);
import int32 OPT_BaseAlignment (OPT_Struct typ);
import void OPT_Close (void);
import void OPT_CloseScope (void);
import void OPT_Export (BOOLEAN *ext, BOOLEAN *new);
@ -92,6 +93,7 @@ import void OPT_FindImport (OPT_Object mod, OPT_Object *res);
import void OPT_IdFPrint (OPT_Struct typ);
import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done);
import void OPT_Init (OPS_Name name, SET opt);
import void OPT_InitRecno (void);
import void OPT_Insert (OPS_Name name, OPT_Object *obj);
import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old);
import int16 OPT_IntSize (int64 n);
@ -103,6 +105,8 @@ import OPT_Object OPT_NewObj (void);
import OPT_Struct OPT_NewStr (int8 form, int8 comp);
import void OPT_OpenScope (int8 level, OPT_Object owner);
import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
import int32 OPT_SizeAlignment (int32 size);
import void OPT_TypSize (OPT_Struct typ);
import void *OPT__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -17,7 +17,6 @@ typedef
static int16 OPV_stamp;
static int32 OPV_recno;
static OPV_ExitInfo OPV_exit;
static int16 OPV_nofExitLabels;
@ -46,88 +45,15 @@ static void OPV_Stamp (OPS_Name s);
static OPT_Object OPV_SuperProc (OPT_Node n);
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported);
static void OPV_TraverseRecord (OPT_Struct typ);
export void OPV_TypSize (OPT_Struct typ);
static void OPV_TypeOf (OPT_Node n);
static void OPV_design (OPT_Node n, int16 prec);
static void OPV_expr (OPT_Node n, int16 prec);
static void OPV_stat (OPT_Node n, OPT_Object outerProc);
void OPV_TypSize (OPT_Struct typ)
{
int16 f, c;
int32 offset, size, base, fbase, off0;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
if (typ == OPT_undftyp) {
OPM_err(58);
} else if (typ->size == -1) {
f = typ->form;
c = typ->comp;
if (c == 4) {
btyp = typ->BaseTyp;
if (btyp == NIL) {
offset = 0;
base = 1;
} else {
OPV_TypSize(btyp);
offset = btyp->size - __ASHR(btyp->sysflag, 8);
base = btyp->align;
}
fld = typ->link;
while ((fld != NIL && fld->mode == 4)) {
btyp = fld->typ;
OPV_TypSize(btyp);
size = btyp->size;
fbase = OPC_BaseAlignment(btyp);
OPC_Align(&offset, fbase);
fld->adr = offset;
offset += size;
if (fbase > base) {
base = fbase;
}
fld = fld->link;
}
off0 = offset;
if (offset == 0) {
offset = 1;
}
OPC_Align(&offset, base);
if ((typ->strobj == NIL && __MASK(typ->align, -65536) == 0)) {
OPV_recno += 1;
base += __ASHL(OPV_recno, 16);
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8);
} else if (c == 2) {
OPV_TypSize(typ->BaseTyp);
typ->size = typ->n * typ->BaseTyp->size;
} else if (f == 11) {
typ->size = OPM_AddressSize;
if (typ->BaseTyp == OPT_undftyp) {
OPM_Mark(128, typ->n);
} else {
OPV_TypSize(typ->BaseTyp);
}
} else if (f == 12) {
typ->size = OPM_AddressSize;
} else if (c == 3) {
btyp = typ->BaseTyp;
OPV_TypSize(btyp);
if (btyp->comp == 3) {
typ->size = btyp->size + 4;
} else {
typ->size = 8;
}
}
}
}
void OPV_Init (void)
{
OPV_stamp = 0;
OPV_recno = 0;
OPV_nofExitLabels = 0;
}
@ -212,7 +138,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte
mode = obj->mode;
if ((mode == 5 && (obj->vis != 0) == exported)) {
typ = obj->typ;
OPV_TypSize(obj->typ);
OPT_TypSize(obj->typ);
if (typ->form == 11) {
typ = typ->BaseTyp;
}
@ -222,7 +148,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte
} else if (mode == 13) {
OPV_GetTProcNum(obj);
} else if (mode == 1) {
OPV_TypSize(obj->typ);
OPT_TypSize(obj->typ);
}
if (!exported) {
if ((__IN(mode, 0x60, 32) && obj->mnolev > 0)) {
@ -548,7 +474,7 @@ static void OPV_design (OPT_Node n, int16 prec)
OPT_Struct typ = NIL;
int16 class, designPrec, comp;
OPT_Node d = NIL, x = NIL;
int16 dims, i, _for__27;
int16 dims, i, _for__26;
comp = n->typ->comp;
obj = n->obj;
class = n->class;
@ -624,9 +550,9 @@ static void OPV_design (OPT_Node n, int16 prec)
}
x = x->left;
}
_for__27 = dims;
_for__26 = dims;
i = 1;
while (i <= _for__27) {
while (i <= _for__26) {
OPM_Write(')');
i += 1;
}
@ -1290,7 +1216,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x)
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(base->size);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPC_BaseAlignment(base));
OPM_WriteInt(OPT_BaseAlignment(base));
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(nofdim);
OPM_WriteString((CHAR*)", ", 3);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPV__h
#define OPV__h
@ -12,7 +12,6 @@
import void OPV_AdrAndSize (OPT_Object topScope);
import void OPV_Init (void);
import void OPV_Module (OPT_Node prog);
import void OPV_TypSize (OPT_Struct typ);
import void *OPV__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Reals__h
#define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspamSf */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
#define INTEGER int16
#define LONGINT int32
@ -35,6 +35,7 @@ void Vishap_Module (BOOLEAN *done)
OPP_Module(&p, OPM_opt);
if (OPM_noerr) {
OPV_Init();
OPT_InitRecno();
OPV_AdrAndSize(OPT_topScope);
OPT_Export(&ext, &new);
if (OPM_noerr) {
@ -165,8 +166,6 @@ export int main(int argc, char **argv)
Platform_SetInterruptHandler(Vishap_Trap);
Platform_SetQuitHandler(Vishap_Trap);
Platform_SetBadInstructionHandler(Vishap_Trap);
OPB_typSize = OPV_TypSize;
OPT_typSize = OPV_TypSize;
Vishap_Translate();
__FINI;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef errors__h
#define errors__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -89,7 +89,7 @@ void extTools_LinkMain (CHAR *moduleName, LONGINT moduleName__len, BOOLEAN stati
Strings_Append((CHAR*)" -o ", 5, (void*)cmd, 1023);
Strings_Append(moduleName, moduleName__len, (void*)cmd, 1023);
Strings_Append((CHAR*)" -L\"", 5, (void*)cmd, 1023);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)cmd, 1023);
Strings_Append((CHAR*)"", 1, (void*)cmd, 1023);
Strings_Append((CHAR*)"/lib\"", 6, (void*)cmd, 1023);
Strings_Append((CHAR*)" -l voc", 8, (void*)cmd, 1023);
extTools_execute((CHAR*)"Assemble and link: ", 20, cmd, 1023);
@ -108,7 +108,7 @@ export void *extTools__init(void)
__REGMOD("extTools", 0);
/* BEGIN */
Strings_Append((CHAR*)" -I \"", 6, (void*)extTools_compilationOptions, 1023);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)extTools_compilationOptions, 1023);
Strings_Append((CHAR*)"", 1, (void*)extTools_compilationOptions, 1023);
Strings_Append((CHAR*)"/include\" ", 11, (void*)extTools_compilationOptions, 1023);
Platform_GetEnv((CHAR*)"CFLAGS", 7, (void*)extTools_CFLAGS, 1023);
Strings_Append(extTools_CFLAGS, 1023, (void*)extTools_compilationOptions, 1023);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef vt100__h
#define vt100__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -7,7 +7,7 @@
#include "SYSTEM.h"
export CHAR Configuration_versionLong[41];
export CHAR Configuration_versionLong[75];
@ -18,6 +18,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("1.95 [2016/09/23] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__MOVE("1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Configuration__h
#define Configuration__h
@ -6,7 +6,7 @@
#include "SYSTEM.h"
import CHAR Configuration_versionLong[41];
import CHAR Configuration_versionLong[75];
import void *Configuration__init(void);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Console__h
#define Console__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -10,7 +10,6 @@
#include "OPT.h"
export void (*OPB_typSize)(OPT_Struct);
static int16 OPB_exp;
static int64 OPB_maxExp;
@ -1917,7 +1916,7 @@ void OPB_StPar0 (OPT_Node *par0, int16 fctno)
OPB_err(110);
x = OPB_NewIntConst(1);
} else if (__IN(f, 0x18fe, 32) || __IN(x->typ->comp, 0x14, 32)) {
(*OPB_typSize)(x->typ);
OPT_TypSize(x->typ);
x->typ->pvused = 1;
x = OPB_NewIntConst(x->typ->size);
} else {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPB__h
#define OPB__h
@ -8,7 +8,6 @@
#include "OPT.h"
import void (*OPB_typSize)(OPT_Struct);
import void OPB_Assign (OPT_Node *x, OPT_Node y);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -17,10 +17,8 @@ static BOOLEAN OPC_GlbPtrs;
static CHAR OPC_BodyNameExt[13];
export void OPC_Align (int32 *adr, int32 base);
export void OPC_Andent (OPT_Struct typ);
static void OPC_AnsiParamList (OPT_Object obj, BOOLEAN showParamNames);
export int32 OPC_BaseAlignment (OPT_Struct typ);
export OPT_Object OPC_BaseTProc (OPT_Object obj);
export void OPC_BegBlk (void);
export void OPC_BegStat (void);
@ -79,7 +77,6 @@ static void OPC_PutBase (OPT_Struct typ);
static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt);
static void OPC_RegCmds (OPT_Object obj);
export void OPC_SetInclude (BOOLEAN exclude);
export int32 OPC_SizeAlignment (int32 size);
static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause);
static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x);
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l);
@ -750,7 +747,7 @@ static void OPC_CProcDefs (OPT_Object obj, int16 vis)
{
int16 i;
OPT_ConstExt ext = NIL;
int16 _for__9;
int16 _for__7;
if (obj != NIL) {
OPC_CProcDefs(obj->left, vis);
if ((((obj->mode == 9 && (int16)obj->vis >= vis)) && obj->adr == 1)) {
@ -762,9 +759,9 @@ static void OPC_CProcDefs (OPT_Object obj, int16 vis)
OPC_DeclareParams(obj->link, 1);
OPM_Write(0x09);
}
_for__9 = (int16)(*obj->conval->ext)[0];
_for__7 = (int16)(*obj->conval->ext)[0];
i = i;
while (i <= _for__9) {
while (i <= _for__7) {
OPM_Write((*obj->conval->ext)[__X(i, 256)]);
i += 1;
}
@ -843,64 +840,11 @@ void OPC_InitTDesc (OPT_Struct typ)
}
}
void OPC_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
*adr += __MASK(*adr, -2);
break;
case 4:
*adr += __MASK(-*adr, -4);
break;
case 8:
*adr += __MASK(-*adr, -8);
break;
case 16:
*adr += __MASK(-*adr, -16);
break;
default:
break;
}
}
int32 OPC_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
}
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
}
int32 OPC_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
} else {
alignment = OPC_BaseAlignment(typ->BaseTyp);
}
} else {
alignment = OPC_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
}
static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign)
{
int32 adr;
adr = off;
OPC_Align(&adr, align);
OPT_Align(&adr, align);
if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align;
OPC_BegStat();
@ -955,8 +899,8 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, i
}
} else {
adr = *off;
fldAlign = OPC_BaseAlignment(fld->typ);
OPC_Align(&adr, fldAlign);
fldAlign = OPT_BaseAlignment(fld->typ);
OPT_Align(&adr, fldAlign);
gap = fld->adr - adr;
if (fldAlign > *curAlign) {
*curAlign = fldAlign;
@ -1205,7 +1149,7 @@ static void OPC_GenHeaderMsg (void)
OPM_WriteString((CHAR*)"/* ", 4);
OPM_WriteString((CHAR*)"voc", 4);
OPM_Write(' ');
OPM_WriteString(Configuration_versionLong, 41);
OPM_WriteString(Configuration_versionLong, 75);
OPM_Write(' ');
i = 0;
while (i <= 31) {
@ -1966,84 +1910,84 @@ void OPC_Constant (OPT_Const con, int16 form)
}
}
static struct InitKeywords__48 {
static struct InitKeywords__46 {
int8 *n;
struct InitKeywords__48 *lnk;
} *InitKeywords__48_s;
struct InitKeywords__46 *lnk;
} *InitKeywords__46_s;
static void Enter__49 (CHAR *s, LONGINT s__len);
static void Enter__47 (CHAR *s, LONGINT s__len);
static void Enter__49 (CHAR *s, LONGINT s__len)
static void Enter__47 (CHAR *s, LONGINT s__len)
{
int16 h;
__DUP(s, s__len, CHAR);
h = OPC_PerfectHash((void*)s, s__len);
OPC_hashtab[__X(h, 105)] = *InitKeywords__48_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__48_s->n, 50)], 9);
*InitKeywords__48_s->n += 1;
OPC_hashtab[__X(h, 105)] = *InitKeywords__46_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__46_s->n, 50)], 9);
*InitKeywords__46_s->n += 1;
__DEL(s);
}
static void OPC_InitKeywords (void)
{
int8 n, i;
struct InitKeywords__48 _s;
struct InitKeywords__46 _s;
_s.n = &n;
_s.lnk = InitKeywords__48_s;
InitKeywords__48_s = &_s;
_s.lnk = InitKeywords__46_s;
InitKeywords__46_s = &_s;
n = 0;
i = 0;
while (i <= 104) {
OPC_hashtab[__X(i, 105)] = -1;
i += 1;
}
Enter__49((CHAR*)"address", 8);
Enter__49((CHAR*)"asm", 4);
Enter__49((CHAR*)"auto", 5);
Enter__49((CHAR*)"break", 6);
Enter__49((CHAR*)"case", 5);
Enter__49((CHAR*)"char", 5);
Enter__49((CHAR*)"const", 6);
Enter__49((CHAR*)"continue", 9);
Enter__49((CHAR*)"default", 8);
Enter__49((CHAR*)"do", 3);
Enter__49((CHAR*)"double", 7);
Enter__49((CHAR*)"else", 5);
Enter__49((CHAR*)"enum", 5);
Enter__49((CHAR*)"extern", 7);
Enter__49((CHAR*)"export", 7);
Enter__49((CHAR*)"float", 6);
Enter__49((CHAR*)"for", 4);
Enter__49((CHAR*)"fortran", 8);
Enter__49((CHAR*)"goto", 5);
Enter__49((CHAR*)"if", 3);
Enter__49((CHAR*)"import", 7);
Enter__49((CHAR*)"int", 4);
Enter__49((CHAR*)"int16", 6);
Enter__49((CHAR*)"int32", 6);
Enter__49((CHAR*)"int64", 6);
Enter__49((CHAR*)"int8", 5);
Enter__49((CHAR*)"long", 5);
Enter__49((CHAR*)"register", 9);
Enter__49((CHAR*)"return", 7);
Enter__49((CHAR*)"short", 6);
Enter__49((CHAR*)"signed", 7);
Enter__49((CHAR*)"sizeof", 7);
Enter__49((CHAR*)"size_t", 7);
Enter__49((CHAR*)"static", 7);
Enter__49((CHAR*)"struct", 7);
Enter__49((CHAR*)"switch", 7);
Enter__49((CHAR*)"typedef", 8);
Enter__49((CHAR*)"uint16", 7);
Enter__49((CHAR*)"uint32", 7);
Enter__49((CHAR*)"uint64", 7);
Enter__49((CHAR*)"uint8", 6);
Enter__49((CHAR*)"union", 6);
Enter__49((CHAR*)"unsigned", 9);
Enter__49((CHAR*)"void", 5);
Enter__49((CHAR*)"volatile", 9);
Enter__49((CHAR*)"while", 6);
InitKeywords__48_s = _s.lnk;
Enter__47((CHAR*)"address", 8);
Enter__47((CHAR*)"asm", 4);
Enter__47((CHAR*)"auto", 5);
Enter__47((CHAR*)"break", 6);
Enter__47((CHAR*)"case", 5);
Enter__47((CHAR*)"char", 5);
Enter__47((CHAR*)"const", 6);
Enter__47((CHAR*)"continue", 9);
Enter__47((CHAR*)"default", 8);
Enter__47((CHAR*)"do", 3);
Enter__47((CHAR*)"double", 7);
Enter__47((CHAR*)"else", 5);
Enter__47((CHAR*)"enum", 5);
Enter__47((CHAR*)"extern", 7);
Enter__47((CHAR*)"export", 7);
Enter__47((CHAR*)"float", 6);
Enter__47((CHAR*)"for", 4);
Enter__47((CHAR*)"fortran", 8);
Enter__47((CHAR*)"goto", 5);
Enter__47((CHAR*)"if", 3);
Enter__47((CHAR*)"import", 7);
Enter__47((CHAR*)"int", 4);
Enter__47((CHAR*)"int16", 6);
Enter__47((CHAR*)"int32", 6);
Enter__47((CHAR*)"int64", 6);
Enter__47((CHAR*)"int8", 5);
Enter__47((CHAR*)"long", 5);
Enter__47((CHAR*)"register", 9);
Enter__47((CHAR*)"return", 7);
Enter__47((CHAR*)"short", 6);
Enter__47((CHAR*)"signed", 7);
Enter__47((CHAR*)"sizeof", 7);
Enter__47((CHAR*)"size_t", 7);
Enter__47((CHAR*)"static", 7);
Enter__47((CHAR*)"struct", 7);
Enter__47((CHAR*)"switch", 7);
Enter__47((CHAR*)"typedef", 8);
Enter__47((CHAR*)"uint16", 7);
Enter__47((CHAR*)"uint32", 7);
Enter__47((CHAR*)"uint64", 7);
Enter__47((CHAR*)"uint8", 6);
Enter__47((CHAR*)"union", 6);
Enter__47((CHAR*)"unsigned", 9);
Enter__47((CHAR*)"void", 5);
Enter__47((CHAR*)"volatile", 9);
Enter__47((CHAR*)"while", 6);
InitKeywords__46_s = _s.lnk;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPC__h
#define OPC__h
@ -9,9 +9,7 @@
import void OPC_Align (int32 *adr, int32 base);
import void OPC_Andent (OPT_Struct typ);
import int32 OPC_BaseAlignment (OPT_Struct typ);
import OPT_Object OPC_BaseTProc (OPT_Object obj);
import void OPC_BegBlk (void);
import void OPC_BegStat (void);
@ -41,7 +39,6 @@ import void OPC_IntLiteral (int64 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude);
import int32 OPC_SizeAlignment (int32 size);
import void OPC_TDescDecl (OPT_Struct typ);
import void OPC_TypeDefs (OPT_Object obj, int16 vis);
import void OPC_TypeOf (OPT_Object ap);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -223,6 +223,7 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48;
OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48;
i += 2;
Files_SetSearchPath((CHAR*)"", 1);
}
break;
case 'B':
@ -270,7 +271,7 @@ BOOLEAN OPM_OpenPar (void)
if (Platform_ArgCount == 1) {
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20);
OPM_LogWStr(Configuration_versionLong, 41);
OPM_LogWStr(Configuration_versionLong, 75);
OPM_LogW('.');
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Based on Ofront by Software Templ OEG.", 39);
@ -1118,7 +1119,7 @@ export void *OPM__init(void)
Strings_Append((CHAR*)";.;", 4, (void*)OPM_OBERON, 1024);
Strings_Append(OPM_MODULES, 1024, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)";", 2, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"/opt/voc", 9, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"", 1, (void*)OPM_OBERON, 1024);
Strings_Append((CHAR*)"/sym;", 6, (void*)OPM_OBERON, 1024);
Files_SetSearchPath(OPM_OBERON, 1024);
OPM_AddressSize = 8;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPM__h
#define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define INTEGER int16
#define LONGINT int32

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define INTEGER int16
#define LONGINT int32
@ -87,7 +87,6 @@ typedef
} OPT_StrDesc;
export void (*OPT_typSize)(OPT_Struct);
export OPT_Object OPT_topScope;
export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
export OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj;
@ -100,6 +99,7 @@ static OPT_ImpCtxt OPT_impCtxt;
static OPT_ExpCtxt OPT_expCtxt;
static int32 OPT_nofhdfld;
static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew;
static int32 OPT_recno;
export address *OPT_ConstDesc__typ;
export address *OPT_ObjDesc__typ;
@ -108,6 +108,8 @@ export address *OPT_NodeDesc__typ;
export address *OPT_ImpCtxt__typ;
export address *OPT_ExpCtxt__typ;
export void OPT_Align (int32 *adr, int32 base);
export int32 OPT_BaseAlignment (OPT_Struct typ);
export void OPT_Close (void);
export void OPT_CloseScope (void);
static void OPT_DebugStruct (OPT_Struct btyp);
@ -136,6 +138,7 @@ static void OPT_InStruct (OPT_Struct *typ);
static OPT_Object OPT_InTProc (int8 mno);
static OPT_Struct OPT_InTyp (int32 tag);
export void OPT_Init (OPS_Name name, SET opt);
export void OPT_InitRecno (void);
static void OPT_InitStruct (OPT_Struct *typ, int8 form);
export void OPT_Insert (OPS_Name name, OPT_Object *obj);
export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old);
@ -157,9 +160,16 @@ 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);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
export int32 OPT_SizeAlignment (int32 size);
export void OPT_TypSize (OPT_Struct typ);
static void OPT_err (int16 n);
void OPT_InitRecno (void)
{
OPT_recno = 0;
}
static void OPT_err (int16 n)
{
OPM_err(n);
@ -240,6 +250,130 @@ OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
__RETCHK;
}
void OPT_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
*adr += __MASK(*adr, -2);
break;
case 4:
*adr += __MASK(-*adr, -4);
break;
case 8:
*adr += __MASK(-*adr, -8);
break;
case 16:
*adr += __MASK(-*adr, -16);
break;
default:
break;
}
}
int32 OPT_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
}
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
}
int32 OPT_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
} else {
alignment = OPT_BaseAlignment(typ->BaseTyp);
}
} else {
alignment = OPT_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
}
void OPT_TypSize (OPT_Struct typ)
{
int16 f, c;
int32 offset, size, base, fbase, off0;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
if (typ == OPT_undftyp) {
OPM_err(58);
} else if (typ->size == -1) {
f = typ->form;
c = typ->comp;
if (c == 4) {
btyp = typ->BaseTyp;
if (btyp == NIL) {
offset = 0;
base = 1;
} else {
OPT_TypSize(btyp);
offset = btyp->size - __ASHR(btyp->sysflag, 8);
base = btyp->align;
}
fld = typ->link;
while ((fld != NIL && fld->mode == 4)) {
btyp = fld->typ;
OPT_TypSize(btyp);
size = btyp->size;
fbase = OPT_BaseAlignment(btyp);
OPT_Align(&offset, fbase);
fld->adr = offset;
offset += size;
if (fbase > base) {
base = fbase;
}
fld = fld->link;
}
off0 = offset;
if (offset == 0) {
offset = 1;
}
OPT_Align(&offset, base);
if ((typ->strobj == NIL && __MASK(typ->align, -65536) == 0)) {
OPT_recno += 1;
base += __ASHL(OPT_recno, 16);
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8);
} else if (c == 2) {
OPT_TypSize(typ->BaseTyp);
typ->size = typ->n * typ->BaseTyp->size;
} else if (f == 11) {
typ->size = OPM_AddressSize;
if (typ->BaseTyp == OPT_undftyp) {
OPM_Mark(128, typ->n);
} else {
OPT_TypSize(typ->BaseTyp);
}
} else if (f == 12) {
typ->size = OPM_AddressSize;
} else if (c == 3) {
btyp = typ->BaseTyp;
OPT_TypSize(btyp);
if (btyp->comp == 3) {
typ->size = btyp->size + 4;
} else {
typ->size = 8;
}
}
}
}
OPT_Const OPT_NewConst (void)
{
OPT_Const _o_result;
@ -552,21 +686,21 @@ void OPT_IdFPrint (OPT_Struct typ)
}
}
static struct FPrintStr__13 {
static struct FPrintStr__15 {
int32 *pbfp, *pvfp;
struct FPrintStr__13 *lnk;
} *FPrintStr__13_s;
struct FPrintStr__15 *lnk;
} *FPrintStr__15_s;
static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__18 (OPT_Object obj);
static void FPrintFlds__16 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__18 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__20 (OPT_Object obj);
static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr)
static void FPrintHdFld__18 (OPT_Struct typ, OPT_Object fld, int32 adr)
{
int32 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
FPrintFlds__14(typ->link, adr, 0);
FPrintFlds__16(typ->link, adr, 0);
} else if (typ->comp == 2) {
btyp = typ->BaseTyp;
n = typ->n;
@ -576,53 +710,53 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr)
}
if (btyp->form == 11 || btyp->comp == 4) {
j = OPT_nofhdfld;
FPrintHdFld__16(btyp, fld, adr);
FPrintHdFld__18(btyp, fld, adr);
if (j != OPT_nofhdfld) {
i = 1;
while ((i < n && OPT_nofhdfld <= 2048)) {
adr += btyp->size;
FPrintHdFld__16(btyp, fld, adr);
FPrintHdFld__18(btyp, fld, adr);
i += 1;
}
}
}
} else if (typ->form == 11 || __STRCMP(fld->name, "@ptr") == 0) {
OPM_FPrint(&*FPrintStr__13_s->pvfp, 11);
OPM_FPrint(&*FPrintStr__13_s->pvfp, adr);
OPM_FPrint(&*FPrintStr__15_s->pvfp, 11);
OPM_FPrint(&*FPrintStr__15_s->pvfp, adr);
OPT_nofhdfld += 1;
}
}
static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible)
static void FPrintFlds__16 (OPT_Object fld, int32 adr, BOOLEAN visible)
{
while ((fld != NIL && fld->mode == 4)) {
if ((fld->vis != 0 && visible)) {
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->vis);
OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)fld->name, 256);
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->adr);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->vis);
OPT_FPrintName(&*FPrintStr__15_s->pbfp, (void*)fld->name, 256);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->adr);
OPT_FPrintStr(fld->typ);
OPM_FPrint(&*FPrintStr__13_s->pbfp, fld->typ->pbfp);
OPM_FPrint(&*FPrintStr__13_s->pvfp, fld->typ->pvfp);
OPM_FPrint(&*FPrintStr__15_s->pbfp, fld->typ->pbfp);
OPM_FPrint(&*FPrintStr__15_s->pvfp, fld->typ->pvfp);
} else {
FPrintHdFld__16(fld->typ, fld, fld->adr + adr);
FPrintHdFld__18(fld->typ, fld, fld->adr + adr);
}
fld = fld->link;
}
}
static void FPrintTProcs__18 (OPT_Object obj)
static void FPrintTProcs__20 (OPT_Object obj)
{
if (obj != NIL) {
FPrintTProcs__18(obj->left);
FPrintTProcs__20(obj->left);
if (obj->mode == 13) {
if (obj->vis != 0) {
OPM_FPrint(&*FPrintStr__13_s->pbfp, 13);
OPM_FPrint(&*FPrintStr__13_s->pbfp, __ASHR(obj->adr, 16));
OPT_FPrintSign(&*FPrintStr__13_s->pbfp, obj->typ, obj->link);
OPT_FPrintName(&*FPrintStr__13_s->pbfp, (void*)obj->name, 256);
OPM_FPrint(&*FPrintStr__15_s->pbfp, 13);
OPM_FPrint(&*FPrintStr__15_s->pbfp, __ASHR(obj->adr, 16));
OPT_FPrintSign(&*FPrintStr__15_s->pbfp, obj->typ, obj->link);
OPT_FPrintName(&*FPrintStr__15_s->pbfp, (void*)obj->name, 256);
}
}
FPrintTProcs__18(obj->right);
FPrintTProcs__20(obj->right);
}
}
@ -632,11 +766,11 @@ void OPT_FPrintStr (OPT_Struct typ)
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL, bstrobj = NIL;
int32 pbfp, pvfp;
struct FPrintStr__13 _s;
struct FPrintStr__15 _s;
_s.pbfp = &pbfp;
_s.pvfp = &pvfp;
_s.lnk = FPrintStr__13_s;
FPrintStr__13_s = &_s;
_s.lnk = FPrintStr__15_s;
FPrintStr__15_s = &_s;
if (!typ->fpdone) {
OPT_IdFPrint(typ);
pbfp = typ->idfp;
@ -673,11 +807,11 @@ void OPT_FPrintStr (OPT_Struct typ)
OPM_FPrint(&pvfp, typ->align);
OPM_FPrint(&pvfp, typ->n);
OPT_nofhdfld = 0;
FPrintFlds__14(typ->link, 0, 1);
FPrintFlds__16(typ->link, 0, 1);
if (OPT_nofhdfld > 2048) {
OPM_Mark(225, typ->txtpos);
}
FPrintTProcs__18(typ->link);
FPrintTProcs__20(typ->link);
OPM_FPrint(&pvfp, pbfp);
strobj = typ->strobj;
if (strobj == NIL || strobj->name[0] == 0x00) {
@ -687,7 +821,7 @@ void OPT_FPrintStr (OPT_Struct typ)
typ->pbfp = pbfp;
typ->pvfp = pvfp;
}
FPrintStr__13_s = _s.lnk;
FPrintStr__15_s = _s.lnk;
}
void OPT_FPrintObj (OPT_Object obj)
@ -1119,7 +1253,7 @@ static void OPT_InStruct (OPT_Struct *typ)
(*typ)->comp = 2;
OPT_InStruct(&(*typ)->BaseTyp);
(*typ)->n = OPM_SymRInt();
(*OPT_typSize)(*typ);
OPT_TypSize(*typ);
break;
case 38:
(*typ)->form = 13;
@ -1130,7 +1264,7 @@ static void OPT_InStruct (OPT_Struct *typ)
} else {
(*typ)->n = 0;
}
(*OPT_typSize)(*typ);
OPT_TypSize(*typ);
break;
case 39:
(*typ)->form = 13;
@ -1899,6 +2033,7 @@ export void *OPT__init(void)
__REGMOD("OPT", EnumPtrs);
__REGCMD("Close", OPT_Close);
__REGCMD("CloseScope", OPT_CloseScope);
__REGCMD("InitRecno", OPT_InitRecno);
__INITYP(OPT_ConstDesc, OPT_ConstDesc, 0);
__INITYP(OPT_ObjDesc, OPT_ObjDesc, 0);
__INITYP(OPT_StrDesc, OPT_StrDesc, 0);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */
/* voc 1.95 [2016/09/23]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPT__h
#define OPT__h
@ -66,7 +66,6 @@ typedef
} OPT_StrDesc;
import void (*OPT_typSize)(OPT_Struct);
import OPT_Object OPT_topScope;
import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_hinttyp, OPT_adrtyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
import OPT_Object OPT_sintobj, OPT_intobj, OPT_lintobj;
@ -80,6 +79,8 @@ import address *OPT_ObjDesc__typ;
import address *OPT_StrDesc__typ;
import address *OPT_NodeDesc__typ;
import void OPT_Align (int32 *adr, int32 base);
import int32 OPT_BaseAlignment (OPT_Struct typ);
import void OPT_Close (void);
import void OPT_CloseScope (void);
import void OPT_Export (BOOLEAN *ext, BOOLEAN *new);
@ -92,6 +93,7 @@ import void OPT_FindImport (OPT_Object mod, OPT_Object *res);
import void OPT_IdFPrint (OPT_Struct typ);
import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done);
import void OPT_Init (OPS_Name name, SET opt);
import void OPT_InitRecno (void);
import void OPT_Insert (OPS_Name name, OPT_Object *obj);
import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old);
import int16 OPT_IntSize (int64 n);
@ -103,6 +105,8 @@ import OPT_Object OPT_NewObj (void);
import OPT_Struct OPT_NewStr (int8 form, int8 comp);
import void OPT_OpenScope (int8 level, OPT_Object owner);
import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
import int32 OPT_SizeAlignment (int32 size);
import void OPT_TypSize (OPT_Struct typ);
import void *OPT__init(void);

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