perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@hyperreal.org
Subject cvs commit: modperl/src/modules/perl Constants.xs
Date Tue, 14 Jul 1998 16:24:56 GMT
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
   
  
  
  

Mime
View raw message