× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Schmidt, Mihael wrote:
...
Also I am standing before the task of creating procedure prototypes
for RPG and am having some difficulties, especially with the data
structures.

typedef struct _neo_err
{
...
/* internal use only */
struct _neo_err *next;
} NEOERR;
Here the structure has a subfield with the type of itself ( struct
_neo_err *next). AFAIK this is not possible in RPG. Is there a workaround?

RPG doesn't have typed pointers, so you would just define next as a pointer.

D neoerr1 ds likeds(NEOERR)
D based(pNeoerr1)

pNeoerr1 = address of the first structure;
dow pNeoerr1 <> *null;
--- work with neoerr1 ---
pNeoerr1 = neoerr1.next;
enddo;


typedef enum
{
/* Unary operators */
CS_OP_NONE = (1<<0),
CS_OP_EXISTS = (1<<1),
CS_OP_NOT = (1<<2),
CS_OP_NUM = (1<<3), ...

} CSTOKEN_TYPE;
typedef struct _arg
{
CSTOKEN_TYPE op_type;
char *argexpr;
...
} CSARG;
How would I define the CSTOKEN_TYPE subfield in an RPG data structure?


The actual type of an C enum depends on your compile options (ENUM parameter) and on the enum values. Compile the C version of the enum and struct with OPTION(*AGR *XREF) and find out the size and type that C is using for the enum and subfield. It will be either 1, 2, 4, 8 byte integer or unsigned, that will map to one of RPG's 3i, 5i,10i, 20i, 3u, 5u, 10u or 20u.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.