texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[8427] parsetexi error message for non-existent file


From: gavinsmith0123
Subject: [8427] parsetexi error message for non-existent file
Date: Sat, 27 Oct 2018 15:20:22 -0400 (EDT)

Revision: 8427
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8427
Author:   gavin
Date:     2018-10-27 15:20:21 -0400 (Sat, 27 Oct 2018)
Log Message:
-----------
parsetexi error message for non-existent file

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/Parsetexi.pm
    trunk/tp/Texinfo/XS/parsetexi/Parsetexi.xs
    trunk/tp/Texinfo/XS/parsetexi/api.c
    trunk/tp/Texinfo/XS/parsetexi/api.h
    trunk/tp/Texinfo/XS/parsetexi/menus.c
    trunk/tp/Texinfo/XS/parsetexi/parser.c

Modified: trunk/tp/Texinfo/XS/parsetexi/Parsetexi.pm
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/Parsetexi.pm  2018-10-27 18:18:46 UTC (rev 
8426)
+++ trunk/tp/Texinfo/XS/parsetexi/Parsetexi.pm  2018-10-27 19:20:21 UTC (rev 
8427)
@@ -289,7 +289,13 @@
   my $file_name = shift;
   my $tree_stream;
 
-  parse_file ($file_name);
+  my $status = parse_file ($file_name);
+  if ($status) {
+    # TODO: internationalise this message?
+    $self->document_error(sprintf("could not open %s: %s", $file_name, $!));
+    return undef;
+  }
+
   my $TREE = build_texinfo_tree ();
   get_parser_info ($self);
   _complete_node_menus ($self, $TREE);

Modified: trunk/tp/Texinfo/XS/parsetexi/Parsetexi.xs
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/Parsetexi.xs  2018-10-27 18:18:46 UTC (rev 
8426)
+++ trunk/tp/Texinfo/XS/parsetexi/Parsetexi.xs  2018-10-27 19:20:21 UTC (rev 
8427)
@@ -29,7 +29,7 @@
 void
 wipe_errors ()
 
-void
+int
 parse_file(filename)
         char * filename
 

Modified: trunk/tp/Texinfo/XS/parsetexi/api.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/api.c 2018-10-27 18:18:46 UTC (rev 8426)
+++ trunk/tp/Texinfo/XS/parsetexi/api.c 2018-10-27 19:20:21 UTC (rev 8427)
@@ -78,11 +78,14 @@
 }
 
 /* Set ROOT to root of tree obtained by parsing FILENAME. */
-void
+int
 parse_file (char *filename)
 {
   debug_output = 0;
   Root = parse_texi_file (filename);
+  if (Root)
+    return 0;
+  return 1;
 }
 
 ELEMENT *

Modified: trunk/tp/Texinfo/XS/parsetexi/api.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/api.h 2018-10-27 18:18:46 UTC (rev 8426)
+++ trunk/tp/Texinfo/XS/parsetexi/api.h 2018-10-27 19:20:21 UTC (rev 8427)
@@ -2,7 +2,7 @@
 extern ELEMENT *Root;
 extern CONF conf;
 
-void parse_file (char *filename);
+int parse_file (char *filename);
 ELEMENT *get_root (void);
 char *element_type_name (ELEMENT *element);
 int num_contents_children (ELEMENT *e);

Modified: trunk/tp/Texinfo/XS/parsetexi/menus.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/menus.c       2018-10-27 18:18:46 UTC (rev 
8426)
+++ trunk/tp/Texinfo/XS/parsetexi/menus.c       2018-10-27 19:20:21 UTC (rev 
8427)
@@ -20,7 +20,6 @@
 #include "input.h"
 #include "text.h"
 
-// 3549
 /* Save 'menu_entry_name' 'menu_entry_node', and 'menu_entry_description'
    extra keys on the top-level @menu element. */
 void
@@ -41,7 +40,6 @@
               line_warn ("empty menu entry name in `%s'", texi);
               free (texi);
             }
-          // FIXME: Check menu label isn't empty
         }
       else if (arg->type == ET_menu_entry_node)
         {
@@ -96,7 +94,6 @@
   char *line = *line_inout;
   int retval = 1;
 
-  // 4052
   /* A "*" at the start of a line beginning a menu entry. */
   if (*line == '*'
       && current->type == ET_preformatted
@@ -117,7 +114,6 @@
 
       /* The ET_menu_star element won't appear in the final tree. */
     }
-  // 4067
   /* A space after a "*" at the beginning of a line. */
   else if (strchr (whitespace_chars, *line)
            && current->contents.number > 0
@@ -160,7 +156,7 @@
         }
 
       if (pop_context () != ct_preformatted)
-        abort (); // bug
+        abort (); /* bug */
 
       menu_entry = new_element (ET_menu_entry);
       leading_text = new_element (ET_menu_entry_leading_text);
@@ -174,7 +170,6 @@
       text_append_n (&leading_text->text, line, leading_spaces);
       line += leading_spaces;
     }
-  // 4116
   /* A "*" followed by anything other than a space. */
   else if (current->contents.number > 0
            && last_contents_child(current)->type == ET_menu_star)
@@ -182,7 +177,6 @@
       debug ("ABORT MENU STAR");
       last_contents_child(current)->type = ET_NONE;
     }
-  // 4122
   /* After a separator in a menu (which would have been added in
      handle_separator in separator.c). */
   else if (current->args.number > 0

Modified: trunk/tp/Texinfo/XS/parsetexi/parser.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/parser.c      2018-10-27 18:18:46 UTC (rev 
8426)
+++ trunk/tp/Texinfo/XS/parsetexi/parser.c      2018-10-27 19:20:21 UTC (rev 
8427)
@@ -289,7 +289,6 @@
 }
 
 
-/* 835 */
 ELEMENT *
 parse_texi_file (char *filename)
 {
@@ -303,13 +302,8 @@
   
   status = input_push_file (filename);
   if (status)
-    {
-      /* FIXME document_error */
-      abort ();
-    }
+    return 0;
 
-  //filename = strdup (filename);
-
   /* Strip off a leading directory path, by looking for the last
      '/' in filename. */
   p = 0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]