texinfo-commits
[Top][All Lists]
Advanced

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

[7184] parsetexi more on global commands


From: gavinsmith0123
Subject: [7184] parsetexi more on global commands
Date: Wed, 25 May 2016 19:19:06 +0000 (UTC)

Revision: 7184
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7184
Author:   gavin
Date:     2016-05-25 19:19:05 +0000 (Wed, 25 May 2016)
Log Message:
-----------
parsetexi more on global commands

Modified Paths:
--------------
    trunk/tp/parsetexi/api.c
    trunk/tp/parsetexi/handle_commands.c
    trunk/tp/parsetexi/parser.c
    trunk/tp/parsetexi/parser.h
    trunk/tp/parsetexi/tree_types.h

Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c    2016-05-25 18:29:16 UTC (rev 7183)
+++ trunk/tp/parsetexi/api.c    2016-05-25 19:19:05 UTC (rev 7184)
@@ -54,6 +54,7 @@
   reset_region_stack ();
   reset_floats ();
   clear_expanded_formats ();
+  wipe_global_info ();
 
   current_node = current_section = 0;
 }

Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c        2016-05-25 18:29:16 UTC (rev 
7183)
+++ trunk/tp/parsetexi/handle_commands.c        2016-05-25 19:19:05 UTC (rev 
7184)
@@ -89,28 +89,6 @@
 int
 register_global_command (enum command_id cmd, ELEMENT *current)
 {
-  if ((command_data(cmd).flags & CF_global_unique))
-    {
-      if (cmd == CM_shortcontents)
-        cmd == CM_summarycontents;
-      switch (cmd)
-        {
-        case CM_copying:
-          global_info.copying = current; break;
-        case CM_settitle:
-          global_info.settitle = current; break;
-        case CM_shorttitlepage:
-          global_info.shorttitlepage = current; break;
-        case CM_title:
-          global_info.title = current; break;
-        case CM_titlepage:
-          global_info.titlepage = current; break;
-        case CM_top:
-          global_info.top = current; break;
-        }
-    }
-
-
   // TODO: Why even give @author this flag in the first place?
   if (cmd != CM_author && (command_data(cmd).flags & CF_global))
     {
@@ -151,6 +129,10 @@
     }
   else if ((command_data(cmd).flags & CF_global_unique))
     {
+      ELEMENT **where = 0;
+
+      if (cmd == CM_shortcontents)
+        cmd == CM_summarycontents;
       if (!current->line_nr.line_nr)
         current->line_nr = line_nr;
       switch (cmd)
@@ -160,9 +142,36 @@
           /* Check if we are inside an @include, and if so, do nothing. */
           if (input_number > 1)
             break;
+          where = &global_info.setfilename;
+          break;
         case CM_settitle:
-          global_info.settitle = current;
+          where = &global_info.settitle;
+          break;
+        case CM_shorttitlepage:
+          where = &global_info.shorttitlepage;
+          break;
+        case CM_title:
+          where = &global_info.title;
+          break;
+        case CM_titlepage:
+          where = &global_info.titlepage;
+          break;
+        case CM_top:
+          where = &global_info.top;
+          break;
+        case CM_copying:
+          where = &global_info.copying;
+          break;
+        case CM_documentdescription:
+          where = &global_info.documentdescription;
+          break;
         }
+      if (where)
+        {
+          if (*where)
+            line_warn ("multiple @%s", command_name(cmd));
+          *where = current;
+        }
       return 1;
     }
 

Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-05-25 18:29:16 UTC (rev 7183)
+++ trunk/tp/parsetexi/parser.c 2016-05-25 19:19:05 UTC (rev 7184)
@@ -117,6 +117,13 @@
 GLOBAL_INFO global_info;
 char *global_clickstyle = "arrow";
 
+void
+wipe_global_info (void)
+{
+  global_clickstyle = "arrow";
+  memset (&global_info, 0, sizeof (global_info));
+}
+
 
 /* 835 */
 void

Modified: trunk/tp/parsetexi/parser.h
===================================================================
--- trunk/tp/parsetexi/parser.h 2016-05-25 18:29:16 UTC (rev 7183)
+++ trunk/tp/parsetexi/parser.h 2016-05-25 19:19:05 UTC (rev 7184)
@@ -80,6 +80,7 @@
 
 extern GLOBAL_INFO global_info;
 extern char *global_clickstyle;
+void wipe_global_info (void);
 
 #include "macro.h"
 

Modified: trunk/tp/parsetexi/tree_types.h
===================================================================
--- trunk/tp/parsetexi/tree_types.h     2016-05-25 18:29:16 UTC (rev 7183)
+++ trunk/tp/parsetexi/tree_types.h     2016-05-25 19:19:05 UTC (rev 7184)
@@ -112,12 +112,15 @@
     char *input_encoding_name;
 
     /* Elements that should be unique. */
+    // 288 and Common.pm:164
     ELEMENT *settitle; /* Title of document. */
     ELEMENT *copying;
     ELEMENT *shorttitlepage;
     ELEMENT *title;
     ELEMENT *titlepage;
     ELEMENT *top;
+    ELEMENT *setfilename;
+    ELEMENT *documentdescription;
 
     /* Arrays of elements */
     ELEMENT footnotes;




reply via email to

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