Hello,

I'm still trying to port the template engine ClearSilver to the ILE C and am having some problems. For some I have got a workaround though not yet tested.

Here are my workarounds (or the things I hadn't a workaround for):

- no lrand48, drand48, srand48
#define srand48(s) srand(s)
#define drand48() (((double)rand())/((double)RAND_MAX))
#define lrand48() rand()

- no wait3() in ILE C but waitpid()
#define wait3(stat_loc, options, rusage) waitpid(-1, stat_loc, options)

- no killpg() in ILE C but kill() seems to also does the job. the given pid can also be a pid for a process group.
#define killpg(pid, sig) kill(pid, sig)

- no tzset because time calc gets time zone from job locale => remove call

- no lockf(): dropped the idea of using fcntl() because it uses only advisary locks() and flags , no real locking => no easy workaround

- __VA_ARGS__ : Perhaps you can add to your FAQ section on the porting website on ibm.com that __VA_ARGS__ is not behaving like on Unix/Linux .It seems that in C99 you don't have to pass a variable argument at all and in ILE C you have to pass at least one variable argument.

- string functions: some function definitions seem to be in strings.h instead of string.h
#define __cplusplus__strings__
#include <strings.h>

- for some functions the following is needed:
#define _XOPEN_SOURCE 520


I am no C programmer and as I yet had no chance to test these workarounds it would be nice if you could give some advice or comment on these.

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
{
int error;
int err_stack;
int flags;
char desc[256];
const char *file;
const char *func;
int lineno;
/* 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?

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;
char *s;
long int n;
int alloc;
struct _funct *function;
struct _macro *macro;
struct _arg *expr1;
struct _arg *expr2;
struct _arg *next;
} CSARG;

How would I define the CSTOKEN_TYPE subfield in an RPG data structure?

Thanx in advance for your time and any help.

Regards

Mihael Schmidt
Anwendungsentwicklung

Dirk Rossmann GmbH
Iserhägener Str.16
30938 Burgwedel
* +49 (05139) 898 - 4353

Handelsregister-Nr. HRB 120546, Amtsgericht Hannover
Ust-Id-Nr. DE 115055186
St.-Nr. 16 / 205 / 65401
Geschäftsführer: Dirk Roßmann, Alice Schardt-Roßmann, Roland Frobel, Klaus Praus


This thread ...


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

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].