home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-28 | 48.3 KB | 1,530 lines |
- Newsgroups: comp.sources.misc
- From: gershon%gr@cs.utah.edu (Elber Gershon)
- Subject: v24i047: gnuplot3 - interactive function plotting utility, Part25/26
- Message-ID: <1991Oct29.031129.4319@sparky.imd.sterling.com>
- X-Md4-Signature: a176e9ce920c0f9ef2e16bca4b21fab1
- Date: Tue, 29 Oct 1991 03:11:29 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
- Posting-number: Volume 24, Issue 47
- Archive-name: gnuplot3/part25
- Environment: UNIX, MS-DOS, VMS
- Supersedes: gnuplot2: Volume 11, Issue 65-79
-
- #!/bin/sh
- # this is Part.25 (part 25 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file gnuplot/term.c continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 25; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping gnuplot/term.c'
- else
- echo 'x - continuing file gnuplot/term.c'
- sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term.c' &&
- X }
- X (void) (*t->justify_text)(LEFT);
- X (void) (*t->text_angle)(0);
- X /* test tic size */
- X (*t->move)(xmax/2+t->h_tic*2,0);
- X (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
- X (*t->move)(xmax/2,t->v_tic*2);
- X (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
- X (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
- X /* test line and point types */
- X x = xmax - t->h_char*4 - t->h_tic*4;
- X y = ymax - t->v_char;
- X for ( i = -2; y > t->v_char; i++ ) {
- X (*t->linetype)(i);
- X (void) sprintf(label,"%d",i);
- X if ((*t->justify_text)(RIGHT))
- X (*t->put_text)(x,y,label);
- X else
- X (*t->put_text)(x-strlen(label)*t->h_char,y,label);
- X (*t->move)(x+t->h_char,y);
- X (*t->vector)(x+t->h_char*4,y);
- X if ( i >= -1 )
- X (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
- X y -= t->v_char;
- X }
- X /* test some arrows */
- X (*t->linetype)(0);
- X x = xmax/4;
- X y = ymax/4;
- X xl = t->h_tic*5;
- X yl = t->v_tic*5;
- X (*t->arrow)(x,y,x+xl,y,TRUE);
- X (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
- X (*t->arrow)(x,y,x,y+yl,TRUE);
- X (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
- X (*t->arrow)(x,y,x-xl,y,TRUE);
- X (*t->arrow)(x,y,x-xl,y-yl,TRUE);
- X (*t->arrow)(x,y,x,y-yl,TRUE);
- X (*t->arrow)(x,y,x+xl,y-yl,TRUE);
- X /* and back into text mode */
- X (*t->text)();
- }
- X
- X
- #ifdef PC
- /* output for some terminal types must be binary to stop non Unix computers
- X changing \n to \r\n.
- X If the output is not STDOUT, the following code reopens outfile
- X with binary mode. */
- void
- reopen_binary()
- {
- char filename[MAX_ID_LEN+1];
- X
- X if (strcmp(outstr,"STDOUT")) {
- X (void) fclose(outfile);
- X (void) strcpy(filename,outstr+1); /* remove quotes */
- X filename[strlen(filename)-1] = '\0';
- X if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
- X if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
- X os_error("cannot reopen file with binary type; output unknown",
- X NO_CARET);
- X }
- X else {
- X os_error("cannot reopen file with binary type; output reset to ascii",
- X NO_CARET);
- X }
- X }
- X }
- }
- #endif
- X
- #ifdef vms
- /* these are needed to modify terminal characteristics */
- #include <descrip.h>
- #include <iodef.h>
- #include <ttdef.h>
- #include <tt2def.h>
- #include <dcdef.h>
- #include <ssdef.h>
- #include <stat.h>
- #include <fab.h>
- static unsigned short chan;
- static int old_char_buf[3], cur_char_buf[3];
- $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
- X
- char *vms_init()
- /*
- X * Determine if we have a regis terminal
- X * and save terminal characteristics
- */
- {
- X /* Save terminal characteristics in old_char_buf and
- X initialise cur_char_buf to current settings. */
- X int i;
- X sys$assign(&sysoutput_desc,&chan,0,0);
- X sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
- X for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
- X sys$dassgn(chan);
- X
- X /* Test if terminal is regis */
- X if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
- X return(NULL);
- }
- X
- void
- vms_reset()
- /* set terminal to original state */
- {
- X int i;
- X sys$assign(&sysoutput_desc,&chan,0,0);
- X sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
- X for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
- X sys$dassgn(chan);
- }
- X
- void
- term_mode_tek()
- /* set terminal mode to tektronix */
- {
- X long status;
- X if (outfile != stdout) return; /* don't modify if not stdout */
- X sys$assign(&sysoutput_desc,&chan,0,0);
- X cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
- X cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
- X
- X cur_char_buf[1] &= ~TT$M_CRFILL;
- X cur_char_buf[1] &= ~TT$M_ESCAPE;
- X cur_char_buf[1] &= ~TT$M_HALFDUP;
- X cur_char_buf[1] &= ~TT$M_LFFILL;
- X cur_char_buf[1] &= ~TT$M_MECHFORM;
- X cur_char_buf[1] &= ~TT$M_NOBRDCST;
- X cur_char_buf[1] &= ~TT$M_NOECHO;
- X cur_char_buf[1] &= ~TT$M_READSYNC;
- X cur_char_buf[1] &= ~TT$M_REMOTE;
- X cur_char_buf[1] |= TT$M_LOWER;
- X cur_char_buf[1] |= TT$M_TTSYNC;
- X cur_char_buf[1] |= TT$M_WRAP;
- X cur_char_buf[1] &= ~TT$M_EIGHTBIT;
- X cur_char_buf[1] &= ~TT$M_MECHTAB;
- X cur_char_buf[1] &= ~TT$M_SCOPE;
- X cur_char_buf[1] |= TT$M_HOSTSYNC;
- X
- X cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
- X cur_char_buf[2] &= ~TT2$M_BLOCK;
- X cur_char_buf[2] &= ~TT2$M_DECCRT3;
- X cur_char_buf[2] &= ~TT2$M_LOCALECHO;
- X cur_char_buf[2] &= ~TT2$M_PASTHRU;
- X cur_char_buf[2] &= ~TT2$M_REGIS;
- X cur_char_buf[2] &= ~TT2$M_SIXEL;
- X cur_char_buf[2] |= TT2$M_BRDCSTMBX;
- X cur_char_buf[2] |= TT2$M_EDITING;
- X cur_char_buf[2] |= TT2$M_INSERT;
- X cur_char_buf[2] |= TT2$M_PRINTER;
- X cur_char_buf[2] &= ~TT2$M_ANSICRT;
- X cur_char_buf[2] &= ~TT2$M_AVO;
- X cur_char_buf[2] &= ~TT2$M_DECCRT;
- X cur_char_buf[2] &= ~TT2$M_DECCRT2;
- X cur_char_buf[2] &= ~TT2$M_DRCS;
- X cur_char_buf[2] &= ~TT2$M_EDIT;
- X cur_char_buf[2] |= TT2$M_FALLBACK;
- X
- X status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
- X if (status == SS$_BADPARAM) {
- X /* terminal fallback utility not installed on system */
- X cur_char_buf[2] &= ~TT2$M_FALLBACK;
- X sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
- X }
- X else {
- X if (status != SS$_NORMAL)
- X lib$signal(status,0,0);
- X }
- X sys$dassgn(chan);
- }
- X
- void
- term_mode_native()
- /* set terminal mode back to native */
- {
- X int i;
- X if (outfile != stdout) return; /* don't modify if not stdout */
- X sys$assign(&sysoutput_desc,&chan,0,0);
- X sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
- X for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
- X sys$dassgn(chan);
- }
- X
- void
- term_pasthru()
- /* set terminal mode pasthru */
- {
- X if (outfile != stdout) return; /* don't modify if not stdout */
- X sys$assign(&sysoutput_desc,&chan,0,0);
- X cur_char_buf[2] |= TT2$M_PASTHRU;
- X sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
- X sys$dassgn(chan);
- }
- X
- void
- term_nopasthru()
- /* set terminal mode nopasthru */
- {
- X if (outfile != stdout) return; /* don't modify if not stdout */
- X sys$assign(&sysoutput_desc,&chan,0,0);
- X cur_char_buf[2] &= ~TT2$M_PASTHRU;
- X sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
- X sys$dassgn(chan);
- }
- X
- void
- reopen_binary()
- /* close the file outfile outfile and reopen it with binary type
- X if not already done or outfile == stdout */
- {
- X stat_t stat_buf;
- X char filename[MAX_ID_LEN+1];
- X if (outfile != stdout) { /* don't modify if not stdout */
- X if (!fstat(fileno(outfile),&stat_buf)) {
- X if (stat_buf.st_fab_rfm != FAB$C_FIX) {
- X /* modify only if not already done */
- X (void) fclose(outfile);
- X (void) strcpy(filename,outstr+1); /* remove quotes */
- X filename[strlen(filename)-1] = '\0';
- X (void) delete(filename);
- X if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
- X == (FILE *)NULL ) {
- X if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
- X os_error("cannot reopen file with binary type; output unknown",
- X NO_CARET);
- X }
- X else {
- X os_error("cannot reopen file with binary type; output reset to ascii",
- X NO_CARET);
- X }
- X }
- X }
- X }
- X else{
- X os_error("cannot reopen file with binary type; output remains ascii",
- X NO_CARET);
- X }
- X }
- }
- X
- void
- fflush_binary()
- {
- X typedef short int INT16; /* signed 16-bit integers */
- X register INT16 k; /* loop index */
- X if (outfile != stdout) {
- X /* Stupid VMS fflush() raises error and loses last data block
- X unless it is full for a fixed-length record binary file.
- X Pad it here with NULL characters. */
- X for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
- X putc('\0',outfile);
- X fflush(outfile);
- X }
- }
- #endif
- SHAR_EOF
- echo 'File gnuplot/term.c is complete' &&
- chmod 0644 gnuplot/term.c ||
- echo 'restore of gnuplot/term.c failed'
- Wc_c="`wc -c < 'gnuplot/term.c'`"
- test 50685 -eq "$Wc_c" ||
- echo 'gnuplot/term.c: original size 50685, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/Intergraph.x11 ==============
- if test -f 'gnuplot/Intergraph.x11' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/Intergraph.x11 (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/Intergraph.x11 (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/Intergraph.x11' &&
- #!/bin/sh
- mv gnuplot_x11.c gnuplot_x11.c_x
- mv corplot.c corplot.c_pc
- acc -knr -DSYSV -DUSG -DVFORK -DNOCOPY -DGAMMA=gamma -DGETCWD -DX11 \
- -DUNIXPLOT -I/usr/include/X11 -I/usr/include/X11/Xaw *.c \
- -lbsd -lplot -lm -o gnuplot.intergraph
- mv gnuplot_x11.c_x gnuplot_x11.c
- acc -knr -DSYSV -DUSG -DVFORK -DNOCOPY -DGAMMA=gamma -DGETCWD -DX11 \
- -DUNIXPLOT -I/usr/include/X11 -I/usr/include/X11/Xaw gnuplot_x11.c \
- -lXaw -lXmu -lXt -lXext -lX11 -lbsd -lm -o gnuplot_x11.intergraph
- SHAR_EOF
- chmod 0644 gnuplot/Intergraph.x11 ||
- echo 'restore of gnuplot/Intergraph.x11 failed'
- Wc_c="`wc -c < 'gnuplot/Intergraph.x11'`"
- test 475 -eq "$Wc_c" ||
- echo 'gnuplot/Intergraph.x11: original size 475, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/linkopt.amg ==============
- if test -f 'gnuplot/linkopt.amg' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/linkopt.amg (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/linkopt.amg (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.amg' &&
- FROM LIB:c.o
- X bitmap.o command.o eval.o graphics.o help.o internal.o misc.o parse.o
- X plot.o scanner.o setshow.o standard.o term.o util.o version.o contour.o
- X graph3d.o
- TO gnuplot
- LIB LIB:lcmieee.lib LIB:lcnb.lib
- VERBOSE
- SHAR_EOF
- chmod 0666 gnuplot/linkopt.amg ||
- echo 'restore of gnuplot/linkopt.amg failed'
- Wc_c="`wc -c < 'gnuplot/linkopt.amg'`"
- test 232 -eq "$Wc_c" ||
- echo 'gnuplot/linkopt.amg: original size 232, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/README.Install ==============
- if test -f 'gnuplot/README.Install' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/README.Install (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/README.Install (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.Install' &&
- The GNUPLOT source code and executables may be copied and/or modified
- freely as long as the copyright messages are left intact.
- X
- See the History file for changes to GNUPLOT.
- X
- Compilation instructions are near the end of this file.
- X
- GNUPLOT has been tested on Sun3's and Sun4's (SunOS 4.0.3 and 4.1.1),
- a VAX 6410 (VMS 5.2), Commodore Amiga's (KS/WB 1.3 and 2.0, Lattice C
- and Aztec C beta 5.2a), IBM PC XT's and AT's (MS-DOS 3.3/5.0 BC++ 2.0/TC++
- 1.0), IRIS 4D/70G and 4D/25G with MIPS C, NeXT with gnu C 1.34,
- DECStation 5000/200PXG (ULTRIX V4.1),
- AT&T 3B1 (version 3.51m with cc and gcc 1.39),
- and Apollo's (DomainOS SR10.3 BSD4.3 with C compiler 68K Rev 6.7(316)).
- The code is written with portability in mind.
- GNUPLOT has not been tested on Pyramid 90x and IBM PC Microsoft C.
- X
- Send your comments, suggestions, or modifications to
- X pixar!info-gnuplot@sun.com
- This is a mailing list; to join it send a note to
- X pixar!info-gnuplot-request@sun.com
- Send bug reports to
- X pixar!bug-gnuplot@sun.com
- X
- X PREPROCESSOR #DEFINES
- X
- These #defines should be checked before compilation (see the makefiles):
- define file note
- ------ ---- --------
- NOVFORK Makefile define if you don't have the vfork() system call
- GAMMA Makefile define if you've got gamma(3)
- MEMCPY Makefile define if your bcopy() is called memcpy()
- MEMSET Makefile define if you have memset() but not bzero()
- 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
- X (see example in plot.h)
- PC Makefile define if compiling on a PClone
- MSDOS Makefile define if compiling under MSDOS;
- X 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
- X variable not found at run-time
- NOCWDRC Makefile define to inhibit check of ./.gnuplot
- READLINE Makefile define if you want command-line editing
- X
- Valid TERMFLAGS defines. These defines are used to include the
- various plotting terminals, printers, and protocols that a given version
- of gnuplot can access:
- X
- define file note
- ------ ---- --------
- TERMFLAGS Makefile the set of terminals you want, from below
- X or term.h
- X
- X AED AED 512 and AED 767
- X AMIGASCREEN Amiga custom screen
- X APOLLO Apollo Graphics Primitive Resource (resizable window)
- X ATT6300 PC with AT&T 6300 graphics
- X BITGRAPH BBN BitGraph
- X CGI SCO CGI
- X CORONA PC with Corona graphics 325
- X DXY800A Roland DXY800A plotter
- X DUMB Printer or glass dumb terminal
- X DXF AutoCad (Release 10.x) dxf file format
- X EEPIC EEPIC-extended LaTeX driver, for EEPIC users
- X EGALIB PC with EGA/VGA graphics.
- X EMTEX LATEX picture environment with emTeX specials
- X EPS60 Epson-style 60-dot per inch printers
- X EPSONP Epson LX-800, Star NL-10, NX-1000 and lots of others
- X FIG Fig graphics language (requires object.h from TransFig)
- X GPR Apollo Graphics Primitive Resource (fixed-size window)
- X HERCULES IBM PC/Clone with Hercules graphics board
- X HP2648 HP2648, HP2647
- X HP26 HP2623A and maybe others
- X HP75 HP7580, and probably other HPs
- X HPGL HP7475 and (hopefully) lots of others
- X HPLJII HP Laserjet II
- X IMAGEN Imagen laser printers (300dpi) (requires -Iterm also)
- X IRIS4D IRIS4D series computer
- X KERMIT MS-Kermit Tektronix 4010 emulator
- X LATEX LATEX picture environment
- X NEC NEC CP6 pinwriter printer
- X POSTSCRIPT Postscript
- X PRESCRIBE Kyocera Laser printer
- X QMS QMS/QUIC laserprinter (Talaris 1200 and others)
- X REGIS ReGis graphics (vt125, vt220, vt240, Gigis...)
- X SELANAR Selanar
- X STARC Star Color Printer
- X SUN Sun Microsystems Workstation
- X T410X Tektronix 4106, 4107, 4109 and 420x terminals
- X TANDY60 Tandy DMP-130 series 60-dot per inch graphics
- X TEK Tektronix 4010, and probably others
- X UNIXPC unixpc (ATT 3b1 or ATT 7300)
- X UNIXPLOT unixplot
- X V384 Vectrix 384 and tandy color printer
- X VTTEK VT like Tektronix 4010 emulator
- X X11 X11R4 window system
- X
- X
- These #defines are defined automatically by various compilers, some
- gnuplot routines check these defines to implement features found in the
- various environments:
- X
- define note
- ------ --------
- AMIGA_AC_5 defined for Manx Aztec C 5.2a on the Amiga
- AMIGA_LC_5_1 defined for Lattice C 5.01 on the Amiga
- apollo defined by Apollo's C compilers.
- _CRAY defined by CRAY's C compiler.
- __TURBOC__ defined automatically by Turbo C 2.0, C++ 1.0, Borland C++ 2.0
- unix defined by most unix C compilers.
- vms (and VMS) defined by VAX-11 C under VMS.
- __ZTC__ Zortech C compiler under MSDOS.
- X
- X
- X TO COMPILE
- X
- under UNIX:
- To compile do:
- X Copy makefile.unx to Makefile
- X cp makefile.unx Makefile
- X Look through the Makefile to see if you need to make any changes.
- X See especially the HELPDEST and TERMFLAGS variables. Edit if needed.
- X Alternatively, all these variables may be set as command line arguments to
- X 'make'. For example:
- X
- X make <MACHINE> HELPDEST='/usr/um/misc/lib/gnuplot.gih' \
- X DEST='/usr/um/misc/bin' READLINE=
- X
- X Edit term.h, to include/exclude terminals
- X Type
- X make
- X For further instructions.
- X If that works, try
- X make install
- X For further instructions.
- X
- under VMS:
- X To compile:
- X copy makefile.vms makefile.
- X make
- X Or if you don't have a suitable make:
- X @buildvms
- X To tell gnuplot where to find the help library:
- X $ define gnuplot$help disk:[directory]gnuplot.hlb
- X Alternatively (and preferably) put the help in the main system help library.
- X
- under AmigaDOS:
- Using Aztec C 5.2a
- X make -f makefile.ami
- Using Lattice C 5.1
- X lmk -f makefile.amg
- X
- under MSDOS:
- Using Microsoft C 5.10.
- X copy makefile.msc makefile
- X make makefile
- X
- Using Borland C++ 2.0, Turbo C++ 1.0
- X copy makefile.tc makefile
- X Edit makefile to change TC, BIN, BGI, BGIOBJ. You may also want to turn
- X on overlays (See manual for more on overlays).
- X Edit linkopt.tc (linkopt.tco if overlays on) to change location of
- X libraries.
- X make
- X
- Using Turbo C 2.0.
- X As per Borland C++ 2.0. Edit linkopt.tc to change location of libraries.
- X
- X
- The file gnuplot.gih is needed for help on the PC.
- If the file gnuplot.gih is not in the default directory, then use:
- X set GNUHELP={full path name of gnuplot.gih}
- X
- X
- X ENVIRONMENT VARIABLES
- X
- See 'help environment'.
- X
- 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.
- X
- 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.
- X
- HOME is examined as a directory where a .gnuplot startup file might be
- found. See help on "start-up".
- X
- 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.
- X
- The VMS version looks for the logical name GNUPLOT$HELP to locate
- the help library.
- SHAR_EOF
- chmod 0644 gnuplot/README.Install ||
- echo 'restore of gnuplot/README.Install failed'
- Wc_c="`wc -c < 'gnuplot/README.Install'`"
- test 7729 -eq "$Wc_c" ||
- echo 'gnuplot/README.Install: original size 7729, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/History ==============
- if test -f 'gnuplot/History' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/History (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/History (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/History' &&
- X
- X GNUPLOT 3.0 RELEASE NOTES
- X
- This describes changes to gnuplot since version 2.02 (ie, 2.0
- patchlevel 2).
- X
- Highlights:
- -----------
- Gnuplot now handles surfaces as well. A new command names 'splot' (for
- surface plot) has been added for that purpose. A number of new 'set'
- options for surfaces have also been added and include: isosamples,
- view, contour, cntrparam, mapping and surface. All tic/label/range
- setting for x and y axes were extended for z as well.
- X
- The size of data file for both curves and surfaces is now independent
- of the samples (and iso_samples) variables. Data structures will
- automatically be extended to hold the entire data file.
- X
- New features:
- -------------
- 3-d plotting with 'splot', and many auxiliary options.
- X
- New 'errorbars' plot style.
- X
- New 'using x:y{:z}' format (NOT COMPATIBLE WITH GNUPLOT 2.02).
- X
- Data file plotting (for both curves and surfaces) does not require
- setting samples (and isosamples for surfaces) any more. Size is
- increased on the fly, without affecting the sample rate of functions.
- X
- New makefile scheme for unix, that supports lots of flavors.
- X
- Command-line editing and history.
- X
- Adjustable display of plot border ('set border').
- X
- Set-commands 'x/y/zlabel' can now position the label.
- X
- Set-command 'title' can now position the title.
- X
- New time display command ('set time').
- X
- All PostScript devices were rewritten and merged into one (Color
- Postscript is supported). Due to this many of the old postscript
- terminal driver names are not supported; only 'postscript' is
- recognized. Use 'help set terminal postscript' to find out how to get
- your old favorite back, and more.
- X
- A 'gnuplot' mode for emacs in the file gnuplot.el.
- X
- SGI device was improved.
- X
- New option to 'set arrow' called 'nohead'.
- X
- List of all new commands:
- -------------------------
- splot
- X
- List of all new set-show commands:
- ---------------------------------
- border, cntrparam, contour, isosamples, mapping, rrange, surface,
- time, view, zlabel, ztics, zrange.
- X
- List of changed set-show commands:
- ----------------------------------
- arrow, terminal, title, xlabel, ylabel, zlabel
- X
- New terminal drivers:
- ---------------------
- vws, apollo, gpr apollo, dumb, BigFig, Super
- VGA, ln03/hplj/hpdj, dxf.
- X
- Deletions:
- ----------
- The gnut2p translator (translating gnutex to gnuplot) has been removed
- from the standard distribution. It is available for ftp separately at
- cs.duke.edu as dist/sources/gnuplot/gnut2p.tar.Z
- X
- Bug fixes include:
- ------------------
- Fix a bug in parametric type hangup.
- X
- Add a .sty file to fix indexing problem in manual.
- X
- Fix a bug in hpljii.
- X
- Fix a bug in FIG arrows.
- X
- X
- X ACKNOWLEDGEMENTS
- X
- - New PostScript device by Russell Lang (rjl@monu1.cc.monash.edu.au).
- - Several bug fixes, manual proofing, World Map by John Campbell
- (campbell@nauvax.ucc.nau.edu).
- - Eliminating samples from data files, lasergnu, and errorbars by
- David Kotz (David.Kotz@Dartmouth.edu).
- - New history and line editing capability for Unix and MSDOS, bivariate
- X functions and some bug fixes by Tom Tkacik (tkacik@hobbes.cs.gmr.com).
- - New using x:y{:z} format by Dennis Linse (djlinse@phoenix.princeton.edu).
- - Some polar enhancements, time display and some bug fixes by
- Alex Woo (woo@ra-next.arc.nasa.gov).
- - Dumb terminal by Francois Pinard (pinard@iro.umontreal.ca).
- - VWS device by Walter Speth (speth@dbnpib5.bitnet).
- - BigFig device by (ian@augean.ua.oz.au).
- - XDF device by Florian Hiss (fhis1231@w204zrz.zrz.tu-berlin.de).
- - HP Desk Jet device, overlay support for BCC and more efficient help
- and pc.trm for MSDOS by Maurice Castro and Russell Lang
- (rjl@monu1.cc.monash.edu.au).
- - New makefile scheme by Roque Donizete De Oliveira and David Kotz
- (oliveria@caen.engin.umich.edu and David.Kotz@Dartmouth.edu).
- - The 3d extensions, contouring, Super VGA device, and bringing this new
- version up by Gershon Elber (gershon@cs.utah.edu).
- X
- Other bug fixes/improvments:
- = Tom Bopp (tbopp@uhunix.uhcc.hawaii.edu)
- = Kenneth H. Carpenter (khc@eece.ksu.edu)
- = Mark Christopher (christo@bnr.ca)
- = Henk de Haan (haan@irimcf.tudelft.nl)
- = David Gillespie (daveg@csvax.cs.caltech.edu)
- X
- Beta testers:
- + John Campbell (campbell@nauvax.ucc.nau.edu)
- + Kenneth H. Carpenter (khc@eece.ksu.edu)
- + Gershon Elber (gershon@cs.utah.edu)
- + Pat Empleo (empleop@afal-edwards.af.mil)
- + David Kotz (dfk@moose.dartmouth.edu)
- + Russell Lang (rjl@monu1.cc.monash.edu.au)
- + Tom Tkacik (tkacik@hobbes.cs.gmr.com)
- + Roque Donizete De Oliveira (oliveria@caen.engin.umich.edu)
- + Walter Speth (Speth@dbnpib5.bitnet)
- + Carsten Steger (stegerc@gshalle2.informatik.tu-muenchen.de)
- X
- ============================================================================
- X
- X GNUPLOT 2.0 RELEASE NOTES
- X
- 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.
- X
- Additions:
- X
- Command-line arguments are accepted. They are treated as names of
- files containing gnuplot commands. Gnuplot loads them, one by one, and
- then exits.
- X
- 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.
- X
- Command 'pause'.
- X
- Command 'replot' allows the addition of extra plots.
- X
- Command 'save' now saves all the 'set' options, including the last
- plot command.
- X
- Command 'set autoscale' now accepts autoscaling on the x axis for data
- files. The default is autoscaling on both axes.
- X
- 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.
- X
- 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.
- X
- Command 'set grid' adds a grid between the tic marks.
- X
- Improved key gives sample point or line types. Key can be disabled
- with the 'set nokey'. Key can be positioned anywhere.
- X
- Command 'set label' allows the placement of arbitrary text labels and
- arrows.
- X
- Command 'set polar' for polar plots.
- X
- Command 'set offsets' for reducing the plotted area. Useful for polar
- plots.
- X
- Command 'set size' scales the displayed size of the plot.
- X
- Command 'set tics out' causes the tics to be drawn outwards from the
- border. Useful for impulse plots.
- X
- Command 'set title' places a text label above the plot.
- X
- 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.
- X
- Improved tics on log scales.
- X
- Extended comments: comments are allowed anywhere reasonable in the
- input line, and continue to the end of the input line.
- X
- Line continuation (with \) is added.
- X
- 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.
- X
- New plotting styles 'linespoints' and 'dots'.
- X
- 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.
- X
- 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.
- X
- PC version now compiles with the large model so that gnuplot will
- compile with the above additions!
- X
- Bug fixes include:
- ------------------
- Bug involving functions plotted on a logarithmic x axis is fixed.
- X
- Errors inside of loaded files now clean up and close files properly.
- X
- Numbers of the form xxxxe+nn are now acceptable (+ sign caused error).
- X
- Tics are now place inside the borders (some were outside).
- X
- Reverse axes now work properly.
- X
- Command 'set output ""' used to crash.
- X
- VMS was closing stdout, so 'set output' code changed to avoid closing
- it. VMS version of gnuplot now performs a SET TERM/NOWRAP itself.
- X
- Terminal is now reset before closing output file, changing terminal
- type or exiting gnuplot.
- X
- Several old bugs have been superseded by new ones.
- X
- X
- X ACKNOWLEDGEMENTS
- X
- The Unix PC, polar, pause, and offset additions were by John Campbell.
- (CAMPBELL@NAUVAX.bitnet)
- The Turbo C additions were by Bill Wilson.
- (WILSON@NAUVAX.bitnet)
- Some of the labelling improvements and combining of these additions
- were by Russell Lang.
- (rjl@monu1.cc.monash.oz.au)
- The LaTeX driver, the help system, and some of the labelling
- improvements were by David Kotz.
- (David.Kotz@Dartmouth.edu)
- And of course, the vast majority of the program is by Colin Kelley
- and Thomas Williams.
- (pixar!info-gnuplot@sun.com)
- X
- =======================================================================
- X
- X GNUPLOT 1.1 RELEASE NOTES
- X
- 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.
- X
- New commands: 'set dummy' and 'show dummy' to select the dummy
- variable name; 'replot' to repeat the last 'plot' command.
- X
- 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.
- X
- 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:
- X
- X fact(x) = (x<=1) ? 1 : x*fact(x-1)
- X
- 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.
- X
- 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.
- X
- Several old bugs have been superseded by new ones.
- SHAR_EOF
- chmod 0644 gnuplot/History ||
- echo 'restore of gnuplot/History failed'
- Wc_c="`wc -c < 'gnuplot/History'`"
- test 10762 -eq "$Wc_c" ||
- echo 'gnuplot/History: original size 10762, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/README.gnutex ==============
- if test -f 'gnuplot/README.gnutex' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/README.gnutex (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/README.gnutex (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.gnutex' &&
- A note to former Gnutex users, from David Kotz (David.Kotz@Dartmouth.edu).
- --------------------------------------------------------------------------
- X
- May 30, 1991
- X
- GNUTeX was merged with GNUPLOT beginning with GNUPLOT 2.0. Many
- aspects of gnutex 1.6 made it into GNUPLOT 2.0. Unfortunately for
- those of us who have a lot of gnutex input files around, not
- everything from gnutex is supported by GNUPLOT. To help gnutex users
- with the process of adapting to GNUPLOT (and I recommend it), I have
- included a section in the LaTeX/GNUPLOT tutorial (in ./docs/latextut/)
- about the differences, and written a translator program. Please read
- the LaTeX/GNUPLOT tutorial.
- X
- The translator was available as part of the GNUPLOT 2.0 release, but
- has been removed from the standard distribution of GNUPLOT. The
- translator is now available for anonymous ftp from cs.duke.edu as
- dist/sources/gnuplot/gnut2p.tar.Z. It has not changed since GNUPLOT
- 2.01 (ie, GNUPLOT 2.0 patchlevel 1).
- X
- Users of gnutex that did not use the LaTeX driver will probably have
- little difficulty adapting.
- X
- Please send all comments, complaints, and suggestions on this subject
- to David.Kotz@Dartmouth.edu.
- SHAR_EOF
- chmod 0644 gnuplot/README.gnutex ||
- echo 'restore of gnuplot/README.gnutex failed'
- Wc_c="`wc -c < 'gnuplot/README.gnutex'`"
- test 1170 -eq "$Wc_c" ||
- echo 'gnuplot/README.gnutex: original size 1170, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/makefile.amg ==============
- if test -f 'gnuplot/makefile.amg' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/makefile.amg (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/makefile.amg (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.amg' &&
- # Makefile for SAS/C 5.10 on the Amiga
- X
- CC = lc
- X
- # Remove '-fi' if you don't want to use the better Commodore math-routines.
- # If you do so, you'll have to change 'lcmieee.lib' to 'lcm.lib' in
- # "linkopt.amg"
- CFLAGS = -b0 -dAMIGA_LC_5_1 -dNOGAMMA -dMEMSET -dMEMCPY -j85i -j88i -fi
- X
- .c.o:
- X $(CC) $(CFLAGS) $<
- X
- OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
- X internal.o misc.o parse.o plot.o scanner.o setshow.o \
- X standard.o term.o util.o version.o
- X
- CSOURCE1 = command.c setshow.c
- CSOURCE2 = help.c graphics.c graph3d.o internal.c
- CSOURCE3 = misc.c eval.c parse.c plot.c scanner.c standard.c
- CSOURCE4 = bitmap.c term.c util.c version.c
- CSOURCE5 = term/aed.trm term/cgi.trm term/dumb.trm term/dxy.trm \
- X term/eepic.trm term/epson.trm term/fig.trm term/hp26.trm \
- X term/hp2648.trm term/hpgl.trm term/hpljii.trm term/vws.trm
- CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
- X term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm \
- X term/amiga.trm
- CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
- X term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
- X term/v384.trm term/x11.trm gnuplot_x11.c
- CSOURCE8 = contour.c
- X
- gnuplot: $(OBJS)
- X blink with linkopt.amg
- X
- bitmap.o: bitmap.c bitmap.h plot.h
- command.o: command.c plot.h setshow.h help.h
- contour.o: contour.c plot.h
- eval.o: eval.c plot.h
- graph3d.o: graph3d.c plot.h setshow.h
- graphics.o: graphics.c plot.h setshow.h
- help.o: help.c plot.h help.h
- internal.o: internal.c plot.h
- misc.o: misc.c plot.h setshow.h help.h
- parse.o: parse.c plot.h
- plot.o: plot.c plot.h setshow.h
- scanner.o: scanner.c plot.h
- setshow.o: setshow.c plot.h setshow.h
- standard.o: standard.c plot.h
- term.o: term.c term.h plot.h setshow.c bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
- util.o: util.c plot.h
- version.o: version.c
- SHAR_EOF
- chmod 0644 gnuplot/makefile.amg ||
- echo 'restore of gnuplot/makefile.amg failed'
- Wc_c="`wc -c < 'gnuplot/makefile.amg'`"
- test 1808 -eq "$Wc_c" ||
- echo 'gnuplot/makefile.amg: original size 1808, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/graphics.c ==============
- if test -f 'gnuplot/graphics.c' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/graphics.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/graphics.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/graphics.c' &&
- /* GNUPLOT - graphics.c */
- /*
- X * Copyright (C) 1986, 1987, 1990, 1991 Thomas Williams, Colin Kelley
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X *
- X * AUTHORS
- X *
- X * Original Software:
- X * Thomas Williams, Colin Kelley.
- X *
- X * Gnuplot 2.0 additions:
- X * Russell Lang, Dave Kotz, John Campbell.
- X *
- X * Gnuplot 3.0 additions:
- X * Gershon Elber and many others.
- X *
- X * Send your comments or suggestions to
- X * pixar!info-gnuplot@sun.com.
- X * This is a mailing list; to join it send a note to
- X * pixar!info-gnuplot-request@sun.com.
- X * Send bug reports to
- X * pixar!bug-gnuplot@sun.com.
- X */
- X
- #include <stdio.h>
- #include <math.h>
- #include <assert.h>
- #include <time.h>
- #include "plot.h"
- #include "setshow.h"
- X
- extern char *strcpy(),*strncpy(),*strcat(),*ctime();
- char *tdate;
- #ifdef AMIGA_AC_5
- time_t dated;
- #else
- #ifdef VMS
- time_t dated,time();
- #else
- long dated,time();
- #endif
- #endif
- X
- void plot_impulses();
- void plot_lines();
- void plot_points();
- void plot_dots();
- void plot_bars();
- void edge_intersect();
- BOOLEAN two_edge_intersect();
- X
- /* for plotting error bars */
- #define ERRORBARTIC (t->h_tic/2) /* half the width of error bar tic mark */
- X
- #ifndef max /* Lattice C has max() in math.h, but shouldn't! */
- #define max(a,b) ((a > b) ? a : b)
- #endif
- X
- #ifndef min
- #define min(a,b) ((a < b) ? a : b)
- #endif
- X
- #define inrange(z,min,max) ((min<max) ? ((z>=min)&&(z<=max)) : ((z>=max)&&(z<=min)) )
- X
- /* True if a and b have the same sign or zero (positive or negative) */
- #define samesign(a,b) ((a) * (b) >= 0)
- X
- /* Define the boundary of the plot
- X * These are computed at each call to do_plot, and are constant over
- X * the period of one do_plot. They actually only change when the term
- X * type changes and when the 'set size' factors change.
- X */
- static int xleft, xright, ybot, ytop;
- X
- /* Boundary and scale factors, in user coordinates */
- /* x_min, x_max, y_min, y_max are local to this file and
- X * are not the same as variables of the same names in other files
- X */
- static double x_min, x_max, y_min, y_max;
- static double xscale, yscale;
- X
- /* And the functions to map from user to terminal coordinates */
- #define map_x(x) (int)(xleft+(x-x_min)*xscale+0.5) /* maps floating point x to screen */
- #define map_y(y) (int)(ybot+(y-y_min)*yscale+0.5) /* same for y */
- X
- /* (DFK) Watch for cancellation error near zero on axes labels */
- #define SIGNIF (0.01) /* less than one hundredth of a tic mark */
- #define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x))
- #define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF))
- X
- /* (DFK) For some reason, the Sun386i compiler screws up with the CheckLog
- X * macro, so I write it as a function on that machine.
- X */
- #ifndef sun386
- /* (DFK) Use 10^x if logscale is in effect, else x */
- #define CheckLog(log, x) ((log) ? pow(10., (x)) : (x))
- #else
- static double
- CheckLog(log, x)
- X BOOLEAN log;
- X double x;
- {
- X if (log)
- X return(pow(10., x));
- X else
- X return(x);
- }
- #endif /* sun386 */
- X
- double
- LogScale(coord, islog, what, axis)
- X double coord; /* the value */
- X BOOLEAN islog; /* is this axis in logscale? */
- X char *what; /* what is the coord for? */
- X char *axis; /* which axis is this for ("x" or "y")? */
- {
- X if (islog) {
- X if (coord <= 0.0) {
- X char errbuf[100]; /* place to write error message */
- X (void) sprintf(errbuf,"%s has %s coord of %g; must be above 0 for log scale!",
- X what, axis, coord);
- X (*term_tbl[term].text)();
- X (void) fflush(outfile);
- X int_error(errbuf, NO_CARET);
- X } else
- X return(log10(coord));
- X }
- X return(coord);
- }
- X
- /* borders of plotting area */
- /* computed once on every call to do_plot */
- boundary(scaling)
- X BOOLEAN scaling; /* TRUE if terminal is doing the scaling */
- {
- X register struct termentry *t = &term_tbl[term];
- X xleft = (t->h_char)*12;
- X xright = (scaling ? 1 : xsize) * (t->xmax) - (t->h_char)*2 - (t->h_tic);
- X ybot = (t->v_char)*7/2 + 1;
- X ytop = (scaling ? 1 : ysize) * (t->ymax) - (t->v_char)*5/2 - 1;
- }
- X
- X
- double dbl_raise(x,y)
- double x;
- int y;
- {
- register int i;
- double val;
- X
- X val = 1.0;
- X for (i=0; i < abs(y); i++)
- X val *= x;
- X if (y < 0 ) return (1.0/val);
- X return(val);
- }
- X
- X
- double make_tics(tmin,tmax,logscale)
- double tmin,tmax;
- BOOLEAN logscale;
- {
- register double xr,xnorm,tics,tic,l10;
- X
- X xr = fabs(tmin-tmax);
- X
- X l10 = log10(xr);
- X if (logscale) {
- X tic = dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
- X if (tic < 1.0)
- X tic = 1.0;
- X } else {
- X xnorm = pow(10.0,l10-(double)((l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)));
- X if (xnorm <= 2)
- X tics = 0.2;
- X else if (xnorm <= 5)
- X tics = 0.5;
- X else tics = 1.0;
- X tic = tics * dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
- X }
- X return(tic);
- }
- X
- X
- do_plot(plots, pcount, min_x, max_x, min_y, max_y)
- struct curve_points *plots;
- int pcount; /* count of plots in linked list */
- double min_x, max_x;
- double min_y, max_y;
- {
- register struct termentry *t = &term_tbl[term];
- register int curve, xaxis_y, yaxis_x;
- register struct curve_points *this_plot;
- register double ytic, xtic;
- register int xl, yl;
- X /* only a Pyramid would have this many registers! */
- double xtemp, ytemp;
- struct text_label *this_label;
- struct arrow_def *this_arrow;
- BOOLEAN scaling;
- X
- /* store these in variables global to this file */
- /* otherwise, we have to pass them around a lot */
- X x_min = min_x;
- X x_max = max_x;
- X y_min = min_y;
- X y_max = max_y;
- X
- X if (polar) {
- X /* will possibly change x_min, x_max, y_min, y_max */
- X polar_xform(plots,pcount);
- X }
- X
- X if (y_min == VERYLARGE || y_max == -VERYLARGE ||
- X x_min == VERYLARGE || x_max == -VERYLARGE)
- X int_error("all points undefined!", NO_CARET);
- X
- /* Apply the desired viewport offsets. */
- X if (y_min < y_max) {
- X y_min -= boff;
- X y_max += toff;
- X } else {
- X y_max -= boff;
- X y_min += toff;
- X }
- X if (x_min < x_max) {
- X x_min -= loff;
- X x_max += roff;
- X } else {
- X x_max -= loff;
- X x_min += roff;
- X }
- X
- /* SETUP RANGES, SCALES AND TIC PLACES */
- X if (ytics && yticdef.type == TIC_COMPUTED) {
- X ytic = make_tics(y_min,y_max,log_y);
- X
- X if (autoscale_ly) {
- X if (y_min < y_max) {
- X y_min = ytic * floor(y_min/ytic);
- X y_max = ytic * ceil(y_max/ytic);
- X }
- X else { /* reverse axis */
- X y_min = ytic * ceil(y_min/ytic);
- X y_max = ytic * floor(y_max/ytic);
- X }
- X }
- X }
- X
- X if (xtics && xticdef.type == TIC_COMPUTED) {
- X xtic = make_tics(x_min,x_max,log_x);
- X
- X if (autoscale_lx) {
- X if (x_min < x_max) {
- X x_min = xtic * floor(x_min/xtic);
- X x_max = xtic * ceil(x_max/xtic);
- X } else {
- X x_min = xtic * ceil(x_min/xtic);
- X x_max = xtic * floor(x_max/xtic);
- X }
- X }
- X }
- X
- /* This used be x_max == x_min, but that caused an infinite loop once. */
- X if (fabs(x_max - x_min) < zero)
- X int_error("x_min should not equal x_max!",NO_CARET);
- X if (fabs(y_max - y_min) < zero)
- X int_error("y_min should not equal y_max!",NO_CARET);
- X
- /* INITIALIZE TERMINAL */
- X if (!term_init) {
- X (*t->init)();
- X term_init = TRUE;
- X }
- X screen_ok = FALSE;
- #ifdef AMIGA_LC_5_1
- X scaling = (*t->scale)((double)xsize, (double)ysize);
- #else
- X scaling = (*t->scale)(xsize, ysize);
- #endif
- X (*t->graphics)();
- X
- X /* now compute boundary for plot (xleft, xright, ytop, ybot) */
- X boundary(scaling);
- X
- /* SCALE FACTORS */
- X yscale = (ytop - ybot)/(y_max - y_min);
- X xscale = (xright - xleft)/(x_max - x_min);
- X
- /* DRAW AXES */
- X (*t->linetype)(-1); /* axis line type */
- X xaxis_y = map_y(0.0);
- X yaxis_x = map_x(0.0);
- X
- X if (xaxis_y < ybot)
- X xaxis_y = ybot; /* save for impulse plotting */
- X else if (xaxis_y >= ytop)
- X xaxis_y = ytop ;
- X else if (xzeroaxis && !log_y) {
- X (*t->move)(xleft,xaxis_y);
- X (*t->vector)(xright,xaxis_y);
- X }
- X
- X if (yzeroaxis && !log_x && yaxis_x >= xleft && yaxis_x < xright ) {
- X (*t->move)(yaxis_x,ybot);
- X (*t->vector)(yaxis_x,ytop);
- X }
- X
- /* DRAW TICS */
- X (*t->linetype)(-2); /* border linetype */
- X
- X /* label y axis tics */
- X if (ytics) {
- X switch (yticdef.type) {
- X case TIC_COMPUTED: {
- X if (y_min < y_max)
- X draw_ytics(ytic * floor(y_min/ytic),
- X ytic,
- X ytic * ceil(y_max/ytic));
- X else
- X draw_ytics(ytic * floor(y_max/ytic),
- X ytic,
- X ytic * ceil(y_min/ytic));
- X
- X break;
- X }
- X case TIC_SERIES: {
- X draw_series_ytics(yticdef.def.series.start,
- X yticdef.def.series.incr,
- X yticdef.def.series.end);
- X break;
- X }
- X case TIC_USER: {
- X draw_set_ytics(yticdef.def.user);
- X break;
- X }
- X default: {
- X (*t->text)();
- X (void) fflush(outfile);
- X int_error("unknown tic type in yticdef in do_plot", NO_CARET);
- X break; /* NOTREACHED */
- X }
- X }
- X }
- X
- X /* label x axis tics */
- X if (xtics) {
- X switch (xticdef.type) {
- X case TIC_COMPUTED: {
- X if (x_min < x_max)
- X draw_xtics(xtic * floor(x_min/xtic),
- X xtic,
- X xtic * ceil(x_max/xtic));
- X else
- X draw_xtics(xtic * floor(x_max/xtic),
- X xtic,
- X xtic * ceil(x_min/xtic));
- X
- X break;
- X }
- X case TIC_SERIES: {
- X draw_series_xtics(xticdef.def.series.start,
- X xticdef.def.series.incr,
- X xticdef.def.series.end);
- X break;
- X }
- X case TIC_USER: {
- X draw_set_xtics(xticdef.def.user);
- X break;
- X }
- X default: {
- X (*t->text)();
- X (void) fflush(outfile);
- X int_error("unknown tic type in xticdef in do_plot", NO_CARET);
- X break; /* NOTREACHED */
- X }
- X }
- X }
- X
- /* DRAW PLOT BORDER */
- X (*t->linetype)(-2); /* border linetype */
- X if (draw_border) {
- X (*t->move)(xleft,ybot);
- X (*t->vector)(xright,ybot);
- X (*t->vector)(xright,ytop);
- X (*t->vector)(xleft,ytop);
- X (*t->vector)(xleft,ybot);
- X }
- X
- /* PLACE YLABEL */
- X if (strlen(ylabel) > 0) {
- X int x, y;
- X
- X x = ylabel_xoffset * t->h_char;
- X y = ylabel_yoffset * t->v_char;
- X if ((*t->text_angle)(1)) {
- X if ((*t->justify_text)(CENTRE)) {
- X (*t->put_text)(x+(t->v_char),
- X y+(ytop+ybot)/2, ylabel);
- X }
- X else {
- X (*t->put_text)(x+(t->v_char),
- X y+(ytop+ybot)/2-(t->h_char)*strlen(ylabel)/2,
- X ylabel);
- X }
- X }
- X else {
- X (void)(*t->justify_text)(LEFT);
- X (*t->put_text)(x,y+ytop+(t->v_char), ylabel);
- X }
- X (void)(*t->text_angle)(0);
- X }
- X
- /* PLACE XLABEL */
- X if (strlen(xlabel) > 0) {
- X int x, y;
- X
- X x = xlabel_xoffset * t->h_char;
- X y = xlabel_yoffset * t->v_char;
- X
- X if ((*t->justify_text)(CENTRE))
- X (*t->put_text)(x+(xleft+xright)/2,
- X y+ybot-2*(t->v_char), xlabel);
- X else
- X (*t->put_text)(x+(xleft+xright)/2 - strlen(xlabel)*(t->h_char)/2,
- X y+ybot-2*(t->v_char), xlabel);
- X }
- X
- /* PLACE TITLE */
- X if (strlen(title) > 0) {
- X int x, y;
- X
- X x = title_xoffset * t->h_char;
- X y = title_yoffset * t->v_char;
- X
- X if ((*t->justify_text)(CENTRE))
- X (*t->put_text)(x+(xleft+xright)/2,
- X y+ytop+(t->v_char), title);
- X else
- X (*t->put_text)(x+(xleft+xright)/2 - strlen(title)*(t->h_char)/2,
- X y+ytop+(t->v_char), title);
- X }
- X
- X
- /* PLACE TIMEDATE */
- X if (timedate) {
- X int x, y;
- X
- X x = time_xoffset * t->h_char;
- X y = time_yoffset * t->v_char;
- X dated = time( (long *) 0);
- X tdate = ctime( &dated);
- X tdate[24]='\0';
- X if ((*t->text_angle)(1)) {
- X if ((*t->justify_text)(CENTRE)) {
- X (*t->put_text)(x+(t->v_char),
- X y+ybot+4*(t->v_char), tdate);
- X }
- X else {
- X (*t->put_text)(x+(t->v_char),
- X y+ybot+4*(t->v_char)-(t->h_char)*strlen(ylabel)/2,
- X tdate);
- X }
- X }
- X else {
- X (void)(*t->justify_text)(LEFT);
- X (*t->put_text)(x,
- X y+ybot-3*(t->v_char), tdate);
- X }
- X (void)(*t->text_angle)(0);
- X }
- X
- /* PLACE LABELS */
- X for (this_label = first_label; this_label!=NULL;
- X this_label=this_label->next ) {
- X xtemp = LogScale(this_label->x, log_x, "label", "x");
- X ytemp = LogScale(this_label->y, log_y, "label", "y");
- X if ((*t->justify_text)(this_label->pos)) {
- X (*t->put_text)(map_x(xtemp),map_y(ytemp),this_label->text);
- X }
- X else {
- X switch(this_label->pos) {
- X case LEFT:
- X (*t->put_text)(map_x(xtemp),map_y(ytemp),
- X this_label->text);
- X break;
- X case CENTRE:
- X (*t->put_text)(map_x(xtemp)-
- X (t->h_char)*strlen(this_label->text)/2,
- X map_y(ytemp), this_label->text);
- X break;
- X case RIGHT:
- X (*t->put_text)(map_x(xtemp)-
- X (t->h_char)*strlen(this_label->text),
- X map_y(ytemp), this_label->text);
- X break;
- X }
- X }
- X }
- X
- /* PLACE ARROWS */
- X (*t->linetype)(0); /* arrow line type */
- X for (this_arrow = first_arrow; this_arrow!=NULL;
- X this_arrow = this_arrow->next ) {
- X int sx = map_x(LogScale(this_arrow->sx, log_x, "arrow", "x"));
- X int sy = map_y(LogScale(this_arrow->sy, log_y, "arrow", "y"));
- X int ex = map_x(LogScale(this_arrow->ex, log_x, "arrow", "x"));
- X int ey = map_y(LogScale(this_arrow->ey, log_y, "arrow", "y"));
- X
- X (*t->arrow)(sx, sy, ex, ey, this_arrow->head);
- SHAR_EOF
- true || echo 'restore of gnuplot/graphics.c failed'
- fi
- echo 'End of part 25'
- echo 'File gnuplot/graphics.c is continued in part 26'
- echo 26 > _shar_seq_.tmp
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-