Skip to content

Commit

Permalink
tidy generate_core_flags, doc undoc-ed funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jan 20, 2024
1 parent 99698b8 commit 334bc22
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 8 deletions.
57 changes: 53 additions & 4 deletions Basic/Core/Core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,18 @@ sub PDL::flows {
return ($this->fflows || $this->bflows);
}

=head2 fflows
=for ref
Returns whether the ndarray's C<PDL_DATAFLOW_F> flag is set.
=head2 bflows
=for ref
Returns whether the ndarray's C<PDL_DATAFLOW_B> flag is set.
=head2 new
=for ref
Expand Down Expand Up @@ -2102,12 +2114,49 @@ sub alltopdl {
return $_[0]->new($_[1]);
0;}

=head2 tracedebug
=for ref
Sets whether an ndarray will have debugging info printed during use if a
(Boolean) value is given. Returns the new value.
=head2 donttouch
=for ref
Returns whether the ndarray's C<PDL_DONTTOUCHDATA> flag is set.
=head2 allocated
=for ref
Returns whether the ndarray's C<PDL_ALLOCATED> flag is set.
=head2 vaffine
=for ref
Returns whether the ndarray's C<PDL_OPT_VAFFTRANSOK> flag is set.
=head2 anychgd
=for ref
Returns whether the ndarray's C<PDL_ANYCHANGED> flag is set.
=head2 dimschgd
=for ref
Returns whether the ndarray's C<PDL_PARENTDIMSCHANGED> flag is set.
=head2 inplace
=for ref
Flag an ndarray so that the next operation is done 'in place'
Flag an ndarray so that the next operation is done 'in place', returning
the ndarray.
=for usage
Expand Down Expand Up @@ -2144,12 +2193,12 @@ sub PDL::inplace {

# Copy if not inplace


=head2 is_inplace
=for ref
Test the in-place flag on an ndarray
Sets whether an ndarray will operate "in-place" for the next operation
if a (Boolean) value is given. Returns the old value.
=for usage
Expand Down Expand Up @@ -2964,7 +3013,7 @@ Convert ndarray indices to perl list
@tmp = listindices $x;
C<@tmp> now contains the values C<0..nelem($x)>.
C<@tmp> now contains the values C<0..nelem($x)-1>.
Obviously this is grossly inefficient for the large datasets PDL is designed to
handle. This was provided as a get out while PDL matured. It should now be mostly
Expand Down
8 changes: 4 additions & 4 deletions Basic/Core/Dev.pm
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ my %flags = (
vaffine => { FLAG => "OPT_VAFFTRANSOK" },
anychgd => { FLAG => "ANYCHANGED" },
dimschgd => { FLAG => "PARENTDIMSCHANGED" },
tracedebug => { set => 1},
tracedebug => { set => 1 },
);

sub generate_core_flags {
Expand All @@ -500,11 +500,11 @@ sub generate_core_flags {
foreach my $name ( sort keys %flags ) {
my $flag = "PDL_" . ($flags{$name}{FLAG} || uc($name));
my $with_mode = $flags{$name}{set} || $flags{$name}{postset};
printf <<'EOF', $name, ($with_mode ? ",mode=0" : ''), ($with_mode ? " int mode\n" : '');
printf <<'EOF', $name, $with_mode ? (",mode=0", "\n int mode") : ('', '');
int
%s(x%s)
pdl *x
%s CODE:
pdl *x%s
CODE:
EOF
my $set = " if (items>1) setflag(x->state,$flag,mode);\n";
my $ret = " RETVAL = ((x->state & $flag) > 0);\n";
Expand Down

0 comments on commit 334bc22

Please sign in to comment.