Return-Path: Delivered-To: modperl-cvs-archive@hyperreal.org Received: (qmail 4319 invoked by uid 6000); 14 Jul 1998 16:24:58 -0000 Received: (qmail 4312 invoked by uid 169); 14 Jul 1998 16:24:56 -0000 Date: 14 Jul 1998 16:24:56 -0000 Message-ID: <19980714162456.4311.qmail@hyperreal.org> From: dougm@hyperreal.org To: modperl-cvs@hyperreal.org Subject: cvs commit: modperl/src/modules/perl Constants.xs Sender: modperl-cvs-owner@apache.org Precedence: bulk Reply-To: modperl-cvs@apache.org dougm 98/07/14 09:24:56 Modified: src/modules/perl Constants.xs Log: pre-compile of :common #ifdef XS_IMPORT Revision Changes Path 1.10 +30 -10 modperl/src/modules/perl/Constants.xs Index: Constants.xs =================================================================== RCS file: /export/home/cvs/modperl/src/modules/perl/Constants.xs,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Constants.xs 1998/07/14 14:57:08 1.9 +++ Constants.xs 1998/07/14 16:24:56 1.10 @@ -813,22 +813,42 @@ #define __PACKAGE_LEN__ 17 #define __AUTOLOAD__ "Apache::Constants::AUTOLOAD" -MODULE = Apache::Constants PACKAGE = Apache::Constants - -PROTOTYPES: DISABLE - -BOOT: - items = items; +/* this is kinda ugly, but wtf */ +static void boot_ConstSubs(char *tag) { - AV *export = perl_get_av("Apache::Constants::EXPORT", FALSE); HV *stash = gv_stashpvn(__PACKAGE__, __PACKAGE_LEN__, FALSE); I32 i; +#ifdef XS_IMPORT + char **export = export_tags(tag); + + for (i=0; export[i]; i++) { +#define EXP_NAME export[i] + +#else + HV *exp_tags = perl_get_hv("Apache::Constants::EXPORT_TAGS", TRUE); + SV **avrv = hv_fetch(exp_tags, tag, strlen(tag), FALSE); + AV *export; + if(avrv) + export = (AV*)SvRV(*avrv); + else + return; +#define EXP_NAME SvPV(*av_fetch(export, i, 0),na) + for(i=0; i<=AvFILL(export); i++) { - SV *name = *av_fetch(export, i, 0); - double val = constant(SvPVX(name)); - newCONSTSUB(stash, SvPVX(name), newSViv(val)); +#endif + char *name = EXP_NAME; + double val = constant(name); + newCONSTSUB(stash, name, newSViv(val)); } } + +MODULE = Apache::Constants PACKAGE = Apache::Constants + +PROTOTYPES: DISABLE + +BOOT: + items = items; + boot_ConstSubs("common"); #ifdef XS_IMPORT