groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ./ChangeLog ./NEWS doc/groff.texinfo man/...


From: Werner LEMBERG
Subject: [Groff-commit] groff ./ChangeLog ./NEWS doc/groff.texinfo man/...
Date: Tue, 04 Apr 2006 20:20:05 +0000

CVSROOT:        /cvsroot/groff
Module name:    groff
Branch:         
Changes by:     Werner LEMBERG <address@hidden> 06/04/04 20:20:05

Modified files:
        .              : ChangeLog NEWS 
        doc            : groff.texinfo 
        man            : groff.man groff_diff.man 
        src/roff/troff : TODO input.cpp 
        tmac           : trace.tmac 

Log message:
        Implement new number register `.br' which is set to 1 if a macro has
        been called as .foo and to 0 if called as 'bar.  This is useful for
        -mtrace so that requests can be reliably traced too.
        
        * src/roff/troff/input.cpp (input_iterator): Add virtual function
        `get_break_flag'.
        (macro_iterator): Add `with_break' member and `get_break_flag'
        function.
        Update constructors.
        (input_stack): Add function `get_break_flag'.
        (break_flag_reg): New number register class.
        (input_init_requests): Register `.br'.
        
        * src/roff/troff/TODO: Updated.
        
        * tmac/trace.tmac: s/!!sp/!!!sp/.
        Modify definitions of `de', `de1', `am', and `am1' to use \n[.br].
        
        * docs/groff.texinfo, man/groff.man, man/groff_diff.man, NEWS:
        Document it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/groff/ChangeLog.diff?tr1=1.947&tr2=1.948&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/NEWS.diff?tr1=1.213&tr2=1.214&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/doc/groff.texinfo.diff?tr1=1.236&tr2=1.237&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/man/groff.man.diff?tr1=1.78&tr2=1.79&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/man/groff_diff.man.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/roff/troff/TODO.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/roff/troff/input.cpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/tmac/trace.tmac.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.947 groff/ChangeLog:1.948
--- groff/ChangeLog:1.947       Wed Mar 29 19:37:55 2006
+++ groff/ChangeLog     Tue Apr  4 20:20:03 2006
@@ -1,3 +1,26 @@
+2006-04-04  Werner LEMBERG  <address@hidden>
+
+       Implement new number register `.br' which is set to 1 if a macro has
+       been called as .foo and to 0 if called as 'bar.  This is useful for
+       -mtrace so that requests can be reliably traced too.
+
+       * src/roff/troff/input.cpp (input_iterator): Add virtual function
+       `get_break_flag'.
+       (macro_iterator): Add `with_break' member and `get_break_flag'
+       function.
+       Update constructors.
+       (input_stack): Add function `get_break_flag'.
+       (break_flag_reg): New number register class.
+       (input_init_requests): Register `.br'.
+
+       * src/roff/troff/TODO: Updated.
+
+       * tmac/trace.tmac: s/!!sp/!!!sp/.
+       Modify definitions of `de', `de1', `am', and `am1' to use \n[.br].
+
+       * docs/groff.texinfo, man/groff.man, man/groff_diff.man, NEWS:
+       Document it.
+
 2006-03-29  Werner LEMBERG  <address@hidden>
 
        * src/devices/grops/ps.cpp: s/must not/should not/ in warning
Index: groff/NEWS
diff -u groff/NEWS:1.213 groff/NEWS:1.214
--- groff/NEWS:1.213    Mon Mar 27 18:12:29 2006
+++ groff/NEWS  Tue Apr  4 20:20:03 2006
@@ -22,6 +22,18 @@
 o Two new requests `device' and `devicem' have been added which are
   equivalents to the \X and \Y escapes, respectively.
 
+o A new read-only number register `.br' is available which is set to 1
+  if a macro is called as .foo and to 0 if called as 'foo.  This allows to
+  reliably modify requests.
+
+    .als address@hidden bp
+    .de bp
+    .  tm before bp
+    .  ie \\n[.br] address@hidden
+    .  el 'address@hidden
+    .  tm after bp
+    ..
+
 Pic
 ---
 
@@ -34,6 +46,8 @@
 
 o A new macro `Dx' has been added which identifies the DragonFly OS.
 
+o -mtrace now shows whether a macro has been called as .foo or as 'foo.
+
 
 VERSION 1.19.2
 ==============
Index: groff/doc/groff.texinfo
diff -u groff/doc/groff.texinfo:1.236 groff/doc/groff.texinfo:1.237
--- groff/doc/groff.texinfo:1.236       Mon Mar 27 18:12:29 2006
+++ groff/doc/groff.texinfo     Tue Apr  4 20:20:03 2006
@@ -5438,6 +5438,29 @@
 requests cause a break implicitly; using the single quote control
 character prevents this.
 
address@hidden {.br}
+A read-only number register which is set address@hidden if a macro is called
+with the normal control character (as defined with the @code{cc}
+request), and set address@hidden otherwise.
+
address@hidden modifying requests
address@hidden requests, modifying
+This allows to reliably modify requests.
+
address@hidden
+.als bp*orig bp
+.de bp
+.  tm before bp
+.  ie \\n[.br] .bp*orig
+.  el 'bp*orig
+.  tm after bp
+..
address@hidden
+
+Using this register outside of a macro makes no sense (it always returns
+zero in such cases).
address@hidden
+
 @menu
 * Request and Macro Arguments::
 @end menu
@@ -7620,6 +7643,8 @@
 (@pxref{Environments}).
 @endDefreq
 
address@hidden
+
 @Defreq {eo, }
 @cindex disabling @code{\} (@code{eo})
 @cindex @code{\}, disabling (@code{eo})
Index: groff/man/groff.man
diff -u groff/man/groff.man:1.78 groff/man/groff.man:1.79
--- groff/man/groff.man:1.78    Mon Mar 27 18:12:29 2006
+++ groff/man/groff.man Tue Apr  4 20:20:03 2006
@@ -2,7 +2,7 @@
 .ig
 groff.man
 
-Last update: 27 Mar 2006
+Last update: 04 Apr 2006
 
 This file is part of groff, the GNU roff type-setting system.
 
@@ -3076,6 +3076,10 @@
 is used; always\~1 in
 .BR nroff .
 .
+.REG .br
+Within a macro, set to\~1 if macro called with the `normal' control
+character, and to\~0 otherwise.
+.
 .REG .c
 Current input line number.
 .
Index: groff/man/groff_diff.man
diff -u groff/man/groff_diff.man:1.55 groff/man/groff_diff.man:1.56
--- groff/man/groff_diff.man:1.55       Mon Mar 27 18:12:29 2006
+++ groff/man/groff_diff.man    Tue Apr  4 20:20:04 2006
@@ -3,7 +3,7 @@
 .ig
 groff_diff.man
 
-Last update : 27 Mar 2006
+Last update : 04 Apr 2006
 
 This file is part of groff, the GNU roff type-setting system.
 It is the source of the man-page groff_diff(7).
@@ -2607,6 +2607,31 @@
 The following read-only registers are available:
 .
 .TP
+.B \[rs]n[.br]
+Within a macro call, it is set to\~1 if the macro is called with the
+`normal' control character (`.' by default), and set to\~0 otherwise.
+This allows to reliably modify requests.
+.
+.RS
+.IP
+.ne 6v+\n(.Vu
+.ft CB
+.nf
+.Text .als bp*orig bp
+.Text .de bp
+.Text .tm before bp
+.Text .ie \[rs]\[rs]n[.br] .bp*orig
+.Text .el 'bp*orig
+.Text .tm after bp
+.Text ..
+.fi
+.RE
+.
+.IP
+Using this register outside of a macro makes no sense (it always returns
+zero in such cases).
+.
+.TP
 .B \[rs]n[.C]
 1\~if compatibility mode is in effect, 0\~otherwise.
 .
Index: groff/src/roff/troff/TODO
diff -u groff/src/roff/troff/TODO:1.8 groff/src/roff/troff/TODO:1.9
--- groff/src/roff/troff/TODO:1.8       Sat Dec 22 23:45:52 2001
+++ groff/src/roff/troff/TODO   Tue Apr  4 20:20:04 2006
@@ -106,9 +106,6 @@
 
 Generalized ligatures.
 
-Provide some way for a macro to tell whether it was called with `'' or
-`.'.  This would be useful for implementing a tracing macro package.
-
 Request to remove an environment. (Maintain a count of the references
 to the environment from the environment table, environment dictionary
 or environment stack.)
Index: groff/src/roff/troff/input.cpp
diff -u groff/src/roff/troff/input.cpp:1.35 groff/src/roff/troff/input.cpp:1.36
--- groff/src/roff/troff/input.cpp:1.35 Mon Mar 27 18:12:29 2006
+++ groff/src/roff/troff/input.cpp      Tue Apr  4 20:20:04 2006
@@ -217,6 +217,7 @@
   virtual int has_args() { return 0; }
   virtual int nargs() { return 0; }
   virtual input_iterator *get_arg(int) { return 0; }
+  virtual int get_break_flag() { return 0; }
   virtual int get_location(int, const char **, int *) { return 0; }
   virtual void backtrace() {}
   virtual int set_location(const char *, int) { return 0; }
@@ -416,6 +417,7 @@
   static int peek();
   static void push(input_iterator *);
   static input_iterator *get_arg(int);
+  static int get_break_flag();
   static int nargs();
   static int get_location(int, const char **, int *);
   static int set_location(const char *, int);
@@ -497,10 +499,10 @@
     input_iterator *tem = top;
     check_end_diversion(tem);
 #if defined(DEBUGGING)
-  if (debug_state)
-    if (tem->is_diversion)
-      fprintf(stderr,
-             "in diversion level = %d\n", input_stack::get_div_level());
+    if (debug_state)
+      if (tem->is_diversion)
+       fprintf(stderr,
+               "in diversion level = %d\n", input_stack::get_div_level());
 #endif
     top = top->next;
     level--;
@@ -622,6 +624,11 @@
   return 0;
 }
 
+int input_stack::get_break_flag()
+{
+  return top->get_break_flag();
+}
+
 void input_stack::shift(int n)
 {
   for (input_iterator *p = top; p; p = p->next)
@@ -3584,12 +3591,14 @@
 class macro_iterator : public string_iterator {
   arg_list *args;
   int argc;
+  int with_break;              // whether called as .foo or 'foo
 public:
   macro_iterator(symbol, macro &, const char *how_invoked = "macro");
   macro_iterator();
   ~macro_iterator();
   int has_args() { return 1; }
   input_iterator *get_arg(int i);
+  int get_break_flag() { return with_break; }
   int nargs() { return argc; }
   void add_arg(const macro &m);
   void shift(int n);
@@ -3823,11 +3832,11 @@
 }
 
 macro_iterator::macro_iterator(symbol s, macro &m, const char *how_called)
-: string_iterator(m, how_called, s), args(0), argc(0)
+: string_iterator(m, how_called, s), args(0), argc(0), with_break(break_flag)
 {
 }
 
-macro_iterator::macro_iterator() : args(0), argc(0)
+macro_iterator::macro_iterator() : args(0), argc(0), with_break(break_flag)
 {
 }
 
@@ -6806,6 +6815,16 @@
     return 0;
 }
 
+class break_flag_reg : public reg {
+public:
+  const char *get_string();
+};
+
+const char *break_flag_reg::get_string()
+{
+  return i_to_a(input_stack::get_break_flag());
+}
+
 class constant_reg : public reg {
   const char *s;
 public:
@@ -7669,6 +7688,7 @@
   init_request("writec", write_request_continue);
   init_request("writem", write_macro_request);
   number_reg_dictionary.define(".$", new nargs_reg);
+  number_reg_dictionary.define(".br", new break_flag_reg);
   number_reg_dictionary.define(".C", new constant_int_reg(&compatible_flag));
   number_reg_dictionary.define(".c", new lineno_reg);
   number_reg_dictionary.define(".color", new constant_int_reg(&color_flag));
Index: groff/tmac/trace.tmac
diff -u groff/tmac/trace.tmac:1.6 groff/tmac/trace.tmac:1.7
--- groff/tmac/trace.tmac:1.6   Sun Oct 10 18:17:37 2004
+++ groff/tmac/trace.tmac       Tue Apr  4 20:20:05 2006
@@ -5,7 +5,7 @@
 .nr _C \n(.C
 .cp 0
 .
-.do ds !!sp " \"
+.do ds !!!sp " \"
 .
 .eo
 .
@@ -17,13 +17,18 @@
 .  do ecs
 .  ec
 .  do !!de \$1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** de trace enter: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** de trace enter \$1: \\$0 \\$@
-.    do as !!sp " \"
-.    do nop \\*[!!\$1]\\
-.    do substring !!sp 1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** trace exit: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** trace exit \$1: \\$0 \\$@
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** de trace enter: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** de trace enter \$1: \\*[!!!br]\\$0 \\$@
+.    do as !!!sp " \"
+.    do ie \\n[.br] .do !!\$1 \\$@
+.    el 'do !!\$1 \\$@
+.    do substring !!!sp 1
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
 \..
 .
 .  do ds !!d1 !!\$1
@@ -37,13 +42,18 @@
 .  do ecs
 .  ec
 .  do !!de \$1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** de1 trace enter: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** de1 trace enter \$1: \\$0 \\$@
-.    do as !!sp " \"
-.    do nop \\*[!!\$1]\\
-.    do substring !!sp 1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** trace exit: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** trace exit \$1: \\$0 \\$@
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** de1 trace enter: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** de1 trace enter \$1: \\*[!!!br]\\$0 \\$@
+.    do as !!!sp " \"
+.    do ie \\n[.br] .di !!\$1 \\$@
+.    el 'do !!\$1 \\$@
+.    do substring !!!sp 1
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\$0 \\$@
 \..
 .
 .  do ds !!d1 !!\$1
@@ -60,13 +70,18 @@
 .  do ecs
 .  ec
 .  do !!de \$1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** am trace enter: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** am trace enter \$1: \\$0 \\$@
-.    do as !!sp " \"
-.    do nop \\*[!!\$1]\\
-.    do substring !!sp 1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** trace exit: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** trace exit \$1: \\$0 \\$@
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** am trace enter: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** am trace enter \$1: \\*[!!!br]\\$0 \\$@
+.    do as !!!sp " \"
+.    do ie \\n[.br] .do !!\$1 \\$@
+.    el 'do !!\$1 \\$@
+.    do substring !!!sp 1
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
 \..
 .
 .  do ds !!a1 !!\$1
@@ -80,13 +95,18 @@
 .  do ecs
 .  ec
 .  do !!de \$1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** am1 trace enter: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** am1 trace enter \$1: \\$0 \\$@
-.    do as !!sp " \"
-.    do nop \\*[!!\$1]\\
-.    do substring !!sp 1
-.    ie "\$1"\\$0" .do tm1 "\\*[!!sp]*** trace exit: \\$0 \\$@
-.    el .do tm1 "\\*[!!sp]*** trace exit \$1: \\$0 \\$@
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** am1 trace enter: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** am1 trace enter \$1: \\*[!!!br]\\$0 \\$@
+.    do as !!!sp " \"
+.    do ie \\n[.br] .do !!\$1 \\$@
+.    el 'do !!\$1 \\$@
+.    do substring !!!sp 1
+.    do ie \\n[.br] .ds !!!br .\"
+.    el .do ds !!!br '\"
+.    ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
+.    el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
 \..
 .
 .  do ds !!a1 !!\$1
@@ -99,8 +119,8 @@
 .rn return !!return
 .
 .!!de1 return
-.  substring !!sp 1
-.  tm1 "\*[!!sp]*** return
+.  substring !!!sp 1
+.  tm1 "\*[!!!sp]*** return
 .  !!return twice
 ..
 .




reply via email to

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