groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ChangeLog doc/groff.texinfo src/roff/trof...


From: Werner LEMBERG
Subject: [Groff-commit] groff ChangeLog doc/groff.texinfo src/roff/trof...
Date: Thu, 25 Sep 2008 07:47:39 +0000

CVSROOT:        /cvsroot/groff
Module name:    groff
Changes by:     Werner LEMBERG <wl>     08/09/25 07:47:39

Modified files:
        .              : ChangeLog 
        doc            : groff.texinfo 
        src/roff/troff : input.cpp request.h 

Log message:
        Fix incompatibility between `.de1' and `.do'.  Without this change,
        the following snippet
        
          .de1 xx
          .  tm \\n(.C
          ..
          .cp 1
          .do xx
        
        prints 1 instead of 0.
        
        * src/roff/troff/input.cc (do_request): If a macro gets processed,
        call tok.next().
        (interpolate_macro): Add optional argument.  Update callers.
        (request::invoke): Add optional argument.
        (macro::invoke): Add optional argument to delay call of tok.next().
        
        * src/roff/troff/request.h (request_or_macro): Add argument to
        `invoke' member.  Update all derived classes.
        
        * doc/groff.texinfo: Improve documentation of .do request.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1139&r2=1.1140
http://cvs.savannah.gnu.org/viewcvs/groff/doc/groff.texinfo?cvsroot=groff&r1=1.268&r2=1.269
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/input.cpp?cvsroot=groff&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/request.h?cvsroot=groff&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1139
retrieving revision 1.1140
diff -u -b -r1.1139 -r1.1140
--- ChangeLog   9 Sep 2008 14:44:06 -0000       1.1139
+++ ChangeLog   25 Sep 2008 07:47:37 -0000      1.1140
@@ -1,3 +1,27 @@
+2008-09-24  Werner LEMBERG  <address@hidden>
+
+       Fix incompatibility between `.de1' and `.do'.  Without this change,
+       the following snippet
+
+         .de1 xx
+         .  tm \\n(.C
+         ..
+         .cp 1
+         .do xx
+
+       prints 1 instead of 0.
+
+       * src/roff/troff/input.cc (do_request): If a macro gets processed,
+       call tok.next().
+       (interpolate_macro): Add optional argument.  Update callers.
+       (request::invoke): Add optional argument.
+       (macro::invoke): Add optional argument to delay call of tok.next().
+
+       * src/roff/troff/request.h (request_or_macro): Add argument to
+       `invoke' member.  Update all derived classes.
+
+       * doc/groff.texinfo: Improve documentation of .do request.
+
 2008-09-09  Werner LEMBERG  <address@hidden>
 
        * tmac/an-old.tmac (FT): Initialize properly.  Reported by Tadziu

Index: doc/groff.texinfo
===================================================================
RCS file: /cvsroot/groff/groff/doc/groff.texinfo,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -b -r1.268 -r1.269
--- doc/groff.texinfo   26 Feb 2008 13:48:00 -0000      1.268
+++ doc/groff.texinfo   25 Sep 2008 07:47:38 -0000      1.269
@@ -14166,7 +14166,10 @@
 option.
 
 The @code{do} request turns off compatibility mode
-while executing its arguments as a @code{gtroff} command.
+while executing its arguments as a @code{gtroff} command.  However, it
+does not turn off compatibility mode while processing the macro itself.
+To do that, use the @code{de1} request (or manipulate the @code{.C}
+register manually).  @xref{Writing Macros}.
 
 @Example
 .do fam T

Index: src/roff/troff/input.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/input.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- src/roff/troff/input.cpp    26 Feb 2008 19:41:15 -0000      1.50
+++ src/roff/troff/input.cpp    25 Sep 2008 07:47:38 -0000      1.51
@@ -139,7 +139,7 @@
 static symbol read_long_escape_name(read_mode = NO_ARGS);
 static void interpolate_string(symbol);
 static void interpolate_string_with_args(symbol);
-static void interpolate_macro(symbol);
+static void interpolate_macro(symbol, int = 0);
 static void interpolate_number_format(symbol);
 static void interpolate_environment_variable(symbol);
 
@@ -2601,8 +2601,12 @@
   if (nm.is_null())
     skip_line();
   else
-    interpolate_macro(nm);
+    interpolate_macro(nm, 1);
   compatible_flag = old_compatible_flag;
+  request_or_macro *p = lookup_request(nm);
+  macro *m = p->to_macro();
+  if (m)
+    tok.next();
 }
 
 inline int possibly_handle_first_page_transition()
@@ -3006,7 +3010,7 @@
 {
 }
 
-void request::invoke(symbol)
+void request::invoke(symbol, int)
 {
   (*p)();
 }
@@ -3716,7 +3720,7 @@
   return 1;
 }
 
-static void interpolate_macro(symbol nm)
+static void interpolate_macro(symbol nm, int no_next)
 {
   request_or_macro *p = (request_or_macro *)request_dictionary.lookup(nm);
   if (p == 0) {
@@ -3745,7 +3749,7 @@
     }
   }
   if (p)
-    p->invoke(nm);
+    p->invoke(nm, no_next);
   else {
     skip_line();
     return;
@@ -3854,11 +3858,14 @@
   }
 }
 
-void macro::invoke(symbol nm)
+void macro::invoke(symbol nm, int no_next)
 {
   macro_iterator *mi = new macro_iterator(nm, *this);
   decode_args(mi);
   input_stack::push(mi);
+  // we must delay tok.next() in case the function has been called by
+  // do_request to assure proper handling of compatible_flag
+  if (!no_next)
   tok.next();
 }
 

Index: src/roff/troff/request.h
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/request.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/roff/troff/request.h    26 May 2005 21:02:01 -0000      1.11
+++ src/roff/troff/request.h    25 Sep 2008 07:47:38 -0000      1.12
@@ -1,5 +1,5 @@
 // -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004, 2008
    Free Software Foundation, Inc.
      Written by James Clark (address@hidden)
 
@@ -26,14 +26,14 @@
 class request_or_macro : public object {
 public:
   request_or_macro();
-  virtual void invoke(symbol s) = 0;
+  virtual void invoke(symbol, int) = 0;
   virtual macro *to_macro();
 };
 
 class request : public request_or_macro {
   REQUEST_FUNCP p;
 public:
-  void invoke(symbol);
+  void invoke(symbol, int);
   request(REQUEST_FUNCP);
 };
 
@@ -59,13 +59,13 @@
   macro &operator=(const macro &);
   void append(unsigned char);
   void append(node *);
-  void append_unsigned(unsigned int i);
-  void append_int(int i);
+  void append_unsigned(unsigned int);
+  void append_int(int);
   void append_str(const char *);
   void set(unsigned char, int);
   unsigned char get(int);
   int length();
-  void invoke(symbol);
+  void invoke(symbol, int);
   macro *to_macro();
   void print_size();
   int empty();
@@ -83,7 +83,7 @@
 extern void init_reg_requests();
 extern void init_env_requests();
 extern void init_hyphen_requests();
-extern void init_request(const char *s, REQUEST_FUNCP f);
+extern void init_request(const char *, REQUEST_FUNCP);
 
 class charinfo;
 class environment;




reply via email to

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