Author: bernhard
Date: Tue Oct 18 11:56:07 2005
New Revision: 9509

Modified:
   trunk/config/gen/parrot_include.pl
   trunk/docs/running.pod
   trunk/include/parrot/warnings.h
   trunk/src/dynext.c
   trunk/src/packfile.c
Log:
Turn some fprintf()s into Parrot_warn() in src/dynext.c.
Add PARROT_WARNINGS_DYNEXT_FLAG in include/parrot/warnings.h


Modified: trunk/config/gen/parrot_include.pl
==============================================================================
--- trunk/config/gen/parrot_include.pl  (original)
+++ trunk/config/gen/parrot_include.pl  Tue Oct 18 11:56:07 2005
@@ -17,7 +17,7 @@ use strict;
 use vars qw($description @args);
 use Parrot::Configure::Step ':gen';
 
-$description="Generating runtime/parrot/include...";
+$description = "Generating runtime/parrot/include...";
 
 my @files = qw(
     include/parrot/cclass.h

Modified: trunk/docs/running.pod
==============================================================================
--- trunk/docs/running.pod      (original)
+++ trunk/docs/running.pod      Tue Oct 18 11:56:07 2005
@@ -182,7 +182,7 @@ Prederefernce opcode function arguments 
 =item -t, --trace
 
 Run with the slow core and print trace information to B<stderr>. See 'parrot
---help-debug' for aviable flag bits.
+--help-debug' for available flag bits.
 
 =back
 
@@ -192,11 +192,11 @@ Run with the slow core and print trace i
 
 =item -w, --warnings
 
-Turn on warnings. See 'parrot --help-debug' for aviable flag bits.
+Turn on warnings. See 'parrot --help-debug' for available flag bits.
 
 =item -D, --parrot-debug
 
-Turn on interpreter debug flag. See 'parrot --help-debug' for aviable flag
+Turn on interpreter debug flag. See 'parrot --help-debug' for available flag
 bits.
 
 =item --gc-debug

Modified: trunk/include/parrot/warnings.h
==============================================================================
--- trunk/include/parrot/warnings.h     (original)
+++ trunk/include/parrot/warnings.h     Tue Oct 18 11:56:07 2005
@@ -10,7 +10,8 @@ typedef enum {
     PARROT_WARNINGS_NONE_FLAG     = 0x00,
     PARROT_WARNINGS_UNDEF_FLAG    = 0x01,
     PARROT_WARNINGS_IO_FLAG       = 0x02,
-    PARROT_WARNINGS_PLATFORM_FLAG = 0x04
+    PARROT_WARNINGS_PLATFORM_FLAG = 0x04,
+    PARROT_WARNINGS_DYNEXT_FLAG   = 0x08
 } Warnings_classes;
 
 /* &end_gen */

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c  (original)
+++ trunk/src/dynext.c  Tue Oct 18 11:56:07 2005
@@ -137,8 +137,8 @@ get_path(Interp *interpreter, STRING *li
 {
     STRING *path;
     char *full_name, *file_name, *file_w_ext = NULL;
-    char *tmp_lib_name, *path_end, *ext_start;
-    const char *err;
+    char *tmp_lib_name, *path_end, *ext_start = NULL;
+    const char *err = NULL;    /* buffer returned from Parrot_dlerror */
 
     /* Find the pure library name, without path or extension.  */
     file_name = string_to_cstring(interpreter, lib);
@@ -174,15 +174,17 @@ get_path(Interp *interpreter, STRING *li
                 return path;
             }
             err = Parrot_dlerror();
-            fprintf(stderr, "Couldn't load '%s': %s\n",
+            Parrot_warn(interpreter, PARROT_WARNINGS_DYNEXT_FLAG, "Couldn't 
load '%s': %s\n",
                     full_name, err ? err : "unknown reason");
             string_cstring_free(file_name);
             string_cstring_free(full_name);
             string_cstring_free(file_w_ext);
             return NULL;
         }
+
         /*
-         * then file.extension w/o prefix
+         * File with extension and prefix was not found, 
+         * so try file.extension w/o prefix
          */
         *handle = Parrot_dlopen(file_w_ext);
         if (*handle) {
@@ -208,7 +210,7 @@ get_path(Interp *interpreter, STRING *li
                     return path;
                 }
                 err = Parrot_dlerror();
-                fprintf(stderr, "Couldn't load '%s': %s\n",
+                Parrot_warn(interpreter, PARROT_WARNINGS_DYNEXT_FLAG, 
"Couldn't load '%s': %s\n",
                         full_name, err ? err : "unknown reason");
                 string_cstring_free(file_name);
                 string_cstring_free(file_w_ext);
@@ -228,13 +230,13 @@ get_path(Interp *interpreter, STRING *li
         }
     }
     /*
-     * finally, try the given file name as is.  we still use
+     * finally, try the given file name as is. We still use
      * Parrot_locate_runtime_file so that (a) relative pathnames are searched 
in
      * the standard locations, and (b) the angle of the slashes are adjusted as
      * required for non-Unix systems.
      */
     full_name = Parrot_locate_runtime_file(interpreter, file_name,
-                                           PARROT_RUNTIME_FT_DYNEXT);
+            PARROT_RUNTIME_FT_DYNEXT);
     if (full_name) {
         *handle = Parrot_dlopen(full_name);
         if (*handle) {
@@ -259,7 +261,7 @@ get_path(Interp *interpreter, STRING *li
     }
 #endif
     err = Parrot_dlerror();
-    fprintf(stderr, "Couldn't load '%s': %s\n",
+    Parrot_warn(interpreter, PARROT_WARNINGS_DYNEXT_FLAG, "Couldn't load '%s': 
%s\n",
             file_name, err ? err : "unknown reason");
     string_cstring_free(file_name);
     return NULL;
@@ -310,8 +312,9 @@ Parrot_init_lib(Interp *interpreter,
          */
         lib_pmc = pmc_new(interpreter, enum_class_ParrotLibrary);
     }
+
     /*
-     *  call init, if it exists
+     *  Call init, if it exists
      */
     if (init_func)
         (init_func)(interpreter, lib_pmc);

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c        (original)
+++ trunk/src/packfile.c        Tue Oct 18 11:56:07 2005
@@ -329,7 +329,7 @@ do_1_sub_pragma(Parrot_Interp interprete
                 }
                 else {
                     /* XXX which warn_class */
-                    Parrot_warn(interpreter, 0xff, "@MAIN sub not allowed\n");
+                    Parrot_warn(interpreter, PARROT_WARNINGS_ALL_FLAG, "@MAIN 
sub not allowed\n");
                 }
             }
     }

Reply via email to