Ask a Question related to PERL Modules, Design and Development.
-
Peter Billam #1
Help with xs: converting I32 to int ?
Hi. <xs newbie warning=on> Compiling my Math-WalshTransform-1.11 on a
Fedora5 with gcc 4.1.0 gives me (amongst other stuff which I can fix):
In file included from WalshTransform.xs:7:
ppport.h:231:1: warning: "PERL_UNUSED_DECL" redefined
In file included from WalshTransform.xs:5:
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/perl.h:163:1:
warning: this is the location of the previous definition
WalshTransform.xs: In function 'XS_Math__WalshTransform_xs_fht':
WalshTransform.xs:50: warning: format '%d' expects type 'int',
but argument 4 has type 'I32'
WalshTransform.xs: In function 'XS_Math__WalshTransform_xs_fhtinv':
WalshTransform.xs:90: warning: format '%d' expects type 'int',
but argument 4 has type 'I32'
Now the PERL_UNUSED_DECL bit comes from a
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include "math.h"
#ifdef __cplusplus
}
#endif
incantation at the beginning. Should I change this bit ?
The lines 50 and 90 are like
fprintf (stderr, "fhtinv: n should be a power of 2, but was %d\n", items);
How should I convert my I32 items builtin into an int ?
Regards, Peter
--
AUS/TAS/DPIWE/CIT/Servers hbt/lnd/l8 6233 3061 [url]http://www.pjb.com.au[/url]
Pasaré, pasarémos dice el agua y canta la verdad contra la piedra
-- Pablo Neruda
Peter Billam Guest
-
Converting into PDF bug...
I am trying to convert a file into PDF (a 20 page one) and I keep getting an error message: "unable to convert file" at the end. It seems to be... -
converting PHP to jsp
does anyone know if a website that has been programmed using PHP can be converted to a site that uses jsp? -
Converting .PDF into CF
Is there a way using Coldfusion MX to convert a .PDF into a web page? I know with the new CF7, there is a cfdocument tag, but I only have CF6. -
Converting From PHP
I'm converting a site from PHP to ColdFusion and need to find a compatible feature as __LINE__ magic variable in php to report the line number... -
Converting to PDF
How do you install Acrobat distiller printer? It does not appear in my printers in XP. Can you give me the EASIEST steps to set up my computer to... -
Sisyphus #2
Re: Help with xs: converting I32 to int ?
"Peter Billam" <peter@pjb.dpiwe.tas.gov.au> wrote in message
news:slrne3jate.cu5.peter@localhost.localdomain.....> Hi. <xs newbie warning=on> Compiling my Math-WalshTransform-1.11 on a
> Fedora5 with gcc 4.1.0 gives me (amongst other stuff which I can fix):
>
> In file included from WalshTransform.xs:7:
> ppport.h:231:1: warning: "PERL_UNUSED_DECL" redefined
> In file included from WalshTransform.xs:5:
> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/perl.h:163:1:
> warning: this is the location of the previous definition
> WalshTransform.xs: In function 'XS_Math__WalshTransform_xs_fht':
> WalshTransform.xs:50: warning: format '%d' expects type 'int',
> but argument 4 has type 'I32'
> WalshTransform.xs: In function 'XS_Math__WalshTransform_xs_fhtinv':
> WalshTransform.xs:90: warning: format '%d' expects type 'int',
> but argument 4 has type 'I32'
>
..items);> The lines 50 and 90 are like
> fprintf (stderr, "fhtinv: n should be a power of 2, but was %d\n",Not sure - '%d' is quite happy to accept an I32 for me. Does casting to an> How should I convert my I32 items builtin into an int ?
>
'int' fix the problem :
fprintf (stderr, "fhtinv: n should be a power of 2, but was %d\n",
(int)items);
Cheers,
Rob
Sisyphus Guest
-
Sisyphus #3
Re: Help with xs: converting I32 to int ?
"Peter Billam" <peter@pjb.dpiwe.tas.gov.au>
..> In file included from WalshTransform.xs:7:
> ppport.h:231:1: warning: "PERL_UNUSED_DECL" redefined
> In file included from WalshTransform.xs:5:
> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/perl.h:163:1:
> warning: this is the location of the previous definition
..Sorry - skipped this bit in my other reply. It's hard to answer ->
> Now the PERL_UNUSED_DECL bit comes from a
> #ifdef __cplusplus
> extern "C" {
> #endif
> #include "EXTERN.h"
> #include "perl.h"
> #include "XSUB.h"
> #include "ppport.h"
> #include "math.h"
> #ifdef __cplusplus
> }
> #endif
> incantation at the beginning. Should I change this bit ?
>
search.cpan.org is still showing only version 1.10 (my mirror, at least) so
I can't get at a look at the actual ppport.h you've got.
There's a good chance the redefinition won't matter - but I doubt that it
should be happening. I would think the fact that PERL_UNUSED_DECL was
defined in perl.h should have been detected, and the definition omitted from
the generated ppport.h .... but I'm not really an expert on what ppport.h
should and should not do. (Come to think of it, I'm not an expert on
anything else, either.)
Do you need to include a ppport.h in the source ?
Cheers,
Rob
Sisyphus Guest
-
Peter Billam #4
Re: Help with xs: converting I32 to int ?
On 2006-04-10, Sisyphus <sisyphus1@nomail.afraid.org> wrote:
Yes, it does fix the problem, thanks :-)> Not sure - '%d' is quite happy to accept an I32 for me.> > WalshTransform.xs:50: warning: format '%d' expects type 'int',
> > but argument 4 has type 'I32'
> Does casting to an 'int' fix the problem :
> fprintf (stderr, "fhtinv: n should be a power of 2, but was %d\n",
> (int)items);
Ah, er, sorry, 1.11 is the _next_ release. But 1.10 behaves the same> search.cpan.org is still showing only version 1.10 (my mirror, at> > In file included from WalshTransform.xs:7:
> > ppport.h:231:1: warning: "PERL_UNUSED_DECL" redefined
> least) so I can't get at a look at the actual ppport.h you've got.
>
for me under Fedora5 gcc4.1.0 ...
Well, apparently not; it compiles perfectly without #include "ppport.h",> I'm not really an expert on what ppport.h should and should not do.
> ... Do you need to include a ppport.h in the source ?
so the question remains open of what ppport.h does, and when it's
needed.
Thanks for your help, expect Math::WalshTransform-1.11 sometime soon.
Regards, Peter
--
AUS/TAS/DPIW/CIT/Servers hbt/lnd/l8 6233 3061 [url]http://www.pjb.com.au[/url]
Pasaré, pasarémos dice el agua y canta la verdad contra la piedra
-- Pablo Neruda
Peter Billam Guest
-
Sisyphus #5
Re: Help with xs: converting I32 to int ?
"Peter Billam" <peter@pjb.dpiwe.tas.gov.au> wrote in message
..
..It's probably worth pointing out that if you ever declare dXSARGS in a> > fprintf (stderr, "fhtinv: n should be a power of 2, but was %d\n",
> > (int)items);
function, then 'items' becomes a keyword (within that function) and any
attempt to use 'items' as a variable name (within that function) will
produce fatal redefinition errors - error messages that don't really make it
clear just what the problem is. For that reason I always avoid using 'items'
as a variable name .... even though it's often the logical name to bestow
upon the variable.
Probably a good question for another post - unless someone else comes>>> > I'm not really an expert on what ppport.h should and should not do.
> > ... Do you need to include a ppport.h in the source ?
> Well, apparently not; it compiles perfectly without #include "ppport.h",
> so the question remains open of what ppport.h does, and when it's
> needed.
>
forward here and answers it. I don't think I've ever seen any advocacy for
using it, or indeed any discussion about it. All I know is that it's a part
of a small percentage of source tarballs, and that its own documentation
says it's useful.
I've no doubt there are people perusing this list who know a good deal about
it, but if I were going to ask about the usage of ppport.h I'd probably post
to a higher volume list (like, say, PerlMonks) where there's a wider range
of respondents.
Cheers,
Rob
Sisyphus Guest
-
Peter Billam #6
Re: Help with xs: converting I32 to int ?
On 2006-04-11, Sisyphus <sisyphus1@nomail.afraid.org> wrote:
I got my "items" from perldoc perlxs where it says:> It's probably worth pointing out that if you ever declare dXSARGS
> in a function, then 'items' becomes a keyword (within that function)
> and any attempt to use 'items' as a variable name (within that
> function) will produce fatal redefinition errors - error messages
> that don't really make it clear just what the problem is. For that
> reason I always avoid using 'items' as a variable name .... even
> though it's often the logical name to bestow upon the variable.
XSUBs can have variable-length parameter lists by specifying an
ellipsis "(...)" in the parameter list. This use of the ellipsis
is similar to that found in ANSI C. The programmer is able to
determine the number of arguments passed to the XSUB by examining
the "items" variable which the xsubpp compiler supplies for all <==
XSUBs. By using this mechanism one can create an XSUB which
accepts a list of parameters of unknown length.
What's dXSARGS and when would I need to declare it ?
It's mentioned once in perldoc perlxstut, but not in perldoc perlxs.
Regards, Peter
--
AUS/TAS/DPIW/CIT/Servers hbt/lnd/l8 6233 3061 [url]http://www.pjb.com.au[/url]
Pasaré, pasarémos dice el agua y canta la verdad contra la piedra
-- Pablo Neruda
Peter Billam Guest
-
Sisyphus #7
Re: Help with xs: converting I32 to int ?
"Peter Billam" <peter@pjb.dpiwe.tas.gov.au> wrote in message
news:slrne3m44i.n18.peter@localhost.localdomain...Aaaahh .... sorry - I thought you had declared and were using a variable> On 2006-04-11, Sisyphus <sisyphus1@nomail.afraid.org> wrote:>> > It's probably worth pointing out that if you ever declare dXSARGS
> > in a function, then 'items' becomes a keyword (within that function)
> > and any attempt to use 'items' as a variable name (within that
> > function) will produce fatal redefinition errors - error messages
> > that don't really make it clear just what the problem is. For that
> > reason I always avoid using 'items' as a variable name .... even
> > though it's often the logical name to bestow upon the variable.
> I got my "items" from perldoc perlxs where it says:
> XSUBs can have variable-length parameter lists by specifying an
> ellipsis "(...)" in the parameter list. This use of the ellipsis
> is similar to that found in ANSI C. The programmer is able to
> determine the number of arguments passed to the XSUB by examining
> the "items" variable which the xsubpp compiler supplies for all <==
> XSUBs. By using this mechanism one can create an XSUB which
> accepts a list of parameters of unknown length.
>
named 'items' - but you're obviously not. In fact, you're using 'items' as
that very same reserved variable I was talking about. My mistake.
Cheers,
Rob
Sisyphus Guest



Reply With Quote

