Add IsConsole tests to compiler.mod, update bootstrap.

This commit is contained in:
David Brown 2016-11-15 18:03:57 +00:00
parent 6da0d5d685
commit c12aae020d
187 changed files with 348 additions and 342 deletions

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspamSf */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */
#define SHORTINT INT8
#define INTEGER INT16
@ -46,22 +46,14 @@ void Compiler_Module (BOOLEAN *done)
if (OPM_noerr) {
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
OPM_DeleteNewSym();
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogVT100((CHAR*)"32m", 4);
OPM_LogWStr((CHAR*)" Main program.", 16);
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_LogVT100((CHAR*)"0m", 3);
} else {
if (new) {
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogVT100((CHAR*)"32m", 4);
OPM_LogWStr((CHAR*)" New symbol file.", 19);
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_LogVT100((CHAR*)"0m", 3);
OPM_RegisterNewSym();
} else if (ext) {
OPM_LogWStr((CHAR*)" Extended symbol file.", 24);

View file

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

View file

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

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

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

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. tsSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. tsSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -59,6 +59,7 @@ export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n);
static void OPM_LogErrMsg (INT16 n);
export void OPM_LogVT100 (CHAR *vt100code, LONGINT vt100code__len);
export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void);
export void OPM_LogWNum (INT64 i, INT64 len);
@ -121,6 +122,15 @@ void OPM_LogWLn (void)
Out_Ln();
}
void OPM_LogVT100 (CHAR *vt100code, LONGINT vt100code__len)
{
__DUP(vt100code, vt100code__len, CHAR);
if ((Out_IsConsole && !__IN(16, OPM_Options, 32))) {
VT100_SetAttr(vt100code, vt100code__len);
}
__DEL(vt100code);
}
INT64 OPM_SignedMaximum (INT32 bytecount)
{
INT64 result;
@ -540,22 +550,14 @@ static void OPM_LogErrMsg (INT16 n)
Texts_Scanner S;
CHAR c;
if (n >= 0) {
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"31m", 4);
}
OPM_LogVT100((CHAR*)"31m", 4);
OPM_LogWStr((CHAR*)" err ", 7);
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_LogVT100((CHAR*)"0m", 3);
} else {
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"35m", 4);
}
OPM_LogVT100((CHAR*)"35m", 4);
OPM_LogWStr((CHAR*)" warning ", 11);
n = -n;
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_LogVT100((CHAR*)"0m", 3);
}
OPM_LogWNum(n, 1);
OPM_LogWStr((CHAR*)" ", 3);
@ -641,13 +643,9 @@ static void OPM_ShowLine (INT64 pos)
OPM_LogW(' ');
i -= 1;
}
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogVT100((CHAR*)"32m", 4);
OPM_LogW('^');
if (!__IN(16, OPM_Options, 32)) {
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_LogVT100((CHAR*)"0m", 3);
Files_Close(f);
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef OPM__h
#define OPM__h
@ -31,6 +31,7 @@ import void OPM_Get (CHAR *ch);
import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n);
import void OPM_LogVT100 (CHAR *vt100code, LONGINT vt100code__len);
import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void);
import void OPM_LogWNum (INT64 i, INT64 len);

View file

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

View file

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

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. tspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
#define SHORTINT INT8
#define INTEGER INT16

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -9,6 +9,7 @@
#include "Platform.h"
export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128];
static INT16 Out_in;
@ -311,6 +312,7 @@ export void *Out__init(void)
__REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open);
/* BEGIN */
Out_IsConsole = Platform_IsConsole(Platform_StdOut);
Out_in = 0;
__ENDMOD;
}

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Out__h
#define Out__h
@ -6,6 +6,7 @@
#include "SYSTEM.h"
import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch);

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#define SHORTINT INT8
#define INTEGER INT16
@ -67,6 +67,7 @@ export INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
export BOOLEAN Platform_Inaccessible (INT16 e);
export void Platform_Init (INT32 argc, INT64 argvadr);
export BOOLEAN Platform_Interrupted (INT16 e);
export BOOLEAN Platform_IsConsole (INT64 h);
export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
export INT16 Platform_New (CHAR *n, LONGINT n__len, INT64 *h);
export BOOLEAN Platform_NoSuchDirectory (INT16 e);
@ -622,6 +623,12 @@ static void Platform_EnableVT100 (void)
}
}
BOOLEAN Platform_IsConsole (INT64 h)
{
INT32 mode;
return Platform_GetConsoleMode(Platform_StdOut, &mode);
}
static void Platform_TestLittleEndian (void)
{
INT16 i;

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef Platform__h
#define Platform__h
@ -47,6 +47,7 @@ import INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
import BOOLEAN Platform_Inaccessible (INT16 e);
import void Platform_Init (INT32 argc, INT64 argvadr);
import BOOLEAN Platform_Interrupted (INT16 e);
import BOOLEAN Platform_IsConsole (INT64 h);
import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
import INT16 Platform_New (CHAR *n, LONGINT n__len, INT64 *h);
import BOOLEAN Platform_NoSuchDirectory (INT16 e);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSfF */
/* voc 1.95 [2016/11/15]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */
#ifndef VT100__h
#define VT100__h

View file

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

View file

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