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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -46,22 +46,14 @@ void Compiler_Module (BOOLEAN *done)
if (OPM_noerr) { if (OPM_noerr) {
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
OPM_DeleteNewSym(); OPM_DeleteNewSym();
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogWStr((CHAR*)" Main program.", 16);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} else { } else {
if (new) { if (new) {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogWStr((CHAR*)" New symbol file.", 19); OPM_LogWStr((CHAR*)" New symbol file.", 19);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_RegisterNewSym(); OPM_RegisterNewSym();
} else if (ext) { } else if (ext) {
OPM_LogWStr((CHAR*)" Extended symbol file.", 24); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Configuration__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Files__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Heap__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Modules__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPB__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPC__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -59,6 +59,7 @@ export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n); export INT16 OPM_Integer (INT64 n);
static void OPM_LogErrMsg (INT16 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_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (INT64 i, INT64 len); export void OPM_LogWNum (INT64 i, INT64 len);
@ -121,6 +122,15 @@ void OPM_LogWLn (void)
Out_Ln(); 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 OPM_SignedMaximum (INT32 bytecount)
{ {
INT64 result; INT64 result;
@ -540,22 +550,14 @@ static void OPM_LogErrMsg (INT16 n)
Texts_Scanner S; Texts_Scanner S;
CHAR c; CHAR c;
if (n >= 0) { if (n >= 0) {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"31m", 4);
VT100_SetAttr((CHAR*)"31m", 4);
}
OPM_LogWStr((CHAR*)" err ", 7); OPM_LogWStr((CHAR*)" err ", 7);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} else { } else {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"35m", 4);
VT100_SetAttr((CHAR*)"35m", 4);
}
OPM_LogWStr((CHAR*)" warning ", 11); OPM_LogWStr((CHAR*)" warning ", 11);
n = -n; n = -n;
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} }
OPM_LogWNum(n, 1); OPM_LogWNum(n, 1);
OPM_LogWStr((CHAR*)" ", 3); OPM_LogWStr((CHAR*)" ", 3);
@ -641,13 +643,9 @@ static void OPM_ShowLine (INT64 pos)
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
} }
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogW('^'); OPM_LogW('^');
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
Files_Close(f); 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 #ifndef OPM__h
#define 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_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n); import INT16 OPM_Integer (INT64 n);
import void OPM_LogVT100 (CHAR *vt100code, LONGINT vt100code__len);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (INT64 i, INT64 len); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPP__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPS__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPT__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPV__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -9,6 +9,7 @@
#include "Platform.h" #include "Platform.h"
export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128]; static CHAR Out_buf[128];
static INT16 Out_in; static INT16 Out_in;
@ -311,6 +312,7 @@ export void *Out__init(void)
__REGCMD("Ln", Out_Ln); __REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open); __REGCMD("Open", Out_Open);
/* BEGIN */ /* BEGIN */
Out_IsConsole = Platform_IsConsole(1);
Out_in = 0; Out_in = 0;
__ENDMOD; __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 #ifndef Out__h
#define Out__h #define Out__h
@ -6,6 +6,7 @@
#include "SYSTEM.h" #include "SYSTEM.h"
import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch); 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -63,6 +63,7 @@ export INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
export BOOLEAN Platform_Inaccessible (INT16 e); export BOOLEAN Platform_Inaccessible (INT16 e);
export void Platform_Init (INT32 argc, INT32 argvadr); export void Platform_Init (INT32 argc, INT32 argvadr);
export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_Interrupted (INT16 e);
export BOOLEAN Platform_IsConsole (INT32 h);
export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
export INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h); export INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h);
export BOOLEAN Platform_NoSuchDirectory (INT16 e); export BOOLEAN Platform_NoSuchDirectory (INT16 e);
@ -131,6 +132,7 @@ extern void Heap_InitHeap();
#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var) #define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var)
#define Platform_getpid() (INTEGER)getpid() #define Platform_getpid() (INTEGER)getpid()
#define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0) #define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0)
#define Platform_isatty(fd) isatty(fd)
#define Platform_lseek(fd, o, w) lseek(fd, o, w) #define Platform_lseek(fd, o, w) lseek(fd, o, w)
#define Platform_nanosleep(s, ns) struct timespec req, rem; req.tv_sec = s; req.tv_nsec = ns; nanosleep(&req, &rem) #define Platform_nanosleep(s, ns) struct timespec req, rem; req.tv_sec = s; req.tv_nsec = ns; nanosleep(&req, &rem)
#define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664) #define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664)
@ -404,6 +406,11 @@ INT16 Platform_Close (INT32 h)
__RETCHK; __RETCHK;
} }
BOOLEAN Platform_IsConsole (INT32 h)
{
return Platform_isatty(h) != 0;
}
INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ) INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ)
{ {
Platform_structstats(); Platform_structstats();

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 #ifndef Platform__h
#define Platform__h #define Platform__h
@ -45,6 +45,7 @@ import INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
import BOOLEAN Platform_Inaccessible (INT16 e); import BOOLEAN Platform_Inaccessible (INT16 e);
import void Platform_Init (INT32 argc, INT32 argvadr); import void Platform_Init (INT32 argc, INT32 argvadr);
import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_Interrupted (INT16 e);
import BOOLEAN Platform_IsConsole (INT32 h);
import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
import INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h); import INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h);
import BOOLEAN Platform_NoSuchDirectory (INT16 e); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Reals__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Strings__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Texts__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef VT100__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef extTools__h
#define extTools__h #define extTools__h

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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -46,22 +46,14 @@ void Compiler_Module (BOOLEAN *done)
if (OPM_noerr) { if (OPM_noerr) {
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
OPM_DeleteNewSym(); OPM_DeleteNewSym();
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogWStr((CHAR*)" Main program.", 16);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} else { } else {
if (new) { if (new) {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogWStr((CHAR*)" New symbol file.", 19); OPM_LogWStr((CHAR*)" New symbol file.", 19);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_RegisterNewSym(); OPM_RegisterNewSym();
} else if (ext) { } else if (ext) {
OPM_LogWStr((CHAR*)" Extended symbol file.", 24); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Configuration__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Files__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Heap__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Modules__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPB__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPC__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -59,6 +59,7 @@ export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n); export INT16 OPM_Integer (INT64 n);
static void OPM_LogErrMsg (INT16 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_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (INT64 i, INT64 len); export void OPM_LogWNum (INT64 i, INT64 len);
@ -121,6 +122,15 @@ void OPM_LogWLn (void)
Out_Ln(); 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 OPM_SignedMaximum (INT32 bytecount)
{ {
INT64 result; INT64 result;
@ -540,22 +550,14 @@ static void OPM_LogErrMsg (INT16 n)
Texts_Scanner S; Texts_Scanner S;
CHAR c; CHAR c;
if (n >= 0) { if (n >= 0) {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"31m", 4);
VT100_SetAttr((CHAR*)"31m", 4);
}
OPM_LogWStr((CHAR*)" err ", 7); OPM_LogWStr((CHAR*)" err ", 7);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} else { } else {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"35m", 4);
VT100_SetAttr((CHAR*)"35m", 4);
}
OPM_LogWStr((CHAR*)" warning ", 11); OPM_LogWStr((CHAR*)" warning ", 11);
n = -n; n = -n;
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} }
OPM_LogWNum(n, 1); OPM_LogWNum(n, 1);
OPM_LogWStr((CHAR*)" ", 3); OPM_LogWStr((CHAR*)" ", 3);
@ -641,13 +643,9 @@ static void OPM_ShowLine (INT64 pos)
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
} }
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogW('^'); OPM_LogW('^');
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
Files_Close(f); 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 #ifndef OPM__h
#define 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_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n); import INT16 OPM_Integer (INT64 n);
import void OPM_LogVT100 (CHAR *vt100code, LONGINT vt100code__len);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (INT64 i, INT64 len); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPP__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPS__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPT__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPV__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -9,6 +9,7 @@
#include "Platform.h" #include "Platform.h"
export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128]; static CHAR Out_buf[128];
static INT16 Out_in; static INT16 Out_in;
@ -311,6 +312,7 @@ export void *Out__init(void)
__REGCMD("Ln", Out_Ln); __REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open); __REGCMD("Open", Out_Open);
/* BEGIN */ /* BEGIN */
Out_IsConsole = Platform_IsConsole(1);
Out_in = 0; Out_in = 0;
__ENDMOD; __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 #ifndef Out__h
#define Out__h #define Out__h
@ -6,6 +6,7 @@
#include "SYSTEM.h" #include "SYSTEM.h"
import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch); 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -63,6 +63,7 @@ export INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
export BOOLEAN Platform_Inaccessible (INT16 e); export BOOLEAN Platform_Inaccessible (INT16 e);
export void Platform_Init (INT32 argc, INT32 argvadr); export void Platform_Init (INT32 argc, INT32 argvadr);
export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_Interrupted (INT16 e);
export BOOLEAN Platform_IsConsole (INT32 h);
export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
export INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h); export INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h);
export BOOLEAN Platform_NoSuchDirectory (INT16 e); export BOOLEAN Platform_NoSuchDirectory (INT16 e);
@ -131,6 +132,7 @@ extern void Heap_InitHeap();
#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var) #define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var)
#define Platform_getpid() (INTEGER)getpid() #define Platform_getpid() (INTEGER)getpid()
#define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0) #define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0)
#define Platform_isatty(fd) isatty(fd)
#define Platform_lseek(fd, o, w) lseek(fd, o, w) #define Platform_lseek(fd, o, w) lseek(fd, o, w)
#define Platform_nanosleep(s, ns) struct timespec req, rem; req.tv_sec = s; req.tv_nsec = ns; nanosleep(&req, &rem) #define Platform_nanosleep(s, ns) struct timespec req, rem; req.tv_sec = s; req.tv_nsec = ns; nanosleep(&req, &rem)
#define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664) #define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664)
@ -404,6 +406,11 @@ INT16 Platform_Close (INT32 h)
__RETCHK; __RETCHK;
} }
BOOLEAN Platform_IsConsole (INT32 h)
{
return Platform_isatty(h) != 0;
}
INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ) INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ)
{ {
Platform_structstats(); Platform_structstats();

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 #ifndef Platform__h
#define Platform__h #define Platform__h
@ -45,6 +45,7 @@ import INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
import BOOLEAN Platform_Inaccessible (INT16 e); import BOOLEAN Platform_Inaccessible (INT16 e);
import void Platform_Init (INT32 argc, INT32 argvadr); import void Platform_Init (INT32 argc, INT32 argvadr);
import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_Interrupted (INT16 e);
import BOOLEAN Platform_IsConsole (INT32 h);
import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
import INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h); import INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h);
import BOOLEAN Platform_NoSuchDirectory (INT16 e); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Reals__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Strings__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Texts__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef VT100__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef extTools__h
#define extTools__h #define extTools__h

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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -46,22 +46,14 @@ void Compiler_Module (BOOLEAN *done)
if (OPM_noerr) { if (OPM_noerr) {
if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { if ((__IN(10, OPM_Options, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) {
OPM_DeleteNewSym(); OPM_DeleteNewSym();
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogWStr((CHAR*)" Main program.", 16); OPM_LogWStr((CHAR*)" Main program.", 16);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} else { } else {
if (new) { if (new) {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogWStr((CHAR*)" New symbol file.", 19); OPM_LogWStr((CHAR*)" New symbol file.", 19);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
OPM_RegisterNewSym(); OPM_RegisterNewSym();
} else if (ext) { } else if (ext) {
OPM_LogWStr((CHAR*)" Extended symbol file.", 24); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Configuration__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Files__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Heap__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef Modules__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPB__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPC__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -59,6 +59,7 @@ export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
export void OPM_InitOptions (void); export void OPM_InitOptions (void);
export INT16 OPM_Integer (INT64 n); export INT16 OPM_Integer (INT64 n);
static void OPM_LogErrMsg (INT16 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_LogW (CHAR ch);
export void OPM_LogWLn (void); export void OPM_LogWLn (void);
export void OPM_LogWNum (INT64 i, INT64 len); export void OPM_LogWNum (INT64 i, INT64 len);
@ -121,6 +122,15 @@ void OPM_LogWLn (void)
Out_Ln(); 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 OPM_SignedMaximum (INT32 bytecount)
{ {
INT64 result; INT64 result;
@ -540,22 +550,14 @@ static void OPM_LogErrMsg (INT16 n)
Texts_Scanner S; Texts_Scanner S;
CHAR c; CHAR c;
if (n >= 0) { if (n >= 0) {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"31m", 4);
VT100_SetAttr((CHAR*)"31m", 4);
}
OPM_LogWStr((CHAR*)" err ", 7); OPM_LogWStr((CHAR*)" err ", 7);
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} else { } else {
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"35m", 4);
VT100_SetAttr((CHAR*)"35m", 4);
}
OPM_LogWStr((CHAR*)" warning ", 11); OPM_LogWStr((CHAR*)" warning ", 11);
n = -n; n = -n;
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
} }
OPM_LogWNum(n, 1); OPM_LogWNum(n, 1);
OPM_LogWStr((CHAR*)" ", 3); OPM_LogWStr((CHAR*)" ", 3);
@ -641,13 +643,9 @@ static void OPM_ShowLine (INT64 pos)
OPM_LogW(' '); OPM_LogW(' ');
i -= 1; i -= 1;
} }
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"32m", 4);
VT100_SetAttr((CHAR*)"32m", 4);
}
OPM_LogW('^'); OPM_LogW('^');
if (!__IN(16, OPM_Options, 32)) { OPM_LogVT100((CHAR*)"0m", 3);
VT100_SetAttr((CHAR*)"0m", 3);
}
Files_Close(f); 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 #ifndef OPM__h
#define 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_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len);
import void OPM_InitOptions (void); import void OPM_InitOptions (void);
import INT16 OPM_Integer (INT64 n); import INT16 OPM_Integer (INT64 n);
import void OPM_LogVT100 (CHAR *vt100code, LONGINT vt100code__len);
import void OPM_LogW (CHAR ch); import void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void); import void OPM_LogWLn (void);
import void OPM_LogWNum (INT64 i, INT64 len); 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPP__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPS__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPT__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #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 #ifndef OPV__h
#define 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -9,6 +9,7 @@
#include "Platform.h" #include "Platform.h"
export BOOLEAN Out_IsConsole;
static CHAR Out_buf[128]; static CHAR Out_buf[128];
static INT16 Out_in; static INT16 Out_in;
@ -311,6 +312,7 @@ export void *Out__init(void)
__REGCMD("Ln", Out_Ln); __REGCMD("Ln", Out_Ln);
__REGCMD("Open", Out_Open); __REGCMD("Open", Out_Open);
/* BEGIN */ /* BEGIN */
Out_IsConsole = Platform_IsConsole(1);
Out_in = 0; Out_in = 0;
__ENDMOD; __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 #ifndef Out__h
#define Out__h #define Out__h
@ -6,6 +6,7 @@
#include "SYSTEM.h" #include "SYSTEM.h"
import BOOLEAN Out_IsConsole;
import void Out_Char (CHAR ch); 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 SHORTINT INT8
#define INTEGER INT16 #define INTEGER INT16
@ -63,6 +63,7 @@ export INT16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIden
export BOOLEAN Platform_Inaccessible (INT16 e); export BOOLEAN Platform_Inaccessible (INT16 e);
export void Platform_Init (INT32 argc, INT64 argvadr); export void Platform_Init (INT32 argc, INT64 argvadr);
export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_Interrupted (INT16 e);
export BOOLEAN Platform_IsConsole (INT32 h);
export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d);
export INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h); export INT16 Platform_New (CHAR *n, LONGINT n__len, INT32 *h);
export BOOLEAN Platform_NoSuchDirectory (INT16 e); export BOOLEAN Platform_NoSuchDirectory (INT16 e);
@ -131,6 +132,7 @@ extern void Heap_InitHeap();
#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var) #define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var)
#define Platform_getpid() (INTEGER)getpid() #define Platform_getpid() (INTEGER)getpid()
#define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0) #define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0)
#define Platform_isatty(fd) isatty(fd)
#define Platform_lseek(fd, o, w) lseek(fd, o, w) #define Platform_lseek(fd, o, w) lseek(fd, o, w)
#define Platform_nanosleep(s, ns) struct timespec req, rem; req.tv_sec = s; req.tv_nsec = ns; nanosleep(&req, &rem) #define Platform_nanosleep(s, ns) struct timespec req, rem; req.tv_sec = s; req.tv_nsec = ns; nanosleep(&req, &rem)
#define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664) #define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664)
@ -404,6 +406,11 @@ INT16 Platform_Close (INT32 h)
__RETCHK; __RETCHK;
} }
BOOLEAN Platform_IsConsole (INT32 h)
{
return Platform_isatty(h) != 0;
}
INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ) INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ)
{ {
Platform_structstats(); Platform_structstats();

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