Hope this helps.
Here's what I got from a similar question:
from my Laff.xs :

#define const2perl(const) do{if(const<0){\
newconst(#const,newSViv((IV)const) );\
}else{setuv((UV)const);newconst(#const,mpSvNew);}}while(0)
#define newconst( sName, newSV )\
newCONSTSUB( mHvStash, sName, newSV )
#define setuv(u) do{mpSvNew=newSViv(0);sv_setuv(mpSvNew,u);}while(0)

MODULE = Laff           PACKAGE = Laff  PREFIX=Laff

BOOT:
    {
        HV *mHvStash= gv_stashpv( "Laff", TRUE );
        SV *mpSvNew;
        const2perl( lALL );
        const2perl( lARB );
        const2perl( lATTR );
        const2perl( lBOUNDARY );
        const2perl( lBIDIRECTIONAL );
...
    }


from my Laff.pm:
@EXPORT = qw(
AndFigs
MAX_INT32
MAX_LAYERS
MAX_POINTS
MIN_INT32
NotFigs
OversizeFig
XorFigs
lALL
lARB
lATTR
lBOUNDARY
lBIDIRECTIONAL
...
);


   ___  _ ____       ___       __  __
  / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
 / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
           /___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455,  [EMAIL PROTECTED]

On Wed, 9 Jul 2003, Marc Mettes wrote:

>
> In my XS module, I need to make numerous enum's available to perl
> and I'm looking for recommendations on which option to chose to
> implement them.
>
> I've seen two variations, one using h2xs which auto-generated a
> big mess, and another using the ALIAS keyword (borrowed from
> DBI::Oracle).
>
> I can think of two other variations, where one would be creating
> native perl data structures in the .pm file (as part of the build
> process), and another would be dynamically examining the C-based
> library's header files to build the data structures on the fly.
>
> There are probably 10-20 different enum's that I would want to
> incorporate into my XS module, and they change slightly with each
> API revision (every 9-12 months).  Performance and maintainability
> are both important factors.
>
> Can anyone share some insight as to which of the above choices
> would be better or worse?
>
>
> Thanks for your help,
>
> Marc
> --
> Marc Mettes
> CAD Support
> Bic Corporation
>

Reply via email to