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

[PATCH] [perl #21887] h2xs becoming enum-aware

Thread Next
From:
Tassilo von Parseval
Date:
May 13, 2003 01:38
Subject:
[PATCH] [perl #21887] h2xs becoming enum-aware
Message ID:
20030513083631.GA21782@ethan
Hi,

this is a proposed patch (not necessarily to be applied immediately)
that will make h2xs include C enumerations in its generation of the
constant() functions. I eventually opted out the idea of submitting a
preliminary format-patch. I learnt that there is not much to gain from
it when cleaning up h2xs. Anyway...

h2xs now has a new switch combo -e/--omit-enums. That means that the
default behaviour of h2xs now changes! Enumerations are by default
included. If this is not desired, the mentioned switch needs to be
provided. It takes an optional argument. This is treated as a regular
expression. enum names that match this pattern will be skipped. So the
switch relates not to the name of the constants but to the name of the
enum in which they were defined. No provided pattern results in
skipping all enums.

The fact that the pattern is optional is a slight problem, IMO because
this will go wrong:

    h2xs -n Foo -e foo.h

because foo.h is now taken to be the pattern. It would have to be
written

    h2xs -e -n Foo foo.h

This is mentioned in the PODs.

The patch makes one change to whitespacing, namely in the examples of
the PODs. There was a wild mixture between hard tabs and spaces. Now
all tabs are expanded to four spaces. Also, an unpleasant wrapping on a
80char-wide console in one of the example was fixed. 

Please comment on whether it is ok to change h2xs' default behaviour and
to have a switch that uses an optional argument.

Additional credits go to David Nicol from whom I shamelessly stole some
code to achieve the above.

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

Thread Next


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