(Largely untested) Oakwood Math.Mod, some SETxx fixes.

This commit is contained in:
David Brown 2016-10-03 20:05:22 +01:00
parent fcb51a6c23
commit 80c9d36a7a
200 changed files with 780 additions and 987 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD; __DEFMOD;
__REGMOD("Configuration", 0); __REGMOD("Configuration", 0);
/* BEGIN */ /* BEGIN */
__MOVE("1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __MOVE("1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD; __ENDMOD;
} }

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Configuration__h #ifndef Configuration__h
#define Configuration__h #define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef Files__h #ifndef Files__h
#define Files__h #define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Heap__h #ifndef Heap__h
#define Heap__h #define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Modules__h #ifndef Modules__h
#define Modules__h #define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -1273,6 +1273,8 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
case 7: case 7:
if ((g == 7 && y->typ->size < z->typ->size)) { if ((g == 7 && y->typ->size < z->typ->size)) {
OPB_Convert(&y, z->typ); OPB_Convert(&y, z->typ);
} else if (g == 7) {
OPB_Convert(&z, y->typ);
} else { } else {
OPB_err(100); OPB_err(100);
} }

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPB__h #ifndef OPB__h
#define OPB__h #define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPC__h #ifndef OPC__h
#define OPC__h #define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPM__h #ifndef OPM__h
#define OPM__h #define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPP__h #ifndef OPP__h
#define OPP__h #define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef OPS__h #ifndef OPS__h
#define OPS__h #define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPT__h #ifndef OPT__h
#define OPT__h #define OPT__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -41,7 +41,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (int64 n, int32 size); static void OPV_ParIntLiteral (int64 n, int32 size);
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n); static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (int32 from, int32 to); static void OPV_SizeCast (OPT_Node n, int32 to);
static void OPV_Stamp (OPS_Name s); static void OPV_Stamp (OPS_Name s);
static OPT_Object OPV_SuperProc (OPT_Node n); static OPT_Object OPV_SuperProc (OPT_Node n);
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported); static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported);
@ -380,12 +380,24 @@ static void OPV_Entier (OPT_Node n, int16 prec)
} }
} }
static void OPV_SizeCast (int32 from, int32 to) static void OPV_SizeCast (OPT_Node n, int32 to)
{ {
if ((from != to && (from > 4 || to != 4))) { if ((to < n->typ->size && __IN(2, OPM_Options, 32))) {
OPM_WriteString((CHAR*)"(int", 5); OPM_WriteString((CHAR*)"__SHORT", 8);
OPM_WriteInt(__ASHL(to, 3)); if (OPV_SideEffects(n)) {
OPM_WriteString((CHAR*)")", 2); OPM_Write('F');
}
OPM_Write('(');
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPM_SignedMaximum(to) + 1);
OPM_Write(')');
} else {
if ((n->typ->size != to && (n->typ->size > 4 || to != 4))) {
OPM_WriteString((CHAR*)"(int", 5);
OPM_WriteInt(__ASHL(to, 3));
OPM_WriteString((CHAR*)")", 2);
}
} }
} }
@ -395,26 +407,19 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
from = n->typ->form; from = n->typ->form;
to = newtype->form; to = newtype->form;
if (to == 7) { if (to == 7) {
OPM_WriteString((CHAR*)"__SETOF(", 9); if (from == 7) {
OPV_Entier(n, -1); OPV_SizeCast(n, newtype->size);
OPM_WriteString((CHAR*)",", 2);
OPM_WriteInt(__ASHL(newtype->size, 3));
OPM_Write(')');
} else if (to == 4) {
if ((newtype->size < n->typ->size && __IN(2, OPM_Options, 32))) {
OPM_WriteString((CHAR*)"__SHORT", 8);
if (OPV_SideEffects(n)) {
OPM_Write('F');
}
OPM_Write('(');
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPM_SignedMaximum(newtype->size) + 1);
OPM_Write(')');
} else {
OPV_SizeCast(n->typ->size, newtype->size);
OPV_Entier(n, 9); OPV_Entier(n, 9);
} else {
OPM_WriteString((CHAR*)"__SETOF(", 9);
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)",", 2);
OPM_WriteInt(__ASHL(newtype->size, 3));
OPM_Write(')');
} }
} else if (to == 4) {
OPV_SizeCast(n, newtype->size);
OPV_Entier(n, 9);
} else if (to == 3) { } else if (to == 3) {
if (__IN(2, OPM_Options, 32)) { if (__IN(2, OPM_Options, 32)) {
OPM_WriteString((CHAR*)"__CHR", 6); OPM_WriteString((CHAR*)"__CHR", 6);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPV__h #ifndef OPV__h
#define OPV__h #define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Out__h #ifndef Out__h
#define Out__h #define Out__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Platform__h #ifndef Platform__h
#define Platform__h #define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Reals__h #ifndef Reals__h
#define Reals__h #define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Strings__h #ifndef Strings__h
#define Strings__h #define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Texts__h #ifndef Texts__h
#define Texts__h #define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef errors__h #ifndef errors__h
#define errors__h #define errors__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef extTools__h #ifndef extTools__h
#define extTools__h #define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef vt100__h #ifndef vt100__h
#define vt100__h #define vt100__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD; __DEFMOD;
__REGMOD("Configuration", 0); __REGMOD("Configuration", 0);
/* BEGIN */ /* BEGIN */
__MOVE("1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __MOVE("1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD; __ENDMOD;
} }

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Configuration__h #ifndef Configuration__h
#define Configuration__h #define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef Files__h #ifndef Files__h
#define Files__h #define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Heap__h #ifndef Heap__h
#define Heap__h #define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Modules__h #ifndef Modules__h
#define Modules__h #define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -1273,6 +1273,8 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
case 7: case 7:
if ((g == 7 && y->typ->size < z->typ->size)) { if ((g == 7 && y->typ->size < z->typ->size)) {
OPB_Convert(&y, z->typ); OPB_Convert(&y, z->typ);
} else if (g == 7) {
OPB_Convert(&z, y->typ);
} else { } else {
OPB_err(100); OPB_err(100);
} }

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPB__h #ifndef OPB__h
#define OPB__h #define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPC__h #ifndef OPC__h
#define OPC__h #define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPM__h #ifndef OPM__h
#define OPM__h #define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPP__h #ifndef OPP__h
#define OPP__h #define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef OPS__h #ifndef OPS__h
#define OPS__h #define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPT__h #ifndef OPT__h
#define OPT__h #define OPT__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -41,7 +41,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (int64 n, int32 size); static void OPV_ParIntLiteral (int64 n, int32 size);
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n); static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (int32 from, int32 to); static void OPV_SizeCast (OPT_Node n, int32 to);
static void OPV_Stamp (OPS_Name s); static void OPV_Stamp (OPS_Name s);
static OPT_Object OPV_SuperProc (OPT_Node n); static OPT_Object OPV_SuperProc (OPT_Node n);
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported); static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported);
@ -380,12 +380,24 @@ static void OPV_Entier (OPT_Node n, int16 prec)
} }
} }
static void OPV_SizeCast (int32 from, int32 to) static void OPV_SizeCast (OPT_Node n, int32 to)
{ {
if ((from != to && (from > 4 || to != 4))) { if ((to < n->typ->size && __IN(2, OPM_Options, 32))) {
OPM_WriteString((CHAR*)"(int", 5); OPM_WriteString((CHAR*)"__SHORT", 8);
OPM_WriteInt(__ASHL(to, 3)); if (OPV_SideEffects(n)) {
OPM_WriteString((CHAR*)")", 2); OPM_Write('F');
}
OPM_Write('(');
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPM_SignedMaximum(to) + 1);
OPM_Write(')');
} else {
if ((n->typ->size != to && (n->typ->size > 4 || to != 4))) {
OPM_WriteString((CHAR*)"(int", 5);
OPM_WriteInt(__ASHL(to, 3));
OPM_WriteString((CHAR*)")", 2);
}
} }
} }
@ -395,26 +407,19 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
from = n->typ->form; from = n->typ->form;
to = newtype->form; to = newtype->form;
if (to == 7) { if (to == 7) {
OPM_WriteString((CHAR*)"__SETOF(", 9); if (from == 7) {
OPV_Entier(n, -1); OPV_SizeCast(n, newtype->size);
OPM_WriteString((CHAR*)",", 2);
OPM_WriteInt(__ASHL(newtype->size, 3));
OPM_Write(')');
} else if (to == 4) {
if ((newtype->size < n->typ->size && __IN(2, OPM_Options, 32))) {
OPM_WriteString((CHAR*)"__SHORT", 8);
if (OPV_SideEffects(n)) {
OPM_Write('F');
}
OPM_Write('(');
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPM_SignedMaximum(newtype->size) + 1);
OPM_Write(')');
} else {
OPV_SizeCast(n->typ->size, newtype->size);
OPV_Entier(n, 9); OPV_Entier(n, 9);
} else {
OPM_WriteString((CHAR*)"__SETOF(", 9);
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)",", 2);
OPM_WriteInt(__ASHL(newtype->size, 3));
OPM_Write(')');
} }
} else if (to == 4) {
OPV_SizeCast(n, newtype->size);
OPV_Entier(n, 9);
} else if (to == 3) { } else if (to == 3) {
if (__IN(2, OPM_Options, 32)) { if (__IN(2, OPM_Options, 32)) {
OPM_WriteString((CHAR*)"__CHR", 6); OPM_WriteString((CHAR*)"__CHR", 6);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPV__h #ifndef OPV__h
#define OPV__h #define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Out__h #ifndef Out__h
#define Out__h #define Out__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Platform__h #ifndef Platform__h
#define Platform__h #define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Reals__h #ifndef Reals__h
#define Reals__h #define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Strings__h #ifndef Strings__h
#define Strings__h #define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Texts__h #ifndef Texts__h
#define Texts__h #define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef errors__h #ifndef errors__h
#define errors__h #define errors__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef extTools__h #ifndef extTools__h
#define extTools__h #define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef vt100__h #ifndef vt100__h
#define vt100__h #define vt100__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -19,6 +19,6 @@ export void *Configuration__init(void)
__DEFMOD; __DEFMOD;
__REGMOD("Configuration", 0); __REGMOD("Configuration", 0);
/* BEGIN */ /* BEGIN */
__MOVE("1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __MOVE("1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75);
__ENDMOD; __ENDMOD;
} }

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Configuration__h #ifndef Configuration__h
#define Configuration__h #define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef Files__h #ifndef Files__h
#define Files__h #define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
#ifndef Heap__h #ifndef Heap__h
#define Heap__h #define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef Modules__h #ifndef Modules__h
#define Modules__h #define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -1273,6 +1273,8 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
case 7: case 7:
if ((g == 7 && y->typ->size < z->typ->size)) { if ((g == 7 && y->typ->size < z->typ->size)) {
OPB_Convert(&y, z->typ); OPB_Convert(&y, z->typ);
} else if (g == 7) {
OPB_Convert(&z, y->typ);
} else { } else {
OPB_err(100); OPB_err(100);
} }

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPB__h #ifndef OPB__h
#define OPB__h #define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPC__h #ifndef OPC__h
#define OPC__h #define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPM__h #ifndef OPM__h
#define OPM__h #define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPP__h #ifndef OPP__h
#define OPP__h #define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
#ifndef OPS__h #ifndef OPS__h
#define OPS__h #define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#ifndef OPT__h #ifndef OPT__h
#define OPT__h #define OPT__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/10/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */ /* voc 1.95 [2016/10/03]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
#define SHORTINT int8 #define SHORTINT int8
#define INTEGER int16 #define INTEGER int16
@ -41,7 +41,7 @@ static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (int64 n, int32 size); static void OPV_ParIntLiteral (int64 n, int32 size);
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n); static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (int32 from, int32 to); static void OPV_SizeCast (OPT_Node n, int32 to);
static void OPV_Stamp (OPS_Name s); static void OPV_Stamp (OPS_Name s);
static OPT_Object OPV_SuperProc (OPT_Node n); static OPT_Object OPV_SuperProc (OPT_Node n);
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported); static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported);
@ -380,12 +380,24 @@ static void OPV_Entier (OPT_Node n, int16 prec)
} }
} }
static void OPV_SizeCast (int32 from, int32 to) static void OPV_SizeCast (OPT_Node n, int32 to)
{ {
if ((from != to && (from > 4 || to != 4))) { if ((to < n->typ->size && __IN(2, OPM_Options, 32))) {
OPM_WriteString((CHAR*)"(int", 5); OPM_WriteString((CHAR*)"__SHORT", 8);
OPM_WriteInt(__ASHL(to, 3)); if (OPV_SideEffects(n)) {
OPM_WriteString((CHAR*)")", 2); OPM_Write('F');
}
OPM_Write('(');
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPM_SignedMaximum(to) + 1);
OPM_Write(')');
} else {
if ((n->typ->size != to && (n->typ->size > 4 || to != 4))) {
OPM_WriteString((CHAR*)"(int", 5);
OPM_WriteInt(__ASHL(to, 3));
OPM_WriteString((CHAR*)")", 2);
}
} }
} }
@ -395,26 +407,19 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
from = n->typ->form; from = n->typ->form;
to = newtype->form; to = newtype->form;
if (to == 7) { if (to == 7) {
OPM_WriteString((CHAR*)"__SETOF(", 9); if (from == 7) {
OPV_Entier(n, -1); OPV_SizeCast(n, newtype->size);
OPM_WriteString((CHAR*)",", 2);
OPM_WriteInt(__ASHL(newtype->size, 3));
OPM_Write(')');
} else if (to == 4) {
if ((newtype->size < n->typ->size && __IN(2, OPM_Options, 32))) {
OPM_WriteString((CHAR*)"__SHORT", 8);
if (OPV_SideEffects(n)) {
OPM_Write('F');
}
OPM_Write('(');
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)", ", 3);
OPM_WriteInt(OPM_SignedMaximum(newtype->size) + 1);
OPM_Write(')');
} else {
OPV_SizeCast(n->typ->size, newtype->size);
OPV_Entier(n, 9); OPV_Entier(n, 9);
} else {
OPM_WriteString((CHAR*)"__SETOF(", 9);
OPV_Entier(n, -1);
OPM_WriteString((CHAR*)",", 2);
OPM_WriteInt(__ASHL(newtype->size, 3));
OPM_Write(')');
} }
} else if (to == 4) {
OPV_SizeCast(n, newtype->size);
OPV_Entier(n, 9);
} else if (to == 3) { } else if (to == 3) {
if (__IN(2, OPM_Options, 32)) { if (__IN(2, OPM_Options, 32)) {
OPM_WriteString((CHAR*)"__CHR", 6); OPM_WriteString((CHAR*)"__CHR", 6);

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