texinfo-commits
[Top][All Lists]
Advanced

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

[7161] parsetexi aliases


From: gavinsmith0123
Subject: [7161] parsetexi aliases
Date: Thu, 12 May 2016 20:12:43 +0000 (UTC)

Revision: 7161
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7161
Author:   gavin
Date:     2016-05-12 20:12:42 +0000 (Thu, 12 May 2016)
Log Message:
-----------
parsetexi aliases

Modified Paths:
--------------
    trunk/tp/parsetexi/commands.h
    trunk/tp/parsetexi/end_line.c
    trunk/tp/parsetexi/handle_commands.c
    trunk/tp/parsetexi/parser.c

Modified: trunk/tp/parsetexi/commands.h
===================================================================
--- trunk/tp/parsetexi/commands.h       2016-05-12 19:35:25 UTC (rev 7160)
+++ trunk/tp/parsetexi/commands.h       2016-05-12 20:12:42 UTC (rev 7161)
@@ -58,7 +58,7 @@
 #define CF_regular_font_style          0x0200
 #define CF_in_heading                  0x0400
 #define CF_ref                         0x0800
-/* free                                0x1000 */
+#define CF_ALIAS                        0x1000
 #define CF_block                       0x2000
 #define CF_raw                         0x4000
 #define CF_format_raw                  0x8000

Modified: trunk/tp/parsetexi/end_line.c
===================================================================
--- trunk/tp/parsetexi/end_line.c       2016-05-12 19:35:25 UTC (rev 7160)
+++ trunk/tp/parsetexi/end_line.c       2016-05-12 20:12:42 UTC (rev 7161)
@@ -276,6 +276,7 @@
       {
         /* @alias NEW = EXISTING */
         char *new = 0, *existing = 0;
+        enum command_id new_cmd, existing_cmd;
 
         if (!isalnum (*line)) /* This stops e.g. "@alias * = :" */
           goto alias_invalid;
@@ -297,9 +298,19 @@
 
         ADD_ARG(new);
         ADD_ARG(existing);
+
+        /* Remember the alias. */
+        new_cmd = add_texinfo_command (new);
+        new_cmd &= ~USER_COMMAND_BIT;
+        user_defined_command_data[new_cmd].flags |= CF_ALIAS;
+
+        user_defined_command_data[new_cmd].data = existing_cmd;
+        /* Note the data field is an int, existing_cmd is
+           enum command_id, so would have problems if enum command_id
+           were wider than an int. */
+
         free (new); free (existing);
 
-        /* TODO: Rememer the alias. */
         break;
       alias_invalid:
         line_error ("bad argument to @alias");

Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c        2016-05-12 19:35:25 UTC (rev 
7160)
+++ trunk/tp/parsetexi/handle_commands.c        2016-05-12 20:12:42 UTC (rev 
7161)
@@ -801,7 +801,7 @@
 
       // 4699 - If conditional true, push onto conditional stack.  Otherwise
       // open a new element (which we shall later remove, in
-      // process_remaining_on_line ("CLOSED (conditional)").
+      // process_remaining_on_line ("CLOSED conditional").
 
       debug ("CONDITIONAL %s", command_name(cmd));
       if (iftrue)
@@ -815,6 +815,10 @@
           add_to_element_contents (current, e);
           current = e;
         }
+      // 4709 ("last;")
+      line = strchr (line, '\0');
+      *get_new_line = 1;
+      goto funexit;
     }
   else /* line 4710 */
     {

Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-05-12 19:35:25 UTC (rev 7160)
+++ trunk/tp/parsetexi/parser.c 2016-05-12 20:12:42 UTC (rev 7161)
@@ -915,6 +915,8 @@
             }
           free (command);
         }
+      if (cmd && (command_data(cmd).flags & CF_ALIAS))
+        cmd = command_data(cmd).data;
     }
 
   /* There are cases when we need more input, but we don't want to




reply via email to

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