move constants to xs

This commit is contained in:
Doug MacEachern 2007-09-03 16:19:27 +00:00
parent 3d46e602ef
commit 239dec2d43
2 changed files with 22 additions and 22 deletions

View File

@ -40,27 +40,5 @@ else {
sub NULL_HWADDR() { "00:00:00:00:00:00" }
sub IFF_UP() { 0x1 }
sub IFF_BROADCAST() { 0x2 }
sub IFF_DEBUG() { 0x4 }
sub IFF_LOOPBACK() { 0x8 }
sub IFF_POINTOPOINT() { 0x10 }
sub IFF_NOTRAILERS() { 0x20 }
sub IFF_RUNNING() { 0x40 }
sub IFF_NOARP() { 0x80 }
sub IFF_PROMISC() { 0x100 }
sub IFF_ALLMULTI() { 0x200 }
sub IFF_MULTICAST() { 0x800 }
1;
__END__

View File

@ -134,12 +134,34 @@ static int proc_env_getvalue(void *data,
return SIGAR_OK;
}
#define XS_SIGAR_CONST_IV(name) \
(void)newCONSTSUB(stash, #name, newSViv(SIGAR_##name))
static void boot_Sigar_constants(pTHX)
{
HV *stash = gv_stashpv("Sigar", TRUE);
XS_SIGAR_CONST_IV(IFF_UP);
XS_SIGAR_CONST_IV(IFF_BROADCAST);
XS_SIGAR_CONST_IV(IFF_DEBUG);
XS_SIGAR_CONST_IV(IFF_LOOPBACK);
XS_SIGAR_CONST_IV(IFF_POINTOPOINT);
XS_SIGAR_CONST_IV(IFF_NOTRAILERS);
XS_SIGAR_CONST_IV(IFF_RUNNING);
XS_SIGAR_CONST_IV(IFF_NOARP);
XS_SIGAR_CONST_IV(IFF_PROMISC);
XS_SIGAR_CONST_IV(IFF_ALLMULTI);
XS_SIGAR_CONST_IV(IFF_MULTICAST);
}
MODULE = Sigar PACKAGE = Sigar
PROTOTYPES: disable
INCLUDE: Sigar_generated.xs
BOOT:
boot_Sigar_constants(aTHX);
MODULE = Sigar PACKAGE = Sigar PREFIX = sigar_
Sigar