Skip to content

Commit

Permalink
f0015 / v0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
adesutherland committed Jul 21, 2020
1 parent 562d5af commit f2ca360
Show file tree
Hide file tree
Showing 29 changed files with 455 additions and 889 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
BREXX CMS Change LOG
====================

CMS-0.9.5 - 21 July 2020
F0015 - IO Updates to leverage GCCLIB >= 0.7.13 / f0029
(Stability and performance)
Initial Test Scripts
- Changed LREADINCSIZE from 32 to 250 to improve whole
file reading performance
F0014 - Fix Memory leak on error in X2C
F0013 - Possibility to turn on debug and turn off optimser

Expand Down
44 changes: 14 additions & 30 deletions charin.c
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
/*
* $Id: charin.c,v 1.6 2008/07/15 07:40:54 bnv Exp $
* $Log: charin.c,v $
* Revision 1.6 2008/07/15 07:40:54 bnv
* #include changed from <> to ""
*
* Revision 1.5 2004/03/26 22:50:22 bnv
* *** empty log message ***
*
* Revision 1.4 2002/06/11 12:37:15 bnv
* Added: CDECL
*
* Revision 1.3 2001/06/25 18:49:48 bnv
* Header changed to Id
*
* Revision 1.2 1999/11/26 09:53:14 bnv
* Changed: To use the new macros.
*
* Revision 1.1 1998/07/02 17:17:00 bnv
* Initial revision
*
*/

/* VM/370 CMS and GCCLIB charin.c */
#include <stdio.h>
#include "lstring.h"

/* ---------------- Lcharin ------------------- */
void __CDECL
Lcharin( FILEP f, const PLstr line, const long start, const long length )
{
if (start>=1)
FSEEK(f,start-1,SEEK_SET);
if (length<=0) {
LZEROSTR(*line);
return;
}
Lread(f,line,length);
int l;

if (start>=1) {
l = fseek(f,start-1,SEEK_SET);
if (l)
Lerror(ERR_NOT_RANDOM_ACCESS,0);
}
if (length<=0) {
LZEROSTR(*line);
return;
}
Lread(f,line,length);
} /* Lcharin */
9 changes: 5 additions & 4 deletions charout.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
void __CDECL
Lcharout( FILEP f, const PLstr line, const long start )
{
#ifndef __CMS__
if (start>=0)
FSEEK(f,start,SEEK_SET);
#endif
int l;
if (start>=0) {
l = FSEEK(f,start,SEEK_SET);
if (l) Lerror(ERR_NOT_RANDOM_ACCESS,0);
}

Lwrite(f,line,FALSE);
} /* Lcharout */
60 changes: 10 additions & 50 deletions chars.c
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
/*
* $Id: chars.c,v 1.7 2008/07/15 07:40:54 bnv Exp $
* $Log: chars.c,v $
* Revision 1.7 2008/07/15 07:40:54 bnv
* #include changed from <> to ""
*
* Revision 1.6 2008/07/14 13:08:16 bnv
* MVS,CMS support
*
* Revision 1.5 2004/03/26 22:50:22 bnv
* Modified to handle FIFO, Devices and files
*
* Revision 1.4 2002/06/11 12:37:15 bnv
* Added: CDECL
*
* Revision 1.3 2001/06/25 18:49:48 bnv
* Header changed to Id
*
* Revision 1.2 1999/11/26 09:53:28 bnv
* Changed: To use the new macros.
*
* Revision 1.1 1998/07/02 17:17:00 bnv
* Initial revision
*
*/

#if !defined(WIN) && !defined(__CMS__) && !defined(__MVS__)
# include <sys/stat.h>
# include <unistd.h>
#endif
/* VM/370 CMS and GCCLIB chars.c */

#include <stdio.h>
#include "lstring.h"

/* ---------------- Lchars ------------------- */
long __CDECL
Lchars( FILEP f )
long Lchars( FILEP f )
{
#if defined(WCE) && !defined(__BORLANDC__)
return GetFileSize(f->handle,NULL) - FTELL(f);
#else
long l,chs;

#if !defined(WIN) && !defined(__CMS__) && !defined(__MVS__)
struct stat buf;
fstat(fileno(f),&buf);
if (S_ISCHR(buf.st_mode) || S_ISFIFO(buf.st_mode))
return !FEOF(f);
#endif

l = FTELL(f); /* read current position */
FSEEK(f,0L,SEEK_END); /* seek at the end */
chs = FTELL(f) - l ;
FSEEK(f,l,SEEK_SET);
return chs;
#endif
long l;
l = ftell(f); /* read current position */
if (l==-1) {
/* File does not support character counting */
return !fateof(f);
}
return fgetlen(f) - l;
} /* Lchars */
4 changes: 2 additions & 2 deletions config.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Modified for VM/370 CMS and GCC by Robert O'Hara, July 2010. */

/* The one version to rule them all! */
/* #define CMS_VERSION "CMS-0.9.4" */
#define CMS_VERSION "CMS-F0014"
#define CMS_VERSION "CMS-0.9.5"
/* #define CMS_VERSION "CMS-F0015" */
/* #define __DEBUG__ */

#include "rxmvs.h"
Expand Down
4 changes: 0 additions & 4 deletions context.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ struct Context {
/* rexxfunc.c */
BinTree *rexxfunc_ExtraFuncs;

/* rxfiles.c */
int rxfiles_file_size; /* file size in filelist structure */
void* rxfiles_file;

/* Previous Context */
Context *previous;
};
Expand Down
1 change: 1 addition & 0 deletions cp2vm370.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ REM This tests the cmsbuild.sh and cmsinstall.sh scripts
REM that are used by the automated build process

docker kill vm370
REM docker pull adriansutherland/vm370:latest
docker run --rm -d -p 3270:3270 -p 8038:8038 -p 3505:3505 --name vm370 adriansutherland/vm370:latest
REM docker run --rm -d -p 3270:3270 -p 8038:8038 -p 3505:3505 --name vm370 adriansutherland/vm370x:latest

Expand Down
4 changes: 3 additions & 1 deletion errortxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ const ErrorMsg errortext[] = {

{ ERRNUM(57,0), "Cannot open file" },
{ ERRNUM(58,0), "File not found" },
{ ERRNUM(59,0), "File not opened" }
{ ERRNUM(59,0), "File not opened" },
{ ERRNUM(60,0), "File does not support random character access" },
{ ERRNUM(61,0), "File does not support random record access" }
};

/* ------------------ Lerrortext ------------------- */
Expand Down
4 changes: 2 additions & 2 deletions lerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
#define ERR_CANT_OPEN_FILE 57
#define ERR_FILE_NOT_FOUND 58
#define ERR_FILE_NOT_OPENED 59


#define ERR_NOT_RANDOM_ACCESS 60
#define ERR_NOT_RECORD_ACCESS 61
/*#define ERR_PARADOX_ERROR 23*/
/*#define ERR_FULL_CTRL_STACK 11*/
/*#define ERR_TOO_LONG_LINE 12*/
Expand Down
71 changes: 0 additions & 71 deletions linein .c

This file was deleted.

91 changes: 33 additions & 58 deletions linein.c
Original file line number Diff line number Diff line change
@@ -1,71 +1,46 @@
/*
* $Id: linein.c,v 1.6 2008/07/15 07:40:54 bnv Exp $
* $Log: linein.c,v $
* Revision 1.6 2008/07/15 07:40:54 bnv
* #include changed from <> to ""
*
* Revision 1.5 2002/06/11 12:37:15 bnv
* Added: CDECL
*
* Revision 1.4 2001/06/25 18:49:48 bnv
* Header changed to Id
*
* Revision 1.3 1999/11/26 12:52:25 bnv
* Changed: To use the new macros.
*
* Revision 1.2 1999/03/15 15:25:53 bnv
* Corrected: initial value to prev
*
* Revision 1.1 1998/07/02 17:18:00 bnv
* Initial Version
*
*/
/* VM/370 CMS and GCCLIB linein.c */

#include <stdio.h>
#include <errno.h>
#include "lstring.h"


/* ---------------- Llinein ------------------- */
void __CDECL
Llinein( FILEP f, const PLstr line, long *curline, long start, long length )
Llinein( FILEP f, const PLstr line, long start, long length )
{
int ch,prev='\n';
Lstr aux;
int l, i;
char *c;

/* initialise line */
LZEROSTR(*line);
/* initialise line */
LZEROSTR(*line);

/* find current line */
if (start>=0) {
if (*curline>start) {
*curline = 1;
FSEEK(f,0,SEEK_SET);
}
while (start>*curline) {
ch = FGETC(f);
if (ch==EOF) {
if (prev!='\n') (*curline)++;
break;
}
if (ch=='\n') (*curline)++;
prev = ch;
/* find start line */
if (start>=0) {
if (!fsetrec(f,start)) {
if (errno==ENOTBLK) Lerror(ERR_NOT_RECORD_ACCESS,0);
else Lerror(ERR_INCORRECT_CALL,0);
}
}
if (start > *curline) return;
}

if (length<=0) return;
if (length<=0) return;

else if (length==1) Lread(f,line,LREADLINE);

if (length==1) {
Lread(f,line,LREADLINE);
(*curline)++;
} else {
LINITSTR(aux);
while (length) {
Lread(f,&aux,LREADLINE);
Lstrcat(line,&aux);
if (length>1)
Lcat(line,"\n");
(*curline)++;
length--;
else {
Lfx(line,LREADINCSIZE);
l = 0;
while (length && (i=nextrecLen(f))>0) {
if (l+i > LMAXLEN(*line)) {
Lfx(line, (size_t)(l+i+LREADINCSIZE));
}
c = LSTR(*line) + l;
fgets(c, i+1, f);
l+=i;
length--;
}
Lfx(line,l); /* Give back unwanted memory */
LLEN(*line) = l;
LTYPE(*line) = LSTRING_TY;
}
LFREESTR(aux);
}
} /* Llinein */
Loading

0 comments on commit f2ca360

Please sign in to comment.