kip 2003/03/18 00:43:41
Modified: . CONTRIB Changes axconfig.c lib/Apache/AxKit ConfigReader.pm Log: Fixes to AxAddDynamicProcessors ordering courtesy of patches from Jason Johnston Revision Changes Path 1.2 +1 -0 xml-axkit/CONTRIB Index: CONTRIB =================================================================== RCS file: /home/cvs/xml-axkit/CONTRIB,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CONTRIB 13 Jan 2002 20:45:08 -0000 1.1 +++ CONTRIB 18 Mar 2003 08:43:40 -0000 1.2 @@ -5,6 +5,7 @@ Owen Stenseth (output filtering single point of exit, and others) Honza Pazdziora (many small patches) Brian Wheeler (Filter fixes, XPathScript improvements, AxAddDynamicProcessor) +Jason Johnston (AxAddDynamicProcessor ordering fix) If I've missed anyone, please correct this list as my memory is poor. 1.12 +4 -1 xml-axkit/Changes Index: Changes =================================================================== RCS file: /home/cvs/xml-axkit/Changes,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Changes 29 Jan 2003 01:41:49 -0000 1.11 +++ Changes 18 Mar 2003 08:43:40 -0000 1.12 @@ -1,5 +1,8 @@ AxKit Changes - +1.7-ALPHA + - Made processors added via AxAddDynamicProcessor appear in their proper + order based on the order in which they appear in the config files (rather than simply + appended on to the current processing chain). 1.6.1 - Added AxExternalEncoding option including TransHandler - Made AxHandleDirs work as documented (updated File provider) 1.17 +3 -51 xml-axkit/axconfig.c Index: axconfig.c =================================================================== RCS file: /home/cvs/xml-axkit/axconfig.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- axconfig.c 20 Sep 2002 17:00:24 -0000 1.16 +++ axconfig.c 18 Mar 2003 08:43:40 -0000 1.17 @@ -113,7 +113,6 @@ /* complex types */ new->type_map = NULL; new->processors = NULL; - new->dynamic_processors = NULL; new->xsp_taglibs = NULL; new->current_styles = NULL; new->current_medias = NULL; @@ -140,7 +139,6 @@ "new.debug_level: %d\n" "new.type_map: %d\n" "new.processors: %d\n" - "new.dynamic_processors: %d\n" "new.xsp_taglibs: %d\n" "new.current_styles: %d\n" "new.current_medias: %d\n" @@ -164,7 +162,6 @@ new->debug_level, new->type_map, new->processors, - new->dynamic_processors, new->xsp_taglibs, new->current_styles, new->current_medias, @@ -190,9 +187,6 @@ new->processors = newHV(); ap_register_cleanup(p, (void*)new->processors, ax_cleanup_hv, ap_null_cleanup); - - new->dynamic_processors = newAV(); - ap_register_cleanup(p, (void*)new->dynamic_processors, ax_cleanup_av, ap_null_cleanup); new->xsp_taglibs = newHV(); ap_register_cleanup(p, (void*)new->xsp_taglibs, ax_cleanup_hv, ap_null_cleanup); @@ -292,7 +286,6 @@ "parent_dir.debug_level: %d\n" "parent_dir.type_map: %d\n" "parent_dir.processors: %d\n" - "parent_dir.dynamic_processors: %d\n" "parent_dir.xsp_taglibs: %d\n" "parent_dir.current_styles: %d\n" "parent_dir.current_medias: %d\n" @@ -316,7 +309,6 @@ parent_dir->debug_level, parent_dir->type_map, parent_dir->processors, - parent_dir->dynamic_processors, parent_dir->xsp_taglibs, parent_dir->current_styles, parent_dir->current_medias, @@ -342,7 +334,6 @@ "subdir.debug_level: %d\n" "subdir.type_map: %d\n" "subdir.processors: %d\n" - "subdir.dynamic_processors: %d\n" "subdir.xsp_taglibs: %d\n" "subdir.current_styles: %d\n" "subdir.current_medias: %d\n" @@ -366,7 +357,6 @@ subdir->debug_level, subdir->type_map, subdir->processors, - subdir->dynamic_processors, subdir->xsp_taglibs, subdir->current_styles, subdir->current_medias, @@ -539,37 +529,6 @@ } { - /* cfg->dynamic_processors */ - new->dynamic_processors = newAV(); - if (av_len(subdir->dynamic_processors) >= 0) { - I32 key = 0; - for(key = 0; key <= av_len(subdir->dynamic_processors); key++) { - SV ** val = av_fetch(subdir->dynamic_processors, key, 0); - if (val != NULL) { - char * cval; - STRLEN len; - cval = ap_pstrdup(p, SvPV(*val, len)); - av_push(new->dynamic_processors, newSVpvn(cval, strlen(cval))); - } - } - } - else { - I32 key = 0; - for(key = 0; key <= av_len(parent_dir->dynamic_processors); key++) { - SV ** val = av_fetch(parent_dir->dynamic_processors, key, 0); - if (val != NULL) { - char * cval; - STRLEN len; - cval = ap_pstrdup(p, SvPV(*val, len)); - av_push(new->dynamic_processors, newSVpvn(cval, strlen(cval))); - } - } - } - - ap_register_cleanup(p, (void*)new->dynamic_processors, ax_cleanup_av, ap_null_cleanup); - } - - { /* cfg->xsp_taglibs */ new->xsp_taglibs = newHV(); if (HvKEYS(parent_dir->xsp_taglibs)) { @@ -753,7 +712,6 @@ warn("merge results: %d\n" "typemap: %d\n" "processors: %d\n" - "dynamic: %d\n" "taglibs: %d\n" "c_styles: %d\n" "c_medias: %d\n" @@ -762,7 +720,6 @@ new, new->type_map, new->processors, - new->dynamic_processors, new->xsp_taglibs, new->current_styles, new->current_medias, @@ -809,10 +766,7 @@ ax_add_dynamic_processor (cmd_parms *cmd, axkit_dir_config *ax, char *module) { - SV * mod_sv = newSVpv(module, 0); - av_push(ax->dynamic_processors, mod_sv); - - return NULL; + return ax_add_type_processor(cmd, ax, "", "", module); } CHAR_P @@ -1230,7 +1184,7 @@ "a mime type, a stylesheet, and a dtd filename" }, { "AxAddDynamicProcessor", ax_add_dynamic_processor, - NULL, OR_ALL, TAKE1, + (void*)"Dynamic", OR_ALL, TAKE1, "a package name" }, { "AxAddRootProcessor", ax_add_type_processor, @@ -1524,8 +1478,6 @@ 8, newRV_inc((SV*)cfg->type_map), 0); hv_store(retval, "Processors", 10, newRV_inc((SV*)cfg->processors), 0); - hv_store(retval, "DynamicProcessors", - 17, newRV_inc((SV*)cfg->dynamic_processors), 0); hv_store(retval, "XSPTaglibs", 10, newRV_inc((SV*)cfg->xsp_taglibs), 0); hv_store(retval, "Plugins", 1.15 +10 -12 xml-axkit/lib/Apache/AxKit/ConfigReader.pm Index: ConfigReader.pm =================================================================== RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/ConfigReader.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ConfigReader.pm 20 Feb 2003 10:22:18 -0000 1.14 +++ ConfigReader.pm 18 Mar 2003 08:43:41 -0000 1.15 @@ -398,21 +398,19 @@ push @results, $style_hash; } } + elsif (lc($type) eq 'dynamic') { + my $package = $directive->[3]; + AxKit::load_module($package); + no strict 'refs'; + my($handler) = $package.'::handler'; + push @results, $handler->($provider, $media, $style, + $doctype, $dtd, $root); + } else { warn "Unrecognised directive type: $type"; } } - - # list any dynamically chosen stylesheets here - $list = $self->{cfg}{DynamicProcessors} || [ $self->{apache}->dir_config->get('AxDynamicProcessors') ]; - foreach my $package (@$list) { - AxKit::load_module($package); - no strict 'refs'; - my($handler) = $package.'::handler'; - push @results, $handler->($provider, $media, $style, - $doctype, $dtd, $root); - } - + return @results; }