Hi Patrick,

The interface to “converttype” has changed very slightly by removing a 
parameter, and you just need to remove the “, 1” in calls to it. That was what 
I was trying to convey.

Regarding the snippet of documentation you quote, that describes the behaviour 
of the function. I don’t know what else you’d want from such documentation to 
qualify as “useful”.

I already alluded to “pdlcore.h”. Here is a link to the line that gives the 
parameters of the function: 
https://github.com/PDLPorters/pdl/blob/2259a8e0d492387a185ddc1338b9f73482a8b334/Basic/Core/pdlcore.h#L91.

Best regards,
Ed

From: Patrick Dupre<mailto:pdu...@gmx.com>
Sent: 17 July 2022 22:08
To: Ed .<mailto:ej...@hotmail.com>
Cc: pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net>
Subject: Re: RE: [Pdl-general] converttype

Thank Ed,

Yes,
If I could find the syntax for converttype, I guess that I can manage the issue.
I use a routine to read parameters like hash.
These parameters are checked (number, format, etc. )
Then there are converted in pdl to be used by a perl or a C application.

The interface of this application has been written 10-20 years ago.
It worked fine. I now need to make the appropriated changes.
I had a manual to make my interfaces, but this manual seems at least
partially obsolete.
Unfortunately, I did not found the alternative manual.
If I can find the interface of converttype, I guess that I will be OK.

man PDL::AP

converttype
            Used by "set_datatype" to change an ndarray's type, converting and
            possibly re-allocating the data if a different size. If the
            ndarray's "badflag" was set, its "badvalue" will become the
            default for the new type. Bad values will still be bad.

is not really useful

===========================================================================
Patrick DUPRÉ | | email: pdu...@gmx.com
Laboratoire interdisciplinaire Carnot de Bourgogne
9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
Tel: +33 (0)380395988 | | Room# D114A
===========================================================================


Sent: Sunday, July 17, 2022 at 10:41 PM
From: "Ed ." <ej...@hotmail.com>
To: "Patrick Dupre" <pdu...@gmx.com>, "pdl-general@lists.sourceforge.net" 
<pdl-general@lists.sourceforge.net>
Subject: RE: [Pdl-general] converttype
Hi Patrick,

It seems like you followed my advice to email the list, but did not read the 
rest of my earlier email. I reproduce part of it here with a new addition in 
bold:

“Extending and Embedding Perl” is a book (from 2002) added: not a manual, and 
it looks to me like you’re using that. Since 2002, the API for “converttype” 
has changed to remove the obsolete 3rd parameter (in fact, the Changes file 
reminds me that was in 2.057_01, in Sep 2021). The PDL C API is somewhat 
documented in PDL::API (https://metacpan.org/dist/PDL/view/Basic/Pod/API.pod - 
use that instead of the book) emphasis added, but the best “source of truth” is 
pdlcore.h.

Another approach to writing your own C/PDL code is to use 
https://metacpan.org/pod/Inline::Pdlpp which for normal usage I would recommend 
instead. A non-trivial use of this can be seen at 
https://github.com/Fourmilab/floating_point_benchmarks/pull/1/files.

I would highly recommend you subscribe to one of the PDL mailing lists 
(https://pdl.perl.org/?page=mailing-lists) and ask questions there, so that 
you’re not relying on my availability :-)

If you can better spell out what you’re actually trying to achieve (since the 
example from the 2002 book does not do anything that doesn’t already exist in 
PDL operations), perhaps someone here can actually help.

I will also link here to the “PDL book” (https://pdl.perl.org/?page=FirstSteps) 
and the article “Practical Magick with C, PDL, and PDL::PP -- a guide to 
compiled add-ons for PDL” (https://arxiv.org/abs/1702.07753).

Best regards,
Ed

From: Patrick Dupre<mailto:pdu...@gmx.com>
Sent: 17 July 2022 21:31
To: pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net>
Subject: [Pdl-general] converttype

Hello,

Before version 2.80, I used to follow the manual
Extending and Embedding Perl
1) Is there an alternative manual?
2) Here is my code (see p. 196 of the manual).
SV *piddle = HeVAL (he) ;
pdl *array = INT2PTR (pdl*, SvIV ((SV*) SvRV (piddle))) ;
PDL -> converttype (&array, PDL_D, 1) ;

Now, the compilation fails

Cores.xs:146:37: warning: passing argument 1 of ‘PDL->converttype’ from 
incompatible pointer type [-Wincompatible-pointer-types]
  146 |                 PDL -> converttype (&array, PDL_D, 1) ;
      |                                     ^~~~~~
      |                                     |
      |                                     pdl **
Cores.xs:146:37: note: expected ‘pdl *’ but argument is of type ‘pdl **’
Cores.xs:146:17: error: too many arguments to function ‘PDL->converttype’
  146 |                 PDL -> converttype (&array, PDL_D, 1) ;


It seems that the function converttype differs from the previous versions.
I cannot find how I could modify my code for passing the compilation
with the same behavior.

Can somebody help me?

Thank.

===========================================================================
 Patrick DUPRÉ                                 | | email: pdu...@gmx.com
 Laboratoire interdisciplinaire Carnot de Bourgogne
 9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
 Tel: +33 (0)380395988                    | | Room# D114A
===========================================================================



_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general


_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to