texinfo-commits
[Top][All Lists]
Advanced

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

[7429] parsetexi update


From: gavinsmith0123
Subject: [7429] parsetexi update
Date: Sun, 2 Oct 2016 16:13:32 +0000 (UTC)

Revision: 7429
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7429
Author:   gavin
Date:     2016-10-02 16:13:29 +0000 (Sun, 02 Oct 2016)
Log Message:
-----------
parsetexi update

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

Modified: trunk/tp/parsetexi/Parsetexi.pm
===================================================================
--- trunk/tp/parsetexi/Parsetexi.pm     2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/Parsetexi.pm     2016-10-02 16:13:29 UTC (rev 7429)
@@ -170,6 +170,8 @@
         for my $f (@{$parser->{$key}}) {
           add_expanded_format ($f);
         }
+      } elsif ($key eq 'SHOW_MENU') {
+        conf_set_show_menu ($conf->{$key});
       } else {
        #warn "ignoring parser configuration value \"$key\"\n";
       }

Modified: trunk/tp/parsetexi/Parsetexi.xs
===================================================================
--- trunk/tp/parsetexi/Parsetexi.xs     2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/Parsetexi.xs     2016-10-02 16:13:29 UTC (rev 7429)
@@ -130,3 +130,5 @@
 add_expanded_format (format)
      char *format
 
+void
+conf_set_show_menu (int i)

Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c    2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/api.c    2016-10-02 16:13:29 UTC (rev 7429)
@@ -59,6 +59,7 @@
   reset_internal_xrefs ();
   reset_labels ();
   input_reset_input_stack ();
+  reset_conf ();
 
   current_node = current_section = 0;
 }
@@ -1019,3 +1020,20 @@
     }
   return hv;
 }
+
+
+/* Configuration values. */
+CONF conf;
+
+void
+conf_set_show_menu (int i)
+{
+  conf.show_menu = i;
+}
+
+void
+reset_conf (void)
+{
+  memset (&conf, 0, sizeof (conf));
+  conf.show_menu = 1;
+}

Modified: trunk/tp/parsetexi/api.h
===================================================================
--- trunk/tp/parsetexi/api.h    2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/api.h    2016-10-02 16:13:29 UTC (rev 7429)
@@ -27,3 +27,6 @@
 
 /* In api.c */
 void reset_context_stack (void);
+
+void conf_set_show_menu (int i);
+void reset_conf (void);

Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c        2016-10-02 12:57:34 UTC (rev 
7428)
+++ trunk/tp/parsetexi/handle_commands.c        2016-10-02 16:13:29 UTC (rev 
7429)
@@ -1062,21 +1062,25 @@
 
               if (current_node) // 4793
                 {
-                  if (cmd == CM_direntry)
+                  if (cmd == CM_direntry && conf.show_menu)
                     {
                       line_warn ("@direntry after first node");
                     }
                   else if (cmd == CM_menu)
                     {
-                      // add to array of menus for current node
+                      /* Add to array of menus for current node.  Currently
+                         done in Perl code. */
                     }
                 }
               else if (cmd != CM_direntry)
                 {
-                  line_error ("@%s seen before first @node",
-                              command_name(cmd));
-                  line_error ("perhaps your @top node should be "
-                              "wrapped in @ifnottex rather than @ifinfo?");
+                  if (conf.show_menu)
+                    {
+                      line_error ("@%s seen before first @node",
+                                  command_name(cmd));
+                      line_error ("perhaps your @top node should be "
+                                  "wrapped in @ifnottex rather than @ifinfo?");
+                    }
                   // 4810 unassociated menus
                 }
             }

Modified: trunk/tp/parsetexi/menus.c
===================================================================
--- trunk/tp/parsetexi/menus.c  2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/menus.c  2016-10-02 16:13:29 UTC (rev 7429)
@@ -46,10 +46,14 @@
           isolate_last_space (arg, ET_space_at_end_menu_node);
 
           parsed_entry_node = parse_node_manual (arg);
-          if (1)
+          if (!parsed_entry_node)
             {
-              add_extra_node_spec (current, "menu_entry_node", 
parsed_entry_node);
+              if (conf.show_menu)
+                line_error ("empty node name in menu entry");
             }
+          else
+            add_extra_node_spec (current, "menu_entry_node",
+                                 parsed_entry_node);
         }
       else if (arg->type == ET_menu_entry_description)
         {

Modified: trunk/tp/parsetexi/parser.h
===================================================================
--- trunk/tp/parsetexi/parser.h 2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/parser.h 2016-10-02 16:13:29 UTC (rev 7429)
@@ -118,3 +118,6 @@
 #include "counter.h"
 /* Defined in parser.c */
 extern COUNTER count_remaining_args, count_items, count_cells;
+
+/* In api.c */
+extern CONF conf;

Modified: trunk/tp/parsetexi/tree_types.h
===================================================================
--- trunk/tp/parsetexi/tree_types.h     2016-10-02 12:57:34 UTC (rev 7428)
+++ trunk/tp/parsetexi/tree_types.h     2016-10-02 16:13:29 UTC (rev 7429)
@@ -154,6 +154,10 @@
     ELEMENT part;
 } GLOBAL_INFO;
 
+typedef struct CONF {
+    int show_menu;
+} CONF;
+
 typedef struct {
     char *index_name;
     char *index_prefix;




reply via email to

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