I tried to do a simple function to try out the PMCode solution, but I'm missing 
something. 
The following code defines a simple function that multiplies a pdl by 2.
      ...
      pp_def('test', 
             Pars=>'a(); [o] b();',
             PMCode => q{ 
                        sub test { # 
                            my ($a)=@_;
                            $b=PDL->null;
                            _test_int($a, $b);
                        }
              },
             Code=> q{
                $b()=2*$a();
             },
          );
      ...

The PMCode doesn't do anything useful yet. I was just trying to
understand how to use it.

If I remove all of the PMCode section, I can compile and install the
code and it works as expected. However, with the PMCode it produces an error 
message:

     Could not find a typemap for C type 'pdl *'.  The following C types
     are mapped by the current typemap: 'AV *', 'Boolean', 'CV *', 'FILE
     *', 'FileHandle', 'HV *', 'I16', 'I32', 'I8', 'IV', 'InOutStream',
     'InputStream', 'NV', 'OutputStream', 'PerlIO *', 'Result', 'STRLEN',
     'SV *', 'SVREF', 'SysRet', 'SysRetLong', 'Time_t *', 'U16', 'U32',
     'U8', 'UV', 'bool', 'bool_t', 'caddr_t', 'char', 'char *', 'char **',
     'const char *', 'double', 'float', 'int', 'long', 'short', 'size_t',
     'ssize_t', 'time_t', 'unsigned', 'unsigned char', 'unsigned char *',
     'unsigned int', 'unsigned long', 'unsigned long *', 'unsigned short',
     'void *', 'wchar_t', 'wchar_t *'

The line that produces the error in the generated xs code is:

       void
       _test_int(a,b)
               pdl  *a         # <=This generates the error
               pdl  *b
        CODE:
        { pdl_test_struct  *__privtrans;
         int badflag_cache = 0;
         ...


What am I doing wrong, or missing?

Regards,

Luis


On Sat, Feb 04, 2017 at 09:33:41PM -0600, Luis Mochan wrote:
> 
> 
> On Sat, Feb 04, 2017 at 02:56:45PM -0700, Craig DeForest wrote:
> > I seem to be late to the discussion, but this is exactly what I do.  I make 
> > heavy use of PMCode to condition and take care of any Stupid Index Tricks 
> > that are needed, then hand that in to a PP routine that does the work.
> > 
> Thanks for the suggestion. I'll follow it.
> Best regards,
> Luis
> 
> 
> -- 
> 
>                                                                   o
> W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
> Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
> Apdo. Postal 48-3, 62251             |                           (*)/\/  \
> Cuernavaca, Morelos, México          | [email protected]   /\_/\__/
> GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB
> 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> pdl-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pdl-general
> 

-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Apdo. Postal 48-3, 62251             |                           (*)/\/  \
Cuernavaca, Morelos, México          | [email protected]   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to