Author: rurban
Date: Sun Jan  4 14:42:28 2009
New Revision: 34944

Modified:
   branches/pdd30install_stage3/src/library.c
   branches/pdd30install_stage3/t/src/library.t

Log:
Fix TT #128 "Honor source types in Parrot_locate_runtime_file":
  Added a third argument to try_bytecode_extensions() to pass the file_type 
down.
  Only on PARROT_RUNTIME_FT_PBC we find a .pbc now, 
  on PARROT_RUNTIME_FT_SOURCE and PARROT_RUNTIME_FT_PIR we find no existing 
.pbc. 

TBD: No check for PIR or SOURCE yet. Do we want this?


Modified: branches/pdd30install_stage3/src/library.c
==============================================================================
--- branches/pdd30install_stage3/src/library.c  (original)
+++ branches/pdd30install_stage3/src/library.c  Sun Jan  4 14:42:28 2009
@@ -83,7 +83,8 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
-static STRING* try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
+static STRING* try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path),
+    enum_runtime_ft file_type)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(* path);
@@ -494,7 +495,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
 static STRING*
-try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
+try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path), enum_runtime_ft 
file_type)
 {
     STRING *with_ext, *result;
 
@@ -535,7 +536,8 @@
       loop control. This is so the array can easily be processed in reverse.
      */
 
-    for (guess = 0 ; guess <= LOAD_EXT_CODE_LAST ; guess++) {
+    guess = file_type & PARROT_RUNTIME_FT_PBC ? 0 : 1;
+    for (; guess <= LOAD_EXT_CODE_LAST ; guess++) {
         with_ext = string_copy(interp, path);
         with_ext = string_append(interp,
                                  with_ext, const_string(interp, 
load_ext_code[guess]));
@@ -645,7 +647,7 @@
         full_name =
             (type & PARROT_RUNTIME_FT_DYNEXT)
                 ? try_load_file(interp, full_name)
-                : try_bytecode_extensions(interp, full_name);
+                : try_bytecode_extensions(interp, full_name, type);
 
         if (full_name)
             return full_name;
@@ -654,7 +656,7 @@
     full_name =
         (type & PARROT_RUNTIME_FT_DYNEXT)
             ? try_load_file(interp, file)
-            : try_bytecode_extensions(interp, file);
+            : try_bytecode_extensions(interp, file, type);
 
     return full_name;
 }

Modified: branches/pdd30install_stage3/t/src/library.t
==============================================================================
--- branches/pdd30install_stage3/t/src/library.t        (original)
+++ branches/pdd30install_stage3/t/src/library.t        Sun Jan  4 14:42:28 2009
@@ -132,7 +132,7 @@
 (null)
 OUTPUT
 
-c_output_is( <<'CODE', <<"OUTPUT", "FT_SOURCE, FT_PIR", 'todo' => 'TT #128 
force pir')
+c_output_is( <<'CODE', <<"OUTPUT", "FT_SOURCE, FT_PIR")
 
 #include <parrot/parrot.h>
 #include <parrot/embed.h>

Reply via email to