From 8b185c7d9c3c8b53b4cea6741b3efb8f4f52ef7a Mon Sep 17 00:00:00 2001 From: Adrian Sutherland Date: Fri, 28 Aug 2020 15:53:59 +0100 Subject: [PATCH] v0.7.18 / f0039 --- changelog.txt | 5 +++++ cmsio.c | 1 + cmsrtstb.c | 2 ++ cmsruntm.c | 2 +- cmsruntm.h | 35 +++++------------------------------ cmsstdio.c | 1 + cmsstdlb.c | 1 + cmssys.h | 29 +++++++++++++++++++++++++++-- cmssysc.c | 8 +------- gcccrab.h | 16 +++++++--------- members.parm | 1 - signal.c | 1 + stdio.h | 3 +-- tsts.c | 1 + vtable.macro | 1 - 15 files changed, 54 insertions(+), 53 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8743edd..90977e3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,11 @@ GCCLIB Change LOG ================= +0.7.18- 28 August 2020 +F0039 - Reoranised header files a bit to *reduce* circular dependancies + - Changed CMSGetPG() to macro - performance + + 0.7.17- 11 August 2020 F0038 - Add support for being called via a type 5 call - Assist to turn main() return int into a calltype 5 return EVALBLOK string diff --git a/cmsio.c b/cmsio.c index 53b4aaf..96906cf 100644 --- a/cmsio.c +++ b/cmsio.c @@ -15,6 +15,7 @@ #include +#include #include #include #include diff --git a/cmsrtstb.c b/cmsrtstb.c index f4e3242..059fc56 100644 --- a/cmsrtstb.c +++ b/cmsrtstb.c @@ -9,7 +9,9 @@ /* Released to the public domain. */ /**************************************************************************************************/ #include +#include #include +#include #include #include diff --git a/cmsruntm.c b/cmsruntm.c index c779b15..7554b99 100644 --- a/cmsruntm.c +++ b/cmsruntm.c @@ -10,7 +10,7 @@ /**************************************************************************************************/ /* TODO Paramter Overruns */ #include - +#include #include #include #include diff --git a/cmsruntm.h b/cmsruntm.h index c94a713..eab856d 100644 --- a/cmsruntm.h +++ b/cmsruntm.h @@ -10,7 +10,6 @@ #ifndef CMSRUNTM_INCLUDED #define CMSRUNTM_INCLUDED -#include #ifndef __SIZE_T_DEFINED #define __SIZE_T_DEFINED @@ -38,7 +37,7 @@ struct CMSCRAB { CMSCRAB *backchain; /* backchain to previous save area +04 */ CMSCRAB *forward; /* forward chain to next save area +08 */ void *regsavearea[15]; /* register save area and save area chaining +12 */ - GCCCRAB *gcccrab; /* GCC C Runtime Anchor Block (GCCCRAB) +72 */ + struct GCCCRAB *gcccrab; /* GCC C Runtime Anchor Block (GCCCRAB) +72 */ void *stackNext; /* next available byte in the stack +76 */ void *numconv; /* numeric conversion buffer +80 */ void *funcrslt; /* function result buffer +84 */ @@ -74,7 +73,6 @@ struct CMSCRAB { #define ARGBUFFERLEN 300 /* Startup Functions */ -int __cstub(PLIST *plist , EPLIST *eplist); int __cstart(MAINFUNC* mainfunc); /* @@ -139,30 +137,7 @@ typedef struct CMSDRIVER CMSDRIVER; typedef struct CMSDRIVERS CMSDRIVERS; typedef struct CMSFILECACHE CMSFILECACHE; typedef struct CMSCACHEENTRY CMSCACHEENTRY; - -struct FILE { - char validator1; /* Marks a valid FILE structure */ - char name[21]; /* File name used for messages */ - char fileid[19]; /* Null terminated FILEID */ - FILE* next; /* Next file in the file list */ - FILE* prev; /* Previous file in the file list */ - int access; /* type of access mode flags (read, write, etc.) */ - int status; /* status flags (error, eof, dirty record buffer, read/write mode, etc.) */ - int error; /* error code from last I/O operation against this file */ - int ungetchar; /* Unget Character */ - int recpos; /* char position in record buffer, next unread byte, next byte position to write */ - int recnum; /* Record number (1 base) of the record in the buffer, -1 nonblock device, - 0 no record loaded */ - int reclen; /* Current Record length excluding any trailing \n and null */ - int maxreclen; /* Max Record length for curren record excluding any trailing \n and null */ - int filemaxreclen; /* Max Record length / Buffer Length excluding any trailing \n and null */ - int records; /* Number of records or -1 for non-block file */ - CMSDRIVER *device; /* device driver (console, disk, etc.) */ - char *buffer; /* record buffer */ - CMSFILECACHE *cache; /* File cache */ - CMSFILE fscb; /* the CMS File System Control Block (if it is a disk file) */ - char validator2; /* Marks a valid FILE structure */ -}; +/* FILE Structure Specified in cmssys.h */ /* Status flags */ #define STATUS_EOF 1 @@ -206,9 +181,9 @@ struct CMSCACHEENTRY { }; /* IO Drivers */ -typedef int (CONTROL_FUNC)(FILE *stream); -typedef int (OPEN_FUNC)(char filespecwords[][10], FILE* file); -typedef int (SETPOS_FUNC)(FILE *stream, int recpos); +typedef int (CONTROL_FUNC)(struct FILE *stream); +typedef int (OPEN_FUNC)(char filespecwords[][10], struct FILE* file); +typedef int (SETPOS_FUNC)(struct FILE *stream, int recpos); struct CMSDRIVER { OPEN_FUNC *open_func; diff --git a/cmsstdio.c b/cmsstdio.c index a4cb376..cd9b5a2 100644 --- a/cmsstdio.c +++ b/cmsstdio.c @@ -9,6 +9,7 @@ /**************************************************************************************************/ #include +#include #include #include #include diff --git a/cmsstdlb.c b/cmsstdlb.c index 5cfc8f8..0254fd9 100644 --- a/cmsstdlb.c +++ b/cmsstdlb.c @@ -9,6 +9,7 @@ /**************************************************************************************************/ #include +#include #include #include #include diff --git a/cmssys.h b/cmssys.h index a55b928..39a931f 100644 --- a/cmssys.h +++ b/cmssys.h @@ -8,7 +8,7 @@ #ifndef CMSSYS_INCLUDED #define CMSSYS_INCLUDED -#define GCCLIB_VERSION "0.7.17" +#define GCCLIB_VERSION "0.7.18" #include #include @@ -58,6 +58,30 @@ typedef struct { int bytesRead; /* number of bytes actually read */ } CMSFILE; +struct FILE { + char validator1; /* Marks a valid FILE structure */ + char name[21]; /* File name used for messages */ + char fileid[19]; /* Null terminated FILEID */ + struct FILE* next; /* Next file in the file list */ + struct FILE* prev; /* Previous file in the file list */ + int access; /* type of access mode flags (read, write, etc.) */ + int status; /* status flags (error, eof, dirty record buffer, read/write mode, etc.) */ + int error; /* error code from last I/O operation against this file */ + int ungetchar; /* Unget Character */ + int recpos; /* char position in record buffer, next unread byte, next byte position to write */ + int recnum; /* Record number (1 base) of the record in the buffer, -1 nonblock device, + 0 no record loaded */ + int reclen; /* Current Record length excluding any trailing \n and null */ + int maxreclen; /* Max Record length for curren record excluding any trailing \n and null */ + int filemaxreclen; /* Max Record length / Buffer Length excluding any trailing \n and null */ + int records; /* Number of records or -1 for non-block file */ + struct CMSDRIVER *device; /* device driver (console, disk, etc.) */ + char *buffer; /* record buffer */ + struct CMSFILECACHE *cache; /* File cache */ + CMSFILE fscb; /* the CMS File System Control Block (if it is a disk file) */ + char validator2; /* Marks a valid FILE structure */ +}; + /**************************************************************************************************/ /* CMSFILEINFO maps the CMS FST (File Status Table). */ /**************************************************************************************************/ @@ -100,7 +124,8 @@ typedef struct { /* */ /**************************************************************************************************/ void* CMSPGAll(size_t size); -void* CMSGetPG(void); +#include +#define CMSGetPG() (GETGCCCRAB()->process_global) /**************************************************************************************************/ /* int CMSGetFlag(int flag) */ diff --git a/cmssysc.c b/cmssysc.c index 2e887a7..2fe63af 100644 --- a/cmssysc.c +++ b/cmssysc.c @@ -146,7 +146,7 @@ int __CMSCMD(char *command, int calltype) /* I have coined this memory - Process Global Memory. */ /* */ /* void* CMSPGAll(size_t size) - Allocate / Reallocate Process Global Memory Block */ -/* void* CMSGetPG(void) - Get the address of the Process Global Memory Block */ +/* void* CMSGetPG(void) - Get the address of the Process Global Memory *** MACRO in cmssys.h *** */ /* */ /* Note: that this area is freed automatically on normal program termination. */ /* */ @@ -164,12 +164,6 @@ void* CMSPGAll(size_t size) { return crab->process_global; } -void* CMSGetPG(void) { - GCCCRAB *crab; - crab = GETGCCCRAB(); - return crab->process_global; -} - /**************************************************************************************************/ /* Call Type 5 (function) call */ /* __CMSFNA() */ diff --git a/gcccrab.h b/gcccrab.h index 882e7e9..e30e534 100644 --- a/gcccrab.h +++ b/gcccrab.h @@ -10,8 +10,6 @@ #ifndef GCCCRAB_INCLUDED #define GCCCRAB_INCLUDED -#include -#include #ifndef __SIZE_T_DEFINED #define __SIZE_T_DEFINED @@ -36,21 +34,21 @@ struct GCCCRAB { EXITFUNC *exitfunc; void* dlmspace; /* For DLMALLOC */ size_t startmemoryusage; - FILE *gstdin; - FILE *gstdout; - FILE *gstderr; + struct FILE *gstdin; + struct FILE *gstdout; + struct FILE *gstderr; int gerrno; SIGHANDLER **handlers; USEREXIT **userexits; - FILE* filehandles; + struct FILE* filehandles; char *strtok_old; void *process_global; char **argv; char *argbuffer; - PLIST *plist; - EPLIST *eplist; + char (*plist)[8]; + struct EPLIST *eplist; int calltype; - EVALBLOK *evalblok; + struct EVALBLOK *evalblok; int isproc; int argc; }; diff --git a/members.parm b/members.parm index d17ef38..7f4368c 100644 --- a/members.parm +++ b/members.parm @@ -27,7 +27,6 @@ *********************************************************************** @@DEBUG CMSPGALL -CMSGETPG CMSSETFL CMSSETNU @@ATTN diff --git a/signal.c b/signal.c index d152ac3..db0af3a 100644 --- a/signal.c +++ b/signal.c @@ -11,6 +11,7 @@ /*********************************************************************/ #include +#include #include #include #include diff --git a/stdio.h b/stdio.h index 1e3542e..57261b3 100644 --- a/stdio.h +++ b/stdio.h @@ -11,7 +11,6 @@ #ifndef STDIO_INCLUDED #define STDIO_INCLUDED -#include #include #include @@ -38,9 +37,9 @@ typedef struct FPOS_T fpos_t; /**************************************************************************************************/ /* FILE - open stream file block */ -/* Specified in cmsruntm.h */ /**************************************************************************************************/ typedef struct FILE FILE; +/* FILE Structure Specified in cmssys.h */ /* Stdlib Public Global Variables */ #include diff --git a/tsts.c b/tsts.c index f662534..fd332c0 100644 --- a/tsts.c +++ b/tsts.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "tsts.h" diff --git a/vtable.macro b/vtable.macro index f26a649..4a0e9cf 100644 --- a/vtable.macro +++ b/vtable.macro @@ -30,7 +30,6 @@ *********************************************************************** @@DEBUG VTENTRY CMSPGALL VTENTRY -CMSGETPG VTENTRY CMSSETFL VTENTRY CMSSETNU VTENTRY @@ATTN VTENTRY