Hello,
I don't understand the return type of the function, the
PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION COMPILE8
contains some identifiers which are probably macro variables - I guess that
COMPILE8 is the function name, and pcre* is the result type, that is, that the
function returns a pointer, and that the rest are modifiers like static etc.,
that don't really matter.
I would write a small C wrapper function that calls this function; I think that
it is better not to try to return a function result from C directly to PL/1, but
instead to return the pointer - the function result - by an additional
parameter.
So the modified C prototype would loke like this:
#pragma map (COMPILE_wrapper, COMP_WRP)
void COMPILE8_wrapper
(const char *pattern,
int options,
const char **errorptr,
int *erroroffset,
const unsigned char *tables,
pcre **result);
then:
there is no problem to pass pointers from PL/1 to C or pointer on pointers, but:
the "int options" parameter needs some care on the PL/1 side. Newer PL/1
versions have the BYVALUE option; you will need this option to pass a BIN FIXED
(31) variable BYVALUE.
So the DCL ENTRY for COMPILE8 could look like this:
DCL COMP_WRP ENTRY (PTR BYVALUE,
BIN FIXED (31) BYVALUE,
PTR BYADDR,
BIN FIXED (31) BYADDR,
PTR BYVALUE,
PTR BYADDR);
and the CALL:
CALL COMP_WRP (ADDR (PATTERN),
OPTIONS,
ERRORPTR,
ERROROFFSET,
ADDR (TABLES),
RESULTPTR);
of course, if you want for example all parameters to be passed by value - just
to have the same look and feel for all of them - this is perfectly simple.
To have all of them passed by reference, you can do this, too, if the wrapper
function takes care of that.
Kind regards
Bernd
Am 24.02.2014 02:31, schrieb D.J.:
> Hello, all.
>
> My brain is failing me today...
>
> I have a routine, coded in C that is defined like this:
>
> PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION COMPILE8
> (const char *pattern,
> int options,
> const char **errorptr,
> int *erroroffset,
> const unsigned char *tables)
>
> How would I map this to the equivalent PL/I call statement? The
> environment is IBM's z/OS with Enterprise PL/I.
>
> Thanks and have a good one, too.
>
> DJ
|