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/grof...


From: Werner LEMBERG
Subject: [Groff-commit] groff ChangeLog NEWS doc/groff.texinfo man/grof...
Date: Sun, 19 Nov 2006 09:56:49 +0000

CVSROOT:        /cvsroot/groff
Module name:    groff
Changes by:     Werner LEMBERG <wl>     06/11/19 09:56:49

Modified files:
        .              : ChangeLog NEWS 
        doc            : groff.texinfo 
        man            : groff_tmac.man roff.man 
        tmac           : Makefile.sub trace.tmac 
Added files:
        tmac           : 62bit.tmac 

Log message:
        * man/roff.man, doc/groff.texinfo: Improve history of roff, based on
        information from Tom Van Vleck <address@hidden>.
        
        * tmac/62bit.tmac: New macro package.
        * tmac/Makefile.sub (NORMALFILES): Add it.
        * NEWS: Document it.
        
        * tmac/trace.tmac: Protect against being loaded again.
        (nr): Always show result.
        
        * doc/groff.texinfo (Input Encodings): Document latin-5.
        
        * man/grof_tmac.man: Document sv, latinX, cp1047, 60bit, ec.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1006&r2=1.1007
http://cvs.savannah.gnu.org/viewcvs/groff/NEWS?cvsroot=groff&r1=1.226&r2=1.227
http://cvs.savannah.gnu.org/viewcvs/groff/doc/groff.texinfo?cvsroot=groff&r1=1.252&r2=1.253
http://cvs.savannah.gnu.org/viewcvs/groff/man/groff_tmac.man?cvsroot=groff&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/groff/man/roff.man?cvsroot=groff&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/groff/tmac/Makefile.sub?cvsroot=groff&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/groff/tmac/trace.tmac?cvsroot=groff&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/groff/tmac/62bit.tmac?cvsroot=groff&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1006
retrieving revision 1.1007
diff -u -b -r1.1006 -r1.1007
--- ChangeLog   13 Nov 2006 17:53:12 -0000      1.1006
+++ ChangeLog   19 Nov 2006 09:56:49 -0000      1.1007
@@ -1,3 +1,21 @@
+2006-11-18  Werner LEMBERG  <address@hidden>
+
+       * man/roff.man, doc/groff.texinfo: Improve history of roff, based on
+       information from Tom Van Vleck <address@hidden>.
+
+2006-11-16  Werner LEMBERG  <address@hidden>
+
+       * tmac/62bit.tmac: New macro package.
+       * tmac/Makefile.sub (NORMALFILES): Add it.
+       * NEWS: Document it.
+
+       * tmac/trace.tmac: Protect against being loaded again.
+       (nr): Always show result.
+
+       * doc/groff.texinfo (Input Encodings): Document latin-5.
+
+       * man/grof_tmac.man: Document sv, latinX, cp1047, 60bit, ec.
+
 2006-11-13  Werner LEMBERG  <address@hidden>
 
        * doc/groff.texinfo (Page Location Traps) [.wh]: Give more details

Index: NEWS
===================================================================
RCS file: /cvsroot/groff/groff/NEWS,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -b -r1.226 -r1.227
--- NEWS        6 Nov 2006 12:33:32 -0000       1.226
+++ NEWS        19 Nov 2006 09:56:49 -0000      1.227
@@ -99,6 +99,10 @@
   rectangle on devices which don't support inclusion of PS images) and
   is loaded in troffrc at start-up.
 
+o A new auxiliary macro package `62bit' has been added which provides some
+  macros for adding, multiplying, and dividing signed 62bit integers (mainly
+  to handle normal groff number operations without risking overflow errors).
+
 
 VERSION 1.19.2
 ==============

Index: doc/groff.texinfo
===================================================================
RCS file: /cvsroot/groff/groff/doc/groff.texinfo,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -b -r1.252 -r1.253
--- doc/groff.texinfo   13 Nov 2006 17:53:12 -0000      1.252
+++ doc/groff.texinfo   19 Nov 2006 09:56:49 -0000      1.253
@@ -623,17 +623,18 @@
 @section History
 @cindex history
 
address@hidden @code{runoff}, the program
address@hidden @code{RUNOFF}, the program
 @cindex @code{rf}, the program
 @code{troff} can trace its origins back to a formatting program called
address@hidden, written by address@hidden@tie{}Saltzer, which ran on MIT's CTSS
-operating system in the mid-sixties.  The name came from the use of the
-phrase ``run off a document'', meaning to print it out.  Bob Morris ported it
-to the 635 architecture and called the program @code{roff} (an abbreviation
-of @code{runoff}).  It was rewritten as @code{rf} for the @w{PDP-7}
-(before having @acronym{UNIX}), and at the same time (1969), Doug
-McIllroy rewrote an extended and simplified version of @code{roff} in
-the @acronym{BCPL} programming language.
address@hidden, written by Jerry E.@: Saltzer, which ran on MIT's
address@hidden (@emph{Compatible Time Sharing System}) operating system in
+the mid-sixties.  The name came from the use of the phrase ``run off a
+document'', meaning to print it out.  Bob Morris ported it to the 635
+architecture and called the program @code{roff} (an abbreviation of
address@hidden).  It was rewritten as @code{rf} for the @w{PDP-7} (before
+having @acronym{UNIX}), and at the same time (1969), Doug McIllroy rewrote
+an extended and simplified version of @code{roff} in the @acronym{BCPL}
+programming language.
 
 @cindex @code{roff}, the program
 The first version of @acronym{UNIX} was developed on a @w{PDP-7} which
@@ -4840,6 +4841,16 @@
 beginning of your document or use @samp{-mlatin2} as a command line
 argument for @code{groff}.
 
address@hidden latin-5
address@hidden encoding, input, @w{latin-5} (ISO @w{8859-9})
address@hidden @w{latin-2} (ISO @w{8859-9}), input encoding
address@hidden ISO @w{8859-9} (@w{latin-2}), input encoding
address@hidden input encoding, @w{latin-2} (ISO @w{8859-9})
address@hidden latin2.tmac
+For Turkish.  Either say @address@hidden latin9.tmac}} at the very
+beginning of your document or use @samp{-mlatin9} as a command line
+argument for @code{groff}.
+
 @item latin-9 (latin-0)
 @cindex encoding, input, @w{latin-9} (@w{latin-0}, ISO @w{8859-15})
 @cindex @w{latin-9} (@w{latin-0}, ISO @w{8859-15}), input encoding

Index: man/groff_tmac.man
===================================================================
RCS file: /cvsroot/groff/groff/man/groff_tmac.man,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- man/groff_tmac.man  2 Jul 2006 09:06:19 -0000       1.14
+++ man/groff_tmac.man  19 Nov 2006 09:56:49 -0000      1.15
@@ -14,7 +14,7 @@
 
 File position: <groff-source>/man/groff_tmac.man
 
-Last update: 02 Jul 2006
+Last update: 16 Nov 2006
 
 This file is part of groff, the GNU roff type-setting system.
 
@@ -404,24 +404,21 @@
 .
 .
 .\" --------------------------------------------------------------------
-.SS "Special Packages"
+.SS "Language-specific Packages"
 .\" --------------------------------------------------------------------
 .
-The macro packages in this section are not intended for stand-alone
-usage, but can be used to add special functionality to any other
-macro package or to plain groff.
-.
 .
 .TP
 .B fr
 This file adds support for French localization of the main macro packages
 (me, mom, mm, and ms).
 .
-It should be used as the last macro package on the command line.
 .
 Example:
+.RS
 .IP
 .Shell_cmd "groff -ms -mfr foo.ms > foo.ps"
+.RE
 .
 .IP
 Note that
@@ -431,6 +428,95 @@
 .
 .
 .TP
+.B sv
+Swedish localization support for the me, mom, and ms macro packages.
+.
+Note that Swedish for the mm macros is handled separately; see
+.BR groff_mmse (@MAN7EXT@).
+.
+It should be used as the last macro package on the command line.
+.
+.
+.\" --------------------------------------------------------------------
+.SS "Input Encodings"
+.\" --------------------------------------------------------------------
+.
+.
+.TP
+.B latin1
+.TP+
+.B latin2
+.TP+
+.B latin5
+.TP+
+.B latin9
+Various input encodings supported directly by groff.
+.
+Normally, this macro is loaded at the very beginning of a document or
+specified as the first macro argument on the command line.
+.
+.B @address@hidden
+loads latin1 by default at start-up.
+.
+Note that these macro packages don't work on EBCDIC hosts.
+.
+.
+.TP
+.B cp1047
+Encoding support for EBCDIC.
+.
+On those platforms it is loaded automatically at start-up.
+.
+Due to different character ranges used in
+.B @address@hidden
+it doesn't work on architectures which are based on ASCII.
+.
+.
+.P
+Note that it can happen that some input encoding characters are not
+available for a particular output device.
+.
+For example, saying
+.
+.P
+.Example
+.  Text groff -Tlatin1 -mlatin9 ...
+./Example
+.
+.P
+fails if you use the Euro character in the input.
+.
+Usually, this limitation is present only for devices which have a
+limited set of output glyphs
+.RB ( \-Tascii ,
+.BR \-Tlatin1 );
+for other devices it is usually sufficient to install proper
+fonts which contain the necessary glyphs.
+.
+.
+.\" --------------------------------------------------------------------
+.SS "Special Packages"
+.\" --------------------------------------------------------------------
+.
+The macro packages in this section are not intended for stand-alone
+usage, but can be used to add special functionality to any other
+macro package or to plain groff.
+.
+.
+.TP
+.B 60bit
+Provide some macros for addition, multiplication, and division of 60bit
+integers (allowing safe multiplication of 30bit integers, for example).
+.
+.
+.TP
+.B ec
+Switch to the EC and TC font families.  To be used with
+.BR \%grodvi (@MAN1EXT@)
+\[en] this man page also gives more details how to use it.     
+.
+.
+.TP
 .B papersize
 This macro file is already loaded at start-up by
 .B @address@hidden
@@ -1101,6 +1187,7 @@
 for text lines, or write your own macro that handles also text lines
 with a leading dot.
 .
+.RS
 .IP
 .Example
 .  Text .de Text
@@ -1109,6 +1196,7 @@
 .  Text .\ nop\ \[rs])\[rs]\[rs]$*[rs]\)
 .  Text ..
 ./Example
+.RE
 .
 .Topic
 Write a comment macro that works both for copy-in and draft mode; for
@@ -1118,12 +1206,14 @@
 For example, the following macro just ignores its arguments, so it
 acts like a comment line:
 .
+.RS
 .IP
 .Example
 .  Text .de\ c
 .  Text ..
 .  Text .c\ This\ is\ like\ a\ comment\ line.
 ./Example
+.RE
 .
 .Topic
 In long macro definitions, make ample use of comment lines or empty

Index: man/roff.man
===================================================================
RCS file: /cvsroot/groff/groff/man/roff.man,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- man/roff.man        28 Oct 2006 15:49:53 -0000      1.33
+++ man/roff.man        19 Nov 2006 09:56:49 -0000      1.34
@@ -1,7 +1,7 @@
 .ig
 roff.man
 
-Last update: 27 Oct 2006
+Last update: 18 Nov 2006
 
 This file is part of groff, the GNU roff type-setting system.
 
@@ -195,13 +195,6 @@
 implements the look-and-feel and functionality of its classical
 ancestors, but has many extensions.
 .
-As
-.I groff
-is the only
-.I roff
-system that is available for every (or almost every) computer system
-it is the de-facto roff standard today.
-.
 .P
 In some ancient Unix systems, there was a binary called
 .B roff
@@ -209,7 +202,7 @@
 .B runoff
 of the
 .I Multics
-operating system, cf. section
+operating system, cf.\& section
 .BR HISTORY .
 The functionality of this program was very restricted even in
 comparison to ancient
@@ -242,7 +235,7 @@
 The most popular application of
 .I roff
 is the concept of
-.I manual pages
+.IR "manual pages" ,
 or shortly
 .IR "man pages" ;
 this is the standard documentation system on many operating systems.
@@ -257,7 +250,7 @@
 .I roff
 pipeline, which is usually hidden behind front-ends like
 .BR groff (@MAN1EXT@);
-an general overview of the formatting language; some tips for editing
+a general overview of the formatting language; some tips for editing
 .I roff
 files; and many pointers to further readings.
 .
@@ -279,7 +272,7 @@
 .
 .
 .\" --------------------------------------------------------------------
-.SS "The Predecessor runoff"
+.SS "The Predecessor RUNOFF"
 .\" --------------------------------------------------------------------
 .
 .P
@@ -288,20 +281,26 @@
 is intimately related to the history of the operating systems.
 .
 Its predecessor
-.B runoff
+.B RUNOFF
 was written by
 .I Jerry Saltzer
-on the
+for the
 .I CTSS
 operating system
 .RI ( "Compatible Time Sharing System" )
-as early as 1961.
+as early as 1964 \[en] note that CTSS commands were all uppercase.
 .
 When CTSS was further developed into the operating system
 .URL http://\:www.multicians.org "Multics" ,
 the famous predecessor of Unix from 1963,
 .I runoff
-became the main format for documentation and text processing.
+has been improved further by people from the Massachusetts Institute of
+Technology (MIT) and the Bell Technical Laboratory (BTL), including Dennis
+Ritchie and Joe Ossanna.
+.
+.BR "Multics runoff" ,
+for example, was now able to do two-pass operations; it became the main
+format for documentation and text processing.
 .
 Both operating systems could only be run on very expensive computers
 at that time, so they were mostly used in research and for official
@@ -326,7 +325,7 @@
 .
 .P
 The runoff program was written in the
-.I PL/1
+.I MAD
 language first, later on in
 .IR BCPL ,
 the grandmother of the
@@ -338,8 +337,12 @@
 .IR roff 's
 task to manage the Unix manual pages.
 .
-There are still documents written in the runoff language; for examples
-see Saltzer's home page, cf. section
+On the other hand, BCPL and runoff were ported to the GCOS system
+at Bell Labs since BTL left the development of Multics.
+.
+.P
+There are still documents written in the RUNOFF language; for examples
+see Saltzer's home page, cf.\& section
 .BR "SEE ALSO" .
 .
 .
@@ -347,12 +350,7 @@
 .SS "The Classical nroff/troff System"
 .\" --------------------------------------------------------------------
 .
-In the 1970s, the Multics off-spring
-.I Unix
-became more and more popular because it could be run on affordable
-machines and was easily available for universities at that time.
-.
-At MIT (the Massachusetts Institute of Technology), there was a need to
+At the Bell Labs, there was a need to
 drive the Wang
 .I Graphic Systems CAT
 typesetter, a graphical output device from a PDP-11 computer running
@@ -361,8 +359,7 @@
 As runoff was too limited for this task it was further developed into
 a more powerful text formatting system by
 .IR "Josef F. Osanna" ,
-a main developer of the Multics operating system and programmer of
-several runoff ports.
+who already programmed several runoff ports.
 .
 .P
 The name
@@ -411,7 +408,7 @@
 sytem as a whole.
 .
 .P
-Osanna first version was written in the PDP-11 assembly language and
+Osanna's first version was written in the PDP-11 assembly language and
 released in 1973.
 .
 .I Brian Kernighan
@@ -506,46 +503,11 @@
 .SS "Free roff"
 .\" --------------------------------------------------------------------
 .
-None of the commercial
-.I roff
-systems could attain the status of a successor for the general
-.I roff
-development.
-.
-Everyone was only interested in their own stuff.
-.
-This led to a steep downfall of the once excellent
-Unix operating system during the 1980s.
-.
-.P
-As a counter-measure to the galopping commercialization, AT&T Bell
-Labs tried to launch a rescue project with their
-.I Plan\~9
-operating system.
-.
-It is freely available for non-commercial use, even the source code,
-but has a proprietary license that impedes the free development.
-.
-This concept is outdated, so Plan\~9 was not accepted as a platform to
-bundle the main-stream development.
-.
-.P
-The only remedy came from the emerging free operatings systems
-(\f[CR]386BSD\f[], \f[CR]GNU/\:Linux\f[], etc.) and software projects
-during the 1980s and 1990s.
-.
-These implemented the ancient Unix features and many extensions, such
-that the old experience is not lost.
-.
-In the 21st century, Unix-like systems are again a major factor in
-computer industry \[em] thanks to free software.
-.
-.P
 The most important free
 .I roff
-project was the \f[CR]GNU\f[] port of
+project was the \f[CR]GNU\f[] implementation of
 .IR troff ,
-created by James Clark and put under the
+written from scratch by James Clark and put under the
 .URL http://\:www.gnu.org/\:copyleft "GNU Public License" .
 .
 It was called
@@ -576,6 +538,13 @@
 .I roff
 standard today.
 .
+.P
+An alternative is Gunnar Ritter's
+.URL http://\:heirloom.sf.net "Heirloom Documentation Tools"
+project, started in 2005, which provides enhanced versions of the various
+roff tools found in the OpenSolaris and Plan\~9 operating systems, now
+available under free licenses.
+.
 .
 .\" --------------------------------------------------------------------
 .SH "USING ROFF"
@@ -1319,7 +1288,7 @@
 .URL http://web.mit.edu/\:Saltzer/\:www/\:publications/\:pubs.html \
 "Jerry Saltzer's home page"
 .
-stores some documents using the ancient runoff formatting language.
+stores some documents using the ancient RUNOFF formatting language.
 .
 .TP
 CSTR Papers
@@ -1434,7 +1403,8 @@
 .SH AUTHORS
 .\" --------------------------------------------------------------------
 .
-Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006
+Free Software Foundation, Inc.
 .
 .P
 This document is distributed under the terms of the \f[CR]FDL\f[]

Index: tmac/Makefile.sub
===================================================================
RCS file: /cvsroot/groff/groff/tmac/Makefile.sub,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- tmac/Makefile.sub   30 May 2006 17:29:09 -0000      1.40
+++ tmac/Makefile.sub   19 Nov 2006 09:56:49 -0000      1.41
@@ -33,6 +33,7 @@
   mdoc.tmac \
   pic.tmac \
   a4.tmac papersize.tmac \
+  62bit.tmac \
   ec.tmac \
   safer.tmac \
   trace.tmac \

Index: tmac/trace.tmac
===================================================================
RCS file: /cvsroot/groff/groff/tmac/trace.tmac,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- tmac/trace.tmac     28 Oct 2006 16:59:32 -0000      1.11
+++ tmac/trace.tmac     19 Nov 2006 09:56:49 -0000      1.12
@@ -2,6 +2,8 @@
 .\"
 .\" Load this before a macro package that you want to trace.
 .
+.do if d !!!sp .nx
+.
 .nr _C \n(.C
 .cp 0
 .
@@ -15,12 +17,7 @@
 .  do !!ds !!!inc \$2
 .  do !!substring !!!inc 0 0
 .  do !!nr \$*
-.  do ie "\?\*[!!!inc]\?"\?-\?" \
-.    do tm1 "\*[!!!sp]*** .nr \$* (-> \n[\$1])
-.  el .do ie "\?\*[!!!inc]\?"\?+\?" \
 .    do tm1 "\*[!!!sp]*** .nr \$* (-> \n[\$1])
-.  el \
-.    do tm1 "\*[!!!sp]*** .nr \$*
 ..
 .
 .rn ds !!ds

Index: tmac/62bit.tmac
===================================================================
RCS file: tmac/62bit.tmac
diff -N tmac/62bit.tmac
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tmac/62bit.tmac     19 Nov 2006 09:56:49 -0000      1.1
@@ -0,0 +1,193 @@
+.\" 62bit.tmac
+.\"
+.\" Copyright (C) 2003, 2006
+.\"   Free Software Foundation, Inc.
+.\"      Written by Werner Lemberg (address@hidden)
+.\"
+.\" This file is part of groff.
+.\"
+.\" groff is free software; you can redistribute it and/or modify it under
+.\" the terms of the GNU General Public License as published by the Free
+.\" Software Foundation; either version 2, or (at your option) any later
+.\" version.
+.\"
+.\" groff is distributed in the hope that it will be useful, but WITHOUT ANY
+.\" WARRANTY; without even the implied warranty of MERCHANTABILITY or
+.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+.\" for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along
+.\" with groff; see the file COPYING.  If not, write to the Free Software
+.\" Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
+.\"
+.\"
+.\"
+.\" This file provides macros for addition, multiplication, and division of
+.\" 62bit signed integers.  Its main application is to `scale' 31bit values,
+.\" namely, to perform the operation `a * b / c' accurately.
+.\"
+.\" Note that it is the duty of the user to check whether the input values
+.\" fit within 31 bits (this is the range [-1073741824,1073741823]).
+.\"
+.
+.if d add31to62 \
+.  nx
+.
+.
+.\" .add31to62 <x> <y> <z>
+.\"
+.\" Add a 31bit signed integer to a signed 62bit integer.  Result is a
+.\" signed 62bit integer:
+.\"
+.\"   <x> + (<y>h * 2^30 + <y>l) = <z>h * 2^30 + <z>l
+.\"
+.\"
+.\" in: \n[<x>], \n[<y>h], \n[<y>l]
+.\"
+.\" out: \n[<z>h], \n[<z>l]
+.\"
+.\" Example: .add31to62 p q r
+.\"
+.\"          -> input registers: \n[p], \n[qh], \n[ql]
+.\"             output registers: \n[rh], \n[rl]
+.\"
+.de1 add31to62
+.  nr 62bit-lo2 (\\n[\\$2l])
+.  nr 62bit-hi2 (\\n[\\$2h])
+.
+.  nr 62bit-i ((\\n[\\$1] + \\n[62bit-lo2]) / 1073741824)
+.  nr \\$3l ((\\n[\\$1] + \\n[62bit-lo2]) % 1073741824)
+.
+.  ie ((\\n[62bit-lo2] > 0) & (\\n[\\$3l] < 0)) \{\
+.    nr \\$3l +1073741824
+.    nr 62bit-i -1
+.  \}
+.  el \
+.    if ((\\n[62bit-lo2] < 0) & (\\n[\\$3l] > 0)) \{\
+.      nr \\$3l -1073741824
+.      nr 62bit-i +1
+.    \}
+.
+.  nr \\$3h (\\n[62bit-hi2] + \\n[62bit-i])
+..
+.
+.
+.\" .mult31by31 <x> <y> <z>
+.\"
+.\" Multiply two 31bit signed integers.  Result is a 62bit signed
+.\" integer:
+.\"
+.\"   <x> * <y> = <z>h * 2^30 + <z>l
+.\"
+.\"
+.\" in: \n[<x>], \n[<y>]
+.\"
+.\" out: \n[<z>h], \n[<z>l]
+.\"
+.\" Example: .mult31by31 a b c
+.\"
+.\"          -> input registers: \n[a], \n[b]
+.\"             output registers: \n[ch], \n[cl]
+.\"
+.de1 mult31by31
+.  nr 62bit-1 (\\n[\\$1])
+.  nr 62bit-2 (\\n[\\$2])
+.
+.  nr 62bit-sign 1
+.  if !\\n[62bit-1] \{\
+.    nr 62bit-sign -(\\n[62bit-sign])
+.    nr 62bit-1 -(\\n[62bit-1])
+.  \}
+.  if !\\n[62bit-2] \{\
+.    nr 62bit-sign -(\\n[62bit-sign])
+.    nr 62bit-2 -(\\n[62bit-2])
+.  \}
+.
+.  nr 62bit-lo1 (\\n[62bit-1] % 32768)
+.  nr 62bit-hi1 (\\n[62bit-1] / 32768)
+.  nr 62bit-lo2 (\\n[62bit-2] % 32768)
+.  nr 62bit-hi2 (\\n[62bit-2] / 32768)
+.
+.  nr 62bit-lo3 (\\n[62bit-lo1] * \\n[62bit-lo2] % 1073741824)
+.  nr 62bit-i1 (\\n[62bit-lo1] * \\n[62bit-hi2] % 1073741824)
+.  nr 62bit-i2 (\\n[62bit-lo2] * \\n[62bit-hi1] % 1073741824)
+.  nr 62bit-hi3 (\\n[62bit-hi1] * \\n[62bit-hi2] % 1073741824)
+.
+.  nr 62bit-i1 (\\n[62bit-i1] + \\n[62bit-i2] % 1073741824)
+.  \" check carry overflow of 62bit-i1 + 62bit-i2
+.  if (\\n[62bit-i1] < \\n[62bit-i2]) \
+.    nr 62bit-hi3 +32768
+.
+.  nr 62bit-hi3 +(\\n[62bit-i1] / 32768)
+.  \" multiply by 32768 in small steps to avoid overflow
+.  nr 62bit-i 16 1
+.  while \\n-[62bit-i] \
+.    nr 62bit-i1 (\\n[62bit-i1] * 2 % 1073741824)
+.
+.  nr 62bit-lo3 (\\n[62bit-lo3] + \\n[62bit-i1] % 1073741824)
+.  \" check carry overflow of 62bit-i1 + lo
+.  if (\\n[62bit-lo3] < \\n[62bit-i1]) \
+.    nr 62bit-hi3 +1
+.
+.  if !\\n[62bit-sign] \{\
+.    nr 62bit-lo3 -(\\n[62bit-lo3])
+.    nr 62bit-hi3 -(\\n[62bit-hi3])
+.  \}
+.  nr \\$3l \\n[62bit-lo3]
+.  nr \\$3h \\n[62bit-hi3]
+..
+.
+.
+.\" .div62by31 <x> <y> <z>
+.\"
+.\" Divide a signed 62bit integer by a 31bit integer.  Result is a
+.\" 31bit signed integer:
+.\"
+.\"   (<x>h * 2^30 + <x>l) / <y> = <z>
+.\"
+.\"
+.\" in: \n[<x>h], \n[<x>l], \n[<y>]
+.\"
+.\" out: \n[<z>]
+.\"
+.\" Example: .div62by31 foo bar baz
+.\"
+.\"          -> input registers: \n[fooh] \n[fool] \n[bar]
+.\"             output register: \n[baz]
+.\"
+.de1 div62by31
+.  nr 62bit-lo1 \\n[\\$1l]
+.  nr 62bit-hi1 \\n[\\$1h]
+.  nr 62bit-2 \\n[\\$2]
+.  nr 62bit-3 0
+.
+.  nr 62bit-sign 1
+.  if ((\\n[62bit-lo1] < 0) : (\\n[62bit-hi1] < 0)) \{\
+.    nr 62bit-sign -(\\n[62bit-sign])
+.    nr 62bit-lo1 -(\\n[62bit-lo1])
+.    nr 62bit-hi1 -(\\n[62bit-hi1])
+.  \}
+.  if !\\n[62bit-2] \{\
+.    nr 62bit-sign -(\\n[62bit-sign])
+.    nr 62bit-2 -(\\n[62bit-2])
+.  \}
+.
+.  nr 62bit-i 31 1
+.  while \\n-[62bit-i] \{\
+.    nr 62bit-hi1 (\\n[62bit-hi1] * 2 % 1073741824)
+.    nr 62bit-3 (\\n[62bit-3] * 2)
+.    nr 62bit-hi1 +(\\n[62bit-lo1] / 536870912)
+.
+.    if (\\n[62bit-hi1] >= \\n[62bit-2]) \{\
+.      nr 62bit-hi1 -\\n[62bit-2]
+.      nr 62bit-3 +1
+.    \}
+.    nr 62bit-lo1 (\\n[62bit-lo1] * 2 % 1073741824)
+.  \}
+.
+.  if !\\n[62bit-sign] \
+.    nr 62bit-3 -(\\n[62bit-3])
+.  nr \\$3 \\n[62bit-3]
+..
+.
+.\" EOF




reply via email to

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