It just came to my mind that you can do the same thing in PL/1,
if you pass Pointers BYVALUE and treat the pointers in the same way
as I did it in my C example.

I often did this (passing Pointers BYVALUE from PL/1 modules),
when there was the need to call C modules from PL/1 programs
and no other definition of the C ENTRY was appropriate.

for example:

DCL YCSPXML ENTRY (PTR BYVALUE,
                   PTR BYVALUE,
                   PTR BYVALUE,
                   PTR BYVALUE,
                   PTR BYVALUE,
                   PTR BYVALUE)
            OPTIONS (ASM RETCODE);

in fact, it is a C program, returning an int (the retcode).

Kind regards

Bernd




-------- Original-Nachricht --------
Betreff:        Fwd: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
Datum:  Tue, 10 Apr 2012 23:26:51 +0200
Von:    Bernd Oppolzer <bernd.oppol...@t-online.de>
Antwort an:     IBM Mainframe Discussion List <IBM-MAIN@bama.ua.edu>
An:     IBM-MAIN@bama.ua.edu
Newsgruppen:    bit.listserv.ibm-main
Referenzen:     <4f84a4db.8080...@t-online.de>



Sorry, the ! should be a |

bitwise or operator in C

I mixed up bitwise or in C with logical or in PL/1

Kind regards

Bernd




-------- Original-Nachricht --------
Betreff:        Re: PL/I with variable PLISTs (was: LE C calling HLASM)
Datum:  Tue, 10 Apr 2012 23:23:39 +0200
Von:    Bernd Oppolzer<bernd.oppol...@t-online.de>
An:     IBM Mainframe Discussion List<IBM-MAIN@bama.ua.edu>



I don't know if it helps you, but using C I would code the two calls
this way:

rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer,&outputlength);


Note that the parameters that are probably integers are prefixed with an
ampersand
to pass the addresses.

If it is needed that the 3rd and the 5th address has the high order bit
set,
you can to this in C, too. I would use a macro called HIGHBITON (x), for
example,
which is coded as follows:

#define HIGHBITON(x)  (void *)((unsigned int)(x) ! 0x80000000)

So we have


rc = THEFUNCTION (&magic, inputbuffer, HIGHBITON(&inputlength), NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer, 
HIGHBITON(&outputlength));


The two additional NULL parameters after the 3rd address in the first
case do no harm.

Kind regards

Bernd



Am 10.04.2012 23:11, schrieb Phil Smith:
  Steve Comstock wrote:
  Slipperier and slipperier. OK, let's try a different approach:
  You tell me exactly what you want to see from the PL/I routine calling
  your API and I'll see if I can cause PL/I to construct that.
  In other words, your routine will see
  (R1) ->    ????????
  rc = THEFUNCTION(magic,inputbuffer,inputlength)

  (R1) ==>    A(magic),A(inputbuffer),A(inputlength)<== high bit set on the 
third fullword

  OR (the fully specified case):

  rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

  (R1) ==>    
A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength)<== high bit 
set on the fifth fullword

  Pretty standard, yes?

  ----------------------------------------------------------------------
  For IBM-MAIN subscribe / signoff / archive access instructions,
  send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to