develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34485 - in branches/pdd30install_stage3: config/gen/config_pm runtime/parrot/library src

From:
rurban
Date:
December 28, 2008 05:05
Subject:
[svn:parrot] r34485 - in branches/pdd30install_stage3: config/gen/config_pm runtime/parrot/library src
Message ID:
20081228130535.D9E1CCB9F9@x12.develooper.com
Author: rurban
Date: Sun Dec 28 05:05:34 2008
New Revision: 34485

Modified:
   branches/pdd30install_stage3/config/gen/config_pm/config_lib.in
   branches/pdd30install_stage3/runtime/parrot/library/config.pir
   branches/pdd30install_stage3/runtime/parrot/library/parrotlib.pir
   branches/pdd30install_stage3/src/library.c

Log:
56996-fhs-runtime

Modified: branches/pdd30install_stage3/config/gen/config_pm/config_lib.in
==============================================================================
--- branches/pdd30install_stage3/config/gen/config_pm/config_lib.in	(original)
+++ branches/pdd30install_stage3/config/gen/config_pm/config_lib.in	Sun Dec 28 05:05:34 2008
@@ -1,3 +1,4 @@
+
 .pcc_sub main:
         get_params "(0)", P5
 	set I10, P5     # argv
@@ -12,10 +13,17 @@
 
 	<<PCONFIG>>
 
-	if I11, is_install
+	set P0["installed"], I11
+	ge I11, 1, is_install
 	set S1, "<<PWD>>"
 	set P0["prefix"], S1
 is_install:
 	freeze S0, P0
 	print S0
 	end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:

Modified: branches/pdd30install_stage3/runtime/parrot/library/config.pir
==============================================================================
--- branches/pdd30install_stage3/runtime/parrot/library/config.pir	(original)
+++ branches/pdd30install_stage3/runtime/parrot/library/config.pir	Sun Dec 28 05:05:34 2008
@@ -48,12 +48,27 @@
 .sub _config
     .local pmc CONF
     .local string conf_file
+
+    # We should check if a linked frozen hash already exists
+    # and return that instead. See RT #57418
+    #$P0 = find_global '', '_config'
+    #unless $P0 goto runtime
+    #$P0 = _config()
+    #.return( $P0 )
+
+runtime:
     conf_file = interpinfo .INTERPINFO_RUNTIME_PREFIX
-    conf_file .= "/runtime/parrot/include/config.fpmc"
+    conf_file .= "/lib/parrot/include/config.fpmc"
+    stat $I0, conf_file, 0
+    if $I0 goto conf
 
+    conf_file = interpinfo .INTERPINFO_RUNTIME_PREFIX
+    conf_file .= "/runtime/parrot/include/config.fpmc"
+conf:
     open CONF, conf_file, "<"
     $I0 = defined CONF
     if $I0 goto ok1
+
     printerr "Can't read '"
     printerr conf_file
     printerr "': "

Modified: branches/pdd30install_stage3/runtime/parrot/library/parrotlib.pir
==============================================================================
--- branches/pdd30install_stage3/runtime/parrot/library/parrotlib.pir	(original)
+++ branches/pdd30install_stage3/runtime/parrot/library/parrotlib.pir	Sun Dec 28 05:05:34 2008
@@ -24,14 +24,13 @@
     .local pmc includes
     .local string root
 
-
-    # XXX todo: get root from config
     $P0 = new 'Env'
     root = $P0["PARROT_RUNTIME_ROOT"]
     length $I0, root
     if $I0 == 0 goto DEFAULT
     branch OKAY
 DEFAULT:
+    # lib/parrot on installed, or runtime
     root = "runtime/parrot"
 OKAY:
 
@@ -138,13 +137,22 @@
     stat $I0, name, 0
     if $I0 goto END
 
-    name = "runtime/parrot/dynext/"
+    .include "interpinfo.pasm"
+    name = interpinfo .INTERPINFO_RUNTIME_PREFIX
+    concat name, "lib/parrot/dynext/"
     concat name, request
     stat $I0, name, 0
     if $I0 goto END
 
+    concat name, ext
+    stat $I0, name, 0
+    if $I0 goto END
+
     name = "runtime/parrot/dynext/"
     concat name, request
+    stat $I0, name, 0
+    if $I0 goto END
+
     concat name, ext
     stat $I0, name, 0
     if $I0 goto END

Modified: branches/pdd30install_stage3/src/library.c
==============================================================================
--- branches/pdd30install_stage3/src/library.c	(original)
+++ branches/pdd30install_stage3/src/library.c	Sun Dec 28 05:05:34 2008
@@ -121,64 +121,111 @@
 Platform code may add, delete, or replace search path entries as needed. See
 also F<include/parrot/library.h> for C<enum_lib_paths>.
 
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+then the config hash is checked for the path prefix. This still crashes.
+
 =cut
 
 */
 
+#undef ENABLE_PARROT_LIBRARY_INSTALLED
+
 void
 parrot_init_library_paths(PARROT_INTERP)
 {
     PMC *paths;
     STRING *entry;
+    INTVAL installed = 0;
 
     PMC * const iglobals = interp->iglobals;
     /* create the lib_paths array */
     PMC * const lib_paths = pmc_new(interp, enum_class_FixedPMCArray);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    PMC * const config_hash = VTABLE_get_pmc_keyed_int(interp, iglobals, IGLOBALS_CONFIG_HASH);
+    STRING * const key = CONST_STRING(interp, "installed");
+#endif
 
     VTABLE_set_integer_native(interp, lib_paths, PARROT_LIB_PATH_SIZE);
     VTABLE_set_pmc_keyed_int(interp, iglobals,
             IGLOBALS_LIB_PATHS, lib_paths);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    if (VTABLE_elements(interp, config_hash) &&
+        VTABLE_exists_keyed_str(interp, config_hash, key))) {
+        installed = VTABLE_get_integer_keyed_str(interp, config_hash, key);
+    }
+#endif
+
     /* each is an array of strings */
     /* define include paths */
     paths = pmc_new(interp, enum_class_ResizableStringArray);
     VTABLE_set_pmc_keyed_int(interp, lib_paths,
             PARROT_LIB_PATH_INCLUDE, paths);
-    entry = CONST_STRING(interp, "runtime/parrot/include/");
-    VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "runtime/parrot/");
-    VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    if (installed) {
+#endif
+        entry = CONST_STRING(interp, "lib/parrot/include/");
+        VTABLE_push_string(interp, paths, entry);
+        entry = CONST_STRING(interp, "lib/parrot/");
+        VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    }
+    else {
+#endif
+        entry = CONST_STRING(interp, "runtime/parrot/include/");
+        VTABLE_push_string(interp, paths, entry);
+        entry = CONST_STRING(interp, "runtime/parrot/");
+        VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    }
+#endif
     entry = CONST_STRING(interp, "./");
     VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "lib/parrot/include/");
-    VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "lib/parrot/");
-    VTABLE_push_string(interp, paths, entry);
 
     /* define library paths */
     paths = pmc_new(interp, enum_class_ResizableStringArray);
     VTABLE_set_pmc_keyed_int(interp, lib_paths,
             PARROT_LIB_PATH_LIBRARY, paths);
-    entry = CONST_STRING(interp, "runtime/parrot/library/");
-    VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "runtime/parrot/");
-    VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    if (installed) {
+#endif
+        entry = CONST_STRING(interp, "lib/parrot/library/");
+        VTABLE_push_string(interp, paths, entry);
+        entry = CONST_STRING(interp, "lib/parrot/");
+        VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    }
+    else {
+#endif
+        entry = CONST_STRING(interp, "runtime/parrot/library/");
+        VTABLE_push_string(interp, paths, entry);
+        entry = CONST_STRING(interp, "runtime/parrot/");
+        VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    }
+#endif
     entry = CONST_STRING(interp, "./");
     VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "lib/parrot/library/");
-    VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "lib/parrot/");
-    VTABLE_push_string(interp, paths, entry);
 
     /* define dynext paths */
     paths = pmc_new(interp, enum_class_ResizableStringArray);
     VTABLE_set_pmc_keyed_int(interp, lib_paths,
             PARROT_LIB_PATH_DYNEXT, paths);
-    entry = CONST_STRING(interp, "runtime/parrot/dynext/");
-    VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    if (installed) {
+#endif
+        entry = CONST_STRING(interp, "lib/parrot/dynext/");
+        VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    }
+    else {
+#endif
+        entry = CONST_STRING(interp, "runtime/parrot/dynext/");
+        VTABLE_push_string(interp, paths, entry);
+#ifdef ENABLE_PARROT_LIBRARY_INSTALLED
+    }
+#endif
     entry = CONST_STRING(interp, "");
     VTABLE_push_string(interp, paths, entry);
-    entry = CONST_STRING(interp, "lib/parrot/dynext/");
-    VTABLE_push_string(interp, paths, entry);
 
     /* shared exts */
     paths = pmc_new(interp, enum_class_ResizableStringArray);



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About