Prepare for typ.size aware version of OPV.Convert

This commit is contained in:
David Brown 2016-08-21 14:26:12 +01:00
parent c1228e4ae0
commit 731f2215aa
198 changed files with 368 additions and 334 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
@ -13,6 +13,6 @@ export void *Configuration__init(void)
__DEFMOD;
__REGMOD("Configuration", 0);
/* BEGIN */
__MOVE("1.95 [2016/08/20] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__MOVE("1.95 [2016/08/21] for gcc LP64 on cygwin", Configuration_versionLong, 41);
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Configuration__h
#define Configuration__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Platform.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Console__h
#define Console__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin tspkaSfF */
#include "SYSTEM.h"
#include "Configuration.h"
#include "Console.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin tspkaSfF */
#ifndef Files__h
#define Files__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin tskSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin tskSfF */
#include "SYSTEM.h"
struct Heap__1 {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin tskSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin tskSfF */
#ifndef Heap__h
#define Heap__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Console.h"
#include "Heap.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Modules__h
#define Modules__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "OPM.h"
#include "OPS.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPB__h
#define OPB__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Configuration.h"
#include "OPM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPC__h
#define OPC__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Configuration.h"
#include "Console.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPM__h
#define OPM__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "OPB.h"
#include "OPM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPP__h
#define OPP__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin tspkaSfF */
#include "SYSTEM.h"
#include "OPM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin tspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin tspkaSfF */
#ifndef OPS__h
#define OPS__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "OPM.h"
#include "OPS.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPT__h
#define OPT__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "OPC.h"
#include "OPM.h"
@ -23,7 +23,7 @@ export LONGINT *OPV_ExitInfo__typ;
static void OPV_ActualPar (OPT_Node n, OPT_Object fp);
export void OPV_AdrAndSize (OPT_Object topScope);
static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc);
static void OPV_Convert (OPT_Node n, INTEGER form, INTEGER prec);
static void OPV_Convert (OPT_Node n, OPT_Struct typ, INTEGER prec);
static void OPV_DefineTDescs (OPT_Node n);
static void OPV_Entier (OPT_Node n, INTEGER prec);
static void OPV_GetTProcNum (OPT_Object obj);
@ -38,6 +38,7 @@ static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max);
static void OPV_NewArr (OPT_Node d, OPT_Node x);
static INTEGER OPV_Precedence (INTEGER class, INTEGER subclass, INTEGER form, INTEGER comp);
static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (LONGINT size);
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);
@ -465,20 +466,32 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
}
}
static void OPV_Convert (OPT_Node n, INTEGER form, INTEGER prec)
static void OPV_SizeCast (LONGINT size)
{
INTEGER from;
if (size <= (LONGINT)OPM_SIntSize) {
OPM_WriteString((CHAR*)"(SHORTINT)", (LONGINT)11);
} else if (size <= (LONGINT)OPM_IntSize) {
OPM_WriteString((CHAR*)"(INTEGER)", (LONGINT)10);
} else {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10);
}
}
static void OPV_Convert (OPT_Node n, OPT_Struct typ, INTEGER prec)
{
INTEGER from, to;
from = n->typ->form;
if (form == 9) {
to = typ->form;
if (to == 9) {
OPM_WriteString((CHAR*)"__SETOF(", (LONGINT)9);
OPV_Entier(n, -1);
OPM_Write(')');
} else if (form == 6) {
} else if (to == 6) {
if (from < 6) {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10);
}
OPV_Entier(n, 9);
} else if (form == 5) {
} else if (to == 5) {
if (from < 5) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
OPV_expr(n, 9);
@ -498,7 +511,7 @@ static void OPV_Convert (OPT_Node n, INTEGER form, INTEGER prec)
OPV_Entier(n, 9);
}
}
} else if (form == 4) {
} else if (to == 4) {
if (__IN(2, OPM_opt)) {
OPM_WriteString((CHAR*)"__SHORT", (LONGINT)8);
if (OPV_SideEffects(n)) {
@ -513,7 +526,7 @@ static void OPV_Convert (OPT_Node n, INTEGER form, INTEGER prec)
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
OPV_Entier(n, 9);
}
} else if (form == 3) {
} else if (to == 3) {
if (__IN(2, OPM_opt)) {
OPM_WriteString((CHAR*)"__CHR", (LONGINT)6);
if (OPV_SideEffects(n)) {
@ -576,7 +589,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
OPT_Struct typ = NIL;
INTEGER class, designPrec, comp;
OPT_Node d = NIL, x = NIL;
INTEGER dims, i, _for__26;
INTEGER dims, i, _for__27;
comp = n->typ->comp;
obj = n->obj;
class = n->class;
@ -652,9 +665,9 @@ static void OPV_design (OPT_Node n, INTEGER prec)
}
x = x->left;
}
_for__26 = dims;
_for__27 = dims;
i = 1;
while (i <= _for__26) {
while (i <= _for__27) {
OPM_Write(')');
i += 1;
}
@ -914,7 +927,7 @@ static void OPV_expr (OPT_Node n, INTEGER prec)
OPM_Write(')');
break;
case 20:
OPV_Convert(l, form, exprPrec);
OPV_Convert(l, n->typ, exprPrec);
break;
case 21:
if (OPV_SideEffects(l)) {

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef OPV__h
#define OPV__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
typedef

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Platform__h
#define Platform__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Reals__h
#define Reals__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Strings__h
#define Strings__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Files.h"
#include "Modules.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef Texts__h
#define Texts__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkamSf */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkamSf */
#include "SYSTEM.h"
#include "Configuration.h"
#include "Heap.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
typedef

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef errors__h
#define errors__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Configuration.h"
#include "Console.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef extTools__h
#define extTools__h

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#include "SYSTEM.h"
#include "Console.h"
#include "Strings.h"

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/08/20] for gcc LP64 on cygwin xtspkaSfF */
/* voc 1.95 [2016/08/21] for gcc LP64 on cygwin xtspkaSfF */
#ifndef vt100__h
#define vt100__h