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

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

Thread Next
Tassilo von Parseval
May 13, 2003 01:38
[PATCH] [perl #21887] h2xs becoming enum-aware
Message ID:

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

    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.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About