home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-27 | 48.3 KB | 1,778 lines |
- Newsgroups: comp.sources.misc
- From: gershon%gr@cs.utah.edu (Elber Gershon)
- Subject: v24i033: gnuplot3 - interactive function plotting utility, Part11/26
- Message-ID: <1991Oct28.002139.12134@sparky.imd.sterling.com>
- X-Md4-Signature: 4fef2995497b6a848484ce063ddaf813
- Date: Mon, 28 Oct 1991 00:21:39 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
- Posting-number: Volume 24, Issue 33
- Archive-name: gnuplot3/part11
- Environment: UNIX, MS-DOS, VMS
- Supersedes: gnuplot2: Volume 11, Issue 65-79
-
- #!/bin/sh
- # this is Part.11 (part 11 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file gnuplot/docs/titlepage.tex continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 11; 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/docs/titlepage.tex'
- else
- echo 'x - continuing file gnuplot/docs/titlepage.tex'
- sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/docs/titlepage.tex' &&
- X {\huge\bf GNUPLOT}\\
- X \vspace{3ex}
- X {\Large An Interactive Plotting Program}\\
- X \vspace{2ex}
- X \large
- X Thomas Williams \& Colin Kelley\\
- X \vspace{2ex}
- X Version 3.0 organized by: Gershon Elber \\
- X Version 3.0 major contributors (alphabetic order):\\
- X John Campbell\\
- X Gershon Elber\\
- X David Kotz\\
- X Ed Kubaitis\\
- X Russell Lang\\
- X Tom Tkacik\\
- X Alex Woo\\
- X
- X \vspace{3ex}
- X Mailing list for comments: \verb+pixar!info-gnuplot@sun.com+\\
- X Mailing list for bug reports: \verb+pixar!bug-gnuplot@sun.com+
- X
- X \vfill
- X {\small This manual is for GNUPLOT version 3.0.}
- X
- X \end{center}
- \newpage
- X
- \tableofcontents
- \newpage
- X
- \setcounter{page}{1}
- \pagestyle{myheadings}
- \markboth{GNUPLOT 3.0}{GNUPLOT 3.0}
- SHAR_EOF
- echo 'File gnuplot/docs/titlepage.tex is complete' &&
- chmod 0644 gnuplot/docs/titlepage.tex ||
- echo 'restore of gnuplot/docs/titlepage.tex failed'
- Wc_c="`wc -c < 'gnuplot/docs/titlepage.tex'`"
- test 1027 -eq "$Wc_c" ||
- echo 'gnuplot/docs/titlepage.tex: original size 1027, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/docs/toc_entry.sty ==============
- if test -f 'gnuplot/docs/toc_entry.sty' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/docs/toc_entry.sty (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/docs/toc_entry.sty (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/toc_entry.sty' &&
- %
- % TOC_ENTRY.STY of 13 Dec 90
- % written by Stefan Timphus
- %
- % Will produce the right space for sectionnumbers in the tableofcontents
- % Necessary for entries where the number for each kind of section
- % is greater 10 (e.g. "12.14.18 Sectionname")
- % When using the original definition the first letter of the sectionname
- % overwrites the last number of the sectionnumber
- %
- % call adjustments with command \adjustSTYLENAME
- %
- X
- \typeout{`toc_entry.sty' 1.0 of 13 Dec 90}
- X
- %
- % HERE ARE THE ORIGINAL DEFINITIONS
- %
- X
- % article.sty
- %
- %\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
- %\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
- %\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
- %\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
- X
- % report.sty and book.sty
- %
- %\def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
- %\def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
- %\def\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
- %\def\l@paragraph{\@dottedtocline{4}{10em}{5em}}
- %\def\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
- X
- %
- % MODIFICATIONS
- %
- X
- \newlength{\twonum}
- X \settowidth{\twonum}{99.99.}
- \newlength{\threenum}
- X \settowidth{\threenum}{99.99.99.}
- \newlength{\fournum}
- X \settowidth{\fournum}{99.99.99.99.}
- \newlength{\fivenum}
- X \settowidth{\fivenum}{99.99.99.99.99.}
- \newlength{\sixnum}
- X \settowidth{\sixnum}{99.99.99.99.99.99.}
- X
- \newcommand{\adjustarticle}
- {\def\l@subsection{\@dottedtocline{2}{1.5em}{\twonum}}
- \def\l@subsubsection{\@dottedtocline{3}{4.0em}{\threenum}}
- \def\l@paragraph{\@dottedtocline{4}{7.8em}{\fournum}}
- \def\l@subparagraph{\@dottedtocline{5}{10.4em}{\fivenum}}}
- X
- \newcommand{\adjustreport}
- {\def\l@section{\@dottedtocline{1}{1.5em}{\twonum}}
- \def\l@subsection{\@dottedtocline{2}{4.0em}{\threenum}}
- \def\l@subsubsection{\@dottedtocline{3}{7.8em}{\fournum}}
- \def\l@paragraph{\@dottedtocline{4}{10.4em}{\fivenum}}
- \def\l@subparagraph{\@dottedtocline{5}{12.6em}{\sixnum}}}
- X
- \newcommand{\adjustbook}{\adjustreport}
- X
- % end of TOC_ENTRY.STY
- SHAR_EOF
- chmod 0644 gnuplot/docs/toc_entry.sty ||
- echo 'restore of gnuplot/docs/toc_entry.sty failed'
- Wc_c="`wc -c < 'gnuplot/docs/toc_entry.sty'`"
- test 2009 -eq "$Wc_c" ||
- echo 'gnuplot/docs/toc_entry.sty: original size 2009, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/docs/Makefile.ami ==============
- if test -f 'gnuplot/docs/Makefile.ami' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/docs/Makefile.ami (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/docs/Makefile.ami (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/Makefile.ami' &&
- #
- # Makefile for GNUPLOT documentation (Aztec C v5.xx Version)
- #
- # Note that the top-level file for documentation is gnuplot.doc.
- # See README.
- #
- # To print manual:
- # make gnuplot.dvi (for latex)
- # (print or view gnuplot.dvi)
- # OR
- # make gnuplot.nroff (for nroff)
- # (print or view gnuplot.nroff)
- # or
- # make "TROFF=itroff" troff (for troff; use your troff for itroff here)
- #
- # $Id: Makefile,v 1.1 90/01/11 15:43:03 dfk Exp Locker: dfk $
- X
- # usually overridden by ../Makefile
- HELPDEST = /usr/local/lib/
- X
- # substitute your troff command (and any flags) for this one
- TROFF=itroff
- X
- # substitute cp if you do not have the install program
- INSTALL=install
- X
- # Compiler flags
- # -DSYSV if att sys V
- # -DMSDOS if MSDOS PS
- # -traditional -g -O if gcc (set 'CC = gcc')
- # no extra flags for BSD
- CFLAGS =
- CC = cc
- LN =ln
- LFLAGS = -lm -lc
- X
- # default is what is needed for interactive gnuplot
- default: gnuplot.hlp gnuplot.gih
- X
- ### [tn]roff documentation
- troff: gnuplot.ms titlepage.ms
- X tbl gnuplot.ms | eqn | $(TROFF) -ms
- X
- # for screen viewing, or printers with backspace/overstrike, remove the -Tlpr
- nroff gnuplot.nroff: gnuplot.ms titlepage.ms
- X tbl gnuplot.ms | neqn | nroff -ms -Tlpr > gnuplot.nroff
- X
- ms gnuplot.ms: doc2ms gnuplot.doc
- X doc2ms < gnuplot.doc > gnuplot.ms
- X
- doc2ms: doc2ms.c
- X $(CC) $(CFLAGS) -o doc2ms.o doc2ms.c
- X $(LN) -o doc2ms doc2ms.o $(LFLAGS)
- X
- ### LaTeX documentation
- tex gnuplot.tex: doc2tex gnuplot.doc
- X doc2tex < gnuplot.doc > gnuplot.tex
- X
- dvi gnuplot.dvi: gnuplot.tex titlepage.tex
- X latex gnuplot.tex
- X latex gnuplot.tex
- X
- doc2tex: doc2tex.c
- X $(CC) $(CFLAGS) -o doc2tex.o doc2tex.c
- X $(LN) -o doc2tex doc2tex.o $(LFLAGS)
- X
- # this is how to make gnuplot.hlp
- hlp gnuplot.hlp: doc2hlp gnuplot.doc
- X doc2hlp < gnuplot.doc > gnuplot.hlp
- X
- doc2hlp: doc2hlp.c
- X $(CC) $(CFLAGS) -o doc2hlp.o doc2hlp.c
- X $(LN) -o doc2hlp doc2hlp.o $(LFLAGS)
- X
- # this is how to make gnuplot.gih
- gih gnuplot.gih: doc2gih gnuplot.doc
- X doc2gih < gnuplot.doc > gnuplot.gih
- X
- doc2gih: doc2gih.c
- X $(CC) $(CFLAGS) -o doc2gih.o doc2gih.c
- X $(LN) -o doc2gih doc2gih.o $(LFLAGS)
- X
- # this is how to check the gnuplot.doc file
- check: checkdoc gnuplot.doc
- X checkdoc < gnuplot.doc
- X
- checkdoc: checkdoc.c
- X $(CC) $(CFLAGS) -o checkdoc.o checkdoc.c
- X $(LN) -o checkdoc checkdoc.o $(LFLAGS)
- X
- # For Unix and MSDOS only
- install-unix: gnuplot.gih
- X $(INSTALL) gnuplot.gih $(HELPDEST)
- X
- # for VMS only
- install-vms: gnuplot.hlp
- X $(INSTALL) gnuplot.hlp $(HELPDEST)
- X
- # remove all derived files
- clean:
- X rm -f doc2ms gnuplot.nroff gnuplot.ms
- X rm -f doc2tex gnuplot.tex gnuplot.dvi gnuplot.aux gnuplot.log gnuplot.toc
- X rm -f doc2hlp gnuplot.hlp
- X rm -f doc2gih gnuplot.gih
- X rm -f checkdoc *~ *.o core a.out
- SHAR_EOF
- chmod 0644 gnuplot/docs/Makefile.ami ||
- echo 'restore of gnuplot/docs/Makefile.ami failed'
- Wc_c="`wc -c < 'gnuplot/docs/Makefile.ami'`"
- test 2688 -eq "$Wc_c" ||
- echo 'gnuplot/docs/Makefile.ami: original size 2688, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/corgraph.asm ==============
- if test -f 'gnuplot/corgraph.asm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/corgraph.asm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/corgraph.asm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/corgraph.asm' &&
- TITLE Corona graphics module
- ; Colin Kelley
- ; January 1987
- X
- include header.mac
- X
- if1
- include lineproc.mac
- endif
- X
- X
- _text segment
- X
- public _GrInit,_GrReset,_GrOnly,_TxOnly,_GrandTx,_Cor_line,_Cor_mask
- X
- corpixel proc near
- X ror word ptr linemask,1
- X jc cont
- X ret
- cont: push bp
- X mov bp,sp
- X push ax
- X push bx
- X push cx
- X mov es,ScSeg
- X shl bx,1 ; y
- X mov bx,word ptr LookUp[bx] ; bx has y mem address
- X mov cl,al ; x
- X and cl,7
- X shr ax,1
- X shr ax,1
- X shr ax,1 ; ax /= 8
- X add bx,ax
- X mov al,1
- X shl al,cl ; al contains bit mask
- X or byte ptr es:[bx],al
- X pop cx
- X pop bx
- X pop ax
- X pop bp
- X ret
- X
- lineproc _Cor_line, corpixel
- X
- beginproc _GrInit
- X push bp
- X mov bp,sp
- X push di
- X mov ax, [bp+X] ; screen number (0 - 7)
- X mov cl,11
- X shl ax,cl ; multiply by 2048 to get segment
- X mov ScSeg,ax ; save segment for later
- X push ax
- X mov es, ax
- X xor ax,ax
- X mov di,ax
- X mov cx, 4000h
- X cld
- X rep stosw
- X pop cx
- X call near ptr GrAddr
- X mov ax,es
- X pop di
- X pop bp
- X ret
- _GrInit endp
- X
- beginproc _GrReset
- X mov cx, 0
- X call near ptr GrAddr
- X ret
- _GrReset endp
- X
- GrAddr proc near
- X mov dx,3b4h ; address of 6845
- X mov al,0ch ; register 12
- X out dx,al
- X inc dx
- X mov al,ch ; Graphics Segment High
- X out dx,al
- X dec dx
- X mov al,0dh ; register 13
- X out dx,al
- X mov al,cl ; Graphics Segment Low
- X inc dx
- X out dx,al
- X ret
- GrAddr endp
- X
- beginproc _GrOnly
- X mov dx,3b8h
- X mov al,0a0h
- X out dx,al
- X ret
- _GrOnly endp
- X
- beginproc _TxOnly
- X mov dx,3b8h
- X mov al,28h
- X out dx,al
- X ret
- _TxOnly endp
- X
- beginproc _GrandTx
- X mov dx,3b8h
- X mov al,0a8h
- X out dx,al
- X ret
- _GrandTx endp
- X
- beginproc _Cor_mask
- X push bp
- X mov bp,sp
- X mov ax,[bp+x] ; mask
- X mov linemask,ax
- X pop bp
- X ret
- _Cor_mask endp
- X
- corpixel endp
- X
- _text ends
- X
- X
- _data segment
- linemask dw -1
- ScSeg dw 0
- _data ends
- X
- const segment
- X
- K equ 1024
- X
- mem_mac MACRO x
- X dw x,2*K+x,4*K+x,6*K+x,8*K+x,10*K+x,12*K+x,14*K+x,16*K+x
- X dw 18*K+x,20*K+x,22*K+x,24*K+x
- X ENDM
- LookUp equ $
- X mem_mac 0
- X mem_mac 80
- X mem_mac (80*2)
- X mem_mac (80*3)
- X mem_mac (80*4)
- X mem_mac (80*5)
- X mem_mac (80*6)
- X mem_mac (80*7)
- X mem_mac (80*8)
- X mem_mac (80*9)
- X mem_mac (80*10)
- X mem_mac (80*11)
- X mem_mac (80*12)
- X mem_mac (80*13)
- X mem_mac (80*14)
- X mem_mac (80*15)
- X mem_mac (80*16)
- X mem_mac (80*17)
- X mem_mac (80*18)
- X mem_mac (80*19)
- X mem_mac (80*20)
- X mem_mac (80*21)
- X mem_mac (80*22)
- X mem_mac (80*23)
- X mem_mac (80*24)
- X
- const ends
- X
- X end
- SHAR_EOF
- chmod 0666 gnuplot/corgraph.asm ||
- echo 'restore of gnuplot/corgraph.asm failed'
- Wc_c="`wc -c < 'gnuplot/corgraph.asm'`"
- test 2272 -eq "$Wc_c" ||
- echo 'gnuplot/corgraph.asm: original size 2272, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/corplot.c ==============
- if test -f 'gnuplot/corplot.c' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/corplot.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/corplot.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/corplot.c' &&
- /* GNUPLOT - corplot.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 */
- #include <stdio.h>
- #include <process.h>
- #include <dos.h>
- X
- #define BOUNDARY 32768
- #define segment(addr) (FP_SEG(m) + ((FP_OFF(m)+15) >> 4));
- #define round(value,boundary) (((value) + (boundary) - 1) & ~((boundary) - 1))
- X
- char *malloc(),*realloc();
- X
- char prog[] = "gnuplot";
- char corscreen[] = "CORSCREEN=0";
- X
- main()
- {
- register unsigned int segm,start;
- char *m;
- X if (!(m = malloc(BOUNDARY))) {
- X printf("malloc() failed\n");
- X exit(1);
- X }
- X segm = segment(m);
- X start = round(segm,BOUNDARY/16);
- X
- X if (realloc(m,BOUNDARY+(start-segm)*16) != m) {
- X printf("can't realloc() memory\n");
- X exit(2);
- X }
- X
- X if ((segm = start >> 11) >= 8) {
- X printf("not enough room in first 256K\n");
- X exit(3);
- X }
- X
- X corscreen[sizeof(corscreen)-2] = '0' + segm;
- X if (putenv(corscreen))
- X perror("putenv");
- X
- X if (spawnlp(P_WAIT,prog,prog,NULL))
- X perror("spawnlp");
- }
- SHAR_EOF
- chmod 0666 gnuplot/corplot.c ||
- echo 'restore of gnuplot/corplot.c failed'
- Wc_c="`wc -c < 'gnuplot/corplot.c'`"
- test 1979 -eq "$Wc_c" ||
- echo 'gnuplot/corplot.c: original size 1979, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/eval.c ==============
- if test -f 'gnuplot/eval.c' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/eval.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/eval.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/eval.c' &&
- /* GNUPLOT - eval.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 "plot.h"
- X
- extern int c_token;
- extern struct ft_entry ft[];
- extern struct udvt_entry *first_udv;
- extern struct udft_entry *first_udf;
- extern struct at_type at;
- extern struct lexical_unit token[];
- X
- struct value *integer();
- X
- X
- X
- struct udvt_entry *
- add_udv(t_num) /* find or add value and return pointer */
- int t_num;
- {
- register struct udvt_entry **udv_ptr = &first_udv;
- X
- X /* check if it's already in the table... */
- X
- X while (*udv_ptr) {
- X if (equals(t_num,(*udv_ptr)->udv_name))
- X return(*udv_ptr);
- X udv_ptr = &((*udv_ptr)->next_udv);
- X }
- X
- X *udv_ptr = (struct udvt_entry *)
- X alloc((unsigned int)sizeof(struct udvt_entry), "value");
- X (*udv_ptr)->next_udv = NULL;
- X copy_str((*udv_ptr)->udv_name,t_num);
- X (*udv_ptr)->udv_value.type = INT; /* not necessary, but safe! */
- X (*udv_ptr)->udv_undef = TRUE;
- X return(*udv_ptr);
- }
- X
- X
- struct udft_entry *
- add_udf(t_num) /* find or add function and return pointer */
- int t_num; /* index to token[] */
- {
- register struct udft_entry **udf_ptr = &first_udf;
- X
- X while (*udf_ptr) {
- X if (equals(t_num,(*udf_ptr)->udf_name))
- X return(*udf_ptr);
- X udf_ptr = &((*udf_ptr)->next_udf);
- X }
- X *udf_ptr = (struct udft_entry *)
- X alloc((unsigned int)sizeof(struct udft_entry), "function");
- X (*udf_ptr)->next_udf = (struct udft_entry *) NULL;
- X (*udf_ptr)->definition = NULL;
- X (*udf_ptr)->at = NULL;
- X copy_str((*udf_ptr)->udf_name,t_num);
- X (void) integer(&((*udf_ptr)->dummy_values[0]), 0);
- X (void) integer(&((*udf_ptr)->dummy_values[1]), 0);
- X return(*udf_ptr);
- }
- X
- X
- union argument *
- add_action(sf_index)
- enum operators sf_index; /* index of p-code function */
- {
- X if (at.a_count >= MAX_AT_LEN)
- X int_error("action table overflow",NO_CARET);
- X at.actions[at.a_count].index = sf_index;
- X return(&(at.actions[at.a_count++].arg));
- }
- X
- X
- int standard(t_num) /* return standard function index or 0 */
- {
- register int i;
- X for (i = (int)SF_START; ft[i].f_name != NULL; i++) {
- X if (equals(t_num,ft[i].f_name))
- X return(i);
- X }
- X return(0);
- }
- X
- X
- X
- execute_at(at_ptr)
- struct at_type *at_ptr;
- {
- register int i,index,count,offset;
- X
- X count = at_ptr->a_count;
- X for (i = 0; i < count;) {
- X index = (int)at_ptr->actions[i].index;
- X offset = (*ft[index].func)(&(at_ptr->actions[i].arg));
- X if (is_jump(index))
- X i += offset;
- X else
- X i++;
- X }
- }
- X
- /*
- X
- X 'ft' is a table containing C functions within this program.
- X
- X An 'action_table' contains pointers to these functions and arguments to be
- X passed to them.
- X
- X at_ptr is a pointer to the action table which must be executed (evaluated)
- X
- X so the iterated line exectues the function indexed by the at_ptr and
- X passes the address of the argument which is pointed to by the arg_ptr
- X
- */
- SHAR_EOF
- chmod 0666 gnuplot/eval.c ||
- echo 'restore of gnuplot/eval.c failed'
- Wc_c="`wc -c < 'gnuplot/eval.c'`"
- test 3799 -eq "$Wc_c" ||
- echo 'gnuplot/eval.c: original size 3799, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/gnuplot.el ==============
- if test -f 'gnuplot/gnuplot.el' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/gnuplot.el (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/gnuplot.el (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/gnuplot.el' &&
- ;
- ; gnu-plot.el - Definitions of GNU-PLOT mode for emacs editor.
- ;
- ; Author: Gershon Elber
- ; Computer Science Dept.
- ; University of Utah
- ; Date: Tue May 14 1991
- ; Copyright (c) 1991, Gershon Elber
- ;
- ; This file defines an environment to run edit and execute GNU-PLOT programs.
- ; Such a program should have a '.gp' extension in order it to be in
- ; gnu-plot-mode major mode. Two new functions are provided to communicate
- ; between the editted file and the plotting program:
- ; 1. send-line-to-gnu-plot - sends a single line to the plotting program for
- ; execution. The line sent is the line the cursor is on,
- ; Bounded to Meta-E be default.
- ; 2. send-region-to-gnu-plot - sends the region from the current mark
- ; (mark-marker) to current position (point-marker) to the plotting program.
- ; This function is convenient for sending a large block of commands.
- ; Bounded to Meta-R be default.
- ; Both functions checks for existance of a buffer named gnu-plot-program
- ; and a process named "gnu-plot" hooked to it, and will restart a new process
- ; or buffer if none exists. The program to execute as process "gnu-plot" is
- ; defined by the gnu-plot-program constant below.
- ;
- X
- (defvar gnu-plot-program "gnuplot"
- X "*The executable to run for gnu-plot-program buffer.")
- X
- (defvar gnu-plot-echo-program t
- X "*Control echo of executed commands to gnu-plot-program buffer.")
- X
- (defvar gnu-plot-mode-map nil "")
- (if gnu-plot-mode-map
- X ()
- X (setq gnu-plot-mode-map (make-sparse-keymap))
- X (define-key gnu-plot-mode-map "\M-e" 'send-line-to-gnu-plot)
- X (define-key gnu-plot-mode-map "\M-r" 'send-region-to-gnu-plot))
- X
- ;;;
- ;;; Define the gnu-plot-mode
- ;;;
- (defun gnu-plot-mode ()
- X "Major mode for editing and executing GNU-PLOT files.
- X
- see send-line-to-gnu-plot and send-region-to-gnu-plot for more."
- X (interactive)
- X (use-local-map gnu-plot-mode-map)
- X (setq major-mode 'gnu-plot-mode)
- X (setq mode-name "Gnu-Plot")
- X (run-hooks 'gnu-plot-mode-hook))
- X
- ;;;
- ;;; Define send-line-to-gnu-plot - send from current cursor position to next
- ;;; semicolin detected.
- ;;;
- (defun send-line-to-gnu-plot ()
- X "Sends one line of code from current buffer to the GNU-PLOT program.
- X
- Use to execute a line in the GNU-PLOT plotting program. The line send is
- the line the cursor (point) is on.
- X
- The GNU-PLOT plotting program buffer name is gnu-plot-program and the
- process name is 'gnu-plot'. If none exists, a new one is created.
- X
- The name of the gnu-plot program program to execute is stored in
- gnu-plot-program variable and may be changed."
- X (interactive)
- X (if (equal major-mode 'gnu-plot-mode)
- X (progn
- X (make-gnu-plot-buffer) ; In case we should start a new one.
- X (beginning-of-line)
- X (let ((start-mark (point-marker)))
- X (next-line 1)
- X (let* ((crnt-buffer (buffer-name))
- X (end-mark (point-marker))
- X (string-copy (buffer-substring start-mark end-mark)))
- X (switch-to-buffer-other-window (get-buffer "gnu-plot-program"))
- X (end-of-buffer)
- X (if gnu-plot-echo-program
- X (insert string-copy))
- X (set-marker (process-mark (get-process "gnu-plot")) (point-marker))
- X (if (not (pos-visible-in-window-p))
- X (recenter 3))
- X (switch-to-buffer-other-window (get-buffer crnt-buffer))
- X (process-send-region "gnu-plot" start-mark end-mark)
- X (goto-char end-mark))))
- X (message "Should be invoked in gnu-plot-mode only.")))
- X
- ;;;
- ;;; Define send-region-to-gnu-plot - send from current cursor position to
- ;;; current marker.
- ;;;
- (defun send-region-to-gnu-plot ()
- X "Sends a region of code from current buffer to the GNU-PLOT program.
- X
- When this function is invoked on an GNU-PLOT file it send the region
- from current point to current mark to the gnu-plot plotting program.
- X
- The GNU-PLOT plotting program buffer name is gnu-plot-program and the
- process name is 'gnu-plot'. If none exists, a new one is created.
- X
- The name of the gnu-plot program program to execute is stored in
- gnu-plot-program variable and may be changed."
- X (interactive)
- X (if (equal major-mode 'gnu-plot-mode)
- X (progn
- X (make-gnu-plot-buffer) ; In case we should start a new one.
- X (copy-region-as-kill (mark-marker) (point-marker))
- X (let ((crnt-buffer (buffer-name)))
- X (switch-to-buffer-other-window (get-buffer "gnu-plot-program"))
- X (end-of-buffer)
- X (if gnu-plot-echo-program
- X (yank))
- X (set-marker (process-mark (get-process "gnu-plot")) (point-marker))
- X (if (not (pos-visible-in-window-p))
- X (recenter 3))
- X (switch-to-buffer-other-window (get-buffer crnt-buffer))
- X (process-send-region "gnu-plot" (mark-marker) (point-marker))))
- X (message "Should be invoked in gnu-plot-mode only.")))
- X
- ;;;
- ;;; Switch to "gnu-plot-program" buffer if exists. If not, creates one and
- ;;; execute the program defined by gnu-plot-program.
- ;;;
- (defun make-gnu-plot-buffer ()
- X "Switch to iris-program buffer or create one if none exists"
- X (interactive)
- X (if (get-buffer "gnu-plot-program")
- X (if (not (get-process "gnu-plot"))
- X (progn
- X (message "Starting GNU-PLOT plotting program...")
- X (start-process "gnu-plot" "gnu-plot-program" gnu-plot-program)
- X (process-send-string "gnu-plot" "\n")
- X (message "Done.")))
- X (progn
- X (message "Starting GNU-PLOT plotting program...")
- X (start-process "gnu-plot" "gnu-plot-program" gnu-plot-program)
- X (process-send-string "gnu-plot" "\n")
- X (message "Done."))))
- X
- ;;;
- ;;; Autoload gnu-plot-mode on any file with gp extension.
- ;;;
- (setq auto-mode-alist (append '(("\\.gp$" . gnu-plot-mode))
- X auto-mode-alist))
- SHAR_EOF
- chmod 0666 gnuplot/gnuplot.el ||
- echo 'restore of gnuplot/gnuplot.el failed'
- Wc_c="`wc -c < 'gnuplot/gnuplot.el'`"
- test 5487 -eq "$Wc_c" ||
- echo 'gnuplot/gnuplot.el: original size 5487, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/gnuplot_x11.c ==============
- if test -f 'gnuplot/gnuplot_x11.c' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/gnuplot_x11.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/gnuplot_x11.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/gnuplot_x11.c' &&
- /*-----------------------------------------------------------------------------
- X * gnuplot_x11 - X11 outboard terminal driver for gnuplot 3
- X *
- X * Requires installation of companion inboard x11 driver in gnuplot/term.c
- X *
- X * Acknowledgements:
- X * Chris Peterson (MIT) - original Xlib gnuplot support (and Xaw examples)
- X * Dana Chee (Bellcore) - mods to original support for gnuplot 2.0
- X * Arthur Smith (Cornell) - graphical-label-widget idea (xplot)
- X * Hendri Hondorp (University of Twente, The Netherlands) - Motif xgnuplot
- X *
- X * This code is provided as is and with no warranties of any kind.
- X *
- X * Ed Kubaitis - Computing Services Office - University of Illinois, Urbana
- X *---------------------------------------------------------------------------*/
- X
- #include <stdio.h>
- #include <signal.h>
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <Label.h> /* use -Idir for location on your system */
- #ifdef MOTIF
- #include <Xm.h> /* use -Idir for location on your system */
- #define LabelWC xmLabelWidgetClass
- #define LabelBPM XmNbackgroundPixmap
- #else
- #define LabelWC labelWidgetClass
- #define LabelBPM XtNbitmap
- #endif
- X
- #define Color (D>1)
- #define Ncolors 11
- unsigned long colors[Ncolors];
- char color_keys[Ncolors][30] = { "text", "border", "axis",
- X "line1", "line2", "line3", "line4", "line5", "line6", "line7", "line8" };
- char color_values[Ncolors][30] = { "black", "black", "black",
- X "red", "green", "blue", "magenta", "cyan", "sienna", "orange", "coral" };
- X
- char dashes[10][5] = { {0}, {1,6,0},
- X {0}, {4,2,0}, {1,3,0}, {4,4,0}, {1,5,0}, {4,4,4,1,0}, {4,2,0}, {1,3,0}
- X };
- X
- Widget w_top, w_label; Window win; Display *dpy;
- Pixmap pixmap; GC gc = (GC)NULL;
- Dimension W = 640 , H = 450; int D;
- Arg args[5];
- static void gnuplot(), resize();
- X
- int cx=0, cy=0, vchar, nc = 0, ncalloc = 0;
- double xscale, yscale;
- #define X(x) (Dimension) (x * xscale)
- #define Y(y) (Dimension) ((4095-y) * yscale)
- enum JUSTIFY { LEFT, CENTRE, RIGHT } jmode;
- #define Nbuf 1024
- char buf[Nbuf];
- String *commands = NULL;
- X
- typedef struct { /* See "X Toolkit Intrinsics Programming Manual" */
- X XFontStruct *font; /* Nye and O'Reilly, O'Reilly & Associates, pp. 80-85 */
- X unsigned long fg;
- X unsigned long bg;
- X } RValues, *RVptr;
- RValues rv;
- X
- XXtResource resources[] = {
- X { XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- X XtOffset(RVptr, font), XtRString, "fixed" },
- X { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
- X XtOffset(RVptr, fg), XtRString, XtDefaultForeground },
- X { XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
- X XtOffset(RVptr, bg), XtRString, XtDefaultBackground },
- X };
- X
- /*-----------------------------------------------------------------------------
- X * main program - fire up application and callbacks
- X *---------------------------------------------------------------------------*/
- X
- main(argc, argv) int argc; char *argv[]; {
- X
- X signal(SIGINT, SIG_IGN);
- #ifdef SIGTSTP
- X signal(SIGTSTP, SIG_IGN);
- #endif
- X
- X /* initialize application */
- X w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
- X XtSetArg(args[0], XtNwidth, W);
- X XtSetArg(args[1], XtNheight, H);
- X w_label = XtCreateManagedWidget ("", LabelWC, w_top, args, (Cardinal)2);
- X XtRealizeWidget(w_top);
- X
- X /* extract needed information */
- X dpy = XtDisplay(w_top); win = XtWindow(w_label);
- X D = DisplayPlanes(dpy,DefaultScreen(dpy));
- X if (Color) {
- X char option[20], *value;
- X XColor used, exact; int n;
- X
- X for(n=0; n<Ncolors; n++) {
- X strcpy(option, color_keys[n]);
- X strcat(option, "Color");
- X value = XGetDefault(dpy, "gnuplot", option);
- X if (!value) { value = color_values[n]; }
- X if (XAllocNamedColor(dpy, DefaultColormap(dpy,0), value, &used,&exact))
- X colors[n] = used.pixel;
- X else {
- X fprintf(stderr, "gnuplot: cannot allocate %s:%s\n", option, value);
- X fprintf(stderr, "gnuplot: assuming %s:black\n", option);
- X colors[n] = BlackPixel(dpy,0);
- X }
- X }
- X }
- X XtSetArg(args[0], XtNwidth, &W);
- X XtSetArg(args[1], XtNheight,&H);
- X XtGetValues(w_label, args, (Cardinal)2);
- X XtGetApplicationResources(w_top, &rv, resources, XtNumber(resources),NULL,0);
- X vchar = (rv.font->ascent + rv.font->descent);
- X
- X /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
- X XtAddInput(0, XtInputReadMask, gnuplot, NULL);
- X XtAddEventHandler(w_label, StructureNotifyMask, FALSE, resize, NULL);
- X
- X XtMainLoop();
- X }
- X
- /*-----------------------------------------------------------------------------
- X * display - display accumulated commands from inboard driver
- X *---------------------------------------------------------------------------*/
- X
- display() {
- X int n, x, y, sw, sl, lt, width, type;
- X char *buf, *str;
- X
- X /* set scaling factor between internal driver & window geometry */
- X xscale = (double)W / 4096.; yscale = (double)H / 4096.;
- X
- X /* create new pixmap & GC */
- X if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
- X pixmap = XCreatePixmap(dpy, RootWindow(dpy,DefaultScreen(dpy)), W, H, D);
- X gc = XCreateGC(dpy, pixmap, 0, NULL);
- X XSetFont(dpy, gc, rv.font->fid);
- X
- X /* erase pixmap */
- #ifndef MOTIF
- X if (Color) { /* Athena needs different erase for color and mono */
- #endif
- X XSetForeground(dpy, gc, rv.bg);
- X XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
- X XSetForeground(dpy, gc, rv.fg);
- X XSetBackground(dpy, gc, rv.bg);
- #ifndef MOTIF
- X }
- X else {
- X XSetFunction(dpy, gc, GXxor);
- X XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
- X XSetFunction(dpy, gc, GXcopyInverted);
- X }
- #endif
- X
- X /* connect new pixmap to label widget */
- X XtSetArg(args[0], LabelBPM, pixmap);
- X XtSetValues(w_label, args, (Cardinal)1);
- X
- X /* loop over accumulated commands from inboard driver */
- X for (n=0; n<nc; n++) {
- X buf = commands[n];
- X
- X /* X11_vector(x,y) - draw vector */
- X if (*buf == 'V') {
- X sscanf(buf, "V%4d%4d", &x, &y);
- X XDrawLine(dpy, pixmap, gc, X(cx), Y(cy), X(x), Y(y));
- X cx = x; cy = y;
- X }
- X
- X /* X11_move(x,y) - move */
- X else if (*buf == 'M')
- X sscanf(buf, "M%4d%4d", &cx, &cy);
- X
- X /* X11_put_text(x,y,str) - draw text */
- X else if (*buf == 'T') {
- X sscanf(buf, "T%4d%4d", &x, &y);
- X str = buf + 9; sl = strlen(str) - 1;
- X sw = XTextWidth(rv.font, str, sl);
- X switch(jmode) {
- X case LEFT: sw = 0; break;
- X case CENTRE: sw = -sw/2; break;
- X case RIGHT: sw = -sw; break;
- X }
- X if (!Color)
- X XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
- X else {
- X XSetForeground(dpy, gc, colors[0]);
- X XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
- X XSetForeground(dpy, gc, colors[lt+1]);
- X }
- X }
- X
- X /* X11_justify_text(mode) - set text justification mode */
- X else if (*buf == 'J')
- X sscanf(buf, "J%4d", &jmode);
- X
- X /* X11_linetype(type) - set line type */
- X else if (*buf == 'L') {
- X sscanf(buf, "L%4d", <);
- X lt = (lt%8)+2;
- X width = (lt == 0) ? 2 : 0;
- X if (Color) {
- X if (lt != 1)
- X type = LineSolid;
- X else {
- X type = LineOnOffDash;
- X XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
- X }
- X XSetForeground(dpy, gc, colors[lt+1]);
- X }
- X else {
- X type = (lt == 0 || lt == 2) ? LineSolid : LineOnOffDash;
- X if (dashes[lt][0])
- X XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
- X }
- X XSetLineAttributes( dpy,gc, width, type, CapButt, JoinBevel);
- X }
- X }
- X
- X /* trigger expose events to display pixmap */
- X XClearArea(dpy, win, 0, 0, 0, 0, True);
- X }
- X
- /*-----------------------------------------------------------------------------
- X * gnuplot - Xt callback on input from gnuplot inboard X11 driver
- X * resize - Xt callback when window resized
- X *---------------------------------------------------------------------------*/
- X
- static void
- gnuplot(cd, s, id) char *cd; int *s; XtInputId *id; {
- X
- X while (fgets(buf, Nbuf, stdin)) {
- X if (*buf == 'G') { /* enter graphics mode */
- X if (commands) {
- X int n; for (n=0; n<nc; n++) XtFree(commands[n]);
- X XtFree(commands);
- X }
- X commands = NULL; nc = ncalloc = 0;
- X }
- X else if (*buf == 'E') { display(); break; } /* leave graphics mode */
- X else if (*buf == 'R') { exit(0); } /* leave X11/x11 mode */
- X else {
- X if (nc >= ncalloc) {
- X ncalloc = ncalloc*2 + 1;
- X commands = (String *)XtRealloc(commands, ncalloc * sizeof(String));
- X }
- X commands[nc++] = XtNewString(buf);
- X }
- X }
- X if (feof(stdin) || ferror(stdin)) exit(0);
- X }
- X
- static void
- resize(w, cd, e) Widget w; char *cd; XConfigureEvent *e; {
- X if (e->type != ConfigureNotify) return;
- X W = e->width; H = e->height;
- X display();
- X }
- SHAR_EOF
- chmod 0644 gnuplot/gnuplot_x11.c ||
- echo 'restore of gnuplot/gnuplot_x11.c failed'
- Wc_c="`wc -c < 'gnuplot/gnuplot_x11.c'`"
- test 8774 -eq "$Wc_c" ||
- echo 'gnuplot/gnuplot_x11.c: original size 8774, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/linkopt.tc ==============
- if test -f 'gnuplot/linkopt.tc' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/linkopt.tc (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/linkopt.tc (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.tc' &&
- c:\tc\lib\C0l +
- bitmap command eval graphics graph3d help internal misc parse +
- plot scanner setshow standard term util version contour +
- egavgaf hercf cgaf attf +
- ,gnuplot,gnuplot, +
- c:\tc\lib\emu +
- c:\tc\lib\mathl +
- c:\tc\lib\cl +
- c:\tc\lib\graphics
- SHAR_EOF
- chmod 0666 gnuplot/linkopt.tc ||
- echo 'restore of gnuplot/linkopt.tc failed'
- Wc_c="`wc -c < 'gnuplot/linkopt.tc'`"
- test 252 -eq "$Wc_c" ||
- echo 'gnuplot/linkopt.tc: original size 252, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/lasergnu ==============
- if test -f 'gnuplot/lasergnu' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/lasergnu (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/lasergnu (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/lasergnu' &&
- #!/bin/csh -f
- #
- # Print gnuplot output on an Imagen or Postscript laser printer.
- X
- set print_banner = on # Print a banner page unless told otherwise.
- set input_files = () # the plot input command files
- set lpr_opts = () # options to lpr
- X
- # Default printer set by shell variable PRINTER.
- if (! $?PRINTER) then
- X if ($?LASER) then
- X set PRINTER=$LASER
- X else
- X set PRINTER="lw0"
- X endif
- endif
- set printer = (-P$PRINTER)
- X
- # File for plot commands, and for plot output
- set TMP=/tmp/plot$$
- set outfile=$TMP.out # the output file
- onintr cleanup
- X
- # default is Imagen mode for Imagen printer; see -p option
- set setterm="set terminal imagen"
- set LANG="-Limpress"
- X
- set usage="usage: lasergnu [-Pprinter] [-b] [-p] [-t title] [-f file] ['plot command']...."
- X
- # Loop through the command-line arguments.
- X
- top:
- X if ($#argv > 0) then
- X
- X switch ("$argv[1]")
- X
- X case -b*: # Do not print a banner page.
- X case -J*: # Compatible with imprint.
- X set print_banner = off
- X set lpr_opts=($lpr_opts -h)
- X shift argv
- X goto top
- X
- X case -f?*: # Specify file containing plot commands
- X set input_files = ($input_files `echo $argv[1] | sed 's/^-f//'`)
- X shift argv
- X goto top
- X
- X case -f: # Specify file containing plot commands
- X shift argv
- X if ($#argv > 0) then
- X set input_files = ($input_files $argv[1])
- X shift argv
- X else
- X echo "Usage: -f file ..."
- X echo "Type lasergnu -help for help."
- X exit (1)
- X endif
- X goto top
- X
- X case -t?*: # Specify title of plot
- X echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
- X shift argv
- X goto top
- X
- X case -t: # Specify title of plot
- X shift argv
- X if ($#argv > 0) then
- X echo set title \""$1"\" >> $TMP
- X shift argv
- X else
- X echo "Usage: -t title ..."
- X echo "Type lasergnu -help for help."
- X exit (1)
- X endif
- X goto top
- X case -help:
- X echo "$usage"
- X exit(1)
- X
- X case -P?*: # Set the printer, exactly as by itroff.
- X set printer = $argv[1]
- X shift argv
- X goto top
- X
- X case -P: # Set the printer, exactly as by itroff.
- X shift argv
- X if ($#argv > 0) then
- X set printer = (-P$argv[1])
- X shift argv
- X else
- X echo "Usage: -P printer ..."
- X echo "Type lasergnu -help for help."
- X exit (1)
- X endif
- X goto top
- X
- X # use impress
- X case -I:
- X echo Imagen is the default mode now
- X shift argv
- X goto top
- X
- X # use postscript instead of impress language
- X case -p:
- X set setterm="set term postscript"
- X set LANG="-Lpostscript"
- X shift argv
- X goto top
- X
- X case -?*:
- X echo "I do not recognize option $argv[1]."
- X echo "$usage"
- X exit (1)
- X
- X default:
- X echo "$argv[1]" >> $TMP
- X shift argv
- X goto top
- X
- X endsw
- X endif
- X
- # try to devine the printer type
- if ($printer =~ -Plw*) then
- X set setterm="set term postscript"
- X set LANG="-Lpostscript"
- endif
- X
- if ($printer =~ -Pim*) then
- X set setterm="set term imagen"
- X set LANG="-Limpress"
- endif
- X
- # Set up input file
- echo $setterm > $TMP.plt
- echo set output \"$outfile\" >> $TMP.plt
- if (-e $TMP) cat $TMP >> $TMP.plt
- X
- # If input file is specified AND command line contains plot commands, then
- # do command line args first, then plot commands in input file.
- gnuplot $TMP.plt $input_files
- X
- if ($status == 0 && -e $outfile && ! -z $outfile) then
- X # The printer is whatever printer was last specified,
- X # or the default printer if none was specified.
- X if ($LANG == -Limpress) then
- X /usr/local/bin/ipr $LANG $printer \
- X -D"jobheader $print_banner" \
- X -D"pagereversal on" \
- X -D"program lasergnu" $outfile
- X else if ($LANG == -Lpostscript) then
- X lpr $lpr_opts $printer $outfile
- X endif
- else
- X echo "lasergnu: error in plotting or empty plot; nothing printed."
- endif
- X
- cleanup:
- rm -f $TMP* $outfile
- SHAR_EOF
- chmod 0644 gnuplot/lasergnu ||
- echo 'restore of gnuplot/lasergnu failed'
- Wc_c="`wc -c < 'gnuplot/lasergnu'`"
- test 3801 -eq "$Wc_c" ||
- echo 'gnuplot/lasergnu: original size 3801, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/header.mac ==============
- if test -f 'gnuplot/header.mac' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/header.mac (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/header.mac (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/header.mac' &&
- if1
- LARGE equ 1 ; define your memory model here
- X
- ifdef SMALL
- X ; default, so do nothing
- X else
- X
- ifdef MEDIUM
- X LARGE_CODE equ 1
- X else
- X
- ifdef COMPACT
- X LARGE_DATA equ 1
- X else
- X
- ifdef LARGE
- X LARGE_DATA equ 1
- X LARGE_CODE equ 1
- X
- else
- X %out No memory model defined--assuming SMALL
- X
- endif ; LARGE
- endif ; COMPACT
- endif ; MEDIUM
- endif ; SMALL
- X
- X
- beginproc macro procname
- X
- ifdef LARGE_CODE
- X procname proc far
- else
- X procname proc near
- endif ; LARGE_CODE
- X
- X endm ; beginproc
- X
- X
- endif ; if1
- X
- X
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- _TEXT ENDS
- _DATA SEGMENT WORD PUBLIC 'DATA'
- _DATA ENDS
- CONST SEGMENT WORD PUBLIC 'CONST'
- CONST ENDS
- _BSS SEGMENT WORD PUBLIC 'BSS'
- _BSS ENDS
- X
- DGROUP GROUP CONST, _BSS, _DATA
- X assume cs:_text, ds:dgroup, ss:dgroup, es:dgroup
- X
- ; define X as the offset of first argument on stack frame
- X
- ifdef LARGE_CODE
- X X equ 6 ; return offset and segment + old BP
- else
- X X equ 4 ; return offset + old BP
- endif ; LARGE_CODE
- SHAR_EOF
- chmod 0666 gnuplot/header.mac ||
- echo 'restore of gnuplot/header.mac failed'
- Wc_c="`wc -c < 'gnuplot/header.mac'`"
- test 918 -eq "$Wc_c" ||
- echo 'gnuplot/header.mac: original size 918, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/readline.c ==============
- if test -f 'gnuplot/readline.c' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/readline.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/readline.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/readline.c' &&
- /* GNUPLOT - readline.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 * Tom Tkacik
- X *
- X * Msdos port and some enhancements:
- 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
- #ifdef READLINE
- X
- /* a small portable version of GNU's readline */
- X
- /* do not need any terminal capabilities except backspace,
- /* and space overwrites a character */
- X
- /* NANO-EMACS line editing facility */
- /* printable characters print as themselves (insert not overwrite) */
- /* ^A moves to the beginning of the line */
- /* ^B moves back a single character */
- /* ^E moves to the end of the line */
- /* ^F moves forward a single character */
- /* ^K kills from current position to the end of line */
- /* ^P moves back through history */
- /* ^N moves forward through history */
- /* ^H and DEL delete the previous character */
- /* ^D deletes the current character, or EOF if line is empty */
- /* ^L/^R redraw line in case it gets trashed */
- /* ^U kills the entire line */
- /* ^W kills last word */
- /* LF and CR return the entire line regardless of the cursor postition */
- /* EOF with an empty line returns (char *)NULL */
- X
- /* all other characters are ignored */
- X
- #include <stdio.h>
- #include <ctype.h>
- #include <signal.h>
- X
- /* SIGTSTP defines job control */
- /* if there is job control then we need termios.h instead of termio.h */
- #ifdef SIGTSTP
- #define TERMIOS
- #endif
- X
- X
- #ifndef MSDOS
- X
- /* UNIX specific stuff */
- #ifdef TERMIOS
- #include <termios.h>
- static struct termios orig_termio, rl_termio;
- #else
- #include <termio.h>
- static struct termio orig_termio, rl_termio;
- #endif /* TERMIOS */
- static int term_set = 0; /* =1 if rl_termio set */
- X
- #else
- X
- /* MSDOS specific stuff */
- #define getc(stdin) msdos_getch()
- static char msdos_getch();
- X
- #endif /* MSDOS */
- X
- X
- /* is it <string.h> or <strings.h>? just declare what we need */
- extern int strlen();
- extern char *strcpy();
- extern char *malloc();
- X
- #define MAXBUF 1024
- #define BACKSPACE 0x08 /* ^H */
- #define SPACE ' '
- X
- struct hist {
- X char *line;
- X struct hist *prev;
- X struct hist *next;
- };
- X
- static struct hist *history = NULL; /* no history yet */
- static struct hist *cur_entry = NULL;
- X
- static char cur_line[MAXBUF]; /* current contents of the line */
- static int cur_pos = 0; /* current position of the cursor */
- static int max_pos = 0; /* maximum character position */
- X
- X
- void add_history();
- static void fix_line();
- static void redraw_line();
- static void clear_line();
- static void clear_eoline();
- static void copy_line();
- static void set_termio();
- static void reset_termio();
- X
- char *
- readline(prompt)
- char *prompt;
- {
- X
- X char cur_char;
- X char *new_line;
- X
- X /* set the termio so we can do our own input processing */
- X set_termio();
- X
- X /* print the prompt */
- X fputs(prompt, stderr);
- X cur_line[0] = '\0';
- X cur_pos = 0;
- X max_pos = 0;
- X cur_entry = NULL;
- X
- X /* get characters */
- X for(;;) {
- X cur_char = getc(stdin);
- X if(isprint(cur_char)) {
- X int i;
- X for(i=max_pos; i>cur_pos; i--) {
- X cur_line[i] = cur_line[i-1];
- X }
- X putc(cur_char, stderr);
- X cur_line[cur_pos] = cur_char;
- X cur_pos += 1;
- X max_pos += 1;
- X if (cur_pos < max_pos)
- X fix_line();
- X cur_line[max_pos] = '\0';
- X
- X /* else interpret unix terminal driver characters */
- #ifdef VERASE
- X } else if(cur_char == orig_termio.c_cc[VERASE] ){ /* DEL? */
- X if(cur_pos > 0) {
- X int i;
- X cur_pos -= 1;
- X putc(BACKSPACE, stderr);
- X for(i=cur_pos; i<max_pos; i++)
- X cur_line[i] = cur_line[i+1];
- X max_pos -= 1;
- X fix_line();
- X }
- #endif /* VERASE */
- #ifdef VEOF
- X } else if(cur_char == orig_termio.c_cc[VEOF] ){ /* ^D? */
- X if(max_pos == 0) {
- X reset_termio();
- X return((char *)NULL);
- X }
- X if((cur_pos < max_pos)&&(cur_char == 004)) { /* ^D */
- X int i;
- X for(i=cur_pos; i<max_pos; i++)
- X cur_line[i] = cur_line[i+1];
- X max_pos -= 1;
- X fix_line();
- X }
- #endif /* VEOF */
- #ifdef VKILL
- X } else if(cur_char == orig_termio.c_cc[VKILL] ){ /* ^U? */
- X clear_line(prompt);
- #endif /* VKILL */
- #ifdef VWERASE
- X } else if(cur_char == orig_termio.c_cc[VWERASE] ){ /* ^W? */
- X while((cur_pos > 0) &&
- X (cur_line[cur_pos-1] == SPACE)) {
- X cur_pos -= 1;
- X putc(BACKSPACE, stderr);
- X }
- X while((cur_pos > 0) &&
- X (cur_line[cur_pos-1] != SPACE)) {
- X cur_pos -= 1;
- X putc(BACKSPACE, stderr);
- X }
- X clear_eoline();
- X max_pos = cur_pos;
- #endif /* VWERASE */
- #ifdef VREPRINT
- X } else if(cur_char == orig_termio.c_cc[VREPRINT] ){ /* ^R? */
- X putc('\n',stderr); /* go to a fresh line */
- X redraw_line(prompt);
- #else
- #ifdef VRPRNT /* on Ultrix VREPRINT is VRPRNT */
- X } else if(cur_char == orig_termio.c_cc[VRPRNT] ){ /* ^R? */
- X putc('\n',stderr); /* go to a fresh line */
- X redraw_line(prompt);
- #endif /* VRPRNT */
- #endif /* VREPRINT */
- #ifdef VSUSP
- X } else if(cur_char == orig_termio.c_cc[VSUSP]) {
- X reset_termio();
- X kill(0, SIGTSTP);
- X
- X /* process stops here */
- X
- X set_termio();
- X /* print the prompt */
- X redraw_line(prompt);
- #endif /* VSUSP */
- X } else {
- X /* do normal editing commands */
- X /* some of these are also done above */
- X int i;
- X switch(cur_char) {
- X case EOF:
- X reset_termio();
- X return((char *)NULL);
- X case 001: /* ^A */
- X while(cur_pos > 0) {
- X cur_pos -= 1;
- X putc(BACKSPACE, stderr);
- X }
- X break;
- X case 002: /* ^B */
- X if(cur_pos > 0) {
- X cur_pos -= 1;
- X putc(BACKSPACE, stderr);
- X }
- X break;
- X case 005: /* ^E */
- X while(cur_pos < max_pos) {
- X putc(cur_line[cur_pos], stderr);
- X cur_pos += 1;
- X }
- X break;
- X case 006: /* ^F */
- X if(cur_pos < max_pos) {
- X putc(cur_line[cur_pos], stderr);
- X cur_pos += 1;
- X }
- X break;
- X case 013: /* ^K */
- X clear_eoline();
- X max_pos = cur_pos;
- X break;
- X case 020: /* ^P */
- X if(history != NULL) {
- X if(cur_entry == NULL) {
- X cur_entry = history;
- X clear_line(prompt);
- X copy_line(cur_entry->line);
- X } else if(cur_entry->prev != NULL) {
- X cur_entry = cur_entry->prev;
- X clear_line(prompt);
- X copy_line(cur_entry->line);
- X }
- X }
- X break;
- X case 016: /* ^N */
- X if(cur_entry != NULL) {
- X cur_entry = cur_entry->next;
- X clear_line(prompt);
- X if(cur_entry != NULL)
- X copy_line(cur_entry->line);
- X else
- X cur_pos = max_pos = 0;
- X }
- X break;
- X case 014: /* ^L */
- X case 022: /* ^R */
- X putc('\n',stderr); /* go to a fresh line */
- X redraw_line(prompt);
- X break;
- X case 0177: /* DEL */
- X case 010: /* ^H */
- X if(cur_pos > 0) {
- X cur_pos -= 1;
- X putc(BACKSPACE, stderr);
- X for(i=cur_pos; i<max_pos; i++)
- X cur_line[i] = cur_line[i+1];
- X max_pos -= 1;
- X fix_line();
- X }
- X break;
- X case 004: /* ^D */
- X if(max_pos == 0) {
- X reset_termio();
- X return((char *)NULL);
- X }
- X if(cur_pos < max_pos) {
- X for(i=cur_pos; i<max_pos; i++)
- X cur_line[i] = cur_line[i+1];
- X max_pos -= 1;
- X fix_line();
- X }
- X break;
- X case 025: /* ^U */
- X clear_line(prompt);
- X break;
- X case 027: /* ^W */
- SHAR_EOF
- true || echo 'restore of gnuplot/readline.c failed'
- fi
- echo 'End of part 11'
- echo 'File gnuplot/readline.c is continued in part 12'
- echo 12 > _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.
-