Dec 172017
 
Source code to GnuPlot version 2.0, revision level 2.
File GPLTS202.ZIP from The Programmer’s Corner in
Category C Source Code
Source code to GnuPlot version 2.0, revision level 2.
File Name File Size Zip Size Zip Type
BITMAP.C 51412 7432 deflated
BITMAP.H 2726 765 deflated
BUGTEST 0 0 stored
MSCBUG.C 279 176 deflated
PRINTF.C 121 75 deflated
README 1810 884 deflated
SCANF.C 241 125 deflated
BUILDVMS.COM 823 331 deflated
COMMAND.C 38902 11472 deflated
COPYRIGH 889 455 deflated
CORGRAPH.ASM 2272 854 deflated
CORPLOT.C 839 458 deflated
DEMO 0 0 stored
1.DAT 781 218 deflated
2.DAT 781 220 deflated
3.DAT 781 222 deflated
CONTROLS.DEM 712 416 deflated
ELECTRON.DEM 2041 837 deflated
PARAM.DEM 825 322 deflated
POLAR.DEM 869 382 deflated
SIMPLE.DEM 1045 421 deflated
USING.DAT 5568 1487 deflated
USING.DEM 816 349 deflated
DOCS 0 0 stored
CHECKDOC.C 1377 658 deflated
DOC2GIH.C 1949 865 deflated
DOC2HLP.C 1399 678 deflated
DOC2HLP.COM 90 62 deflated
DOC2MS.C 5015 1854 deflated
DOC2TEX.C 4784 1676 deflated
GNUPLOT.1 3639 1805 deflated
GNUPLOT.DOC 57860 16944 deflated
LASERGNU.1 1531 730 deflated
LATEXTUT 0 0 stored
EG1.PLT 65 61 deflated
EG2.PLT 219 150 deflated
EG3.DAT 781 222 deflated
EG3.PLT 199 132 deflated
EG4.PLT 227 145 deflated
EG5.PLT 331 192 deflated
EG6.PLT 457 281 deflated
HEADER.TEX 1675 738 deflated
MAKEFILE 523 290 deflated
TUTORIAL.TEX 21199 7607 deflated
MAKEFILE 2295 859 deflated
README 3670 1533 deflated
TITLEPAG.MS 303 224 deflated
TITLEPAG.TEX 773 419 deflated
EVAL.C 3518 1433 deflated
GNUPLOT_.C 8666 3222 deflated
GRAPHICS.C 35516 8364 deflated
HEADER.MAC 918 413 deflated
HELP.C 15617 5226 deflated
HELP.H 245 156 deflated
HRCGRAPH.ASM 8192 3269 deflated
INTERNAL.C 14810 2866 deflated
LASERGNU 3801 1280 deflated
LINEPROC.MAC 1980 731 deflated
LINKOPT.MSC 143 102 deflated
LINKOPT.TC 226 138 deflated
LINKOPT.VMS 26 26 stored
MAKEFILE.3B1 5143 2058 deflated
MAKEFILE.MSC 2382 962 deflated
MAKEFILE.TC 2923 1175 deflated
MAKEFILE.UNX 6219 2267 deflated
MAKEFILE.VMS 1876 773 deflated
MAKEFILE.X11 7599 2637 deflated
MISC.C 13245 4284 deflated
PARSE.C 9391 2935 deflated
PCGRAPH.ASM 3925 1749 deflated
PLOT.C 7371 2915 deflated
PLOT.H 8269 3307 deflated
README 12057 5057 deflated
README.GNU 914 487 deflated
README.X11 1561 769 deflated
README1.PAT 4083 1710 deflated
README2.PAT 12252 5314 deflated
SCANNER.C 7980 2991 deflated
SETSHOW.C 45083 9397 deflated
SETSHOW.H 2497 977 deflated
STANDARD.C 15122 4673 deflated
TERM 0 0 stored
TERM.C 45924 11035 deflated
TERM.H 3594 1579 deflated
AED.TRM 2311 1047 deflated
CGI.TRM 4407 1775 deflated
DXY.TRM 2238 1029 deflated
EEPIC.TRM 7572 2651 deflated
EPSON.TRM 11328 2783 deflated
FIG.TRM 5033 1905 deflated
HP26.TRM 2262 984 deflated
HP2648.TRM 2113 930 deflated
HPGL.TRM 2625 1145 deflated
HPLJII.TRM 6336 2240 deflated
IMAGEN.TRM 7393 2618 deflated
IMPCODES.H 1260 498 deflated
IRIS4D.TRM 2256 971 deflated
KYO.TRM 2313 913 deflated
LATEX.TRM 17201 5289 deflated
OBJECT.H 5063 1368 deflated
PC.TRM 22173 4322 deflated
POST.TRM 8247 2572 deflated
QMS.TRM 3785 1648 deflated
README 6719 2524 deflated
REGIS.TRM 2967 1281 deflated
SUN.TRM 6147 2205 deflated
T410X.TRM 5056 1825 deflated
TEK.TRM 6579 2137 deflated
UNIXPC.TRM 14197 4242 deflated
UNIXPLOT.TRM 1929 925 deflated
V384.TRM 2579 1070 deflated
X11.TRM 2070 830 deflated
TRANSLAT 0 0 stored
COMMAND.C 27194 6164 deflated
EVAL.C 2739 1156 deflated
GNUT2P.1 1588 792 deflated
INTERNAL.C 12603 2283 deflated
MAKEFILE 718 374 deflated
MISC.C 1630 725 deflated
PARSE.C 6308 1805 deflated
PLOT.C 3258 1415 deflated
PLOT.H 4457 1849 deflated
README 1222 626 deflated
SCANNER.C 7522 2827 deflated
STANDARD.C 5457 1372 deflated
TEST1 775 387 deflated
TEST2 701 354 deflated
UTIL.C 8486 2714 deflated
UTIL.C 11496 3294 deflated
VERSION.C 221 168 deflated

Download File GPLTS202.ZIP Here

Contents of the README file


These two programs demonstrate some of the bugs in the SunOS stdio
library. The explanation, from `help bugs` in gnuplot:

The most important known bug is actually in the stdio library for the
Sun4 operating system (SunOS Sys4-3.2). The "%g" format for `printf`
sometimes incorrectly prints numbers (e.g., 200000.0 as "2"). Thus,
tic mark labels may be incorrect on a Sun4 version of gnuplot. You
may work around it by rescaling your data or by using the `set format`
command to change the tic mark format to "%7.0f" or some other
appropriate format. This appears to have been fixed in SunOS 4.0.

Another bug: On a Sun3 under SunOS 4.0, and on Sun4's under Sys4-3.2
and SunOS 4.0, the `sscanf` routine incorrectly parses "00 12" with
the format "%f %f" and reads 0 and 0 instead of 0 and 12. This
affects data input. If your data file contains X coordinates that are
zero but are specified like '00', '000', etc, then you will read the
wrong Y values. Check your data files or do not use a Sun4 until they
fix the bug. It does NOT appear that this has been fixed in SunOS
4.0, at least by 4.0.3.


compile with
cc printf.c -o printf
cc scanf.c -o scanf

David Kotz
December 1989

----------------

The program mscbug.c demonstrates a bug in Microsoft C 5.1.

The explanation, from `help bugs` in gnuplot:
Microsoft C 5.1 has a nasty bug associated with the %g format for
printf. When any of the formats "%.2g", "%.1g", "%.0g", "%.g" are
used, printf will incorrectly print numbers in the range 1e-4 to 1e-1.
Numbers that should be printed in the %e format are incorrectly
printed in the %f format, with the wrong number of zeros after the
decimal point.
To work around this problem, use the %e or %f formats explicitly.

compile with
cl mscbug.c

Russell Lang
January 1990
Notes on the gnuplot help files and documentation.

Gnuplot documentation is available in three ways:

1 - interactively, within gnuplot
2 - as a printed document.
3 - as a manual page, through the Unix man(1) facility

The first two forms describe the inner workings, and contain
equivalent information, while the third form tells how to run gnuplot.

The two first forms above derive their information from the file
gnuplot.doc, which is the MASTER copy of gnuplot help information. All
other forms, except for gnuplot.1, the man page, are derived from it.

gnuplot.doc -> gnuplot.hlp
-> gnuplot.gih
-> gnuplot.tex
-> gnuplot.ms

On VMS the interactive help is supplied by the system help facility,
using the gnuplot.hlp file. This is made with ('make hlp'). On Unix
and MSDOS the interactive help is built in to the program, and uses
the gnuplot.gih file ('make gih').

The printed document is available in either latex or troff/nroff (ms)
format, using gnuplot.tex or gnuplot.ms, derived from gnuplot.doc with
either doc2tex or doc2ms. Type 'make dvi' or 'make nroff'. For troff,
type 'make ms' and then troff -ms gnuplot.ms in whatever way you use
troff.

If VMS users prefer the gnuplot interactive help facility to the
system facility, this can be easily changed in command.c.


Description of the gnuplot.doc format:
--------------------------------------

Here is an example of the DOC master help format:

?
1 gnuplot
GNUPLOT is a command-driven interactive function plotting program. It
...
?exit
2 exit
'exit', 'quit' and ...
?expressions
2 expressions
In general, any mathematical expression accepted by C, ...

Topics:
functions operators
?expressions functions
?functions
3 functions
The functions in GNUPLOT are ...

Topics:
abs acos arg ...
?expressions functions abs
?functions abs
?abs
4 abs
This function returns the absolute value of its argument. The
returned value is of the same type as the argument.
?expressions functions acos
?functions acos
?acos
4 acos
This function returns the arc cosine (inverse cosine) of its
argument. 'acos' returns its argument in radians.


Some notes about the format:
----------------------------
Remember that all text must be able to be processed by gnuplot, VMS,
nroff, troff, and latex, and always do something reasonable.
The first column is reserved for control characters.
Text does not start in the first column.
Lines that start in column 2 may be typeset by LaTeX.
Lines that have a space in column 2 are to be printed in a verbatim
environment by LaTeX.
Do NOT use tabs in the help file.
Conversion from this format to vax .hlp file involves removal of
lines starting with [[email protected]#$%] (see doc2hlp). VMS uses the numbers
to represent a tree.
Conversion from this format to gnuplot .gih file involves removal of
lines starting with [[email protected]#$%] (see doc2gih). Gnuplot matches your
help query against the ? lines to find the help information.
Multiple ? lines for one text block constitute synonyms. The most
specific should be first, eg 'expressions functions' before 'functions'.
Spaces are allowed here, but should be single.
Backquote pairs are converted by the doc2tex program into boldface;
that is, `some text` is converted to {\bf some text}. Be sure to pair
the backquotes, or the whole document will be boldface!

Control characters in first column:
? used by .gih format, for builtin interactive help - keyword
0-9 used by VMS help and by doc2{tex,ms} formatters to define level,keyword
@ used by doc2{tex,ms} to define table start/end
# used by doc2tex: table entry
% used by doc2ms: table entry
The GNUPLOT source code and executables may be copied and/or modified
freely as long as the copyright messages are left intact.

Compilation instructions are near the end of this file.

GNUPLOT has been tested on Sun3's and Sun4's (SunOS 4.0.3), a Pyramid
90x (OSx 4.0 - ucb 4.3 and att V), a VAX 6410 (VMS 5.2), IBM PC XT's
and AT's (MS-DOS 3.3, Microsoft C 5.10 and Turbo C 2.0)), IRIS 4D/70G
and 4D/25G with MIPS C, and NeXT with gnu C 1.34. The code is written
with portability in mind.

If you have problems, send mail to [email protected] And
please send any modifications you make so they can be considered for
later releases.


GNUPLOT 2.0 RELEASE NOTES

New terminal drivers: ATT6300, Roland DXY800A, EEPIC, emTeX, EPSON LX-800,
EPSON 60dpi, Fig, HP2648, HPGL, HP LaserJet, Imagen, Kermit-MS Tektronix
emulator, LaTeX, MCGA, NEC CP6 pinwriter, POSTSCRIPT, Proprinter, Star color
printer, Tandy DMP-130, Tektronix 410x, SUN, VGA, X11.

Additions:

Command-line arguments are accepted. They are treated as names of
files containing gnuplot commands. Gnuplot loads them, one by one, and
then exits.

Command 'plot' now has a 'title' option to change the information in
the key. The 'with' option can now specify line type and point type.

Command 'pause'.

Command 'replot' allows the addition of extra plots.

Command 'save' now saves all the 'set' options, including the last
plot command.

Command 'set autoscale' now accepts autoscaling on the x axis for data
files. The default is autoscaling on both axes.

Command 'set noclip' disables clipping of points near the border. 'set
clip' reenables clipping. The default used to be 'clip', and is now
'noclip'. Clipping has also been extended to clip lines that extend
outside the borders: line plots are now clipped at the plot boundary.
Formerly, the line stopped at the last in-range data point.

Numerical labelling at tic marks on x and y axes. Command 'set
format' allows the format of the tic mark labels to be altered.
Commands 'set xtics' and 'set ytics' allow for alphanumeric labels and
arbitrary tic positions.

Command 'set grid' adds a grid between the tic marks.

Improved key gives sample point or line types. Key can be disabled
with the 'set nokey'. Key can be positioned anywhere.

Command 'set label' allows the placement of arbitrary text labels and
arrows.

Command 'set polar' for polar plots.

Command 'set offsets' for reducing the plotted area. Useful for polar
plots.

Command 'set size' scales the displayed size of the plot.

Command 'set tics out' causes the tics to be drawn outwards from the
border. Useful for impulse plots.

Command 'set title' places a text label above the plot.

Commands 'set xlabel' and 'set ylabel' place text labels on the x and
y axes respectively. Some terminals will place the y label vertically
upwards on the left of the plot, others place the label horizontally
at the left of the plot.

Improved tics on log scales.

Extended comments: comments are allowed anywhere reasonable in the
input line, and continue to the end of the input line.

Line continuation (with \) is added.

Non-interactive use, through redirection or "load" command, is
improved. Error messages expanded to include file name and line
number, and to reprint command line if not interactive.

New plotting styles 'linespoints' and 'dots'.

Blank lines in data files denote "breaks". In lines and linespoints
plot styles, this breaks the curve being drawn and begins at the next
point, without changing the line or point types.

Completely new interactive help system that is similar to VMS help
system. A printed manual can be obtained in LaTeX, troff, or nroff and
is based on the same information as the interactive help.

PC version now compiles with the large model so that gnuplot will
compile with the above additions!

Bug fixes include:
------------------
Bug involving functions plotted on a logarithmic x axis is fixed.

Errors inside of loaded files now clean up and close files properly.

Numbers of the form xxxxe+nn are now acceptable (+ sign caused error).

Tics are now place inside the borders (some were outside).

Reverse axes now work properly.

Command 'set output ""' used to crash.

VMS was closing stdout, so 'set output' code changed to avoid closing
it. VMS version of gnuplot now performs a SET TERM/NOWRAP itself.

Terminal is now reset before closing output file, changing terminal
type or exiting gnuplot.

Several old bugs have been superseded by new ones.


ACKNOWLEDGEMENTS

The Unix PC, polar, pause, and offset additions were by John Campbell.
([email protected])
The Turbo C additions were by Bill Wilson.
([email protected])
Some of the labelling improvements and combining of these additions
were by Russell Lang.
([email protected])
The LaTeX driver, the help system, and some of the labelling
improvements were by David Kotz.
([email protected])
And of course, the vast majority of the program is by Colin Kelley
and Thomas Williams.
([email protected])


GNUPLOT 1.1 RELEASE NOTES

New terminal drivers: AED 512, BBN BitGraph, HP2623, POSTSCRIPT,
Selanar, Vectrix 384. The PC version now supports Hercules and ATT
6300 monochrome graphics. Thanks to those who sent these drivers in.

New commands: 'set dummy' and 'show dummy' to select the dummy
variable name; 'replot' to repeat the last 'plot' command.

The exclamation point (!) is now accepted as postfix factorial
operator. The gamma() function is also included, if your C library
has gamma(). See GAMMA below.

Logical AND (&&) and OR (||) now short-circuit the way they do in C.
That is, the second && operand is not evaluated if the first is false;
the second || operand is not evaluated if the first is true. The
ternary operator (?:) also does not evaluate the unused operand. This
change allows for the definition of recursive functions, e.g. a
synonym for the ! factorial operator:

fact(x) = (x<=1) ? 1 : x*fact(x-1)

GNUPLOT now has a much better memory allocation scheme, replacing most
fixed-size arrays with malloc()'d linked lists. There is no longer
any artificial maximum on the number of simultaneous plots, number of
points in those plots, or the number of user-defined functions or
variables. All these are limited only by the memory available to
malloc(). This is a big improvement for memory-starved machines like
PDP-11s or PCs.

Lines beginning with # (also ! in VMS) are treated as comments. Only
the $ may now be used for a shell escape in VMS, since ! is a comment.

Several old bugs have been superseded by new ones.


PREPROCESSOR #DEFINES

These #defines should be checked before compilation:
define file note
------ ---- --------
VFORK Makefile define if you've got vfork() system call
GAMMA Makefile define if you've got gamma(3)
BCOPY Makefile define if your memcpy() is called bcopy()
BZERO Makefile define if you have bzero() but not memset()
NOCOPY Makefile define if you've don't have a memcpy() by any name
bcopy() plot.h define if you've got a memcpy() by some OTHER name
(see example in plot.h)
PC Makefile define if compiling on a PClone
MSDOS Makefile define if compiling under MSDOS;
automatically defined by Microsoft C 5.10
HELPFILE Makefile name including path of gnuplot.gih file.
VERYLARGE plot.h define to be largest coordinate number.
SHELL plot.h default shell to spawn if SHELL environment
variable not found at run-time

Valid TERMFLAGS defines. These defines are used to include the
various plotting terminals, printers, and protocols that a given version
of gnuplot can access:

define file note
------ ---- --------
TERMFLAGS Makefile the set of terminals you want, from below
or term.h

AED AED 512 and AED 767
ATT6300 PC with AT&T 6300 graphics
BITGRAPH BBN BitGraph
CGI SCO CGI
CORONA PC with Corona graphics 325
DXY800A Roland DXY800A plotter
EEPIC EEPIC-extended LaTeX driver, for EEPIC users
EMTEX LATEX picture environment with emTeX specials
EPS60 Epson-style 60-dot per inch printers
EPSON Epson LX-800, Star NL-10, NX-1000 and lots of others
FIG Fig graphics language (requires object.h from TransFig)
HERCULES IBM PC/Clone with Hercules graphics board
HP2648 HP2648, HP2647
HP26 HP2623A and maybe others
HP75 HP7580, and probably other HPs
HPGL HP7475 and (hopefully) lots of others
HPLJII HP Laserjet II
IMAGEN Imagen laser printers (300dpi) (requires -Iterm also)
IRIS4D IRIS4D series computer
KERMIT MS-Kermit Tektronix 4010 emulator
LATEX LATEX picture environment
NEC NEC CP6 pinwriter printer
POSTSCRIPT Postscript
PRESCRIBE Kyocera Laser printer
QMS QMS/QUIC laserprinter (Talaris 1200 and others)
REGIS ReGis graphics (vt125, vt220, vt240, Gigis...)
SELANAR Selanar
STARC Star Color Printer
SUN Sun Microsystems Workstation
T410X Tektronix 4106, 4107, 4109 and 420x terminals
TANDY60 Tandy DMP-130 series 60-dot per inch graphics
TEK Tektronix 4010, and probably others
UNIXPC unixpc (ATT 3b1 or ATT 7300)
UNIXPLOT unixplot
V384 Vectrix 384 and tandy color printer
VTTEK VT like Tektronix 4010 emulator
X11 X11R4 window system


These #defines are defined automatically by various compilers, some
gnuplot routines check these defines to implement features found in the
various environments:

define note
------ --------
vms (and VMS) defined by VAX-11 C under VMS.

__TURBOC__ defined automatically by Turbo C 2.0
__ZTC__ defined automatically by Zortech C


TO COMPILE

under UNIX:
To compile do:
Copy one of makefile.unx, makefile.x11 or makefile.3b1,
to Makefile, for example
cp makefile.unx Makefile
Edit Makefile to change LIBS, #defines, especially HELPDEST and TERMFLAGS
Edit term.h, to include/exclude terminals
make
If that works, try
make install

under VMS:
To compile:
copy makefile.vms makefile.
make
Or if you don't have a suitable make:
@buildvms
To tell gnuplot where to find the help library:
$ define gnuplot$help disk:[directory]gnuplot.hlb
Alternatively (and preferably) put the help in the main system help library.

under MSDOS:
Using Microsoft C 5.10.
copy makefile.msc
make makefile

Using Turbo C 2.0.
copy makefile.tc
Edit makefile to change TC, BIN, BGI.
make

The file gnuplot.gih is needed for help on the PC.
If the file gnuplot.gih is not in the default directory, then use:
set GNUHELP={full path name of gnuplot.gih}

The Zortech C++ compiler has been used to compile gnuplot, but
it has not been tested. The Microsoft MASM and linker are needed.


ENVIRONMENT VARIABLES

If the environment variable GNUTERM is found, it is used as the terminal
type. Otherwise, in some cases the variable TERM will be used, or the
hardware may be automatically detected.

The PC version looks for the environment variable GNUPLOT to contain
the name of the directory from which to load the initialization file
GNUPLOT.INI. See the help on 'start_up' for more information.

HOME is examined as a directory where a .gnuplot startup file might be
found. See help on "start-up".

If defined, the environment variable GNUHELP is used for the name
of the .gih help file, otherwise HELPFILE (defined in makefile or
plot.c) is used.

The VMS version looks for the logical name GNUPLOT$HELP to locate
the help library.
DOCUMENTATION FOR GNUPLOT TERMINAL DRIVER WRITERS
By Russell Lang 1/90

Information on each terminal device driver is contained in term.c and
the term/*.trm files. Each driver is contained in a .trm file and is
#include'd into term.c. Each driver has a set of initialisers in
term.c for term_tbl[], an array of struct termentry.

Here is the definition of the struct termentry from plot.h:

struct termentry {
char *name;
char *description;
unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
FUNC_PTR init,reset,text,scale,graphics,move,vector,linetype,
put_text,text_angle,justify_text,point,arrow;
};

Here's a brief description of each variable:

The char *name is a pointer to a string containing the name
of the terminal. This name is used by the 'set terminal' and
'show terminal' commands.
The name must be unique and must not be confused with an abbreviation
of another name. For example if the name "postscript" exists, it is not
possible to have another name "postscript2".
Keep the name under 15 characters.

The char *description is a pointer to a string containing a
description of the terminal, which is displayed in response
to the 'set terminal' command.
Keep the description under 60 characters.

xmax is the maximum number of points in the x direction.
The range of points used by gnuplot is 0 to xmax-1.

ymax is the maximum number of points in the y direction.
The range of points used by gnuplot is 0 to ymax-1.

v_char is the height of characters, in the same units as xmax and ymax.
The border for labelling at the top and bottom of the plot is
calculated using v_char.
v_char is used as the vertical line spacing for characters.

h_char is the width of characters, in the same units as xmax and ymax.
The border for labelling at the left and right of the plot is
calculated using h_char.
If the _justify_text function returns FALSE, h_char is used to justify
text right or centre. If characters are not fixed width, then the
_justify_text function must correctly justify the text.

v_tic is the vertical size of tics along the x axis,
in the same units as ymax.

h_tic is the horizontal size of tics along the y axis,
in the same units as xmax.


Here's a brief description of what each term.c function does:

_init() Called once, when the device is first selected. This procedure
should set up things that only need to be set once, like handshaking and
character sets etc...

_reset() Called when gnuplot is exited, the output device changed or
the terminal type changed. This procedure should reset the device,
possibly flushing a buffer somewhere or generating a form feed.

_scale(xs,ys) Called just before _graphics(). This takes the x and y
scaling factors as information. If the terminal would like to do its
own scaling, it returns TRUE. Otherwise, it can ignore the information
and return FALSE: do_plot will do the scaling for you. null_scale is
provided to do just this, so most drivers can ignore this function
entirely. The Latex driver is currently the only one providing its own
scaling.

_graphics() Called just before a plot is going to be displayed. This
procedure should set the device into graphics mode. Devices which can't
be used as terminals (like plotters) will probably be in graphics mode
always and therefore won't need this.

_text() Called immediately after a plot is displayed. This procedure
should set the device back into text mode if it is also a terminal, so
that commands can be seen as they're typed. Again, this will probably
do nothing if the device can't be used as a terminal.

_move(x,y) Called at the start of a line. The cursor should move to the
(x,y) position without drawing.

_vector(x,y) Called when a line is to be drawn. This should display a line
from the last (x,y) position given by _move() or _vector() to this new (x,y)
position.

_linetype(lt) Called to set the line type before text is displayed or
line(s) plotted. This procedure should select a pen color or line
style if the device has these capabilities.
lt is an integer from -2 to 0 or greater.
An lt of -2 is used for the border of the plot.
An lt of -1 is used for the X and Y axes.
lt 0 and upwards are used for plots 0 and upwards.
If _linetype() is called with lt greater than the available line types,
it should map it to one of the available line types.
Most drivers provide 9 different linetypes (lt is 0 to 8).

_put_text(x,y,str) Called to display text at the (x,y) position,
while in graphics mode. The text should be vertically (with respect
to the text) justified about (x,y). The text is rotated according
to _text_angle and then horizontally (with respect to the text)
justified according to _justify_text.

_text_angle(ang) Called to rotate the text angle when placing the y label.
If ang = 0 then text is horizontal. If ang = 1 then text is vertically
upwards. Returns TRUE if text can be rotated, FALSE otherwise.

_justify_text(mode) Called to justify text left, right or centre.
If mode = LEFT then text placed by _put_text is flushed left against (x,y).
If mode = CENTRE then centre of text is at (x,y).
If mode = RIGHT then text is placed flushed right against (x,y).
Returns TRUE if text can be justified
Returns FALSE otherwise and then _put_text assumes text is flushed left;
justification of text is then performed by calculating the text width
using strlen(text) * h_char.

_point(x,y,point) Called to place a point at position (x,y).
point is -1 or an integer from 0 upwards.
6 point types (numbered 0 to 5) are normally provided.
Point type -1 is a dot.
If point is more than the available point types then it should
be mapped back to one of the available points.
Two _point() functions called do_point() and line_and_point() are
provided in term.c and should be suitable for most drivers.
do_point() draws the points in the current line type.
If your driver uses dotted line types (generally because it is
monochrome), you should use line_and_point() which changes to
line type 0 before drawing the point. line type 0 should be solid.


_arrow(sx,sy,ex,ey) Called to draw an arrrow from (sx,sy) to (ex,ey).
An _arrow() function called do_arrow() is provided in term.c which will
draw arrows using the _move() and _vector() functions.
Drivers should use do_arrow unless it causes problems.


The following should illustrate the order in which calls to these
routines are made:

_init()
_scale(xs,ys)
_graphics()
_linetype(lt)
_move(x,y)
_vector(x,y)
_point(x,y,point)
_text_angle(angle)
_justify(mode)
_put_text(x,y,text)
_arrow(sx,sy,ex,ey)
_text()
_graphics()
.
.
_text()
_reset()


gnut2p translator - David Kotz January 1990

This program converts gnutex files to gnuplot files. It does its
best, but is not perfect. Most of gnutex will translate directly, some
things will translated easily (such as 'set size'), but some things
cannot be translated (such as 'set style'). One thing this program
does is to move plot commands down past the 'label' and 'key' commands
(which change into 'set label' and 'set key' commands). This may move
it past other commands. If it moves past variable or function
definitions, 'set' commands, or other commands which affect the plot
command's execution, then the new version will be incorrect. I expect
this case to be rare; indeed, I generally expect the last lines in
GnuTeX input files used with LaTeX to consist of 'plot, label,' and
'key' commands.

The usage of this program is simple:

gnut2p infile outfile

'infile' is an existing GnuTeX file, and 'outfile' will be created as
the GNUPLOT equivalent. The errors, warnings, and explanatory comments
appear on stderr. Any use of line continuation will be lost, and some
instances of the input style (eg, white space) may be changed.

To build this program, see the Makefile. It is fairly straightforward.


 December 17, 2017  Add comments

Leave a Reply