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
- 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
const char *file;
const char *func;
/* internal use only */
struct _neo_err *next;
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?
/* Unary operators */
CS_OP_NONE = (1<<0),
CS_OP_EXISTS = (1<<1),
CS_OP_NOT = (1<<2),
CS_OP_NUM = (1<<3),
typedef struct _arg
long int n;
struct _funct *function;
struct _macro *macro;
struct _arg *expr1;
struct _arg *expr2;
struct _arg *next;
How would I define the CSTOKEN_TYPE subfield in an RPG data structure?
Thanx in advance for your time and any help.
Dirk Rossmann GmbH
* +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