summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-02-14 11:30:08 +0000
committerwlemb <wlemb>2003-02-14 11:30:08 +0000
commite2b4b9428ae54b64192c7a48dd10098eb2f17f3d (patch)
treecd3b661e1e5caebffaabf546881a9ce7bad25982
parent2f74c30001fab6d35640f015440f896ae6c15d5f (diff)
downloadgroff-e2b4b9428ae54b64192c7a48dd10098eb2f17f3d.tar.gz
New commands \D'Fr ...', \D'Fc ...', etc. for orthogonality.
Make \D'f ...' move horizontally again for backwards compatibility. Replace it with \D'Fg ...' where appropriate to avoid dependency on horizontal resolution. * src/roff/troff/input.cc (do_get_long_name): New function. (get_long_name): Call it. (read_draw_node): Handle `\D'Fx ...' by calling ... (read_color_draw_node): New function. (read_rgb, read_cmy, read_cmyk, read_gray): New optional argument `end'. Pass it to `do_get_long_name' which is used instead of `get_long_name'. * src/libs/libdriver/input.cc (color_from_Df_command): Remove unnecessary value guard. (parse_D_command) <'f'>: Add horizontal shift. * src/preproc/grn/hgraph.cc (HGPrintElt) <POLYGON>: Use \D'Fg ...'. * src/preproc/pic/troff.cc (troff_output::set_fill): Ditto. (FILL_MAX): Removed. * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo: Updated. * src/roff/troff/input.cc (do_name_test, do_expr_test, do_zero_width): Push `\n' if closing delimiter is missing. (token::next) <ESCAPE_NEWLINE>, <'\n'>, <'\ '>: Reset `have_input'. <'F'>: Make \F non-transparent at the beginning of line. (process_input_stack) <token::TOKEN_CHAR, token::TOKEN_NEWLINE, token::TOKEN_REQUEST, token::TOKEN_BEGIN_TRAP>: Don't handle `have_input'. (define_color): Free color in case of reassignment. * doc/groff.texinfo (@Defesc, @DefescList, @DefescItem, @DefescListEnd): Use @Var, not @var. Fix all calls. * src/preproc/grn/hgraph.cc (HGPrintElt): Fix typo. * src/preproc/pic/object.cc (object_spec::~object_spec): Free `shaded' and `outlined' arrays. (object_spec::object_spec): Initialize `shaded' and `outlined'. (graphic_object::set_fill_color, graphic_object::set_outline_color): Use strsave. (closed_object::set_fill_color): Ditto. * src/preproc/pic/troff.cc (troff_output::set_color): Use strsave instead of strdup. (troff_output::reset_color): Use a_delete instead of free. * src/preproc/pic/main.cc (do_file): Free `out' in case of error.
-rw-r--r--ChangeLog59
-rw-r--r--NEWS30
-rw-r--r--doc/groff.texinfo108
-rw-r--r--man/groff.man8
-rw-r--r--man/groff_diff.man25
-rw-r--r--src/libs/libdriver/input.cc16
-rw-r--r--src/preproc/grn/hgraph.cc3
-rw-r--r--src/preproc/pic/main.cc7
-rw-r--r--src/preproc/pic/object.cc14
-rw-r--r--src/preproc/pic/troff.cc12
-rw-r--r--src/roff/troff/input.cc115
-rw-r--r--src/roff/troff/node.cc8
12 files changed, 302 insertions, 103 deletions
diff --git a/ChangeLog b/ChangeLog
index 624b5ac6..35ed9e6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,62 @@
+2003-02-13 Werner LEMBERG <wl@gnu.org>
+
+ New commands \D'Fr ...', \D'Fc ...', etc. for orthogonality.
+ Make \D'f ...' move horizontally again for backwards compatibility.
+ Replace it with \D'Fg ...' where appropriate to avoid dependency
+ on horizontal resolution.
+
+ * src/roff/troff/input.cc (do_get_long_name): New function.
+ (get_long_name): Call it.
+
+ (read_draw_node): Handle `\D'Fx ...' by calling ...
+ (read_color_draw_node): New function.
+
+ (read_rgb, read_cmy, read_cmyk, read_gray): New optional argument
+ `end'.
+ Pass it to `do_get_long_name' which is used instead of
+ `get_long_name'.
+
+ * src/libs/libdriver/input.cc (color_from_Df_command): Remove
+ unnecessary value guard.
+ (parse_D_command) <'f'>: Add horizontal shift.
+
+ * src/preproc/grn/hgraph.cc (HGPrintElt) <POLYGON>: Use \D'Fg ...'.
+ * src/preproc/pic/troff.cc (troff_output::set_fill): Ditto.
+ (FILL_MAX): Removed.
+
+ * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo:
+ Updated.
+
+2003-02-12 Werner LEMBERG <wl@gnu.org>
+
+ * src/roff/troff/input.cc (do_name_test, do_expr_test,
+ do_zero_width): Push `\n' if closing delimiter is missing.
+
+ (token::next) <ESCAPE_NEWLINE>, <'\n'>, <'\ '>: Reset `have_input'.
+ <'F'>: Make \F non-transparent at the beginning of line.
+ (process_input_stack) <token::TOKEN_CHAR, token::TOKEN_NEWLINE,
+ token::TOKEN_REQUEST, token::TOKEN_BEGIN_TRAP>: Don't handle
+ `have_input'.
+
+ (define_color): Free color in case of reassignment.
+
+ * doc/groff.texinfo (@Defesc, @DefescList, @DefescItem,
+ @DefescListEnd): Use @Var, not @var.
+ Fix all calls.
+
+ * src/preproc/grn/hgraph.cc (HGPrintElt): Fix typo.
+
+ * src/preproc/pic/object.cc (object_spec::~object_spec): Free
+ `shaded' and `outlined' arrays.
+ (object_spec::object_spec): Initialize `shaded' and `outlined'.
+ (graphic_object::set_fill_color, graphic_object::set_outline_color):
+ Use strsave.
+ (closed_object::set_fill_color): Ditto.
+ * src/preproc/pic/troff.cc (troff_output::set_color): Use strsave
+ instead of strdup.
+ (troff_output::reset_color): Use a_delete instead of free.
+ * src/preproc/pic/main.cc (do_file): Free `out' in case of error.
+
2003-02-11 Werner LEMBERG <wl@gnu.org>
* doc/groff.texinfo: Improve documentation of `ad'.
diff --git a/NEWS b/NEWS
index dcfd6d9c..ce825bd8 100644
--- a/NEWS
+++ b/NEWS
@@ -44,9 +44,6 @@ o Composite glyphs are now supported. To do this, a subset of the Adobe
Please refer to the info pages of groff and to the groff_char man page
for more details.
-o The font cmtex10 has been added as the special font `SC' to the DVI fonts.
- It is used as a font-specific special font for CW and CWI.
-
o A new request `fschar' has been added to define font-specific fallback
characters. They are searched after the list of fonts declared with the
`fspecial' request but before the list of fonts declared with `special'.
@@ -58,6 +55,27 @@ o A new request `schar' has been added to define global fallback
characters. They are searched after the list of fonts declared with the
`special' request but before the already mounted special fonts.
+o In groff versions 1.18 and 1.18.1, \D'f ...' didn't move the current
+ point horizontally. Despite of being silly, this change has been
+ reverted for backwards compatibility. Consequently, the intermediate
+ output command `Df' also moves the position horizontally again.
+
+ \D'f ...' is deprecated since it depends on the horizontal resolution of
+ the output device (given with the `hor' parameter in the DESC file).
+ Use the new \D'Fg ...' instead.
+
+o For orthogonality, new \D subcommands to change the fill color are
+ available:
+
+ \D'Fr ...' (rgb)
+ \D'Fc ...' (cmy)
+ \D'Fg ...' (gray)
+ \D'Fk ...' (cmyk)
+ \D'Fd' (default color)
+
+ The arguments are the same as with the `defcolor' request. The current
+ position is *not* changed.
+
o The `.pe' number register isn't new but hasn't been documented before.
It is set to 1 during a page ejection caused by the `bp' request.
@@ -69,6 +87,12 @@ Grops
o The font `freeeuro.pfa' has been added to provide various default glyph
shapes for `eu' and `Eu'.
+Grodvi
+-----
+
+o The font cmtex10 has been added as the special font `SC' to the DVI fonts.
+ It is used as a font-specific special font for CW and CWI.
+
Grotty
------
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index dbd4a792..1d24e1c4 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -21,7 +21,7 @@
@copying
-This manual documents GNU @code{troff} version 1.18.
+This manual documents GNU @code{troff} version 1.18.2.
Copyright @copyright{} 1994-2000, 2001, 2002, 2003
Free Software Foundation, Inc.
@@ -150,24 +150,24 @@ Software Foundation raise funds for GNU development.''
@c definition of escapes
@macro Defesc{name, delimI, arg, delimII}
-@deffn Escape @t{\name\\delimI\}@var{\arg\}@t{\delimII\}
+@deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
@esindex \name\
@end macro
@macro DefescList{name, delimI, arg, delimII}
-@deffn Escape @t{\name\\delimI\}@var{\arg\}@t{\delimII\}
+@deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
@defdummy
@esindex \name\
@end macro
@macro DefescItem{name, delimI, arg, delimII}
-@deffnx Escape @t{\name\\delimI\}@var{\arg\}@t{\delimII\}
+@deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
@defdummy
@esindex \name\
@end macro
@macro DefescListEnd{name, delimI, arg, delimII}
-@deffnx Escape @t{\name\\delimI\}@var{\arg\}@t{\delimII\}
+@deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
@esindex \name\
@end macro
@@ -1274,11 +1274,11 @@ directory, and the main tmac directory; the default locations are
@Example
/usr/local/lib/groff/site-tmac
/usr/local/share/groff/site-tmac
-/usr/local/share/groff/1.18/tmac
+/usr/local/share/groff/1.18.2/tmac
@endExample
@noindent
-assuming that the version of @code{groff} is 1.18, and the installation
+assuming that the version of @code{groff} is 1.18.2, and the installation
prefix was @file{/usr/local}. It is possible to fine-tune those
directories during the installation process.
@end itemize
@@ -1332,11 +1332,11 @@ locations are
@Example
/usr/local/share/groff/site-font
-/usr/local/share/groff/1.18/font
+/usr/local/share/groff/1.18.2/font
@endExample
@noindent
-assuming that the version of @code{groff} is 1.18, and the installation
+assuming that the version of @code{groff} is 1.18.2, and the installation
prefix was @file{/usr/local}. It is possible to fine-tune those
directories during the installation process.
@end itemize
@@ -5164,8 +5164,8 @@ increment or decrement a register.
@DefreqList {nr, ident @t{+}@Var{value}}
@DefreqItem {nr, ident @t{-}@Var{value}}
-@DefescItem {\\R, ', ident @t{+}@Var{value}, '}
-@DefescListEnd {\\R, ', ident @t{-}@Var{value}, '}
+@DefescItem {\\R, ', ident @t{+}value, '}
+@DefescListEnd {\\R, ', ident @t{-}value, '}
Increment (decrement) register @var{ident} by @var{value}.
@Example
@@ -8482,8 +8482,8 @@ did not have a wide variety of fonts, and when @code{nroff} and
necessary in GNU @code{troff}. Nevertheless, they are supported.
@DefescList {\\H, ', height, '}
-@DefescItem {\\H, ', @t{+}@Var{height}, '}
-@DefescListEnd {\\H, ', @t{-}@Var{height}, '}
+@DefescItem {\\H, ', @t{+}height, '}
+@DefescListEnd {\\H, ', @t{-}height, '}
@cindex changing the font height (@code{\H})
@cindex font height, changing (@code{\H})
@cindex height, font, changing (@code{\H})
@@ -10331,7 +10331,7 @@ A read-only number register containing the current horizontal output
position.
@endDefreg
-@Defesc {\\o, ', @Var{a}@Var{b}@Var{c}, '}
+@Defesc {\\o, ', abc, '}
@cindex overstriking glyphs (@code{\o})
@cindex glyphs, overstriking (@code{\o})
Overstrike glyphs @var{a}, @var{b}, @var{c}, @dots{}; the glyphs
@@ -10384,8 +10384,8 @@ information.
All drawing is done via escapes.
-@DefescList {\\l, ', @Var{l}, '}
-@DefescListEnd {\\l, ', @Var{l}@Var{g}, '}
+@DefescList {\\l, ', l, '}
+@DefescListEnd {\\l, ', lg, '}
@cindex drawing horizontal lines (@code{\l})
@cindex horizontal line, drawing (@code{\l})
@cindex line, horizontal, drawing (@code{\l})
@@ -10430,8 +10430,8 @@ beginning of the @emph{input} line -- this works because the line
length is negative, not moving the current point.
@endDefesc
-@DefescList {\\L, ', @Var{l}, '}
-@DefescListEnd {\\L, ', @Var{l}@Var{g}, '}
+@DefescList {\\L, ', l, '}
+@DefescListEnd {\\L, ', lg, '}
@cindex drawing vertical lines (@code{\L})
@cindex vertical line drawing (@code{\L})
@cindex line, vertical, drawing (@code{\L})
@@ -10470,7 +10470,8 @@ of the available drawing functions.
The default scaling indicator for all subcommands of @code{\D} is
@samp{m} for horizontal distances and @samp{v} for vertical ones.
Exceptions are @w{@code{\D'f @dots{}'}} and @w{@code{\D't @dots{}'}}
-which use @code{u} as the default.
+which use @code{u} as the default, and @w{@code{\D'F@var{x} @dots{}'}}
+which arguments are treated similar to the @code{defcolor} request.
@table @code
@item \D'l @var{dx} @var{dy}'
@@ -10507,27 +10508,30 @@ containing the largest height and depth of the whole string.
@cindex circle, drawing (@w{@code{\D'c @dots{}'}})
@cindex drawing a circle (@w{@code{\D'c @dots{}'}})
Draw a circle with a diameter of@tie{}@var{d} with the leftmost point at the
-current position.
+current position. After drawing, the current location is positioned at the
+rightmost point of the circle.
@item \D'C @var{d}'
@cindex circle, solid, drawing (@w{@code{\D'C @dots{}'}})
@cindex drawing a solid circle (@w{@code{\D'C @dots{}'}})
@cindex solid circle, drawing (@w{@code{\D'C @dots{}'}})
-Draw a solid circle with the same parameters as an outlined circle. No
-outline is drawn.
+Draw a solid circle with the same parameters and behaviour as an outlined
+circle. No outline is drawn.
@item \D'e @var{x} @var{y}'
@cindex drawing an ellipse (@w{@code{\D'e @dots{}'}})
@cindex ellipse, drawing (@w{@code{\D'e @dots{}'}})
Draw an ellipse with a horizontal diameter of @var{x} and a vertical
diameter of @var{y} with the leftmost point at the current position.
+After drawing, the current location is positioned at the rightmost point of
+the ellipse.
@item \D'E @var{x} @var{y}'
@cindex ellipse, solid, drawing (@w{@code{\D'E @dots{}'}})
@cindex drawing a solid ellipse (@w{@code{\D'E @dots{}'}})
@cindex solid ellipse, drawing (@w{@code{\D'E @dots{}'}})
-Draw a solid ellipse with the same parameters as an outlined ellipse.
-No outline is drawn.
+Draw a solid ellipse with the same parameters and behaviour as an
+outlined ellipse. No outline is drawn.
@item \D'a @var{dx1} @var{dy1} @var{dx2} @var{dy2}'
@cindex arc, drawing (@w{@code{\D'a @dots{}'}})
@@ -10536,13 +10540,15 @@ Draw an arc clockwise from the current location through the two
specified relative locations (@var{dx1},@var{dy1}) and
(@var{dx2},@var{dy2}). The coordinates of the first point are relative
to the current position, and the coordinates of the second point are
-relative to the first point.
+relative to the first point. After drawing, the current position is moved
+to the final point of the arc.
@item \D'~ @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
@cindex drawing a spline (@w{@code{\D'~ @dots{}'}})
@cindex spline, drawing (@w{@code{\D'~ @dots{}'}})
Draw a spline from the current location to the relative point
(@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}), and so on.
+The current position is moved to the terminal point of the drawn curve.
@item \D'f @var{n}'
@cindex gray shading (@w{@code{\D'f @dots{}'}})
@@ -10554,11 +10560,14 @@ correspond to intermediate shades of gray. This applies only to solid
circles, solid ellipses, and solid polygons. By default, a level of
1000 is used.
+Despite of being silly, the current point is moved horizontally to the
+right by@tie{}@var{n}.
+
@cindex @w{@code{\D'f @dots{}'}} and horizontal resolution
Don't use this command! It has the serious drawback that it will be
always rounded to the next integer multiple of the horizontal resolution
(the value of the @code{hor} keyword in the @file{DESC} file). Use
-@code{\M} with a gray value instead (@pxref{Colors}).
+@code{\M} (@pxref{Colors}) or @w{@code{\D'Fg @dots{}'}} instead.
@item \D'p @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
@cindex drawing a polygon (@w{@code{\D'p @dots{}'}})
@@ -10566,14 +10575,16 @@ always rounded to the next integer multiple of the horizontal resolution
Draw a polygon from the current location to the relative position
(@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}) and so on.
When the specified data points are exhausted, a line is drawn back
-to the starting point.
+to the starting point. The current position is changed by adding the
+sum of all arguments with odd index to the actual horizontal position and
+the even ones to the vertical position.
@item \D'P @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
@cindex polygon, solid, drawing (@w{@code{\D'P @dots{}'}})
@cindex drawing a solid polygon (@w{@code{\D'P @dots{}'}})
@cindex solid polygon, drawing (@w{@code{\D'P @dots{}'}})
-Draw a solid polygon with the same parameters as an outlined polygon.
-No outline is drawn.
+Draw a solid polygon with the same parameters and behaviour as an
+outlined polygon. No outline is drawn.
Here a better variant of the box macro to fill the box with some color.
Note that the box must be drawn before the text since colors in
@@ -10604,6 +10615,28 @@ Set the current line thickness to @var{n}@tie{}machine units. A value of
zero selects the smallest available line thickness. A negative value
makes the line thickness proportional to the current point size (this is
the default behaviour of @acronym{AT&T} @code{troff}).
+
+Despite of being silly, the current point is moved horizontally to the
+right by@tie{}@var{n}.
+
+@item \D'F@var{scheme} @var{color_components}'
+@cindex unnamed fill colors (@code{\D'F@dots{}'})
+@cindex fill colors, unnamed (@code{\D'F@dots{}'})
+@cindex colors, fill, unnamed (@code{\D'F@dots{}'})
+Change current fill color. @var{scheme} is a single letter denoting the
+color scheme: @samp{r} (rgb), @samp{c} (cmy), @samp{k} (cmyk), @samp{g}
+(gray), or @samp{d} (default color). The color components use exactly
+the same syntax as in the @code{defcolor} request (@pxref{Colors}); the
+command @code{\D'Fd'} doesn't take an argument.
+
+@emph{No} position changing!
+
+Examples:
+
+@Example
+@endExample
+\D'Fg .3' \" same gray as \D'f 700'
+\D'Fr #0000ff' \" blue
@end table
@endDefesc
@@ -11152,7 +11185,7 @@ and @code{dl} contain the vertical and horizontal size of the diversion.
@endDefreg
@DefescList {\\!, , , }
-@DefescListEnd {\\?, , @Var{anything}, \\?}
+@DefescListEnd {\\?, , anything, \\?}
@cindex transparent output (@code{\!}, @code{\?})
@cindex output, transparent (@code{\!}, @code{\?})
Prevent requests, macros, and escapes from being
@@ -11509,7 +11542,7 @@ Colors can be also turned off with the @option{-c} command line option.
@Defreq {defcolor, ident scheme color_components}
Define color with name @var{ident}. @var{scheme} can be one of the
-following values: @code{rgb} (three components), @code{cym} (three
+following values: @code{rgb} (three components), @code{cmy} (three
components), @code{cmyk} (four components), and @code{gray} or
@code{grey} (one component).
@@ -12256,16 +12289,16 @@ of the fallback glyph. Anyway, the translation is still active;
@code{gtroff} is not easy to debug, but there are some useful features
and strategies for debugging.
-@Defreq {lf, line filename}
+@Defreq {lf, line [@Var{filename}]}
@pindex soelim
@cindex multi-file documents
@cindex documents, multi-file
@cindex setting input line number (@code{lf})
@cindex input line number, setting (@code{lf})
@cindex number, input line, setting (@code{lf})
-Change the line number and the file name @code{gtroff} shall use for
-error and warning messages. @var{line} is the input line number of the
-@emph{next} line.
+Change the line number and optionally the file name @code{gtroff} shall
+use for error and warning messages. @var{line} is the input line number
+of the @emph{next} line.
Without argument, the request is ignored.
@@ -13629,9 +13662,8 @@ negative left. The arguments called @var{v1}, @var{v2}, @dots{},
negative up. All these distances are offsets relative to the current
location.
-Unless indicated otherwise, each graphics command directly corresponds
-to a similar @code{gtroff} @code{\D} escape sequence. @xref{Drawing
-Requests}.
+Each graphics command directly corresponds to a similar @code{gtroff}
+@code{\D} escape sequence. @xref{Drawing Requests}.
Unknown @samp{D} commands are assumed to be device-specific.
Its arguments are parsed as strings; the whole information is then
diff --git a/man/groff.man b/man/groff.man
index b1d3a0c9..176a04e1 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -2,11 +2,11 @@
.ig
groff.man
-Last update: 3 Dec 2002
+Last update: 13 Feb 2003
This file is part of groff, the GNU roff type-setting system.
-Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
written by Bernd Warken <bwarken@mayn.de>
maintained by Werner Lemberg <wl@gnu.org>
@@ -1717,6 +1717,10 @@ If
.I n
is zero, disable line-tabs mode, otherwise enable it.
.
+.REQ .lf N
+Set input line number to
+.IR N .
+.
.REQ .lf N file
Set input line number to
.I N
diff --git a/man/groff_diff.man b/man/groff_diff.man
index f34e3522..5aebf22c 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -3,7 +3,7 @@
.ig
groff_diff.man
-Last update : 10 Feb 2003
+Last update : 13 Feb 2003
This file is part of groff, the GNU roff type-setting system.
It is the source of the man-page groff_diff(7).
@@ -2396,6 +2396,19 @@ is read in copy mode.
.
.
.\" --------------------------------------------------------------------
+.SS "Extended escape sequences"
+.\" --------------------------------------------------------------------
+.
+.TP
+.BI \[rs]D' .\|.\|. '
+All drawing commands of groff's intermediate output are accepted.
+.
+See subsection
+.B "Drawing Commands"
+below for more information.
+.
+.
+.\" --------------------------------------------------------------------
.SS "Extended requests"
.\" --------------------------------------------------------------------
.
@@ -3281,7 +3294,9 @@ exception of
.BR De .
For the sake of compatibility GNU troff also follows this rule, even
though it produces an ugly result in the case of the
-.BR Dt ,
+.B Dt
+and
+.BR Df ,
and, to a lesser extent,
.B DE
commands.
@@ -3316,11 +3331,7 @@ Set the color components of the filling color similar to the
commands above.
.
.P
-Note that
-.B Df
-is now mapped onto
-.BR DFg .
-The current position isn't changed by those colour commands (including
+The current position isn't changed by those colour commands (contrary to
.BR Df ).
.
.
diff --git a/src/libs/libdriver/input.cc b/src/libs/libdriver/input.cc
index 8e00de9d..9aaea6f5 100644
--- a/src/libs/libdriver/input.cc
+++ b/src/libs/libdriver/input.cc
@@ -2,13 +2,13 @@
// <groff_src_dir>/src/libs/libdriver/input.cc
-/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
Major rewrite 2001 by Bernd Warken (bwarken@mayn.de)
- Last update: 12 Apr 2002
+ Last update: 12 Feb 2003
This file is part of groff, the GNU roff text processing system.
@@ -599,17 +599,10 @@ StringBuf::reset(void)
The Df command is obsoleted by command DFg, but kept for
compatibility.
-
- XXX: Add proper handling for values < 0 or > 1000 as documented in
- groff_out(5).
*/
ColorArg
color_from_Df_command(IntArg Df_gray)
{
- if (Df_gray <= 0)
- return COLORARG_MAX;
- if (Df_gray >= 1000)
- return 0;
return ColorArg((1000-Df_gray) * COLORARG_MAX / 1000); // scaling
}
@@ -1399,7 +1392,9 @@ parse_D_command()
pr->change_fill_color(current_env);
// skip unused `vertical' component (\D'...' always emits pairs)
(void) get_integer_arg();
- // no positioning
+# ifdef STUPID_DRAWING_POSITIONING
+ current_env->hpos += arg;
+# endif
skip_line_x();
break;
}
@@ -1437,7 +1432,6 @@ parse_D_command()
// final args positioning
position_to_end_of_args(args);
# endif
- // no positioning?
delete args;
break;
}
diff --git a/src/preproc/grn/hgraph.cc b/src/preproc/grn/hgraph.cc
index 35cf0c95..ec5da686 100644
--- a/src/preproc/grn/hgraph.cc
+++ b/src/preproc/grn/hgraph.cc
@@ -215,7 +215,8 @@ HGPrintElt(ELT *element,
break;
if (graylevel > NSTIPPLES)
graylevel = NSTIPPLES;
- printf("\\D'f %du'", stipple_index[graylevel]);
+ printf("\\D'Fg %.3f'",
+ double(1000 - stipple_index[graylevel]) / 1000.0);
cr();
tmove(p1);
printf("\\D'%c", command);
diff --git a/src/preproc/pic/main.cc b/src/preproc/pic/main.cc
index 124cbd55..1f2e35e1 100644
--- a/src/preproc/pic/main.cc
+++ b/src/preproc/pic/main.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989-1992, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -302,8 +303,10 @@ void do_file(const char *filename)
else {
errno = 0;
fp = fopen(filename, "r");
- if (fp == 0)
+ if (fp == 0) {
+ delete out;
fatal("can't open `%1': %2", filename, strerror(errno));
+ }
}
out->set_location(filename, 1);
current_filename = filename;
diff --git a/src/preproc/pic/object.cc b/src/preproc/pic/object.cc
index fd25371c..21bce3e4 100644
--- a/src/preproc/pic/object.cc
+++ b/src/preproc/pic/object.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
@@ -410,6 +410,8 @@ object_spec::object_spec(object_type t) : type(t)
segment_width = segment_height = 0.0;
segment_is_absolute = 0;
text = 0;
+ shaded = 0;
+ outlined = 0;
with = 0;
dir = RIGHT_DIRECTION;
}
@@ -434,6 +436,10 @@ object_spec::~object_spec()
delete tem;
}
delete with;
+ if (shaded)
+ a_delete shaded;
+ if (outlined)
+ a_delete outlined;
}
class command_object : public object {
@@ -590,12 +596,12 @@ void graphic_object::set_fill(double)
void graphic_object::set_fill_color(char *c)
{
- color_fill = c;
+ color_fill = strsave(c);
}
void graphic_object::set_outline_color(char *c)
{
- outline_color = c;
+ outline_color = strsave(c);
}
char *graphic_object::get_outline_color()
@@ -714,7 +720,7 @@ void closed_object::set_fill(double f)
void closed_object::set_fill_color(char *fill)
{
- color_fill = fill;
+ color_fill = strsave(fill);
}
class box_object : public closed_object {
diff --git a/src/preproc/pic/troff.cc b/src/preproc/pic/troff.cc
index 087e43e4..cf8f5eee 100644
--- a/src/preproc/pic/troff.cc
+++ b/src/preproc/pic/troff.cc
@@ -206,8 +206,6 @@ void simple_output::ellipse(const position &cent, const distance &dim,
}
}
-#define FILL_MAX 1000
-
class troff_output : public simple_output {
const char *last_filename;
position upper_left;
@@ -478,7 +476,7 @@ void troff_output::line_thickness(double p)
void troff_output::set_fill(double f)
{
if (driver_extension_flag && f != last_fill) {
- printf("\\D'f %du'\n.sp -1\n", int(f*FILL_MAX));
+ printf("\\D'Fg %.3f'\n.sp -1\n", 1.0 - f);
last_fill = f;
}
if (last_filled) {
@@ -496,11 +494,11 @@ void troff_output::set_color(char *color_fill, char *color_outlined)
}
if (color_fill) {
printf("\\M[%s]\n.sp -1\n", color_fill);
- last_filled = strdup(color_fill);
+ last_filled = strsave(color_fill);
}
if (color_outlined) {
printf("\\m[%s]\n.sp -1\n", color_outlined);
- last_outlined = strdup(color_outlined);
+ last_outlined = strsave(color_outlined);
}
}
}
@@ -510,12 +508,12 @@ void troff_output::reset_color()
if (driver_extension_flag) {
if (last_filled) {
printf("\\M[]\n.sp -1\n");
- free(last_filled);
+ a_delete last_filled;
last_filled = 0;
}
if (last_outlined) {
printf("\\m[]\n.sp -1\n");
- free(last_outlined);
+ a_delete last_outlined;
last_outlined = 0;
}
}
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index fb05e2e1..be275c6b 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -70,6 +70,7 @@ void init_column_requests();
#endif /* COLUMN */
static node *read_draw_node();
+static void read_color_draw_node(token &);
void handle_first_page_transition();
static void push_token(const token &);
void copy_file();
@@ -140,6 +141,7 @@ static void interpolate_arg(symbol);
static request_or_macro *lookup_request(symbol);
static int get_delim_number(units *, int);
static int get_delim_number(units *, int, units);
+static symbol do_get_long_name(int, char);
static int get_line_arg(units *res, int si, charinfo **cp);
static int read_size(int *);
static symbol get_delim_name();
@@ -653,7 +655,7 @@ void backtrace_request()
void next_file()
{
- symbol nm = get_long_name(0);
+ symbol nm = get_long_name();
while (!tok.newline() && !tok.eof())
tok.next();
if (nm.is_null())
@@ -1090,9 +1092,9 @@ static unsigned int get_color_element(const char *scheme, const char *col)
return (unsigned int)val;
}
-static color *read_rgb()
+static color *read_rgb(char end = 0)
{
- symbol component = get_long_name(0);
+ symbol component = do_get_long_name(0, end);
if (component.is_null()) {
warning(WARN_COLOR, "missing rgb color values");
return 0;
@@ -1107,7 +1109,8 @@ static color *read_rgb()
}
}
else {
- input_stack::push(make_temp_iterator(" "));
+ if (!end)
+ input_stack::push(make_temp_iterator(" "));
input_stack::push(make_temp_iterator(s));
tok.next();
unsigned int r = get_color_element("rgb color", "red component");
@@ -1118,9 +1121,9 @@ static color *read_rgb()
return col;
}
-static color *read_cmy()
+static color *read_cmy(char end = 0)
{
- symbol component = get_long_name(0);
+ symbol component = do_get_long_name(0, end);
if (component.is_null()) {
warning(WARN_COLOR, "missing cmy color values");
return 0;
@@ -1135,7 +1138,8 @@ static color *read_cmy()
}
}
else {
- input_stack::push(make_temp_iterator(" "));
+ if (!end)
+ input_stack::push(make_temp_iterator(" "));
input_stack::push(make_temp_iterator(s));
tok.next();
unsigned int c = get_color_element("cmy color", "cyan component");
@@ -1146,9 +1150,9 @@ static color *read_cmy()
return col;
}
-static color *read_cmyk()
+static color *read_cmyk(char end = 0)
{
- symbol component = get_long_name(0);
+ symbol component = do_get_long_name(0, end);
if (component.is_null()) {
warning(WARN_COLOR, "missing cmyk color values");
return 0;
@@ -1163,7 +1167,8 @@ static color *read_cmyk()
}
}
else {
- input_stack::push(make_temp_iterator(" "));
+ if (!end)
+ input_stack::push(make_temp_iterator(" "));
input_stack::push(make_temp_iterator(s));
tok.next();
unsigned int c = get_color_element("cmyk color", "cyan component");
@@ -1175,9 +1180,9 @@ static color *read_cmyk()
return col;
}
-static color *read_gray()
+static color *read_gray(char end = 0)
{
- symbol component = get_long_name(0);
+ symbol component = do_get_long_name(0, end);
if (component.is_null()) {
warning(WARN_COLOR, "missing gray values");
return 0;
@@ -1192,7 +1197,8 @@ static color *read_gray()
}
}
else {
- input_stack::push(make_temp_iterator("\n"));
+ if (!end)
+ input_stack::push(make_temp_iterator("\n"));
input_stack::push(make_temp_iterator(s));
tok.next();
unsigned int g = get_color_element("gray", "gray value");
@@ -1246,8 +1252,11 @@ static void define_color()
skip_line();
return;
}
- if (col)
- (void)color_dictionary.lookup(color_name, col);
+ if (col) {
+ color *old_col = (color *)color_dictionary.lookup(color_name, col);
+ if (old_col)
+ delete old_col;
+ }
skip_line();
}
@@ -1261,6 +1270,7 @@ static node *do_overstrike()
tok.next();
if (tok.newline() || tok.eof()) {
warning(WARN_DELIM, "missing closing delimiter");
+ input_stack::push(make_temp_iterator("\n"));
break;
}
if (tok == start
@@ -1317,6 +1327,7 @@ static int do_name_test()
tok.next();
if (tok.newline() || tok.eof()) {
warning(WARN_DELIM, "missing closing delimiter");
+ input_stack::push(make_temp_iterator("\n"));
break;
}
if (tok == start
@@ -1353,6 +1364,7 @@ static int do_expr_test()
tok.next();
if (tok.newline() || tok.eof()) {
warning(WARN_DELIM, "missing closing delimiter");
+ input_stack::push(make_temp_iterator("\n"));
break;
}
if (tok == start && input_stack::get_level() == start_level)
@@ -1408,6 +1420,7 @@ static node *do_zero_width()
tok.next();
if (tok.newline() || tok.eof()) {
warning(WARN_DELIM, "missing closing delimiter");
+ input_stack::push(make_temp_iterator("\n"));
break;
}
if (tok == start
@@ -1605,6 +1618,7 @@ void token::next()
curenv->get_fill_color());
return;
case ESCAPE_NEWLINE:
+ have_input = 0;
break;
case ESCAPE_LEFT_BRACE:
ESCAPE_LEFT_BRACE:
@@ -1669,6 +1683,7 @@ void token::next()
return;
case '\n':
type = TOKEN_NEWLINE;
+ have_input = 0;
return;
case '\001':
type = TOKEN_LEADER;
@@ -1842,6 +1857,7 @@ void token::next()
if (s.is_null())
break;
curenv->set_family(s);
+ have_input = 1;
break;
}
case 'g':
@@ -2032,6 +2048,7 @@ void token::next()
case '}':
goto ESCAPE_RIGHT_BRACE;
case '\n':
+ have_input = 0;
break;
case '[':
if (!compatible_flag) {
@@ -2286,6 +2303,11 @@ symbol get_name(int required)
symbol get_long_name(int required)
{
+ return do_get_long_name(required, 0);
+}
+
+static symbol do_get_long_name(int required, char end)
+{
while (tok.space())
tok.next();
char abuf[ABUF_SIZE];
@@ -2293,7 +2315,8 @@ symbol get_long_name(int required)
int buf_size = ABUF_SIZE;
int i = 0;
for (;;) {
- if (i + 1 > buf_size) {
+ // If end != 0 we normally have to append a null byte
+ if (i + 2 > buf_size) {
if (buf == abuf) {
buf = new char[ABUF_SIZE*2];
memcpy(buf, abuf, buf_size);
@@ -2307,7 +2330,7 @@ symbol get_long_name(int required)
a_delete old_buf;
}
}
- if ((buf[i] = tok.ch()) == 0)
+ if ((buf[i] = tok.ch()) == 0 || buf[i] == end)
break;
i++;
tok.next();
@@ -2316,7 +2339,10 @@ symbol get_long_name(int required)
empty_name_warning(required);
return NULL_SYMBOL;
}
- non_empty_name_warning();
+ if (end && buf[i] == end)
+ buf[i+1] = '\0';
+ else
+ non_empty_name_warning();
if (buf == abuf)
return symbol(buf);
else {
@@ -2570,7 +2596,6 @@ void process_input_stack()
else
interpolate_macro(nm);
suppress_next = 1;
- have_input = 0;
}
else {
if (possibly_handle_first_page_transition())
@@ -2619,7 +2644,6 @@ void process_input_stack()
else {
curenv->newline();
bol = 1;
- have_input = 0;
}
break;
}
@@ -2647,7 +2671,6 @@ void process_input_stack()
break;
}
suppress_next = 1;
- have_input = 0;
break;
}
case token::TOKEN_SPACE:
@@ -2708,7 +2731,6 @@ void process_input_stack()
{
trap_bol_stack.push(bol);
bol = 1;
- have_input = 0;
break;
}
case token::TOKEN_END_TRAP:
@@ -3646,7 +3668,7 @@ void composite_request()
if (strcmp(from_gn, to_gn) == 0)
composite_dictionary.remove(symbol(from_gn));
else
- composite_dictionary.lookup(symbol(from_gn), (void *)to_gn);
+ (void)composite_dictionary.lookup(symbol(from_gn), (void *)to_gn);
}
}
skip_line();
@@ -7383,6 +7405,10 @@ static node *read_draw_node()
error("missing argument");
else {
unsigned char type = tok.ch();
+ if (type == 'F') {
+ read_color_draw_node(start);
+ return 0;
+ }
tok.next();
int maxpoints = 10;
hvpair *point = new hvpair[maxpoints];
@@ -7475,6 +7501,47 @@ static node *read_draw_node()
return 0;
}
+static void read_color_draw_node(token &start)
+{
+ tok.next();
+ if (tok == start) {
+ error("missing color scheme");
+ return;
+ }
+ unsigned char scheme = tok.ch();
+ tok.next();
+ color *col;
+ char end = start.ch();
+ switch (scheme) {
+ case 'c':
+ col = read_cmy(end);
+ break;
+ case 'd':
+ col = &default_color;
+ break;
+ case 'g':
+ col = read_gray(end);
+ break;
+ case 'k':
+ col = read_cmyk(end);
+ break;
+ case 'r':
+ col = read_rgb(end);
+ break;
+ }
+ if (col)
+ curenv->set_fill_color(col);
+ while (tok != start) {
+ if (tok.newline() || tok.eof()) {
+ warning(WARN_DELIM, "missing closing delimiter");
+ input_stack::push(make_temp_iterator("\n"));
+ break;
+ }
+ tok.next();
+ }
+ have_input = 1;
+}
+
static struct {
const char *name;
int mask;
@@ -7781,7 +7848,7 @@ charinfo *get_charinfo_by_number(int n)
if (!ci) {
ci = new charinfo(UNNAMED_SYMBOL);
ci->set_number(n);
- numbered_charinfo_dictionary.lookup(ns, ci);
+ (void)numbered_charinfo_dictionary.lookup(ns, ci);
}
return ci;
}
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index 7ac8862d..108aa81a 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -5358,10 +5358,10 @@ static int mount_font_no_translate(int n, symbol name, symbol external_name)
if (!fm) {
if (not_found)
warning(WARN_FONT, "can't find font `%1'", external_name.contents());
- font_dictionary.lookup(external_name, &a_char);
+ (void)font_dictionary.lookup(external_name, &a_char);
return 0;
}
- font_dictionary.lookup(name, fm);
+ (void)font_dictionary.lookup(name, fm);
}
else if (p == &a_char) {
#if 0
@@ -5422,7 +5422,7 @@ void font_translate()
if (to.is_null() || from == to)
font_translation_dictionary.remove(from);
else
- font_translation_dictionary.lookup(from, (void *)to.contents());
+ (void)font_translation_dictionary.lookup(from, (void *)to.contents());
}
skip_line();
}
@@ -5436,7 +5436,7 @@ void font_position()
else {
symbol internal_name = get_name(1);
if (!internal_name.is_null()) {
- symbol external_name = get_long_name(0);
+ symbol external_name = get_long_name();
mount_font(n, internal_name, external_name); // ignore error
}
}