~ubuntu-branches/ubuntu/trusty/pdl/trusty-proposed

« back to all changes in this revision

Viewing changes to Basic/Core/pdl.h.PL

  • Committer: Package Import Robot
  • Author(s): Henning Glawe
  • Date: 2013-11-11 13:34:09 UTC
  • mfrom: (2.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20131111133409-kjib7wtpms3kwusg
Tags: 1:2.007-2
* successfully built with gcc 4.8 (closes: #701335, #713346)
* add build log evalution helpers to source package: extract
  test suite output from buildlog, cross-refernce test/subtest
  failures between architectures
* use shell to join stderr into stdout while running test suite
* fix Dumper.pm on kfreebsd: 'gnukfreebsd' was assumed as a bsd
  userland, which disabled/broke calls to 'uuencode' and 'uudecode'
* fix debian/filter-test.pl, which cut the test log too early
  due to a too-unspecific regex
* prefer F77Conf over ExtUtils::F77 in t/flexraw_fortran.t in order
  to prevent test failures on kfreebsd* and hurd*

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
#define PDL_ITRANS_VAFFINEVALID 0x2000
226
226
#define PDL_ITRANS_NONMUTUAL 0x4000  /* flag for destruction */
227
227
 
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
231
 
 virtual parent. */
232
 
 
233
 
#ifdef _MSC_VER
 
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
 
234
// instantiated
 
235
 
 
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
 
239
// virtual parent.
 
240
 
 
241
#define PDL_TRANS_START_COMMON                                          \
 
242
  int magicno;                                                          \
 
243
  short flags;                                                          \
 
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 */ \
 
248
  int has_badvalue;                                                     \
 
249
  double badvalue;                                                      \
 
250
  int __datatype
 
251
 
234
252
#define PDL_TRANS_START(np) \
235
 
        int magicno; \
236
 
        short flags; \
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 */ \
242
 
        int has_badvalue; \
243
 
        double badvalue; \
244
 
        int __datatype
245
 
 
 
253
  PDL_TRANS_START_COMMON; \
 
254
  /* The pdls involved in the transformation */ \
 
255
  pdl *pdls[np]
 
256
 
 
257
#define PDL_TRANS_START_FLEXIBLE() \
 
258
  PDL_TRANS_START_COMMON; \
 
259
  /* The pdls involved in the transformation */ \
 
260
  pdl *pdls[]
 
261
 
 
262
#ifdef PDL_DEBUGGING
 
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
246
264
#else
247
 
#define PDL_TRANS_START(np) \
248
 
        int magicno; \
249
 
        short flags; \
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 */ \
255
 
        int has_badvalue; \
256
 
        double badvalue; \
257
 
        int __datatype
258
 
 
 
265
#define PDL_CHKMAGIC_GENERAL(it,this_magic,type)
259
266
#endif
260
267
 
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
264
 
#ifdef PDL_DEBUGGING
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
266
 
#else
267
 
#define PDL_TR_CHKMAGIC(it)
268
 
#endif
269
 
 
270
 
 
 
271
#define PDL_TR_CHKMAGIC(it) PDL_CHKMAGIC_GENERAL(it, PDL_TR_MAGICNO, "TRANS ")
 
272
 
 
273
 
 
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 {
272
 
        PDL_TRANS_START(1);
 
278
  PDL_TRANS_START_FLEXIBLE();
273
279
} ;
274
280
 
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;
280
286
 
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;
285
291
        int ndims;
286
 
        PDL_Long def_incs[PDL_NDIMS];
 
292
        PDL_Indx def_incs[PDL_NDIMS];
287
293
        pdl *from;
288
294
} pdl_vaffine;
289
295
 
321
327
 
322
328
struct pdl {
323
329
#define PDL_MAGICNO 0x24645399
324
 
#ifdef PDL_DEBUGGING
325
 
#define PDL_CHKMAGIC(it) if(it->magicno != PDL_MAGICNO) croak("INVALID MAGIC NO %d %d\n",it,it->magicno); else 0
326
 
#else
327
 
#define PDL_CHKMAGIC(it)
328
 
#endif
 
330
#define PDL_CHKMAGIC(it) PDL_CHKMAGIC_GENERAL(it,PDL_MAGICNO,"")
329
331
   unsigned long magicno; /* Always stores PDL_MAGICNO as a sanity check */
330
332
     /* This is first so most pointer accesses to wrong type are caught */
331
333
   int state;        /* What's in this pdl */
351
353
   double badvalue;
352
354
   int has_badvalue;    /* required by pdlapi.c */
353
355
 
354
 
   int nvals;           /* How many values allocated */
 
356
   PDL_Indx nvals;              /* How many values allocated */
355
357
   int datatype;
356
 
   PDL_Long   *dims;      /* Array of data dimensions */
357
 
   PDL_Long   *dimincs;   /* Array of data default increments */
 
358
   PDL_Indx   *dims;      /* Array of data dimensions */
 
359
   PDL_Indx   *dimincs;   /* Array of data default increments */
358
360
   short    ndims;     /* Number of data dimensions */
359
361
 
360
362
   unsigned char *threadids;  /* Starting index of the thread index set n */
381
383
#define PDL_LIVINGFOR_FAMILY_SRCFORMUTATION  0x0008
382
384
   short living_for; /* perl side not referenced; delete me when */
383
385
 
384
 
   PDL_Long   def_dims[PDL_NDIMS];   /* Preallocated space for efficiency */
385
 
   PDL_Long   def_dimincs[PDL_NDIMS];   /* Preallocated space for efficiency */
 
386
   PDL_Indx   def_dims[PDL_NDIMS];   /* Preallocated space for efficiency */
 
387
   PDL_Indx   def_dimincs[PDL_NDIMS];   /* Preallocated space for efficiency */
386
388
   unsigned char def_threadids[PDL_NTHREADIDS];
387
389
 
388
390
   struct pdl_magic *magic;
416
418
#define ABORT_RECURSE_GUARD __nrec=0;
417
419
#define END_RECURSE_GUARD __nrec--;
418
420
 
419
 
#define PDL_ENSURE_ALLOCATED(it) ((it->state & PDL_ALLOCATED) ||  \
420
 
                                        ((pdl_allocdata(it)),1))
 
421
#define PDL_ENSURE_ALLOCATED(it) ( (void)((it->state & PDL_ALLOCATED) || ((pdl_allocdata(it)),1)) )
421
422
#define PDL_ENSURE_VAFFTRANS(it) \
422
423
  ( ((!it->vafftrans) || (it->vafftrans->ndims < it->ndims)) && \
423
424
    (pdl_vafftrans_alloc(it),1) )