[svn:parrot] r45359 - trunk/src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Mar 31 18:27:14 UTC 2010


Author: NotFound
Date: Wed Mar 31 18:27:14 2010
New Revision: 45359
URL: https://trac.parrot.org/parrot/changeset/45359

Log:
move paths initialization from environmental vars experimental feature from parrot main executable to interpreter initialization in library

Modified:
   trunk/src/library.c
   trunk/src/main.c

Modified: trunk/src/library.c
==============================================================================
--- trunk/src/library.c	Wed Mar 31 17:24:26 2010	(r45358)
+++ trunk/src/library.c	Wed Mar 31 18:27:14 2010	(r45359)
@@ -194,6 +194,13 @@
     paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
     VTABLE_set_pmc_keyed_int(interp, lib_paths,
             PARROT_LIB_PATH_INCLUDE, paths);
+    { /* EXPERIMENTAL: add include path from environment */
+        const char *envvar = Parrot_getenv(interp, Parrot_str_new_constant(interp, "PARROT_INCLUDE"));
+        if (envvar != NULL  && envvar[0]) {
+            entry = Parrot_str_new(interp, envvar, 0);
+            VTABLE_push_string(interp, paths, entry);
+        }
+    }
     if (!STRING_IS_NULL(builddir)) {
         entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/"), 0);
         VTABLE_push_string(interp, paths, entry);
@@ -207,11 +214,17 @@
         VTABLE_push_string(interp, paths, entry);
     }
 
-
     /* define library paths */
     paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
     VTABLE_set_pmc_keyed_int(interp, lib_paths,
             PARROT_LIB_PATH_LIBRARY, paths);
+    { /* EXPERIMENTAL: add library path from environment */
+        const char *envvar = Parrot_getenv(interp, Parrot_str_new_constant(interp, "PARROT_LIBRARY"));
+        if (envvar != NULL && envvar[0]) {
+            entry = Parrot_str_new(interp, envvar, 0);
+            VTABLE_push_string(interp, paths, entry);
+        }
+    }
     if (!STRING_IS_NULL(builddir)) {
         entry = Parrot_str_concat(interp, builddir, CONST_STRING(interp, "/runtime/parrot/library/"), 0);
         VTABLE_push_string(interp, paths, entry);

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	Wed Mar 31 17:24:26 2010	(r45358)
+++ trunk/src/main.c	Wed Mar 31 18:27:14 2010	(r45359)
@@ -129,18 +129,6 @@
     initialize_interpreter(interp, (void*)&stacktop);
     imcc_initialize(interp);
 
-    { /* EXPERIMENTAL: add library and include paths from environment */
-        PMC *env = Parrot_pmc_new(interp, enum_class_Env);
-        STRING *path = VTABLE_get_string_keyed_str(interp, env,
-                Parrot_str_new_constant(interp, "PARROT_LIBRARY"));
-        if (!Parrot_str_is_null(interp, path) && Parrot_str_length(interp, path) > 0)
-            Parrot_lib_add_path(interp, path, PARROT_LIB_PATH_LIBRARY);
-        path = VTABLE_get_string_keyed_str(interp, env,
-                Parrot_str_new_constant(interp, "PARROT_INCLUDE"));
-        if (!Parrot_str_is_null(interp, path) && Parrot_str_length(interp, path) > 0)
-            Parrot_lib_add_path(interp, path, PARROT_LIB_PATH_INCLUDE);
-    }
-
     /* Parse flags */
     sourcefile = parseflags(interp, &argc, &argv, &core, &trace);
 


More information about the parrot-commits mailing list