[svn:mod_parrot] r339 - in mod_parrot/trunk: include src
[email protected] Sun, 18 May 2008 09:42:54 -0700 (PDT)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Sun May 18 09:42:52 2008
New Revision: 339
Modified:
mod_parrot/trunk/include/modparrot_config.h
mod_parrot/trunk/src/mod_parrot.c
mod_parrot/trunk/src/modparrot_config.c
Log:
disable tracing during initialization by default
add MP_OPT_TRACE_INIT flag to allow tweaking of initialization tracing
properly calculate top level option bit vector from enabled and disabled flags
Modified: mod_parrot/trunk/include/modparrot_config.h
==============================================================================
--- mod_parrot/trunk/include/modparrot_config.h (original)
+++ mod_parrot/trunk/include/modparrot_config.h Sun May 18 09:42:52 2008
@@ -20,6 +20,7 @@
/* per-server options */
#define MP_OPT_ENABLE 1
#define MP_OPT_PARENT 2
+#define MP_OPT_TRACE_INIT 4
/* configuration */
struct modparrot_handler_info
@@ -72,6 +73,8 @@
};
typedef struct modparrot_dir_config modparrot_dir_config;
+void modparrot_recalc_options(modparrot_srv_config *);
+
void *create_modparrot_srv_config(apr_pool_t *, server_rec *);
void *create_modparrot_dir_config(apr_pool_t *, char *path);
void *merge_modparrot_dir_config(apr_pool_t *, void *, void *);
Modified: mod_parrot/trunk/src/mod_parrot.c
==============================================================================
--- mod_parrot/trunk/src/mod_parrot.c (original)
+++ mod_parrot/trunk/src/mod_parrot.c Sun May 18 09:42:52 2008
@@ -65,7 +65,10 @@
/* initialize interpreter */
interp = modparrot_init_interpreter(ctx->parent_interp);
- Parrot_set_trace(interp, cfg->trace_flags);
+
+ /* enable tracing */
+ Parrot_set_trace(interp, (cfg->option_flags & MP_OPT_TRACE_INIT) ?
+ cfg->trace_flags : 0);
/* load the init code */
modparrot_load_bytecode(interp,
@@ -104,6 +107,12 @@
}
}
}
+
+ /* if we weren't tracing the initialization phase, enable tracing now */
+ if (!(cfg->option_flags & MP_OPT_TRACE_INIT)) {
+ Parrot_set_trace(interp, cfg->trace_flags);
+ }
+
return(interp);
}
Modified: mod_parrot/trunk/src/modparrot_config.c
==============================================================================
--- mod_parrot/trunk/src/modparrot_config.c (original)
+++ mod_parrot/trunk/src/modparrot_config.c Sun May 18 09:42:52 2008
@@ -228,6 +228,13 @@
return(l);
}
+/* calculate option bit vector from enabled and disabled bits */
+void modparrot_recalc_options(modparrot_srv_config *cfg)
+{
+ cfg->option_flags |= cfg->enable_option_flags;
+ cfg->option_flags &= ~(cfg->disable_option_flags);
+}
+
/* set an option from ParrotOptions
* this is not static so we can call it from a handler
*/
@@ -243,10 +250,15 @@
else if (!strncasecmp(option, "Enable", 6)) {
*flags |= MP_OPT_ENABLE;
}
+ else if (!strncasecmp(option, "TraceInit", 9)) {
+ *flags |= MP_OPT_TRACE_INIT;
+ }
else {
return 0;
}
+ modparrot_recalc_options(cfg);
+
return 1;
}