pdlapi.c (PDL-2.075) | : | pdlapi.c (PDL-2.076) | ||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
#include "pdl.h" /* Data structure declarations */ | #include "pdl.h" /* Data structure declarations */ | |||
#include "pdlcore.h" /* Core declarations */ | #include "pdlcore.h" /* Core declarations */ | |||
#define VTABLE_OR_DEFAULT(what, trans, func, default_func) \ | #define VTABLE_OR_DEFAULT(what, trans, func, default_func) \ | |||
what(PDL_err, ((trans)->vtable->func \ | what(PDL_err, ((trans)->vtable->func \ | |||
? (trans)->vtable->func \ | ? (trans)->vtable->func \ | |||
: pdl_ ## default_func)(trans)) | : pdl_ ## default_func)(trans)) | |||
#define REDODIMS(what, trans) do { \ | #define REDODIMS(what, trans) do { \ | |||
if (trans->dims_redone) { \ | ||||
FREETRANS(trans, 0); \ | ||||
if (PDL_err.error) return PDL_err; \ | ||||
trans->dims_redone = 0; \ | ||||
} \ | ||||
if ((trans)->vtable->redodims) \ | if ((trans)->vtable->redodims) \ | |||
what(PDL_err, pdl_dim_checks( \ | what(PDL_err, pdl_dim_checks( \ | |||
(trans)->vtable, (trans)->pdls, \ | (trans)->vtable, (trans)->pdls, \ | |||
NULL, NULL, \ | NULL, NULL, \ | |||
(trans)->ind_sizes, 1)); \ | (trans)->ind_sizes, 1)); \ | |||
if (trans->dims_redone) { \ | ||||
FREETRANS(trans, 0); \ | ||||
if (PDL_err.error) return PDL_err; \ | ||||
trans->dims_redone = 0; \ | ||||
} \ | ||||
what(PDL_err, ((trans)->vtable->redodims \ | what(PDL_err, ((trans)->vtable->redodims \ | |||
? (trans)->vtable->redodims \ | ? (trans)->vtable->redodims \ | |||
: pdl_redodims_default)(trans)); \ | : pdl_redodims_default)(trans)); \ | |||
} while (0) | } while (0) | |||
#define READDATA(trans) VTABLE_OR_DEFAULT(PDL_ACCUMERROR, trans, readdata, readd ata_affine) | #define READDATA(trans) VTABLE_OR_DEFAULT(PDL_ACCUMERROR, trans, readdata, readd ata_affine) | |||
#define WRITEDATA(trans) VTABLE_OR_DEFAULT(PDL_ACCUMERROR, trans, writebackdata, writebackdata_affine) | #define WRITEDATA(trans) VTABLE_OR_DEFAULT(PDL_ACCUMERROR, trans, writebackdata, writebackdata_affine) | |||
#define FREETRANS(trans, destroy) \ | #define FREETRANS(trans, destroy) \ | |||
if(trans->vtable->freetrans) { \ | if(trans->vtable->freetrans) { \ | |||
PDLDEBUG_f(printf("call freetrans\n")); \ | PDLDEBUG_f(printf("call freetrans\n")); \ | |||
PDL_err = trans->vtable->freetrans(trans, destroy); \ | PDL_ACCUMERROR(PDL_err, trans->vtable->freetrans(trans, destroy)); \ | |||
/* ignore error for now as need to still free rest */ \ | /* ignore error for now as need to still free rest */ \ | |||
if (destroy) PDL_CLRMAGIC(trans); \ | if (destroy) PDL_CLRMAGIC(trans); \ | |||
} | } | |||
#define CHANGED(...) \ | #define CHANGED(...) \ | |||
PDL_ACCUMERROR(PDL_err, pdl_changed(__VA_ARGS__)) | PDL_ACCUMERROR(PDL_err, pdl_changed(__VA_ARGS__)) | |||
extern Core PDL; | extern Core PDL; | |||
/* Make sure transformation is done */ | /* Make sure transformation is done */ | |||
pdl_error pdl__ensure_trans(pdl_trans *trans,int what,int *wd) | pdl_error pdl__ensure_trans(pdl_trans *trans,int what,int *wd) | |||
skipping to change at line 60 | skipping to change at line 60 | |||
if(VAFFINE_FLAG_OK(vtable->per_pdl_flags,j)) | if(VAFFINE_FLAG_OK(vtable->per_pdl_flags,j)) | |||
par_pvaf++; | par_pvaf++; | |||
PDL_RETERROR(PDL_err, pdl_make_physvaffine(trans->pdls[j])); | PDL_RETERROR(PDL_err, pdl_make_physvaffine(trans->pdls[j])); | |||
} | } | |||
for(; j<vtable->npdls; j++) { | for(; j<vtable->npdls; j++) { | |||
if(VAFFINE_FLAG_OK(vtable->per_pdl_flags,j)) | if(VAFFINE_FLAG_OK(vtable->per_pdl_flags,j)) | |||
par_pvaf++; | par_pvaf++; | |||
PDL_RETERROR(PDL_err, pdl_make_physvaffine(trans->pdls[j])); | PDL_RETERROR(PDL_err, pdl_make_physvaffine(trans->pdls[j])); | |||
flag |= trans->pdls[j]->state & PDL_ANYCHANGED; | flag |= trans->pdls[j]->state & PDL_ANYCHANGED; | |||
} | } | |||
if (flag & PDL_PARENTDIMSCHANGED) REDODIMS(PDL_ACCUMERROR, trans); | if (flag & PDL_PARENTDIMSCHANGED) REDODIMS(PDL_RETERROR, trans); | |||
for(j=0; j<vtable->npdls; j++) | for(j=0; j<vtable->npdls; j++) | |||
if(trans->pdls[j]->trans_parent == trans) | if(trans->pdls[j]->trans_parent == trans) | |||
PDL_ENSURE_ALLOCATED(trans->pdls[j]); | PDL_ENSURE_ALLOCATED(trans->pdls[j]); | |||
if(flag & (PDL_PARENTDATACHANGED | PDL_PARENTDIMSCHANGED)) { | if(flag & (PDL_PARENTDATACHANGED | PDL_PARENTDIMSCHANGED)) { | |||
if(par_pvaf && (trans->flags & PDL_ITRANS_ISAFFINE)) { | if(par_pvaf && (trans->flags & PDL_ITRANS_ISAFFINE)) { | |||
/* Attention: this assumes affine = p2child */ | /* Attention: this assumes affine = p2child */ | |||
/* need to signal that redodims has already been called */ | /* need to signal that redodims has already been called */ | |||
trans->pdls[1]->state &= ~PDL_PARENTDIMSCHANGED; | trans->pdls[1]->state &= ~PDL_PARENTDIMSCHANGED; | |||
PDL_RETERROR(PDL_err, pdl_make_physvaffine(trans->pdls[1] )); | PDL_RETERROR(PDL_err, pdl_make_physvaffine(trans->pdls[1] )); | |||
PDL_ACCUMERROR(PDL_err, pdl_readdata_vaffine(trans->pdls[ 1])); | PDL_ACCUMERROR(PDL_err, pdl_readdata_vaffine(trans->pdls[ 1])); | |||
skipping to change at line 390 | skipping to change at line 390 | |||
PDL_DECL_CHILDLOOP(it); | PDL_DECL_CHILDLOOP(it); | |||
PDL_CHKMAGIC(it); | PDL_CHKMAGIC(it); | |||
PDLDEBUG_f(printf("pdl_destroy %p\n",(void*)it)); | PDLDEBUG_f(printf("pdl_destroy %p\n",(void*)it)); | |||
if(it->state & PDL_DESTROYING) { | if(it->state & PDL_DESTROYING) { | |||
PDLDEBUG_f(printf(" already destroying, returning\n")); | PDLDEBUG_f(printf(" already destroying, returning\n")); | |||
return PDL_err; | return PDL_err; | |||
} | } | |||
it->state |= PDL_DESTROYING; | it->state |= PDL_DESTROYING; | |||
/* Clear the sv field so that there will be no dangling ptrs */ | /* Clear the sv field so that there will be no dangling ptrs */ | |||
if(it->sv) { | if(it->sv) { | |||
SvOBJECT_off((SV *)it->sv); | ||||
sv_setiv(it->sv,0x4242); | sv_setiv(it->sv,0x4242); | |||
it->sv = NULL; | it->sv = NULL; | |||
} | } | |||
/* 1. count the trans_children that do flow */ | /* 1. count the trans_children that do flow */ | |||
PDL_START_CHILDLOOP(it) | PDL_START_CHILDLOOP(it) | |||
pdl_trans *curt = PDL_CHILDLOOP_THISCHILD(it); | pdl_trans *curt = PDL_CHILDLOOP_THISCHILD(it); | |||
if(curt->flags & PDL_ITRANS_DO_DATAFLOW_F) | if(curt->flags & PDL_ITRANS_DO_DATAFLOW_F) | |||
nforw ++; | nforw ++; | |||
if(curt->flags & PDL_ITRANS_DO_DATAFLOW_B) | if(curt->flags & PDL_ITRANS_DO_DATAFLOW_B) | |||
skipping to change at line 644 | skipping to change at line 645 | |||
PDL_Indx i; | PDL_Indx i; | |||
pdl_transvtable *vtable = trans->vtable; | pdl_transvtable *vtable = trans->vtable; | |||
/* Then, set our children. This is: */ | /* Then, set our children. This is: */ | |||
/* First, determine whether any of our children already have | /* First, determine whether any of our children already have | |||
* a parent, and whether they need to be updated. If this is | * a parent, and whether they need to be updated. If this is | |||
* the case, we need to do some thinking. */ | * the case, we need to do some thinking. */ | |||
for(i=0; i<vtable->nparents; i++) { | for(i=0; i<vtable->nparents; i++) { | |||
int state = trans->pdls[i]->state; | int state = trans->pdls[i]->state; | |||
if (state & PDL_NOMYDIMS) | if (state & PDL_NOMYDIMS) | |||
return pdl_make_error(PDL_EUSERERROR, | return pdl_make_error(PDL_EUSERERROR, | |||
"Error in %s: input parameter '%s' is null\n", | "Error in %s: input parameter '%s' is null", | |||
vtable->name, vtable->par_names[i] | vtable->name, vtable->par_names[i] | |||
); | ); | |||
if(state & PDL_DATAFLOW_ANY) pfflag++; | if(state & PDL_DATAFLOW_ANY) pfflag++; | |||
} | } | |||
for(; i<vtable->npdls; i++) { | for(; i<vtable->npdls; i++) { | |||
/* If children are flowing, croak. It's too difficult to handle properly */ | /* If children are flowing, croak. It's too difficult to handle properly */ | |||
if(trans->pdls[i]->state & PDL_DATAFLOW_ANY) | if(trans->pdls[i]->state & PDL_DATAFLOW_ANY) | |||
return pdl_make_error_simple(PDL_EUSERERROR, "Sorry, cannot flowing famil ies right now\n"); | return pdl_make_error_simple(PDL_EUSERERROR, "Sorry, cannot flowing famil ies right now\n"); | |||
/* Same, if children have trans yet parents are flowing */ | /* Same, if children have trans yet parents are flowing */ | |||
if(trans->pdls[i]->trans_parent && pfflag) | if(trans->pdls[i]->trans_parent && pfflag) | |||
End of changes. 6 change blocks. | ||||
8 lines changed or deleted | 9 lines changed or added |