groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ./ChangeLog src/preproc/tbl/main.cpp src/...


From: Werner LEMBERG
Subject: [Groff-commit] groff ./ChangeLog src/preproc/tbl/main.cpp src/...
Date: Mon, 13 Sep 2004 04:19:16 -0400

CVSROOT:        /cvsroot/groff
Module name:    groff
Branch:         
Changes by:     Werner LEMBERG <address@hidden> 04/09/13 08:13:48

Modified files:
        .              : ChangeLog 
        src/preproc/tbl: main.cpp table.cpp table.h tbl.man 

Log message:
        In tbl, handle \a as an interpreted leader character if in
        compatibility mode.
        
        * src/preproc/tbl/table.h (PREFIX, PREFIX_CHAR, LEADER,
        LEADER_CHAR): New macros.
        (compatible_flag): New declaration.
        
        * src/preproc/tbl/main.cpp (table_input): Add LEADER_1, LEADER_2,
        LEADER_3, and LEADER_4 to `state'.
        (table_input::get): Handle `\a'.
        
        * src/preproc/tbl/table.cpp (PREFIX): Removed.
        (LEADER_REG): New macro.
        (table::init_output): Define LEADER_REG string register if in
        compatibility mode.
        
        * src/preproc/tbl/tbl.man: Document it.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/ChangeLog.diff?tr1=1.736&tr2=1.737&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/preproc/tbl/main.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/preproc/tbl/table.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/preproc/tbl/table.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/preproc/tbl/tbl.man.diff?tr1=1.12&tr2=1.13&r1=text&r2=text

Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.736 groff/ChangeLog:1.737
--- groff/ChangeLog:1.736       Sat Aug 28 08:15:21 2004
+++ groff/ChangeLog     Mon Sep 13 08:13:48 2004
@@ -1,3 +1,23 @@
+2004-09-10  Werner LEMBERG  <address@hidden>
+
+       In tbl, handle \a as an interpreted leader character if in
+       compatibility mode.
+
+       * src/preproc/tbl/table.h (PREFIX, PREFIX_CHAR, LEADER,
+       LEADER_CHAR): New macros.
+       (compatible_flag): New declaration.
+
+       * src/preproc/tbl/main.cpp (table_input): Add LEADER_1, LEADER_2,
+       LEADER_3, and LEADER_4 to `state'.
+       (table_input::get): Handle `\a'.
+
+       * src/preproc/tbl/table.cpp (PREFIX): Removed.
+       (LEADER_REG): New macro.
+       (table::init_output): Define LEADER_REG string register if in
+       compatibility mode.
+
+       * src/preproc/tbl/tbl.man: Document it.
+
 2004-08-18  Werner LEMBERG  <address@hidden>
 
        * tmac/doc.tmac (An): Fix error message.
Index: groff/src/preproc/tbl/main.cpp
diff -u groff/src/preproc/tbl/main.cpp:1.5 groff/src/preproc/tbl/main.cpp:1.6
--- groff/src/preproc/tbl/main.cpp:1.5  Sun Aug  8 16:51:45 2004
+++ groff/src/preproc/tbl/main.cpp      Mon Sep 13 08:13:48 2004
@@ -26,11 +26,14 @@
 
 extern "C" const char *Version_string;
 
-static int compatible_flag = 0;
+int compatible_flag = 0;
 
 class table_input {
   FILE *fp;
-  enum { START, MIDDLE, REREAD_T, REREAD_TE, REREAD_E, END, ERROR } state;
+  enum { START, MIDDLE,
+        REREAD_T, REREAD_TE, REREAD_E,
+        LEADER_1, LEADER_2, LEADER_3, LEADER_4,
+        END, ERROR } state;
   string unget_stack;
 public:
   table_input(FILE *);
@@ -117,11 +120,15 @@
       }
       break;
     case MIDDLE:
-      // handle line continuation
+      // handle line continuation and uninterpreted leader character
       if ((c = getc(fp)) == '\\') {
        c = getc(fp);
        if (c == '\n')
          c = getc(fp);         // perhaps state ought to be START now
+       else if (c == 'a' && compatible_flag) {
+         state = LEADER_1;
+         return '\\';
+       }
        else {
          if (c != EOF)
            ungetc(c, fp);
@@ -152,6 +159,18 @@
     case REREAD_E:
       state = MIDDLE;
       return 'E';
+    case LEADER_1:
+      state = LEADER_2;
+      return '*';
+    case LEADER_2:
+      state = LEADER_3;
+      return '(';
+    case LEADER_3:
+      state = LEADER_4;
+      return PREFIX_CHAR;
+    case LEADER_4:
+      state = MIDDLE;
+      return LEADER_CHAR;
     case END:
     case ERROR:
       return EOF;
Index: groff/src/preproc/tbl/table.cpp
diff -u groff/src/preproc/tbl/table.cpp:1.4 groff/src/preproc/tbl/table.cpp:1.5
--- groff/src/preproc/tbl/table.cpp:1.4 Mon Apr 19 06:17:46 2004
+++ groff/src/preproc/tbl/table.cpp     Mon Sep 13 08:13:48 2004
@@ -30,7 +30,6 @@
 const int DEFAULT_COLUMN_SEPARATION = 3;
 
 #define DELIMITER_CHAR "\\[tbl]"
-#define PREFIX "3"
 #define SEPARATION_FACTOR_REG PREFIX "sep"
 #define BOTTOM_REG PREFIX "bot"
 #define RESET_MACRO_NAME PREFIX "init"
@@ -64,6 +63,8 @@
 // this must be one character
 #define COMPATIBLE_REG PREFIX "c"
 
+#define LEADER_REG PREFIX LEADER
+
 #define BLOCK_WIDTH_PREFIX PREFIX "tbw"
 #define BLOCK_DIVERSION_PREFIX PREFIX "tbd"
 #define BLOCK_HEIGHT_PREFIX PREFIX "tbh"
@@ -1695,6 +1696,8 @@
     prints(".nr " LINESIZE_REG " \\n[.s]\n");
   if (!(flags & CENTER))
     prints(".nr " SAVED_CENTER_REG " \\n[.ce]\n");
+  if (compatible_flag)
+    prints(".ds " LEADER_REG " \\a\n");
   prints(".de " RESET_MACRO_NAME "\n"
         ".ft \\n[.f]\n"
         ".ps \\n[.s]\n"
Index: groff/src/preproc/tbl/table.h
diff -u groff/src/preproc/tbl/table.h:1.6 groff/src/preproc/tbl/table.h:1.7
--- groff/src/preproc/tbl/table.h:1.6   Sat Apr 17 06:41:50 2004
+++ groff/src/preproc/tbl/table.h       Mon Sep 13 08:13:48 2004
@@ -32,6 +32,14 @@
 #include "errarg.h"
 #include "error.h"
 
+// PREFIX and PREFIX_CHAR must be the same.
+#define PREFIX "3"
+#define PREFIX_CHAR '3'
+
+// LEADER and LEADER_CHAR must be the same.
+#define LEADER "a"
+#define LEADER_CHAR 'a'
+
 struct inc_number {
   short inc;
   short val;
@@ -153,3 +161,5 @@
 };
 
 void set_troff_location(const char *, int);
+
+extern int compatible_flag;
Index: groff/src/preproc/tbl/tbl.man
diff -u groff/src/preproc/tbl/tbl.man:1.12 groff/src/preproc/tbl/tbl.man:1.13
--- groff/src/preproc/tbl/tbl.man:1.12  Sun Mar 14 09:17:38 2004
+++ groff/src/preproc/tbl/tbl.man       Mon Sep 13 08:13:48 2004
@@ -63,11 +63,13 @@
 .SH OPTIONS
 .TP
 .B \-C
-Recognize
+Enable compatibility mode to
+recognize
 .B .TS
 and
 .B .TE
 even when followed by a character other than space or newline.
+Leader characters (\[rs]a) are handled as interpreted.
 .TP
 .B \-v
 Print the version number.
@@ -456,7 +458,8 @@
 instead of
 .BR bp .
 .LP
-Using \ea directly in a table to get leaders will not work.
+Using \ea directly in a table to get leaders will not work (except in
+compatibility mode).
 This is correct behaviour: \ea is an
 .B uninterpreted
 leader.




reply via email to

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