From 2e2c9047c3a8b5b6fdcdcd4585d5b114f31cd386 Mon Sep 17 00:00:00 2001 From: asmodai Date: Wed, 12 Jan 2000 09:51:43 +0000 Subject: Virgin import of FSF groff v1.15 --- contrib/groff/pic/main.cc | 7 +++++-- contrib/groff/pic/pic.cc | 9 ++++++--- contrib/groff/pic/pic.h | 2 ++ contrib/groff/pic/pic.man | 20 +++++++++++++------- contrib/groff/pic/pic.y | 9 ++++++--- contrib/groff/pic/tex.cc | 3 ++- contrib/groff/pic/troff.cc | 2 ++ 7 files changed, 36 insertions(+), 16 deletions(-) (limited to 'contrib/groff/pic') diff --git a/contrib/groff/pic/main.cc b/contrib/groff/pic/main.cc index 87beb5d..cb4444f 100644 --- a/contrib/groff/pic/main.cc +++ b/contrib/groff/pic/main.cc @@ -29,7 +29,7 @@ int zero_length_line_flag = 0; // Non-zero means we're using a groff driver. int driver_extension_flag = 1; int compatible_flag = 0; -int safer_flag = 0; +int safer_flag = 1; int command_char = '.'; // the character that introduces lines // that should be passed through tranparently static int lf_flag = 1; // non-zero if we should attempt to understand @@ -518,7 +518,7 @@ int main(int argc, char **argv) int whole_file_flag = 0; int fig_flag = 0; #endif - while ((opt = getopt(argc, argv, "T:CDStcvnxzpf")) != EOF) + while ((opt = getopt(argc, argv, "T:CDSUtcvnxzpf")) != EOF) switch (opt) { case 'C': compatible_flag = 1; @@ -529,6 +529,9 @@ int main(int argc, char **argv) case 'S': safer_flag = 1; break; + case 'U': + safer_flag = 0; + break; case 'f': #ifdef FIG_SUPPORT whole_file_flag++; diff --git a/contrib/groff/pic/pic.cc b/contrib/groff/pic/pic.cc index 9e9e9f1..c75d6bb 100644 --- a/contrib/groff/pic/pic.cc +++ b/contrib/groff/pic/pic.cc @@ -35,11 +35,14 @@ extern void do_for(char *var, double from, double to, int by_is_multiplicative, double by, char *body); extern void do_lookahead(); -#undef fmod -#undef rand - +#ifndef HAVE_FMOD extern "C" { double fmod(double, double); +} +#endif + +#undef rand +extern "C" { int rand(); } diff --git a/contrib/groff/pic/pic.h b/contrib/groff/pic/pic.h index 70e9567..77e59c7 100644 --- a/contrib/groff/pic/pic.h +++ b/contrib/groff/pic/pic.h @@ -24,9 +24,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include +#ifndef MATH_H_DECLARES_HYPOT extern "C" { double hypot(double, double); } +#endif #include "assert.h" #include "cset.h" diff --git a/contrib/groff/pic/pic.man b/contrib/groff/pic/pic.man index 5e2d142..70ab946 100644 --- a/contrib/groff/pic/pic.man +++ b/contrib/groff/pic/pic.man @@ -1,5 +1,5 @@ .ig \"-*- nroff -*- -Copyright (C) 1989-1995 Free Software Foundation, Inc. +Copyright (C) 1989-1999 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -35,7 +35,7 @@ the original English. .SH SYNOPSIS .B @g@pic [ -.B \-nvC +.B \-nvCSU ] [ .I filename @@ -45,7 +45,7 @@ the original English. .B @g@pic .B \-t [ -.B \-cvzC +.B \-cvzCSU ] [ .I filename @@ -104,6 +104,11 @@ Safer mode; do not execute .B sh commands. This can be useful when operating on untrustworthy input. +(enabled by default) +.TP +.B \-U +Unsafe mode; revert the default option +.BR \-S . .TP .B \-n Don't use the groff extensions to the troff drawing commands. @@ -734,10 +739,11 @@ macros. .br Tpic: Pic for \*(tx .br -AT&T Bell Laboratories, Computing Science Technical Report No.\ 116, -PIC \(em A Graphics Language for Typesetting. -(This can be obtained by sending a mail message to netlib@research.att.com -with a body of `send\ 116\ from\ research/cstr'.) +Brian W. Kernighan, +PIC \(em A Graphics Language for Typesetting (User Manual). +AT&T Bell Laboratories, Computing Science Technical Report No.\ 116 + +(revised May, 1991). .SH BUGS .LP Input characters that are illegal for diff --git a/contrib/groff/pic/pic.y b/contrib/groff/pic/pic.y index 6c7f4ae..46f1a8d 100644 --- a/contrib/groff/pic/pic.y +++ b/contrib/groff/pic/pic.y @@ -30,11 +30,14 @@ extern void do_for(char *var, double from, double to, int by_is_multiplicative, double by, char *body); extern void do_lookahead(); -#undef fmod -#undef rand - +#ifndef HAVE_FMOD extern "C" { double fmod(double, double); +} +#endif + +#undef rand +extern "C" { int rand(); } diff --git a/contrib/groff/pic/tex.cc b/contrib/groff/pic/tex.cc index 5310782..2a91b62 100644 --- a/contrib/groff/pic/tex.cc +++ b/contrib/groff/pic/tex.cc @@ -237,7 +237,8 @@ void tex_output::solid_arc(const position ¢, double rad, milliinches(rad/scale), milliinches(rad/scale), -end_angle, - (-end_angle > -start_angle) ? M_PI * 2 - start_angle : -start_angle); + (-end_angle > -start_angle) ? (double)M_PI * 2 - start_angle + : -start_angle); } void tex_output::arc(const position &start, const position ¢, diff --git a/contrib/groff/pic/troff.cc b/contrib/groff/pic/troff.cc index 71444cd..1656854 100644 --- a/contrib/groff/pic/troff.cc +++ b/contrib/groff/pic/troff.cc @@ -272,6 +272,7 @@ void troff_output::start_picture(double sc, printf(" %s\n", args); else putchar('\n'); + printf(".if '\\*(.T'html' \\X(graphic-start(\n"); printf(".\\\" %g %g %g %g\n", ll.x, ll.y, ur.x, ur.y); printf(".\\\" %.3fi %.3fi %.3fi %.3fi\n", 0.0, height, width, 0.0); printf(".nr " FILL_REG " \\n(.u\n.nf\n"); @@ -290,6 +291,7 @@ void troff_output::finish_picture() printf(".if \\n(" FILL_REG " .fi\n"); printf(".br\n"); printf(".nr " EQN_NO_EXTRA_SPACE_REG " 0\n"); + printf(".if '\\*(.T'html' \\X(graphic-end(\n"); // this is a little gross set_location(current_filename, current_lineno); fputs(flyback_flag ? ".PF\n" : ".PE\n", stdout); -- cgit v1.1