Claude Heiland-Allen wrote:
In pdlua I used some preprocessor magic similar to this, not sure how it compares to the zexy/iemlibs magic but I guess it's roughly the same:
actually it is amazingly the same: #if (defined __x86_64__) && (defined PD_MAJOR_VERSION && defined PD_MINOR_VERSION) && (PD_MAJOR_VERSION > 0 || PD_MINOR_VERSION > 41) # define zarray_t t_word # define zarray_getarray garray_getfloatwords # define zarray_getfloat(pointer, index) (pointer[index].w_float) #else # define zarray_t t_float # define zarray_getarray garray_getfloatarray # define zarray_getfloat(pointer, index) (pointer[index]) #endif
#if PD_MAJOR_VERSION == 0 # if PD_MINOR_VERSION >= 41 /* use new garray support that is 64-bit safe */ # define PDLUA_ARRAYGRAB garray_getfloatwords # define PDLUA_ARRAYTYPE t_word # define PDLUA_ARRAYELEM(arr,idx) ((arr)[(idx)].w_float) # else /* use old garray support, not 64-bit safe */ # define PDLUA_ARRAYGRAB garray_getfloatarray # define PDLUA_ARRAYTYPE t_float # define PDLUA_ARRAYELEM(arr,idx) ((arr)[(idx)]) # endif #endif
it's so strikingly similar that i even wondered whether i had copied the code from you (but honestly, i cannot remember having done so).
apart from that, why do you explicitely not support PD_MAJOR_VERSION!=0?
mgfa.sdr IOhannes