🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.groff.bug
Article #35

me macro problems

#35
From: James Clark
Date: Tue, 04 Aug 1992 12:12
292 lines
12282 bytes
   The following causes a stack underflow error in groff.

   It doesn't generate any error messages in regular ATT troff.  We have
   not tried it on AT&T ditroff.

   START OF EXAMPLE
   .(l
   list1
   list2
   .)l
   .)l
   END OF EXAMPLE

   We used the following command to run groff with .me macros

   #
   unset noclobber
   groff -C -e -t -Tps -me $1 >  /tmp/$1.out

   The issue came up when we attempted to printout the 
   postgres-setup.me
   file from .0/database in gatekeeper.dec.com

   That file appeared to have a mismatched ".)l"

groff gives you an error message because the input is incorrect.  AT&T
troff doesn't give you an error message, because AT&T troff never
(well, hardly ever) gives error messages.

   We are also having trouble printing out the 
   sbprolog_doc.me
   with groff from Stony Brook Prolog release.

   When we print that file out, we get really bad printout--lines are
   on top of each other--the text printed out includes lines that are 
   obviously intended to be troff macros.  We are going to be looking
   more into this problem in the near future.

This is because the groff -me macros interpret the $r and $R number
registers differently from the BSD -me macros (for reasons I explained
on the bug-groff list a couple of weeks ago.)  You'll also need to
change \*[ and \*] to \*{ and \*}.  I'm including a patch at the end.

James Clark
jjc@jclark.com

*** sbprolog_doc.me.~1~	Tue Aug  4 13:05:20 1992
--- sbprolog_doc.me	Tue Aug  4 13:09:39 1992
***************
*** 45,51 ****
  .nr pp 10			\" set pointsize
  .nr sp 10			\" set header pointsize
  .vs 16				\" line spacing 1-1/2 [12=single @ 10 points]
! .nr $r \n(.v/\n(.s		\" ratio of vert space to point size 
  .nr $R \n($r			\"      same, but for another use
  .nr fp 10
  .\}
--- 45,51 ----
  .nr pp 10			\" set pointsize
  .nr sp 10			\" set header pointsize
  .vs 16				\" line spacing 1-1/2 [12=single @ 10 points]
! .nr $r \n(.v00/\n(.sp		\" ratio of vert space to point size 
  .nr $R \n($r			\"      same, but for another use
  .nr fp 10
  .\}
***************
*** 131,137 ****
  .ds f. sec0.t
  .tp
  .nr pp 10
! .nr $r 10
  .fo ''''
  .EQ
  .nr 99 \n(.s
--- 131,137 ----
  .ds f. sec0.t
  .tp
  .nr pp 10
! .nr $r 160
  .fo ''''
  .EQ
  .nr 99 \n(.s
***************
*** 884,890 ****
  not always give the expected results.  An effort is made to minimize surprises
  by considering two numbers \fIx\fR and \fIy\fR (at least one of which is a float)
  to be unifiable if |\^|\^\fIx\fR\^| \- |\^\fIy\fR\^|\^|/\fImin\fR(|\^\fIx\fR\^|, |\^\fIy\fR\^|)
! to be less than 10\*[\-5\*].  However, this does not guarantee
  immunity against round-off errors.  For the same reason, users are warned
  that indexing on predicate arguments (see Section 15) may not give the
  expected results if floating point numbers are involved.
--- 884,890 ----
  not always give the expected results.  An effort is made to minimize surprises
  by considering two numbers \fIx\fR and \fIy\fR (at least one of which is a float)
  to be unifiable if |\^|\^\fIx\fR\^| \- |\^\fIy\fR\^|\^|/\fImin\fR(|\^\fIx\fR\^|, |\^\fIy\fR\^|)
! to be less than 10\*{\-5\*}.  However, this does not guarantee
  immunity against round-off errors.  For the same reason, users are warned
  that indexing on predicate arguments (see Section 15) may not give the
  expected results if floating point numbers are involved.
***************
*** 933,939 ****
  In effect, a builtin is simply a segment of code in a large case
  (i.e. \fIswitch\fR) statement.  Each builtin is identified internally by an
  integer, referred to as its ``builtin number'', associated with it.  The code for a builtin with
! builtin number \fIk\fR corresponds to the \fIk\*[th.\*]\fR case in the switch
  statement.
  SB-Prolog limits the total number of builtins to 256.
  .pp
--- 933,939 ----
  In effect, a builtin is simply a segment of code in a large case
  (i.e. \fIswitch\fR) statement.  Each builtin is identified internally by an
  integer, referred to as its ``builtin number'', associated with it.  The code for a builtin with
! builtin number \fIk\fR corresponds to the \fIk\*{th.\*}\fR case in the switch
  statement.
  SB-Prolog limits the total number of builtins to 256.
  .pp
***************
*** 1197,1203 ****
  not always give the expected results.  An effort is made to minimize surprises
  by considering two numbers \fIx\fR and \fIy\fR (at least one of which is a float)
  to be unifiable if ||\fIx\fR| \- |\fIy\fR||/\fImin\fR(|\fIx\fR|, |\fIy\fR|)
! to be less than 10\*[\-5\*].  The user should note, however, that this does
  not guarantee immunity against round-off errors.
  .pp
  The arithmetic evaluable predicates are as follows, where \fIX\fP and  
--- 1197,1203 ----
  not always give the expected results.  An effort is made to minimize surprises
  by considering two numbers \fIx\fR and \fIy\fR (at least one of which is a float)
  to be unifiable if ||\fIx\fR| \- |\fIy\fR||/\fImin\fR(|\fIx\fR|, |\fIy\fR|)
! to be less than 10\*{\-5\*}.  The user should note, however, that this does
  not guarantee immunity against round-off errors.
  .pp
  The arithmetic evaluable predicates are as follows, where \fIX\fP and  
***************
*** 1303,1312 ****
  \fIM\fR is instantiated to a float \fIm\fR (of magnitude less than 1), and \fIE\fR to an
  integer \fIn\fR, such that
  .(l C
! \fIF\fR = \fIm\fR * 2\*[\fIn\fR\*].
  .)l
  If \fIF\fR is uninstantiated in the call while \fIM\fR is a float and \fIE\fR
! an integer, then \fIF\fR becomes instantiated to \fIM\fR * 2\*[\fIE\fR\*].
  .lp
  \fBexp\fR(\fIX\fR, \fIY\fR\^)
  .(x E
--- 1303,1312 ----
  \fIM\fR is instantiated to a float \fIm\fR (of magnitude less than 1), and \fIE\fR to an
  integer \fIn\fR, such that
  .(l C
! \fIF\fR = \fIm\fR * 2\*{\fIn\fR\*}.
  .)l
  If \fIF\fR is uninstantiated in the call while \fIM\fR is a float and \fIE\fR
! an integer, then \fIF\fR becomes instantiated to \fIM\fR * 2\*{\fIE\fR\*}.
  .lp
  \fBexp\fR(\fIX\fR, \fIY\fR\^)
  .(x E
***************
*** 1314,1320 ****
  .)x
  .ip
  If \fIX\fR is instantiated to a number and \fIY\fR is uninstantiated in the call, then \fIY\fR
! is instantiated to \fIe\*[X\*]\fR (where \fIe\fR = 2.71828...); if \fIX\fR
  is uninstantiated in the call while \fIY\fR is instantiated to a positive
  number, then \fIX\fR is instantiated to \fIlog\*<e\*>\fR(\fIY\fR\^).
  .lp
--- 1314,1320 ----
  .)x
  .ip
  If \fIX\fR is instantiated to a number and \fIY\fR is uninstantiated in the call, then \fIY\fR
! is instantiated to \fIe\*{X\*}\fR (where \fIe\fR = 2.71828...); if \fIX\fR
  is uninstantiated in the call while \fIY\fR is instantiated to a positive
  number, then \fIX\fR is instantiated to \fIlog\*<e\*>\fR(\fIY\fR\^).
  .lp
***************
*** 1324,1330 ****
  .)x
  .ip
  If \fIX\fR is instantiated to a number while \fIY\fR is uninstantiated in
! the call, then \fIY\fR becomes instantiated to \fIX\fR\^\*[2\*]; if \fIX\fR
  is uninstantiated in the call while \fIY\fR is instantiated to a positive number, then
  \fIX\fR becomes instantiated to the positive square root of \fIY\fR (if \fIY\fR
  is negative in the call, \fIX\fR becomes instantiated to 0.0).
--- 1324,1330 ----
  .)x
  .ip
  If \fIX\fR is instantiated to a number while \fIY\fR is uninstantiated in
! the call, then \fIY\fR becomes instantiated to \fIX\fR\^\*{2\*}; if \fIX\fR
  is uninstantiated in the call while \fIY\fR is instantiated to a positive number, then
  \fIX\fR becomes instantiated to the positive square root of \fIY\fR (if \fIY\fR
  is negative in the call, \fIX\fR becomes instantiated to 0.0).
***************
*** 1340,1346 ****
  of \fIX\fR to make sure that the result is meaningful).  If \fIY\fR is
  instantiated to a number between \-\(*p/2 and \(*p/2 and \fIX\fR is
  uninstantiated in the call, then \fIX\fR becomes instantiated to
! \fIsin\fR\*[\-1\*](\fIY\fR\^).
  .lp
  .sh 2 "Convenience"
  .lp
--- 1340,1346 ----
  of \fIX\fR to make sure that the result is meaningful).  If \fIY\fR is
  instantiated to a number between \-\(*p/2 and \(*p/2 and \fIX\fR is
  uninstantiated in the call, then \fIX\fR becomes instantiated to
! \fIsin\fR\*{\-1\*}(\fIY\fR\^).
  .lp
  .sh 2 "Convenience"
  .lp
***************
*** 1947,1953 ****
  .)x
  .ip
  The current instance of \fIC\fR, interpreted as a clause, is asserted to
! the program with an index on its \fIN\^\*[th\*]\fR argument.  If \fIN\fR is
  zero, no index is created.
  .lp
  \fBasserta\fR(\fIC\fR\^)
--- 1947,1953 ----
  .)x
  .ip
  The current instance of \fIC\fR, interpreted as a clause, is asserted to
! the program with an index on its \fIN\^\*{th\*}\fR argument.  If \fIN\fR is
  zero, no index is created.
  .lp
  \fBasserta\fR(\fIC\fR\^)
***************
*** 2615,2621 ****
  \fIAZ\fR is either 0,
  indicating the fact should be inserted as the first clause in \fIPrref\fR,
  or 1, indicating it should be inserted as the last; \fIIndex\fR is 0
! if no index is to be built, or \fIn\fR if an index on the \fIn\fR\*[th\*]
  argument of the fact is to be used.  (Asserting at the beginning of the
  chain with indexing is not yet supported.)  \fIWhere\fR indicates where
  the clref is to be allocated: a value of 0 indicates that it should be
--- 2615,2621 ----
  \fIAZ\fR is either 0,
  indicating the fact should be inserted as the first clause in \fIPrref\fR,
  or 1, indicating it should be inserted as the last; \fIIndex\fR is 0
! if no index is to be built, or \fIn\fR if an index on the \fIn\fR\*{th\*}
  argument of the fact is to be used.  (Asserting at the beginning of the
  chain with indexing is not yet supported.)  \fIWhere\fR indicates where
  the clref is to be allocated: a value of 0 indicates that it should be
***************
*** 3155,3161 ****
  .(x I
  (D)	 index/3
  .)x
! indicating that an index should be created on the \fIIndexArg\fR\*[th.\*]
  argument of the predicate \fIPred\fR/\fIArity\fR.  All of the values
  \fIPred\fR, \fIArity\fR and \fIIndexArg\fR should be bound in the directive:
  \fIPred\fR should be an atom, \fIArity\fR a nonnegative integer, and
--- 3155,3161 ----
  .(x I
  (D)	 index/3
  .)x
! indicating that an index should be created on the \fIIndexArg\fR\*{th.\*}
  argument of the predicate \fIPred\fR/\fIArity\fR.  All of the values
  \fIPred\fR, \fIArity\fR and \fIIndexArg\fR should be bound in the directive:
  \fIPred\fR should be an atom, \fIArity\fR a nonnegative integer, and
***************
*** 3292,3298 ****
  is 50  This can be changed to some other value \fIn\fR by executing
  .(l
  	| ?- globalset($mac_\|depth(\fIn\fR)).
! .)l.
  .sh 2 "Macro Expander Options"
  .lp
  The following options are recognized by the macro expander:
--- 3292,3298 ----
  is 50  This can be changed to some other value \fIn\fR by executing
  .(l
  	| ?- globalset($mac_\|depth(\fIn\fR)).
! .)l
  .sh 2 "Macro Expander Options"
  .lp
  The following options are recognized by the macro expander:
***************
*** 3854,3860 ****
  .lp
  \fB$nthmember\fR(\fIX\fR, \fIL\fR, \fIN\fR)
  .ip
! Succeeds if the \fIN\fR\*[th.\*] element of the list \fIL\fR unifies with
  \fIX\fR.  Fails if \fIN\fR is greater than the length of \fIL\fR.  Either
  \fIX\fR and \fIL\fR, or \fIL\fR and \fIN\fR, should be instantiated at the
  time of the call.
--- 3854,3860 ----
  .lp
  \fB$nthmember\fR(\fIX\fR, \fIL\fR, \fIN\fR)
  .ip
! Succeeds if the \fIN\fR\*{th.\*} element of the list \fIL\fR unifies with
  \fIX\fR.  Fails if \fIN\fR is greater than the length of \fIL\fR.  Either
  \fIX\fR and \fIL\fR, or \fIL\fR and \fIN\fR, should be instantiated at the
  time of the call.
Technical Details
Message-ID: <9208041212.AA01624@jclark.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!jclark.com!jjc
References: <1992Aug2.223819.15396@uxa.ecn.bgu.edu>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.groff.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!jclark.com!jjc
From: jjc@jclark.com (James Clark)
Subject: me macro problems
Message-ID: <9208041212.AA01624@jclark.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
References: <1992Aug2.223819.15396@uxa.ecn.bgu.edu>
Distribution: gnu
Date: Tue, 4 Aug 1992 12:12:17 GMT
Approved: bug-groff@prep.ai.mit.edu
Lines: 294