Skip to content

Commit

Permalink
add Par flag to allow input null - #511
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Dec 26, 2024
1 parent e38feb4 commit 637be67
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/PDL/Core/pdl.h.PL
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ typedef struct pdl_transvtable {
#define PDL_PARAM_ISPHYS (1 << 9)
#define PDL_PARAM_ISIGNORE (1 << 10)
#define PDL_PARAM_ISNOTCOMPLEX (1 << 11)
#define PDL_PARAM_ALLOW_NULL (1 << 12)
#define PDL_LIST_FLAGS_PARAMS(X) \
X(PDL_PARAM_ISREAL) \
Expand All @@ -408,7 +409,8 @@ typedef struct pdl_transvtable {
X(PDL_PARAM_ISWRITE) \
X(PDL_PARAM_ISPHYS) \
X(PDL_PARAM_ISIGNORE) \
X(PDL_PARAM_ISNOTCOMPLEX)
X(PDL_PARAM_ISNOTCOMPLEX) \
X(PDL_PARAM_ALLOW_NULL)
/* All trans must start with this */
Expand Down
2 changes: 1 addition & 1 deletion lib/PDL/Core/pdlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ static inline pdl_error pdl_trans_flow_null_checks(pdl_trans *trans, char *disab
pdl *parent = trans->pdls[i];
if (_trans_forward_only(parent))
input_forward_only = 1;
if (parent->state & PDL_NOMYDIMS)
if (parent->state & PDL_NOMYDIMS && !(vtable->par_flags[i] & PDL_PARAM_ALLOW_NULL))
return pdl_make_error(PDL_EUSERERROR,
"Error in %s: input parameter '%s' is null",
vtable->name, vtable->par_names[i]
Expand Down
2 changes: 1 addition & 1 deletion lib/PDL/Core/pdlconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static char pdl_converttypei_vtable_flags[] = { 0, 0 }; /*CORE21*/
static PDL_Indx pdl_converttypei_vtable_realdims[] = { 0, 0 };
static char *pdl_converttypei_vtable_parnames[] = { "PARENT","CHILD" };
static short pdl_converttypei_vtable_parflags[] = {
PDL_PARAM_ISPHYS,
PDL_PARAM_ALLOW_NULL|PDL_PARAM_ISPHYS,
PDL_PARAM_ISCREAT|PDL_PARAM_ISCREATEALWAYS|PDL_PARAM_ISIGNORE|PDL_PARAM_ISOUT|PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE
};
static pdl_datatypes pdl_converttypei_vtable_partypes[] = { -1, -1 };
Expand Down

0 comments on commit 637be67

Please sign in to comment.