225
225
#define PDL_ITRANS_VAFFINEVALID 0x2000
226
226
#define PDL_ITRANS_NONMUTUAL 0x4000 /* flag for destruction */
228
/* vparent is the "virtual parent" which is either
229
the parent or grandparent or whatever. The trans -structure must store
230
both the relationship with our current parent and, if necessary, the
228
// These define struct pdl_trans and all derived structures. There are many
229
// structures that defined in other parts of the code that can be referenced
230
// like a pdl_trans* because all of these structures have the same pdl_trans
231
// initial piece. These structures can contain multiple pdl* elements in them.
232
// Thus pdl_trans itself ends with a flexible pdl*[] array, which can be used to
233
// reference any number of pdl objects. As a result pdl_trans itself can NOT be
236
// vparent is the "virtual parent" which is either
237
// the parent or grandparent or whatever. The trans -structure must store
238
// both the relationship with our current parent and, if necessary, the
241
#define PDL_TRANS_START_COMMON \
244
pdl_transvtable *vtable; \
245
void (*freeproc)(struct pdl_trans *); /* Call to free this \
246
(means whether malloced or not) */ \
247
int bvalflag; /* required for binary compatability even if WITH_BADVAL=0 */ \
234
252
#define PDL_TRANS_START(np) \
237
pdl_transvtable *vtable; \
238
void (*freeproc)(struct pdl_trans *); /* Call to free this \
239
(means whether malloced or not) */ \
240
pdl *pdls[np ? np : 1]; /* The pdls involved in the transformation */ \
241
int bvalflag; /* required for binary compatability even if WITH_BADVAL=0 */ \
253
PDL_TRANS_START_COMMON; \
254
/* The pdls involved in the transformation */ \
257
#define PDL_TRANS_START_FLEXIBLE() \
258
PDL_TRANS_START_COMMON; \
259
/* The pdls involved in the transformation */ \
263
#define PDL_CHKMAGIC_GENERAL(it,this_magic,type) if((it)->magicno != this_magic) croak("INVALID " #type "MAGIC NO 0x%p %d\n",it,(int)((it)->magicno)); else (void)0
247
#define PDL_TRANS_START(np) \
250
pdl_transvtable *vtable; \
251
void (*freeproc)(struct pdl_trans *); /* Call to free this \
252
(means whether malloced or not) */ \
253
pdl *pdls[np]; /* The pdls involved in the transformation */ \
254
int bvalflag; /* required for binary compatability even if WITH_BADVAL=0 */ \
265
#define PDL_CHKMAGIC_GENERAL(it,this_magic,type)
261
268
#define PDL_TR_MAGICNO 0x91827364
262
269
#define PDL_TR_SETMAGIC(it) it->magicno = PDL_TR_MAGICNO
263
270
#define PDL_TR_CLRMAGIC(it) it->magicno = 0x99876134
265
#define PDL_TR_CHKMAGIC(it) if(it->magicno != PDL_TR_MAGICNO) croak("INVALID TRANS MAGIC NO %d %d\n",it,it->magicno); else 0
267
#define PDL_TR_CHKMAGIC(it)
271
#define PDL_TR_CHKMAGIC(it) PDL_CHKMAGIC_GENERAL(it, PDL_TR_MAGICNO, "TRANS ")
274
// This is a generic parent of all the trans structures. It is a flexible array
275
// (can store an arbitrary number of pdl objects). Thus this can NOT be
276
// instantiated, only "child" structures can
271
277
struct pdl_trans {
278
PDL_TRANS_START_FLEXIBLE();
275
281
typedef struct pdl_trans_affine {
276
282
PDL_TRANS_START(2);
277
283
/* affine relation to parent */
278
PDL_Long *incs; PDL_Long offs;
284
PDL_Indx *incs; PDL_Indx offs;
279
285
} pdl_trans_affine;
281
287
/* Need to make compatible with pdl_trans_affine */
282
288
typedef struct pdl_vaffine {
283
289
PDL_TRANS_START(2);
284
PDL_Long *incs; PDL_Long offs;
290
PDL_Indx *incs; PDL_Indx offs;
286
PDL_Long def_incs[PDL_NDIMS];
292
PDL_Indx def_incs[PDL_NDIMS];