TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Simon Ewins
from: Mike Bilow
date: 1995-07-23 16:11:12
subject: C .DLLs, REXX and stems

Simon Ewins wrote in a message to All:

 SE> I have been experimenting with some .DLL stuff I've written
 SE> in C that is callable by REXX programs. I have got the
 SE> passing of simple variables back and forth working fine but
 SE> I can't seem to find any information anywhere on parsing a
 SE> stem. variable passed to C or passing a character array back
 SE> to REXX as a stem. variable.

 SE> Can anyone either tell me how this is accomplished (if it is
 SE> simple enough to explain here) or point me at the correct
 SE> book or datafile?

The OS/2 Toolkit has some REXX interface samples, including source code for
things like REXXUTIL.DLL.  (If you have the Watcom compiler, these are in
\watcom\samples\toolkt2x\rexx.)  The code for SysFileSearch() in REXXUTIL.C
contains pretty clear information about how to do this.


In REXXSAA.H:

/***    Structure for external interface string (RXSTRING) */

typedef struct _RXSTRING {          /* rxstr */
        ULONG  strlength;           /*   length of string         */
        PCH    strptr;              /*   pointer to string        */
}  RXSTRING;

typedef RXSTRING     *PRXSTRING;       /* pointer to a RXSTRING      */


/***    Structure of Shared Variable Request Block (SHVBLOCK) */

typedef struct _SHVBLOCK {            /* shvb */
    struct _SHVBLOCK  *shvnext;       /* pointer to the next block   */
    RXSTRING           shvname;       /* Pointer to the name buffer  */
    RXSTRING           shvvalue;      /* Pointer to the value buffer */
    ULONG              shvnamelen;    /* Length of the name value    */
    ULONG              shvvaluelen;   /* Length of the fetch value   */
    UCHAR              shvcode;       /* Function code for this block*/
    UCHAR              shvret;        /* Individual Return Code Flags*/
}   SHVBLOCK;

typedef SHVBLOCK *PSHVBLOCK;


In REXXUTIL.C:

/*********************************************************************/
/* RxStemData                                                        */
/*   Structure which describes as generic                            */
/*   stem variable.                                                  */
/*********************************************************************/

typedef struct RxStemData {
    SHVBLOCK shvb;                     /* Request block for RxVar    */
    CHAR ibuf[IBUF_LEN];               /* Input buffer               */
    CHAR varname[MAX];                 /* Buffer for the variable    */
                                       /* name                       */
    CHAR stemname[MAX];                /* Buffer for the variable    */
                                       /* name                       */
    ULONG stemlen;                     /* Length of stem.            */
    ULONG vlen;                        /* Length of variable value   */
    ULONG j;                           /* Temp counter               */
    ULONG tlong;                       /* Temp counter               */
    ULONG count;                       /* Number of elements         */
                                       /* processed                  */
} RXSTEMDATA;

 
-- Mike


---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 323/107 150 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.