[svn:mod_parrot] r561 - in mod_parrot/trunk: include lib src
[email protected] Wed, 31 Dec 2008 14:50:11 -0800 (PST)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Wed Dec 31 14:50:11 2008
New Revision: 561
Modified:
mod_parrot/trunk/include/modparrot_config.h
mod_parrot/trunk/lib/mod_parrot.pir
mod_parrot/trunk/src/mod_parrot.c
mod_parrot/trunk/src/modparrot_config.c
Log:
add ParrotLibPath and ParrotDynextPath directives
ParrotIncludePath is currently the same as ParrotLibPath for compatibility
Modified: mod_parrot/trunk/include/modparrot_config.h
==============================================================================
--- mod_parrot/trunk/include/modparrot_config.h (original)
+++ mod_parrot/trunk/include/modparrot_config.h Wed Dec 31 14:50:11 2008
@@ -119,6 +119,8 @@
int disable_option_flags;
int option_flags;
char *include_path;
+ char *dynext_path;
+ char *lib_path;
apr_array_header_t *preload;
apr_array_header_t *module_array;
apr_hash_t *module_hash;
@@ -155,6 +157,8 @@
const char *modparrot_cmd_load(cmd_parms *, void *, const char *);
const char *modparrot_cmd_load_immediate(cmd_parms *, void *, const char *);
const char *modparrot_cmd_include_path(cmd_parms *, void *, const char *);
+const char *modparrot_cmd_lib_path(cmd_parms *, void *, const char *);
+const char *modparrot_cmd_dynext_path(cmd_parms *, void *, const char *);
const char *modparrot_cmd_add_type(cmd_parms *, void *, const char *, const char *);
const char *modparrot_cmd_add_handler(cmd_parms *, void *, const char *, const char *);
const char *modparrot_cmd_options(cmd_parms *, void *, const char *);
Modified: mod_parrot/trunk/lib/mod_parrot.pir
==============================================================================
--- mod_parrot/trunk/lib/mod_parrot.pir (original)
+++ mod_parrot/trunk/lib/mod_parrot.pir Wed Dec 31 14:50:11 2008
@@ -18,8 +18,6 @@
.include 'iglobals.pasm'
-.loadlib 'modparrot_group.so'
-
# use when NCI can dlfunc from the current image
.sub modparrot_init
.local pmc func
@@ -27,6 +25,9 @@
null nul
+ # loadlib here instead of as a pragma in case we set the dynext path
+ loadlib $P0, 'modparrot_group.so'
+
.include "build/src/pir/request_rec_dlfunc.pir"
dlfunc func, nul, "mpnci_null", "p"
@@ -132,6 +133,34 @@
lib_paths = interp[.IGLOBALS_LIB_PATHS]
# XXX replace magic constant -- see parrot's t/compilers/imcc/syn/file.t
+ include_paths = lib_paths[0]
+
+ pathlist = split ':', pathstring
+ count = elements pathlist
+ $I0 = count
+
+ path_loop:
+ dec $I0
+ path = pathlist[$I0]
+ unshift include_paths, path
+ if $I0 > 0 goto path_loop
+
+ .return(count)
+.end
+
+.sub modparrot_set_lib_path
+ .param string pathstring
+ .local string path
+ .local pmc pathlist
+ .local pmc interp
+ .local pmc lib_paths
+ .local pmc include_paths
+ .local int count
+
+ getinterp interp
+ lib_paths = interp[.IGLOBALS_LIB_PATHS]
+
+ # XXX replace magic constant -- see parrot's t/compilers/imcc/syn/file.t
include_paths = lib_paths[1]
pathlist = split ':', pathstring
@@ -146,3 +175,31 @@
.return(count)
.end
+
+.sub modparrot_set_dynext_path
+ .param string pathstring
+ .local string path
+ .local pmc pathlist
+ .local pmc interp
+ .local pmc lib_paths
+ .local pmc include_paths
+ .local int count
+
+ getinterp interp
+ lib_paths = interp[.IGLOBALS_LIB_PATHS]
+
+ # XXX replace magic constant -- see parrot's t/compilers/imcc/syn/file.t
+ include_paths = lib_paths[2]
+
+ pathlist = split ':', pathstring
+ count = elements pathlist
+ $I0 = count
+
+ path_loop:
+ dec $I0
+ path = pathlist[$I0]
+ unshift include_paths, path
+ if $I0 > 0 goto path_loop
+
+ .return(count)
+.end
Modified: mod_parrot/trunk/src/mod_parrot.c
==============================================================================
--- mod_parrot/trunk/src/mod_parrot.c (original)
+++ mod_parrot/trunk/src/mod_parrot.c Wed Dec 31 14:50:11 2008
@@ -104,10 +104,19 @@
modparrot_load_bytecode(interp,
cfg->init_path ? cfg->init_path : MODPARROT_DEFAULT_INIT);
- /* set additional include paths from apache config */
+ /* set additional paths from apache config */
if (cfg->include_path) {
+ /* XXX set to "include_path" when tests & docs are updated */
modparrot_call_sub_IS(interp, "ModParrot",
- "modparrot_set_include_path", &i, cfg->include_path);
+ "modparrot_set_lib_path", &i, cfg->include_path);
+ }
+ if (cfg->lib_path) {
+ modparrot_call_sub_IS(interp, "ModParrot",
+ "modparrot_set_lib_path", &i, cfg->lib_path);
+ }
+ if (cfg->dynext_path) {
+ modparrot_call_sub_IS(interp, "ModParrot",
+ "modparrot_set_dynext_path", &i, cfg->dynext_path);
}
/* initialize parrot side */
@@ -777,6 +786,20 @@
RSRC_CONF,
"set the Parrot include path"
),
+ AP_INIT_TAKE1(
+ "ParrotLibPath",
+ modparrot_cmd_lib_path,
+ NULL,
+ RSRC_CONF,
+ "set the Parrot library path"
+ ),
+ AP_INIT_TAKE1(
+ "ParrotDynextPath",
+ modparrot_cmd_dynext_path,
+ NULL,
+ RSRC_CONF,
+ "set the Parrot dynext path"
+ ),
AP_INIT_ITERATE(
"ParrotOptions",
modparrot_cmd_options,
Modified: mod_parrot/trunk/src/modparrot_config.c
==============================================================================
--- mod_parrot/trunk/src/modparrot_config.c (original)
+++ mod_parrot/trunk/src/modparrot_config.c Wed Dec 31 14:50:11 2008
@@ -74,6 +74,8 @@
cfg->init_path = NULL;
cfg->preload = apr_array_make(p, 2, sizeof(char *));
cfg->include_path = NULL;
+ cfg->lib_path = NULL;
+ cfg->dynext_path = NULL;
cfg->module_array = apr_array_make(p, 2, sizeof(module *));
cfg->module_hash = apr_hash_make(p);
for (i = 0; i < MP_HOOK_LAST; i++) {
@@ -120,6 +122,10 @@
if (newcfg->option_flags & MP_OPT_PARENT) {
merged->include_path = newcfg->include_path ?
newcfg->include_path : basecfg->include_path;
+ merged->lib_path = newcfg->lib_path ?
+ newcfg->lib_path : basecfg->lib_path;
+ merged->dynext_path = newcfg->dynext_path ?
+ newcfg->dynext_path : basecfg->dynext_path;
merged->trace_flags = newcfg->trace_flags;
merged->init_path = newcfg->init_path;
merged->preload = apr_array_copy(p, newcfg->preload);
@@ -230,6 +236,24 @@
return NULL;
}
+const char *modparrot_cmd_lib_path(cmd_parms *cmd, void *mconfig, const char *path)
+{
+ modparrot_srv_config *cfg;
+
+ cfg = GET_SERVER_CONFIG(cmd);
+ cfg->lib_path = (char *)apr_pstrdup(cmd->pool, path);
+ return NULL;
+}
+
+const char *modparrot_cmd_dynext_path(cmd_parms *cmd, void *mconfig, const char *path)
+{
+ modparrot_srv_config *cfg;
+
+ cfg = GET_SERVER_CONFIG(cmd);
+ cfg->dynext_path = (char *)apr_pstrdup(cmd->pool, path);
+ return NULL;
+}
+
const char *modparrot_cmd_options(cmd_parms *cmd, void *mconfig, const char *option)
{
modparrot_srv_config *cfg;