develooper Front page | perl.perl5.porters | Postings from July 2003

some more questions/inconsistencies with h2xs

From:
Tassilo von Parseval
Date:
July 16, 2003 23:37
Subject:
some more questions/inconsistencies with h2xs
Message ID:
20030717062727.GA1031@ethan
Hi again (and sorry for yet another h2xs-bother),

Two issues in this mail: 1) dysfunctional examples in the SYNOPSIS and
2) the -f switch.

1) Quoting the SYNOPSIS of the h2xs perldocs:

        # Same with function declaration in proto.h as visible from perl.h.
        h2xs -xAn perl2 perl.h,proto.h

When trying that, it dies pretty noisily:

ethan@ethan:~$ h2xs5.8.1 -xAn perl2 perl.h,proto.h
Defaulting to backwards compatibility with perl 5.8.1
If you intend this module to be compatible with earlier perl versions, please
specify a minimum perl version with the -b option.

Writing perl2/ppport.h
Scanning typemaps...
 Scanning /usr/opt/perl5.8.1rc1/lib/5.8.1/ExtUtils/typemap
Scanning perl.h for functions...
panic: multiple types without intervening comma in
	 OP* (*PPADDR_t[]) (void)
whited-out as
	 OP* (*PPADDR_t  ) (    )
     
[ 40ish similar lines snipped ]

Expecting parenth after identifier in `PPADDR_t* Perl_get_ppaddr(void)'
after `PPADDR_t' at /usr/opt/perl5.8.1rc1/lib/site_perl/5.8.1/C/Scan.pm line 729.

Non-working examples should be removed from the SYNOPSIS (I didn't yet
check the others). I'll send a patch a little later after clearing some
other things. Side-effect of the above failure is that I still don't
know the meaning of the comma in "perl.h,proto.h" (which I had hoped to
find out by running this example).

2) -f switch

One of those things that needs clarification is the -f switch of h2xs. From
the docs:

    -f, --force
         Allows an extension to be created for a header even if that header
         is not found in standard include directories.

I fail to see the use of this switch, because:
------>
ethan@ethan:~$ h2xs5.8.1 -f not_there.h
Defaulting to backwards compatibility with perl 5.8.1
If you intend this module to be compatible with earlier perl versions, please
specify a minimum perl version with the -b option.

Can't open Not_there/not_there.h: No such file or directory
<-----

Compared to not using -f:
----->
ethan@ethan:~$ h2xs5.8.1 not_there.h
Defaulting to backwards compatibility with perl 5.8.1
If you intend this module to be compatible with earlier perl versions, please
specify a minimum perl version with the -b option.

Can't find not_there.h in . /usr/include /opt/local/include
/usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include
/usr/include Not_there
<-----

So it'll die in both cases (just in two different lines in h2xs). Where
exactly can this switch be used? I can see the only use in conjunction
with -c (which prevents h2xs from looking into the supplied header at all). 
The only difference from not using a header at all is then the line

    #include <not_there.h>

in Not_there.xs (note how this behaviour will also render the extension
uncompilable, because not_there.h previously had *not* been found by
h2xs so it's not in cc's -I either). I don't think that this is
important enough to justify a dedicated switch. Should it be removed?

Please bear in mind that any removed switch will clean up the source.
One reason why h2xs' source is so hard to follow is the amount of
available switches and their complicated way in which they affect each
other. I became aware of this -f switch when I met a part of the code
that looked completely loopy to me...just to find out that it is
responsible for the aforementioned cited behaviour.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About