Skip to content

Commit

Permalink
f0041
Browse files Browse the repository at this point in the history
  • Loading branch information
adesutherland committed Sep 8, 2020
1 parent 8ee387f commit b03b71b
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GCCLIB Change LOG
=================

F0041 - REXXSAA RexxVariablePool

0.7.19- 31 August 2020
F0040 - Fix for calltype 5 returns where RC is auto-converted to the return
string. The integer RC is set to zero as the call itself was successfull
Expand Down
1 change: 0 additions & 1 deletion cmsrtstb.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <cmsruntm.h>
#include <cmssys.h>
#include <stdio.h>
#include <cmssys.h>
#include <signal.h>
#include <stdlib.h>

Expand Down
2 changes: 1 addition & 1 deletion cmssys.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef CMSSYS_INCLUDED
#define CMSSYS_INCLUDED

#define GCCLIB_VERSION "0.7.19"
#define GCCLIB_VERSION "F0041"

#include <stddef.h>
#include <stdarg.h>
Expand Down
7 changes: 7 additions & 0 deletions members.parm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* Released to the public domain *
***********************************************************************
*
*
*
*
***********************************************************************
* Entry points in CMSSYSC C / CMSSYS H *
***********************************************************************
Expand Down Expand Up @@ -252,4 +255,8 @@ LOCALTIM
MKTIME
STRFTIME
TIME
***********************************************************************
* Entry points in REXXSAA C / REXXSAA H *
***********************************************************************
RXVARPOL
*
4 changes: 3 additions & 1 deletion mkgcclib.exec
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ CMSENTRY CMSJUMP CMSSYS DYNSTK CMSRUNTA
&BEGSTACK ALL
CMSRTSTB CMSRUNTM MALLOC CMSSYSC CMSSTDIO CMSSTDLB ASSERT CTYPE LOCALE MATH
SIGNAL STRING TIME CMSIO CONDRV PUNDRV PRTDRV RDRDRV DSKDRV RESMAIN
REXXSAA
&END
&LOOP -ENDCC &READFLAG = CONSOLE
&READ ARGS
Expand Down Expand Up @@ -77,6 +78,7 @@ TXTLIB ADD GCCLIB MATH
TXTLIB ADD GCCLIB SIGNAL
TXTLIB ADD GCCLIB STRING
TXTLIB ADD GCCLIB TIME
TXTLIB ADD GCCLIB REXXSAA
COPY GCCLIB TXTLIB A = = &ODISK (REPLACE OLDDATE
ERASE GCCLIB TXTLIB A

Expand Down Expand Up @@ -138,7 +140,7 @@ RESMAIN
CMSENTRY CMSRTSTB CMSRUNTM CMSRUNTA DYNSTK CMSJUMP
CMSIO CONDRV PUNDRV PRTDRV RDRDRV DSKDRV
CMSSTDIO CMSSTDLB MALLOC CMSSYSC CMSSYS ASSERT CTYPE
LOCALE MATH SIGNAL STRING TIME
LOCALE MATH SIGNAL STRING TIME REXXSAA
&END
&LOOP -ENDTT &READFLAG = CONSOLE
&READ ARGS
Expand Down
46 changes: 46 additions & 0 deletions rexxsaa.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/******************************************************************************/
/* REXXSAA.C - REXXSAA for BREXX on VM/370 */
/******************************************************************************/
#include <rexxsaa.h>
#include <cmssys.h>

/* Low Level Assembler functions */
int __SVC202(PLIST *plist , EPLIST *eplist, int calltype);

/*
APIRET RexxVariablePool(PSHVBLOCK RequestBlockList)
Variable Pool Interface - Application programs can use the Rexx Variable Pool
Interface to manipulate the variables of a currently active Rexx procedure.
The RequestBlockList is the first item in a chain of request blocks.
Return code contains the return codes from the entire set of requests:
The possible return codes are:
POSITIVE Register 15 is the composite OR of bits 0-5 of the SHVRET bytes
0 success
-1 Incorrect entry conditions
-2 Insufficient storage was available for a requested SET
-3 No EXECCOMM entry point found
Implentation Notes
Call Type X'02'
The R1 PLIST: Register 1 must point to a PLIST which consists
of the 8-byte string EXECCOMM
The R0 Extended PLIST
- First word must contain the value of Register 1 (without the user call-type
information in the high-order byte)
- Second and third words must be identical (for example, both 0)
- The fourth word points to a chain of request blocks
*/
APIRET RxVarPol(PSHVBLOCK RequestBlockList) {
PLIST plist[2] = {"EXECCOMM", "\xFF" "\xFF" "\xFF" "\xFF" "\xFF" "\xFF" "\xFF" "\xFF"};
EPLIST eplist;
eplist.Command = plist;
eplist.BeginArgs = 0;
eplist.EndArgs = 0;
eplist.CallContext = RequestBlockList;
eplist.ArgList = 0;
eplist.FunctionReturn = 0;
return __SVC202(plist , &eplist, 0x02);
}
163 changes: 163 additions & 0 deletions rexxsaa.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/******************************************************************************/
/* REXXSAA.H - REXXSAA for BREXX on VM/370 */
/* This header file is source code compatible with REXXSAA for */
/* the Rexx Variable Pool API, and is binary compatible with the CP/CMS */
/* structures for EXECCOMM. To achieve this the order of fields in the */
/* structs have been changed from the REXXSAA standard */
/******************************************************************************/
#ifndef __REXXSAA_H_INCLUDED
#define __REXXSAA_H_INCLUDED

typedef unsigned long ULONG;
typedef unsigned char UCHAR;
typedef void* PVOID;

typedef struct RXSTRING
{
char* strptr;
ULONG strlength;
} RXSTRING;
typedef RXSTRING *PRXSTRING;

#define APIRET ULONG
#define MAKERXSTRING(x,c,l) ((x).strptr=(c),(x).strlength=(l))
#define RXNULLSTRING(x) (!(x).strptr)
#define RXSTRLEN(x) ((x).strptr ? (x).strlength : 0UL)
#define RXSTRPTR(x) ((x).strptr)
#define RXVALIDSTRING(x) ((x).strptr && (x).strlength)
#define RXZEROLENSTRING(x) ((x).strptr && !(x).strlength)

/* shvret - return code flags */
#define RXSHV_OK 0x00 /* Everything OK */
#define RXSHV_NEWV 0x01 /* Var not previously set */
#define RXSHV_LVAR 0x02 /* Last var in a NEXTV sequence */
#define RXSHV_TRUNC 0x04 /* Name or value has been truncated */
#define RXSHV_BADN 0x08 /* Bad/invalid name */
#define RXSHV_MEMFL 0x10 /* Memory problem, e.g. out of memory *REXXSAA* */
#define RXSHV_BADV 0x10 /* Variable value invalid *CP/CMS* */
#define RXSHV_BADF 0x80 /* Invalid function code */
#define RXSHV_NOAVL 0x90 /* Interface is not available *REXXSAA* */

/* shvcode - function codes */
#define RXSHV_SET 'S' /* Set variable */
#define RXSHV_FETCH 'F' /* Get value of variable */
#define RXSHV_DROPV 'D' /* Drop variable */
#define RXSHV_SYSET 's' /* Set symbolic variable */
#define RXSHV_SYFET 'f' /* Get value of symbolic variable */
#define RXSHV_SYDRO 'd' /* Drop symbolic variable */
#define RXSHV_NEXTV 'N' /* Get next var in a NEXTV sequence */
#define RXSHV_PRIV 'P' /* Get private information */

typedef struct SHVBLOCK
{
struct SHVBLOCK *shvnext; /* Ptr to next SHVBLOCK or 0 */
ULONG shvnamelen; /* Length of name buffer, RXSHV_NEXTV only */
UCHAR shvcode; /* Function code */
UCHAR shvret; /* Return code flags */
short reserved; /* 0 (16 bit) */
ULONG shvvaluelen; /* Length of the value buffer */
RXSTRING shvname; /* variable name */
RXSTRING shvvalue; /* Value */
} SHVBLOCK;

typedef SHVBLOCK *PSHVBLOCK ;

/******************************************************************************/
/*
APIRET RexxVariablePool(PSHVBLOCK RequestBlockList)
Variable Pool Interface - Application programs can use the Rexx Variable Pool
Interface to manipulate the variables of a currently active Rexx procedure.
The RequestBlockList is the first item in a chain of request blocks.
See notes at end for command details
Return code contains the return codes from the entire set of requests:
The possible return codes are:
POSITIVE Register 15 is the composite OR of bits 0-5 of the SHVRET bytes
0 success
-1 Incorrect entry conditions
-2 Insufficient storage was available for a requested SET
-3 No EXECCOMM entry point found
*/
APIRET RxVarPol(PSHVBLOCK RequestBlockList);
#define RexxVariablePool(x) RxVarPol((x))
#define REXXVARIABLEPOOL(x) RxVarPol((x))
/******************************************************************************/

/******************************************************************************/
/* RexxVariablePool NOTES
*** D and d Drop variable.
The SHVNAMA/SHVNAML adlen describes the name of the
variable to be dropped. SHVVALA/SHVVALL are not used. The name is validated to
ensure that it does not contain incorrect characters, and the variable is then
dropped, if it exists. If the name given is a stem, all variables starting with
that stem are dropped.
*** F and f Fetch variable.
The SHVNAMA/SHVNAML adlen
describes the name of the variable to be fetched. SHVVALA specifies the address
of a buffer into which the data is to be copied, and SHVBUFL contains the length
of the buffer. The name is validated to ensure that it does not contain
incorrect characters, and the variable is then located and copied to the buffer.
The total length of the variable is put into SHVVALL, and, if the value was
truncated (because the buffer was not big enough), the SHVTRUNC bit is set. If
the variable is shorter than the length of the buffer, no padding takes place.
If the name is a stem, the initial value of that stem (if any) is returned.
SHVNEWV is set if the variable did not exist before the operation, and in this
case the value copied to the buffer is the derived name of the variable (after
substitution and so forth); see Compound Symbols.
*** N Fetch Next variable.
This function can search through all the variables known
to the language processor (that is, all those of the current generation,
excluding those hidden by PROCEDURE instructions). The order in which the
variables are revealed is not specified. The language processor maintains a
pointer to its list of variables: this is reset to point to the first variable
in the list whenever a host command is issued, or any function other than N or P
is run through the EXECCOMM interface.
Whenever an N (Next) function is run, the name and value of the next variable
available are copied to two buffers supplied by the caller.
SHVNAMA specifies the address of a buffer into which the name is to be copied,
and SHVUSER contains the length of that buffer. The total length of the name is
put into SHVNAML, and if the name was truncated (because the buffer was not big
enough) the SHVTRUNC bit is set. If the name is shorter than the length of the
buffer, no padding takes place. The value of the variable is copied to the
user's buffer area using exactly the same protocol as for the Fetch operation.
If SHVRET has SHVLVAR set, the end of the list of known variables has been
found, the internal pointers have been reset, and no valid data has been copied
to the user buffers. If SHVTRUNC is set, either the name or the value has been
truncated.
By repeatedly executing the N function (until the SHVLVAR flag is set) a user
program can locate all the REXX variables of the current generation.
*** P Fetch private information.
This interface is identical with the F fetch
interface, except that the name refers to certain fixed information items that
are available. Only the first letter of each name is checked (though callers
should supply the whole name), and the following names are recognized: ARG Fetch
primary argument string. The first argument string that would be parsed by the
ARG instruction is copied to the user's buffer. PARM Fetch the number of
argument strings. The number of argument strings supplied to the program is
placed in the caller's buffer. The number is formatted as a character string.
Note When specifying PARM, each letter must be supplied. PARM.n Fetch the nth
argument string. Argument string n is placed in the caller's buffer. Returns a
null string if argument string n cannot be supplied (whether omitted, null, or
fewer than n argument strings specified). Parm.1 returns the same result as ARG.
Note When specifying PARM.n, 'PARM.' must be supplied. SOURCE Fetch source
string. The source string, as described for PARSE SOURCE in PARSE, is copied to
the user's buffer. VERSION Fetch version string. The version string, as
described for PARSE VERSION in PARSE, is copied to the user's buffer. S and s
Set variable. The SHVNAMA/SHVNAML adlen describes the name of the variable to be
set, and SHVVALA/SHVVALL describes the value to be assigned to it. The name is
validated to ensure that it does not contain incorrect characters, and the
variable is then set from the value given. If the name is a stem, all variables
with that stem are set, just as though this was a REXX assignment. SHVNEWV is
set if the variable did not exist before the operation.
*/
#endif /* __REXXSAA_H_INCLUDED */
4 changes: 4 additions & 0 deletions vtable.macro
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,9 @@ LOCALTIM VTENTRY
MKTIME VTENTRY
STRFTIME VTENTRY
TIME VTENTRY
***********************************************************************
* Entry points in REXXSAA C / REXXSAA H *
***********************************************************************
RXVARPOL VTENTRY
*
MEND

0 comments on commit b03b71b

Please sign in to comment.