summaryrefslogtreecommitdiffstats
path: root/contrib/groff/src/preproc/grn
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/groff/src/preproc/grn')
-rw-r--r--contrib/groff/src/preproc/grn/Makefile.sub10
-rw-r--r--contrib/groff/src/preproc/grn/README10
-rw-r--r--contrib/groff/src/preproc/grn/gprint.h2
-rw-r--r--contrib/groff/src/preproc/grn/grn.man29
-rw-r--r--contrib/groff/src/preproc/grn/hdb.cc23
-rw-r--r--contrib/groff/src/preproc/grn/hgraph.cc30
-rw-r--r--contrib/groff/src/preproc/grn/main.cc6
7 files changed, 72 insertions, 38 deletions
diff --git a/contrib/groff/src/preproc/grn/Makefile.sub b/contrib/groff/src/preproc/grn/Makefile.sub
index ffa0ad2..d180803 100644
--- a/contrib/groff/src/preproc/grn/Makefile.sub
+++ b/contrib/groff/src/preproc/grn/Makefile.sub
@@ -1,12 +1,12 @@
-PROG=grn
+PROG=grn$(EXEEXT)
MAN1=grn.n
MLIB=$(LIBM)
XLIBS=$(LIBGROFF)
OBJS=\
- hdb.o \
- hpoint.o \
- hgraph.o \
- main.o
+ hdb.$(OBJEXT) \
+ hpoint.$(OBJEXT) \
+ hgraph.$(OBJEXT) \
+ main.$(OBJEXT)
CCSRCS=\
$(srcdir)/hdb.cc \
$(srcdir)/hpoint.cc \
diff --git a/contrib/groff/src/preproc/grn/README b/contrib/groff/src/preproc/grn/README
index b5b9fc9..7ac685e 100644
--- a/contrib/groff/src/preproc/grn/README
+++ b/contrib/groff/src/preproc/grn/README
@@ -16,7 +16,15 @@ because the gremlin editor uses the conventional spline
algorithm. The Berkeley grn has the choice of different
stipples. Here, only different shades of gray will be painted
depending on the gremlin file. It is possible to upgrade this at
-a later time. (Daniel Senderowicz <daniel@synchrods.com> 12/28/99)
+a later time. (Daniel Senderowicz <daniel@synchrods.com> 12/28/99)
+
+=====================================================================
+
+Gremlin produces three types of curves: B-Splines, interpolated
+curves and Bezier. As the original Berkeley grn, now groff grn
+will honor B-Splines and interpolated curves. Bezier curves will
+be printed as B-Splines. (Daniel Senderowicz <daniel@synchrods.com>
+10/04/02)
=====================================================================
diff --git a/contrib/groff/src/preproc/grn/gprint.h b/contrib/groff/src/preproc/grn/gprint.h
index b25305b..b9df60e 100644
--- a/contrib/groff/src/preproc/grn/gprint.h
+++ b/contrib/groff/src/preproc/grn/gprint.h
@@ -38,6 +38,8 @@
#define ARC 4
#define CURVE 5
#define POLYGON 6
+#define BSPLINE 7
+#define BEZIER 8
#define TOPLEFT 10
#define TOPCENT 11
#define TOPRIGHT 12
diff --git a/contrib/groff/src/preproc/grn/grn.man b/contrib/groff/src/preproc/grn/grn.man
index 82e43cf..9722145 100644
--- a/contrib/groff/src/preproc/grn/grn.man
+++ b/contrib/groff/src/preproc/grn/grn.man
@@ -1,6 +1,6 @@
'\" t
.ig
-Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -46,7 +46,7 @@ the original English.
.BI \-F dir
]
[
-.IR file\.\.\.
+.IR file\.\.\.\&
]
.PP
It is possible to have whitespace between a command line option and its
@@ -131,8 +131,11 @@ for subdirectories
.RI ( name
is the name of the device) for the
.B DESC
-file before the normal
-.BR @FONTDIR@ .
+file before the default font directories
+.BR @LOCALFONTDIR@ ,
+.BR @FONTDIR@ ,
+and
+.BR @LEGACYFONTDIR@ .
.TP
.B \-C
Recognize
@@ -217,7 +220,7 @@ confusion with
There is
.I no
default for stipples (unless one is set by the default command), and it is
-illegal to include a
+invalid to include a
.I gremlin
picture with polygons without specifying a
stipple font.
@@ -408,7 +411,6 @@ format is the use of names for picture objects (e.g., POLYGON, CURVE)
instead of numbers.
Files representing the same picture are shown in Table 1 in each format.
.sp
-.DS
.TS
center, tab(@);
l lw(0.1i) l.
@@ -435,7 +437,6 @@ css.
.sp
Table 1. File examples
.TE
-.DE
.sp
.IP \(bu
The first line of each
@@ -479,6 +480,8 @@ The stuff on this line really isn't all that important; a value of ``1 0.00
.IP \(bu
The rest of the file consists of zero or more element specifications.
After the last element specification is a line containing the string ``-1''.
+.IP \(bu
+Lines longer than 127 characters are chopped to this limit.
.SH ELEMENT SPECIFICATIONS
.IP \(bu
The first line of each element contains a single decimal number giving the
@@ -489,7 +492,6 @@ version) or its ASCII name
version).
See Table 2.
.sp
-.DS
.TS
center, tab(@);
css
@@ -505,6 +507,8 @@ nll.
4@ARC@arc
5@CURVE@curve
6@POLYGON@polygon
+7@BSPLINE@b-spline
+8@BEZIER@B\['e]zier
10@TOPLEFT@top-left-justified text
11@TOPCENT@top-center-justified text
12@TOPRIGHT@top-right-justified text
@@ -517,7 +521,6 @@ css.
Table 2.
Type Specifications in \fIgremlin\fP Files
.TE
-.DE
.sp
.IP \(bu
After the object type comes a variable number of lines, each specifying a
@@ -536,7 +539,6 @@ brush and size for the element.
The brush determines the style in which things are drawn.
For vectors, arcs, and curves there are six legal brush values:
.sp
-.DS
.TS
center, tab(@);
ncw(0.1i)l.
@@ -547,13 +549,11 @@ ncw(0.1i)l.
5 \(mi@@thin solid lines
6 \(mi@@medium solid lines
.TE
-.DE
.sp
For polygons, one more value, 0, is legal.
It specifies a polygon with an invisible border.
For text, the brush selects a font as follows:
.sp
-.DS
.TS
center, tab(@);
ncw(0.1i)l.
@@ -562,7 +562,6 @@ ncw(0.1i)l.
3 \(mi@@bold (B font in groff)
4 \(mi@@special (S font in groff)
.TE
-.DE
.sp
If you're using
.I @g@grn
@@ -570,9 +569,9 @@ to run your pictures through
.IR groff ,
the font is really just a starting font:
The text string can contain formatting sequences like
-``\\fI''
+``\efI''
or
-``\\d''
+``\ed''
which may change the font (as well as do many other things).
For text, the size field is a decimal value between 1 and 4.
It selects the size of the font in which the text will be drawn.
diff --git a/contrib/groff/src/preproc/grn/hdb.cc b/contrib/groff/src/preproc/grn/hdb.cc
index fd5bb48..648a535 100644
--- a/contrib/groff/src/preproc/grn/hdb.cc
+++ b/contrib/groff/src/preproc/grn/hdb.cc
@@ -15,6 +15,7 @@
#include "error.h"
#define MAXSTRING 128
+#define MAXSTRING_S "127"
/* imports from main.cc */
@@ -89,7 +90,7 @@ DBRead(register FILE *file)
SUNFILE = FALSE;
elist = DBInit();
- (void) fscanf(file, "%s\n", string);
+ (void) fscanf(file, "%" MAXSTRING_S "s%*[^\n]\n", string);
if (strcmp(string, "gremlinfile")) {
if (strcmp(string, "sungremlinfile")) {
error("`%1' is not a gremlin file", gremlinfile);
@@ -103,10 +104,10 @@ DBRead(register FILE *file)
done = FALSE;
while (!done) {
- /* if (fscanf(file,"%s\n", string) == EOF) */
+ /* if (fscanf(file,"%" MAXSTRING_S "s\n", string) == EOF) */
/* I changed the scanf format because the element */
/* can have two words (e.g. CURVE SPLINE) */
- if (fscanf(file, "\n%[^\n]\n", string) == EOF) {
+ if (fscanf(file, "\n%" MAXSTRING_S "[^\n]%*[^\n]\n", string) == EOF) {
error("`%1', error in file format", gremlinfile);
return (elist);
}
@@ -210,8 +211,20 @@ DBGetType(register char *s)
case 'A':
return (ARC);
case 'C':
- if (s[1] == 'U')
- return (CURVE);
+ if (s[1] == 'U') {
+ if (s[5] == '\n')
+ return (CURVE);
+ switch (s[7]) {
+ case 'S':
+ return(BSPLINE);
+ case 'E':
+ fprintf(stderr,
+ "Warning: Bezier Curves will be printed as B-Splines\n");
+ return(BSPLINE);
+ default:
+ return(CURVE);
+ }
+ }
switch (s[4]) {
case 'L':
return (CENTLEFT);
diff --git a/contrib/groff/src/preproc/grn/hgraph.cc b/contrib/groff/src/preproc/grn/hgraph.cc
index 7963720..d307faa 100644
--- a/contrib/groff/src/preproc/grn/hgraph.cc
+++ b/contrib/groff/src/preproc/grn/hgraph.cc
@@ -4,6 +4,8 @@
* to troff input.
*/
+#include "lib.h"
+
#include "gprint.h"
#ifdef NEED_DECLARATION_HYPOT
@@ -58,12 +60,13 @@ void tmove2(int px, int py);
void doarc(POINT cp, POINT sp, int angle);
void tmove(POINT * ptr);
void cr();
-void drawwig(POINT * ptr);
+void drawwig(POINT * ptr, int type);
void HGtline(int x1, int y1);
void dx(double x);
void dy(double y);
void HGArc(register int cx, register int cy, int px, int py, int angle);
void picurve(register int *x, register int *y, int npts);
+void HGCurve(int *x, int *y, int numpoints);
void Paramaterize(int x[], int y[], float h[], int n);
void PeriodicSpline(float h[], int z[],
float dz[], float d2z[], float d3z[],
@@ -126,8 +129,14 @@ HGPrintElt(ELT *element,
break;
case CURVE:
- length = 0; /* keep track of line length */
- drawwig(p1);
+ length = 0; /* keep track of line length */
+ drawwig(p1, CURVE);
+ cr();
+ break;
+
+ case BSPLINE:
+ length = 0; /* keep track of line length */
+ drawwig(p1, BSPLINE);
cr();
break;
@@ -533,16 +542,17 @@ line(int px,
/*----------------------------------------------------------------------------
- | Routine: drawwig (ptr)
+ | Routine: drawwig (ptr, type)
|
| Results: The point sequence found in the structure pointed by ptr is
| placed in integer arrays for further manipulation by the
- | existing routing. With the proper parameters, HGCurve is
- | called.
+ | existing routing. With the corresponding type parameter,
+ | either picurve or HGCurve are called.
*----------------------------------------------------------------------------*/
void
-drawwig(POINT * ptr)
+drawwig(POINT * ptr,
+ int type)
{
register int npts; /* point list index */
int x[MAXPOINTS], y[MAXPOINTS]; /* point list */
@@ -552,8 +562,10 @@ drawwig(POINT * ptr)
y[npts] = (int) (ptr->y * troffscale);
}
if (--npts) {
- /* HGCurve(&x[0], &y[0], npts); */ /*Gremlin looks different, so... */
- picurve(&x[0], &y[0], npts);
+ if (type == CURVE) /* Use the 2 different types of curves */
+ HGCurve(&x[0], &y[0], npts);
+ else
+ picurve(&x[0], &y[0], npts);
}
}
diff --git a/contrib/groff/src/preproc/grn/main.cc b/contrib/groff/src/preproc/grn/main.cc
index efb33a9..9b09ea6 100644
--- a/contrib/groff/src/preproc/grn/main.cc
+++ b/contrib/groff/src/preproc/grn/main.cc
@@ -67,9 +67,10 @@
*/
+#include "lib.h"
+
#include <ctype.h>
#include <stdlib.h>
-#include <string.h>
#include "gprint.h"
#include "device.h"
@@ -77,7 +78,6 @@
#include "searchpath.h"
#include "macropath.h"
-#include "lib.h"
#include "errarg.h"
#include "error.h"
#include "defs.h"
@@ -848,7 +848,7 @@ interpret(char *line)
if (par > 0.0)
xscale *= par;
else
- error("illegal scale value on line %1", linenum);
+ error("invalid scale value on line %1", linenum);
break;
case 'f': /* file */
OpenPOWER on IntegriCloud