[svn:mod_parrot] r475 - in mod_parrot/trunk: include lib/ModParrot/HLL src
[email protected] Tue, 28 Oct 2008 10:57:09 -0700 (PDT)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Tue Oct 28 10:57:08 2008
New Revision: 475
Modified:
mod_parrot/trunk/include/modparrot_config.h
mod_parrot/trunk/lib/ModParrot/HLL/pir.pir
mod_parrot/trunk/src/module.c
Log:
use MP_HOOK_ALL enum to register all hooks
Modified: mod_parrot/trunk/include/modparrot_config.h
==============================================================================
--- mod_parrot/trunk/include/modparrot_config.h (original)
+++ mod_parrot/trunk/include/modparrot_config.h Tue Oct 28 10:57:08 2008
@@ -78,7 +78,12 @@
MP_HOOK_FIXUP,
MP_HOOK_LOG,
MP_HOOK_CLEANUP,
- MP_HOOK_LAST
+
+ /* mark the end of the individual hooks */
+ MP_HOOK_LAST,
+
+ /* shortcut for all hooks */
+ MP_HOOK_ALL
};
struct modparrot_module_info
Modified: mod_parrot/trunk/lib/ModParrot/HLL/pir.pir
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/HLL/pir.pir (original)
+++ mod_parrot/trunk/lib/ModParrot/HLL/pir.pir Tue Oct 28 10:57:08 2008
@@ -19,7 +19,9 @@
load_bytecode 'ModParrot/Constants.pbc'
# register apache directives
- .local pmc add_module, cmds, hooks
+ .local pmc add_module, cmds, hooks, mp_const
+
+ mp_const = get_root_global [ 'ModParrot'; 'Constants' ], 'table'
cmds = new 'ResizablePMCArray'
@@ -62,14 +64,8 @@
# we want *all* the hooks
hooks = new 'ResizablePMCArray'
- $I0 = 0
- loop_start:
- $P0 = new 'Integer'
- $P0 = $I0
- hooks[$I0] = $P0
- inc $I0
- if $I0 < 19 goto loop_start
-
+ $I0 = mp_const['MP_HOOK_ALL']
+ hooks[0] = $I0
add_module = get_hll_global [ 'ModParrot'; 'Apache'; 'Module' ], 'add'
$P1 = add_module("modparrot_pir_module", "PIR", cmds, hooks)
.end
Modified: mod_parrot/trunk/src/module.c
==============================================================================
--- mod_parrot/trunk/src/module.c (original)
+++ mod_parrot/trunk/src/module.c Tue Oct 28 10:57:08 2008
@@ -318,14 +318,16 @@
Parrot_PMC cmd_array,
Parrot_PMC hook_array)
{
- int i, num;
+ int i, num, hook_index, do_all=0;
modparrot_srv_config *mpcfg;
modparrot_module_info *minfo;
Parrot_PMC sub;
+ Parrot_PMC hpmc;
module *modp = (module *)apr_pcalloc(p, sizeof(*modp));
module **modpp;
modparrot_context *ctxp = get_interp_ctx(interp);
server_rec *s = ctxp->s;
+
if (!cmd_array) return(NULL);
num = Parrot_PMC_get_intval(interp, cmd_array);
@@ -426,9 +428,17 @@
/* populate hook array for use by register_meta_hooks */
num = Parrot_PMC_get_intval(interp, hook_array);
- for (i = 0; i < num; i++) {
- int hook_index;
- Parrot_PMC hpmc;
+ if (num) {
+ hpmc = Parrot_PMC_get_pmc_keyed_int(interp, hook_array, 0);
+ hook_index = Parrot_PMC_get_intval(interp, hpmc);
+ if (hook_index == MP_HOOK_ALL) {
+ do_all = 1;
+ }
+ for (i = 0; i < MP_HOOK_LAST; i++) {
+ minfo->hooks[i] = 1;
+ }
+ }
+ for (i = 0; i < num && !do_all; i++) {
hpmc = Parrot_PMC_get_pmc_keyed_int(interp, hook_array, i);
hook_index = Parrot_PMC_get_intval(interp, hpmc);
if (hook_index < 0 || hook_index >= MP_HOOK_LAST) {