home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
misc
/
volume24
/
gnuplot3
/
part14
< prev
next >
Wrap
Text File
|
1991-10-27
|
49KB
|
1,734 lines
Newsgroups: comp.sources.misc
From: gershon%gr@cs.utah.edu (Elber Gershon)
Subject: v24i036: gnuplot3 - interactive function plotting utility, Part14/26
Message-ID: <1991Oct28.002238.12335@sparky.imd.sterling.com>
X-Md4-Signature: d825bc892c4ef1a2029f0e6ad80fb265
Date: Mon, 28 Oct 1991 00:22:38 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
Posting-number: Volume 24, Issue 36
Archive-name: gnuplot3/part14
Environment: UNIX, MS-DOS, VMS
Supersedes: gnuplot2: Volume 11, Issue 65-79
#!/bin/sh
# this is Part.14 (part 14 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/command.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 14; 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/command.c'
else
echo 'x - continuing file gnuplot/command.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/command.c' &&
X
X Of course, the more interesting work is to move the y values of
X the x function to become the x values of the y function (checking
X the mins and maxs as we go along).
*/
{
X struct curve_points *xp, *new_list, *yp = start_plot, *tmp,
X *free_list, *free_head=NULL;
X int i, tlen, curve;
X char *new_title;
X double lxmin, lxmax, temp;
X
X if (autoscale_lx) {
X lxmin = VERYLARGE;
X lxmax = -VERYLARGE;
X } else {
X lxmin = xmin;
X lxmax = xmax;
X }
X
/*
X Ok, go through all the plots and move FUNC types together. Note: this
X originally was written to look for a NULL next pointer, but gnuplot
X wants to be sticky in grabbing memory and the right number of items
X in the plot list is controlled by the plot_num variable.
X
X Since gnuplot wants to do this sticky business, a free_list of
X curve_points is kept and then tagged onto the end of the plot list as
X this seems more in the spirit of the original memory behavior than
X simply freeing the memory. I'm personally not convinced this sort
X of concern is worth it since the time spent computing points seems
X to dominate any garbage collecting that might be saved here...
*/
X new_list = xp = start_plot;
X yp = xp->next_cp;
X curve = 0;
X for (; curve < *plot_num; xp = xp->next_cp,yp = yp->next_cp,curve++) {
X if (xp->plot_type != FUNC) {
X continue;
X }
X /* Here's a FUNC parametric function defined as two parts. */
X --(*plot_num);
X /*
X Go through all the points assigning the y's from xp to be the
X x's for yp. Check max's and min's as you go.
X */
X for (i = 0; i < yp->p_count; ++i) {
X /*
X Throw away excess xp points, mark excess yp points as OUTRANGE.
X */
X if (i > xp->p_count) {
X yp->points[i].type = OUTRANGE;
X continue;
X }
X /*
X Just as we had to do when we computed y values--now check that
X x's (computed parametrically) are in the permitted ranges as well.
X */
X temp = xp->points[i].y; /* New x value for yp function. */
X yp->points[i].x = temp;
X /* Handle undefined values differently from normal ranges. */
X if (xp->points[i].type == UNDEFINED)
X yp->points[i].type = xp->points[i].type;
X if (autoscale_lx || polar
X || inrange(temp, lxmin, lxmax)) {
X if (autoscale_lx && temp < lxmin) lxmin = temp;
X if (autoscale_lx && temp > lxmax) lxmax = temp;
X } else
X yp->points[i].type = OUTRANGE; /* Due to x value. */
X }
X /* Ok, fix up the title to include both the xp and yp plots. */
X if (xp->title && xp->title[0] != '\0') {
X tlen = strlen (yp->title) + strlen (xp->title) + 3;
X new_title = alloc ((unsigned int) tlen, "string");
X strcpy (new_title, xp->title);
X strcat (new_title, ", "); /* + 2 */
X strcat (new_title, yp->title); /* + 1 = + 3 */
X free (yp->title);
X yp->title = new_title;
X }
X /* Eliminate the first curve (xparam) and just use the second. */
X if (xp == start_plot) {
X /* Simply nip off the first element of the list. */
X new_list = first_plot = yp;
X xp = xp->next_cp;
X if (yp->next_cp != NULL)
X yp = yp->next_cp;
X /* Add start_plot to the free_list. */
X if (free_head == NULL) {
X free_list = free_head = start_plot;
X free_head->next_cp = NULL;
X } else {
X free_list->next_cp = start_plot;
X start_plot->next_cp = NULL;
X free_list = start_plot;
X }
X }
X else {
X /* Here, remove the xp node and replace it with the yp node. */
X tmp = xp;
X /* Pass over any data files that might have been in place. */
X while (new_list->next_cp && new_list->next_cp != xp)
X new_list = new_list->next_cp;
X new_list->next_cp = yp;
X new_list = new_list->next_cp;
X xp = xp->next_cp;
X if (yp->next_cp != NULL)
X yp = yp->next_cp;
X /* Add tmp to the free_list. */
X tmp->next_cp = NULL;
X if (free_head == NULL) {
X free_list = free_head = tmp;
X } else {
X free_list->next_cp = tmp;
X free_list = tmp;
X }
X }
X }
/* Ok, stick the free list at the end of the curve_points plot list. */
X while (new_list->next_cp != NULL)
X new_list = new_list->next_cp;
X new_list->next_cp = free_head;
X
/* Report the overall graph mins and maxs. */
X *x_min = lxmin;
X *x_max = lxmax;
}
X
void parametric_3dfixup(start_plot, plot_num, x_min, x_max, y_min, y_max,
X z_min, z_max)
struct surface_points *start_plot;
int *plot_num;
double *x_min, *x_max, *y_min, *y_max, *z_min, *z_max;
/*
X The hardest part of this routine is collapsing the FUNC plot types
X in the list (which are gauranteed to occur in (x,y,z) triplets while
X preserving the non-FUNC type plots intact. This means we have to
X work our way through various lists. Examples (hand checked):
X start_plot:F1->F2->F3->NULL ==> F3->NULL
X start_plot:F1->F2->F3->F4->F5->F6->NULL ==> F3->F6->NULL
X start_plot:F1->F2->F3->D1->D2->F4->F5->F6->D3->NULL ==>
X F3->D1->D2->F6->D3->NULL
*/
{
X struct surface_points *xp, *yp, *zp, *new_list, *tmp,
X *free_list, *free_head=NULL;
X struct iso_curve *icrvs, *xicrvs, *yicrvs, *zicrvs;
X int i, tlen, surface;
X char *new_title;
X double lxmin, lxmax, lymin, lymax, lzmin, lzmax, temp;
X
X if (autoscale_lx) {
X lxmin = VERYLARGE;
X lxmax = -VERYLARGE;
X } else {
X lxmin = xmin;
X lxmax = xmax;
X }
X
X if (autoscale_ly) {
X lymin = VERYLARGE;
X lymax = -VERYLARGE;
X } else {
X lymin = ymin;
X lymax = ymax;
X }
X
X if (autoscale_lz) {
X lzmin = VERYLARGE;
X lzmax = -VERYLARGE;
X } else {
X lzmin = zmin;
X lzmax = zmax;
X }
X
/*
X Ok, go through all the plots and move FUNC3D types together. Note:
X this originally was written to look for a NULL next pointer, but
X gnuplot wants to be sticky in grabbing memory and the right number
X of items in the plot list is controlled by the plot_num variable.
X
X Since gnuplot wants to do this sticky business, a free_list of
X surface_points is kept and then tagged onto the end of the plot list as
X this seems more in the spirit of the original memory behavior than
X simply freeing the memory. I'm personally not convinced this sort
X of concern is worth it since the time spent computing points seems
X to dominate any garbage collecting that might be saved here...
*/
X new_list = xp = start_plot;
X for (surface = 0; surface < *plot_num; surface++) {
X if (xp->plot_type != FUNC3D) {
X icrvs = xp->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; ++i) {
X if (lxmin > points[i].x)
X lxmin = points[i].x;
X if (lxmax < points[i].x)
X lxmax = points[i].x;
X if (lymin > points[i].y)
X lymin = points[i].y;
X if (lymax < points[i].y)
X lymax = points[i].y;
X if (lzmin > points[i].z)
X lzmin = points[i].z;
X if (lzmax < points[i].z)
X lzmax = points[i].z;
X }
X
X icrvs = icrvs->next;
X }
X xp = xp->next_sp;
X continue;
X }
X
X yp = xp->next_sp;
X zp = yp->next_sp;
X
X /* Here's a FUNC3D parametric function defined as three parts. */
X (*plot_num) -= 2;
X /*
X Go through all the points and assign the x's and y's from xp
X and yp to zp. Check max's and min's as you go.
X */
X xicrvs = xp->iso_crvs;
X yicrvs = yp->iso_crvs;
X zicrvs = zp->iso_crvs;
X while ( zicrvs ) {
X struct coordinate *xpoints = xicrvs->points,
X *ypoints = yicrvs->points,
X *zpoints = zicrvs->points;
X for (i = 0; i < zicrvs->p_count; ++i) {
X zpoints[i].x = xpoints[i].z;
X zpoints[i].y = ypoints[i].z;
X
X if (lxmin > zpoints[i].x) lxmin = zpoints[i].x;
X if (lxmax < zpoints[i].x) lxmax = zpoints[i].x;
X if (lymin > zpoints[i].y) lymin = zpoints[i].y;
X if (lymax < zpoints[i].y) lymax = zpoints[i].y;
X if (lzmin > zpoints[i].z) lzmin = zpoints[i].z;
X if (lzmax < zpoints[i].z) lzmax = zpoints[i].z;
X }
X xicrvs = xicrvs->next;
X yicrvs = yicrvs->next;
X zicrvs = zicrvs->next;
X }
X
X /* Ok, fix up the title to include xp and yp plots. */
X if ((xp->title && xp->title[0] != '\0') ||
X (yp->title && yp->title[0] != '\0')) {
X tlen = (xp->title ? strlen(xp->title) : 0) +
X (yp->title ? strlen(yp->title) : 0) +
X (zp->title ? strlen(zp->title) : 0) + 5;
X new_title = alloc ((unsigned int) tlen, "string");
X new_title[0] = 0;
X if (xp->title) {
X strcat(new_title, xp->title);
X strcat(new_title, ", "); /* + 2 */
X }
X if (yp->title) {
X strcat(new_title, yp->title);
X strcat(new_title, ", "); /* + 2 */
X }
X if (zp->title) {
X strcat(new_title, zp->title);
X }
X free (zp->title);
X zp->title = new_title;
X }
X
X /* Eliminate the first two surfaces (xp and yp) and just use the third. */
X if (xp == start_plot) {
X /* Simply nip off the first two elements of the list. */
X new_list = first_3dplot = zp;
X xp = zp->next_sp;
X /* Add xp and yp to the free_list. */
X if (free_head == NULL) {
X free_head = start_plot;
X } else {
X free_list->next_sp = start_plot;
X }
X free_list = start_plot->next_sp;
X free_list->next_sp = NULL;
X }
X else {
X /* Here, remove the xp,yp nodes and replace them with the zp node. */
X tmp = xp;
X /* Pass over any data files that might have been in place. */
X while (new_list->next_sp && new_list->next_sp != xp)
X new_list = new_list->next_sp;
X new_list->next_sp = zp;
X new_list = zp;
X xp = zp->next_sp;
X /* Add tmp to the free_list. */
X if (free_head == NULL) {
X free_head = tmp;
X } else {
X free_list->next_sp = tmp;
X }
X free_list = tmp->next_sp;
X free_list->next_sp = NULL;
X }
X }
/* Ok, stick the free list at the end of the surface_points plot list. */
X while (new_list->next_sp != NULL)
X new_list = new_list->next_sp;
X new_list->next_sp = free_head;
X
/* Report the overall graph mins and maxs. */
X if (autoscale_lx) {
X *x_min = (log_x ? pow(10.0, lxmin) : lxmin);
X *x_max = (log_x ? pow(10.0, lxmax) : lxmax);
X }
X else {
X *x_min = xmin;
X *x_max = xmax;
X }
X if (autoscale_ly) {
X *y_min = (log_y ? pow(10.0, lymin) : lymin);
X *y_max = (log_y ? pow(10.0, lymax) : lymax);
X }
X else {
X *y_min = ymin;
X *y_max = ymax;
X }
X if (autoscale_lz) {
X *z_min = (log_z ? pow(10.0, lzmin) : lzmin);
X *z_max = (log_z ? pow(10.0, lzmax) : lzmax);
X }
X else {
X *z_min = zmin;
X *z_max = zmax;
X }
}
X
#ifdef AMIGA_LC_5_1
void sleep(delay)
unsigned int delay;
{
X Delay(50 * delay);
}
#endif
X
#ifdef AMIGA_AC_5
void sleep(delay)
unsigned int delay;
{
unsigned long time_is_up;
X time_is_up = time(NULL) + (unsigned long) delay;
X while (time(NULL)<time_is_up)
X /* wait */ ;
}
#endif
X
#ifdef MSDOS
#ifndef __TURBOC__ /* Turbo C already has sleep() */
#ifndef __ZTC__ /* ZTC already has usleep() */
/* kludge to provide sleep() for msc 5.1 */
void sleep(delay)
unsigned int delay;
{
unsigned long time_is_up;
X time_is_up = time(NULL) + (unsigned long) delay;
X while (time(NULL)<time_is_up)
X /* wait */ ;
}
#endif /* not ZTC */
#endif /* not TURBOC */
#endif /* MSDOS */
X
X
/* Support for input, shell, and help for various systems */
X
#ifdef vms
X
#include <descrip.h>
#include <rmsdef.h>
#include <errno.h>
#include <smgdef.h>
#include <smgmsg.h>
X
extern lib$get_input(), lib$put_output();
extern smg$read_composed_line();
X
int vms_len;
X
unsigned int status[2] = {1, 0};
X
static char help[MAX_LINE_LEN+1] = "gnuplot";
X
$DESCRIPTOR(prompt_desc,PROMPT);
$DESCRIPTOR(line_desc,input_line);
X
$DESCRIPTOR(help_desc,help);
$DESCRIPTOR(helpfile_desc,"GNUPLOT$HELP");
X
X
read_line(prompt)
char *prompt;
{
X int more, start=0;
X char expand_prompt[40];
X
X prompt_desc.dsc$w_length = strlen (prompt);
X prompt_desc.dsc$a_pointer = prompt;
X (void) strcpy (expand_prompt, "_");
X (void) strncat (expand_prompt, prompt, 38);
X do {
X line_desc.dsc$w_length = MAX_LINE_LEN - start;
X line_desc.dsc$a_pointer = &input_line[start];
X switch(status[1] = smg$read_composed_line(&vms_vkid,0,&line_desc, &prompt_desc, &vms_len)){
X case SMG$_EOF:
X done(IO_SUCCESS); /* ^Z isn't really an error */
X break;
X case RMS$_TNS: /* didn't press return in time *
X /
X vms_len--; /* skip the last character */
X break; /* and parse anyway */
X case RMS$_BES: /* Bad Escape Sequence */
X case RMS$_PES: /* Partial Escape Sequence */
X sys$putmsg(status);
X vms_len = 0; /* ignore the line */
X break;
X case SS$_NORMAL:
X break; /* everything's fine */
X default:
X done(status[1]); /* give the error message */
X }
X start += vms_len;
X input_line[start] = '\0';
X inline_num++;
X if (input_line[start-1] == '\\') {
X /* Allow for a continuation line. */
X prompt_desc.dsc$w_length = strlen (expand_prompt);
X prompt_desc.dsc$a_pointer = expand_prompt;
X more = 1;
X --start;
X }
X else {
X line_desc.dsc$w_length = strlen(input_line);
X line_desc.dsc$a_pointer = input_line;
X more = 0;
X }
X } while (more);
}
X
X
do_help()
{
X help_desc.dsc$w_length = strlen(help);
X if ((vaxc$errno = lbr$output_help(lib$put_output,0,&help_desc,
X &helpfile_desc,0,lib$get_input)) != SS$_NORMAL)
X os_error("can't open GNUPLOT$HELP");
}
X
X
do_shell()
{
X if ((vaxc$errno = lib$spawn()) != SS$_NORMAL) {
X os_error("spawn error",NO_CARET);
X }
}
X
X
do_system()
{
X input_line[0] = ' '; /* an embarrassment, but... */
X
X if ((vaxc$errno = lib$spawn(&line_desc)) != SS$_NORMAL)
X os_error("spawn error",NO_CARET);
X
X (void) putc('\n',stderr);
}
X
#else /* vms */
X
/* do_help: (not VMS, although it would work)
X * Give help to the user.
X * It parses the command line into helpbuf and supplies help for that
X * string. Then, if there are subtopics available for that key,
X * it prompts the user with this string. If more input is
X * given, do_help is called recursively, with the argument the index of
X * null character in the string. Thus a more specific help can be
X * supplied. This can be done repeatedly.
X * If null input is given, the function returns, effecting a
X * backward climb up the tree.
X * David Kotz (David.Kotz@Dartmouth.edu) 10/89
X */
do_help()
{
X static char *helpbuf = NULL;
X static char *prompt = NULL;
X int base; /* index of first char AFTER help string */
X int len; /* length of current help string */
X BOOLEAN more_help;
X BOOLEAN only; /* TRUE if only printing subtopics */
X int subtopics; /* 0 if no subtopics for this topic */
X int start; /* starting token of help string */
X char *help_ptr; /* name of help file */
X
X if ( (help_ptr = getenv("GNUHELP")) == (char *)NULL )
X /* if can't find environment variable then just use HELPFILE */
X help_ptr = HELPFILE;
X
X /* Since MSDOS DGROUP segment is being overflowed we can not allow such */
X /* huge static variables (1k each). Instead we dynamically allocate them */
X /* on the first call to this function... */
X if (helpbuf == NULL) {
X helpbuf = alloc(MAX_LINE_LEN, "help buffer");
X prompt = alloc(MAX_LINE_LEN, "help prompt");
X helpbuf[0] = prompt[0] = 0;
X }
X
X len = base = strlen(helpbuf);
X
X /* find the end of the help command */
X for (start = c_token; !(END_OF_COMMAND); c_token++)
X ;
X /* copy new help input into helpbuf */
X if (len > 0)
X helpbuf[len++] = ' '; /* add a space */
X capture(helpbuf+len, start, c_token-1);
X squash_spaces(helpbuf+base); /* only bother with new stuff */
X lower_case(helpbuf+base); /* only bother with new stuff */
X len = strlen(helpbuf);
X
X /* now, a lone ? will print subtopics only */
X if (strcmp(helpbuf + (base ? base+1 : 0), "?") == 0) {
X /* subtopics only */
X subtopics = 1;
X only = TRUE;
X helpbuf[base] = '\0'; /* cut off question mark */
X } else {
X /* normal help request */
X subtopics = 0;
X only = FALSE;
X }
X
X switch (help(helpbuf, help_ptr, &subtopics)) {
X case H_FOUND: {
X /* already printed the help info */
X /* subtopics now is true if there were any subtopics */
X screen_ok = FALSE;
X
X do {
X if (subtopics && !only) {
X /* prompt for subtopic with current help string */
X if (len > 0)
X (void) sprintf(prompt, "Subtopic of %s: ", helpbuf);
X else
X (void) strcpy(prompt, "Help topic: ");
X read_line(prompt);
X num_tokens = scanner(input_line);
X c_token = 0;
X more_help = !(END_OF_COMMAND);
X if (more_help)
X /* base for next level is all of current helpbuf */
X do_help();
X } else
X more_help = FALSE;
X } while(more_help);
X
X break;
X }
X case H_NOTFOUND: {
X printf("Sorry, no help for '%s'\n", helpbuf);
X break;
X }
X case H_ERROR: {
X perror(help_ptr);
X break;
X }
X default: { /* defensive programming */
X int_error("Impossible case in switch\n", NO_CARET);
X /* NOTREACHED */
X }
X }
X
X helpbuf[base] = '\0'; /* cut it off where we started */
}
X
#ifdef AMIGA_AC_5
char strg0[256];
#endif
X
do_system()
{
#ifdef AMIGA_AC_5
X char *parms[80];
X void getparms();
X
X getparms(input_line+1,parms);
X if(fexecv(parms[0],parms) < 0)
#else
X if (system(input_line + 1))
#endif
X os_error("system() failed",NO_CARET);
}
X
#ifdef AMIGA_AC_5
X
/******************************************************************************/
/* */
/* Parses the command string (for fexecv use) and converts the first token */
/* to lower case */
/* */
/******************************************************************************/
X
void getparms(command,parms)
X char *command;
X char **parms;
X {
X register int i = 0; /* A bunch of indices */
X register int j = 0;
X register int k = 0;
X
X while(*(command+j) != '\0') /* Loop on string characters */
X {
X parms[k++] = strg0+i;
X while(*(command+j) == ' ') ++j;
X while(*(command+j) != ' ' && *(command+j) != '\0')
X {
X if(*(command+j) == '"') /* Get quoted string */
X for(*(strg0+(i++)) = *(command+(j++));
X *(command+j) != '"';
X *(strg0+(i++)) = *(command+(j++)));
X *(strg0+(i++)) = *(command+(j++));
X }
X *(strg0+(i++)) = '\0'; /* NUL terminate every token */
X }
X parms[k] = '\0';
X
X for(k=strlen(strg0)-1; k>=0; --k) /* Convert to lower case */
X *(strg0+k)>='A' && *(strg0+k)<='Z'? *(strg0+k)|=32: *(strg0+k);
X }
X
#endif /* AMIGA_AC_5 */
X
#ifdef READLINE
char *
rlgets(s, n, prompt)
char *s;
int n;
char *prompt;
{
X char *readline();
X static char *line = (char *)NULL;
X
X /* If we already have a line, first free it */
X if(line != (char *)NULL)
X free(line);
X
X line = readline((interactive)?prompt:"");
X
X /* If it's not an EOF */
X if(line) {
X if (*line)
X add_history(line);
X strncpy(s, line, n);
X return s;
X }
X
X return line;
}
#endif /* READLINE */
X
#ifdef MSDOS
X
#ifdef __TURBOC__
/* cgets implemented using dos functions */
/* Maurice Castro 22/5/91 */
char *doscgets(s)
char *s;
{
X long datseg;
X
X /* protect and preserve segments - call dos to do the dirty work */
X datseg = _DS;
X
X _DX = FP_OFF(s);
X _DS = FP_SEG(s);
X _AH = 0x0A;
X geninterrupt(33);
X _DS = datseg;
X
X /* check for a carriage return and then clobber it with a null */
X if (s[s[1]+2] == '\r')
X s[s[1]+2] = 0;
X
X /* return the input string */
X return(&(s[2]));
X }
#endif /* __TURBOC__ */
X
X
read_line(prompt)
X char *prompt;
{
X register int i;
X int start = 0, ilen = 0;
X BOOLEAN more;
X int last;
X char *p, *crnt_prompt = prompt;
X
#ifndef __ZTC__
X if (interactive) { /* if interactive use console IO so CED will work */
#ifndef READLINE
X cputs(prompt);
#endif /* READLINE */
X do {
X ilen = MAX_LINE_LEN-start-1;
X input_line[start] = ilen > 126 ? 126 : ilen;
#ifdef READLINE
X input_line[start+2] = 0;
X (void) rlgets(&(input_line[start+2]), ilen, crnt_prompt );
X if (p = strchr(&(input_line[start+2]), '\r')) *p = 0;
X if (p = strchr(&(input_line[start+2]), '\n')) *p = 0;
X input_line[start+1] = strlen(&(input_line[start+2]));
#else /* READLINE */
#ifdef __TURBOC__
X (void) doscgets(&(input_line[start]));
#else /* __TURBOC__ */
X (void) cgets(&(input_line[start]));
#endif /* __TURBOC__ */
X (void) putc('\n',stderr);
#endif /* READLINE */
X if (input_line[start+2] == 26) {
X /* end-of-file */
X (void) putc('\n',stderr);
X input_line[start] = '\0';
X inline_num++;
X if (start > 0) /* don't quit yet - process what we have */
X more = FALSE;
X else {
X (void) putc('\n',stderr);
X done(IO_SUCCESS);
X /* NOTREACHED */
X }
X } else {
X /* normal line input */
X register i = start;
X while ( (input_line[i] = input_line[i+2]) != (char)NULL )
X i++; /* yuck! move everything down two characters */
X
X inline_num++;
X last = strlen(input_line) - 1;
X if (last + 1 >= MAX_LINE_LEN)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[last] == '\\') { /* line continuation */
X start = last;
X more = TRUE;
X } else
X more = FALSE;
X }
#ifndef READLINE
X if (more)
X cputs("> ");
#else
X crnt_prompt = "> ";
#endif /* READLINE */
X } while(more);
X }
X else { /* not interactive */
#endif /* not ZTC */
X if (interactive)
X fputs(prompt,stderr);
X do {
X /* grab some input */
X if ( fgets(&(input_line[start]), MAX_LINE_LEN - start, stdin)
X == (char *)NULL ) {
X /* end-of-file */
X if (interactive)
X (void) putc('\n',stderr);
X input_line[start] = '\0';
X inline_num++;
X if (start > 0) /* don't quit yet - process what we have */
X more = FALSE;
X else
X done(IO_SUCCESS); /* no return */
X } else {
X /* normal line input */
X last = strlen(input_line) - 1;
X if (input_line[last] == '\n') { /* remove any newline */
X input_line[last] = '\0';
X /* Watch out that we don't backup beyond 0 (1-1-1) */
X if (last > 0) --last;
X inline_num++;
X } else if (last+1 >= MAX_LINE_LEN)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[last] == '\\') { /* line continuation */
X start = last;
X more = TRUE;
X } else
X more = FALSE;
X }
X if (more && interactive)
X fputs("> ", stderr);
X } while(more);
#ifndef __ZTC
X }
#endif
}
X
X
do_shell()
{
register char *comspec;
X if ((comspec = getenv("COMSPEC")) == (char *)NULL)
X comspec = "\command.com";
X if (spawnl(P_WAIT,comspec,NULL) == -1)
X os_error("unable to spawn shell",NO_CARET);
}
X
#else /* MSDOS */
X /* plain old Unix */
X
read_line(prompt)
X char *prompt;
{
X int start = 0;
X BOOLEAN more = FALSE;
X int last = 0;
X
#ifndef READLINE
X if (interactive)
X fputs(prompt,stderr);
#endif /* READLINE */
X do {
X /* grab some input */
#ifdef READLINE
X if (((interactive)
X ?rlgets(&(input_line[start]), MAX_LINE_LEN - start,
X ((more)?"> ":prompt))
X :fgets(&(input_line[start]), MAX_LINE_LEN - start, stdin))
X == (char *)NULL ) {
#else
X if ( fgets(&(input_line[start]), MAX_LINE_LEN - start, stdin)
X == (char *)NULL ) {
#endif /* READLINE */
X /* end-of-file */
X if (interactive)
X (void) putc('\n',stderr);
X input_line[start] = '\0';
X inline_num++;
X if (start > 0) /* don't quit yet - process what we have */
X more = FALSE;
X else
X done(IO_SUCCESS); /* no return */
X } else {
X /* normal line input */
X last = strlen(input_line) - 1;
X if (input_line[last] == '\n') { /* remove any newline */
X input_line[last] = '\0';
X /* Watch out that we don't backup beyond 0 (1-1-1) */
X if (last > 0) --last;
X inline_num++;
X } else if (last+1 >= MAX_LINE_LEN)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[last] == '\\') { /* line continuation */
X start = last;
X more = TRUE;
X } else
X more = FALSE;
X }
#ifndef READLINE
X if (more && interactive)
X fputs("> ", stderr);
#endif
X } while(more);
}
X
#ifdef VFORK
X
do_shell()
{
register char *shell;
register int p;
static int execstat;
X if (!(shell = getenv("SHELL")))
X shell = SHELL;
#ifdef AMIGA_AC_5
X execstat = fexecl(shell,shell,NULL);
#else
X if ((p = vfork()) == 0) {
X execstat = execl(shell,shell,NULL);
X _exit(1);
X } else if (p == -1)
X os_error("vfork failed",c_token);
X else
X while (wait(NULL) != p)
#endif
X ;
X if (execstat == -1)
X os_error("shell exec failed",c_token);
X (void) putc('\n',stderr);
}
#else /* VFORK */
X
#ifdef AMIGA_LC_5_1
do_shell()
{
register char *shell;
X if (!(shell = getenv("SHELL")))
X shell = SHELL;
X
X if (system(shell))
X os_error("system() failed",NO_CARET);
X
X (void) putc('\n',stderr);
}
#else /* AMIGA_LC_5_1 */
X
#define EXEC "exec "
do_shell()
{
static char exec[100] = EXEC;
register char *shell;
X if (!(shell = getenv("SHELL")))
X shell = SHELL;
X
X if (system(strncpy(&exec[sizeof(EXEC)-1],shell,
X sizeof(exec)-sizeof(EXEC)-1)))
X os_error("system() failed",NO_CARET);
X
X (void) putc('\n',stderr);
}
#endif /* AMIGA_LC_5_1 */
#endif /* VFORK */
#endif /* MSDOS */
#endif /* vms */
SHAR_EOF
echo 'File gnuplot/command.c is complete' &&
chmod 0644 gnuplot/command.c ||
echo 'restore of gnuplot/command.c failed'
Wc_c="`wc -c < 'gnuplot/command.c'`"
test 85435 -eq "$Wc_c" ||
echo 'gnuplot/command.c: original size 85435, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/lineproc.mac ==============
if test -f 'gnuplot/lineproc.mac' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/lineproc.mac (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/lineproc.mac (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/lineproc.mac' &&
; lineproc.mac
; MASM macro definition for Bresenham line-drawing routine
; Colin Kelley
; January 13, 1987
X
X
INCAX equ 40h ; for Self-Modifying Code
INCBX equ 43h
DECAX equ 48h
DECBX equ 4bh
X
; usage:
; lineproc linename, pixelname
;
; where linemane is the name you want for the proc, and pixelname is the
; name of the routine that linename is to call to set pixels
;
X
lineproc macro linename, pixelname
beginproc linename
X
X push bp
X mov bp,sp
X push si
X push di
X mov ax,[bp+X] ; x1
X mov bx,[bp+X+2] ; y1
X mov cx,[bp+X+4] ; x2
X mov si,[bp+X+6] ; y2
X
X cmp ax,cx ; x1,x2
X jne i19
X cmp bx,si ; y1,y2
X jne i19
X
X call pixelname
X
X jmp i28
i19:
X mov dx,ax ; dx,x1
X sub dx,cx ; x2
X jnc noabsx
X neg dx
noabsx:
X mov di,bx ; dy,y1
X sub di,si ; y2
X jnc noabsy
X neg di ; dy
noabsy:
X cmp dx,di ; dx,dy
X jb i21 ; go iterate y's
;
; iterate x's
;
X cmp bx,si ; y1,y2
X jb forwardy
X mov byte ptr cs:yinc1,DECBX
X jmp short i22
forwardy:
X mov byte ptr cs:yinc1,INCBX
i22:
X cmp ax,cx ; x1,x2
X jae l20004
X mov byte ptr cs:xinc1,INCAX
X jmp short l20005
l20004:
X mov byte ptr cs:xinc1,DECAX
l20005:
X mov bp,dx ; sum,dx
X shr bp,1 ; sum
d23:
X cmp ax,cx ; x1,x2
X je i28 ; done
xinc1: inc ax ; may become inc or dec
X add bp,di ; sum,dy
X cmp bp,dx
X jb i27
X sub bp,dx ; sum,dx
yinc1: inc bx ; may become inc or dec
i27:
X call pixelname
X jmp short d23
X
;
; else iterate y's
;
i21:
X cmp ax,cx ; x1,x2
X jae l20006
X mov byte ptr cs:xinc2,INCAX
X jmp short l20007
l20006:
X mov byte ptr cs:xinc2,DECAX
l20007:
X cmp bx,si ; y1,y2
X jb forwardy2
X mov byte ptr cs:yinc2,DECBX
X jmp short i29
forwardy2:
X mov byte ptr cs:yinc2,INCBX
i29:
X mov bp,di ; sum,dy
X shr bp,1 ; sum,1
d30:
X cmp bx,si ; y1,y2
X je i28
yinc2: inc bx ; may become inc or dec
X add bp,dx ; sum,dx
X cmp bp,di ; sum,dy
X jb i34
X sub bp,di ; sum,dy
xinc2: inc ax ; may become inc or dec
i34:
X call near ptr pixelname
X jmp short d30
;
; clean up and exit
;
i28:
X pop di
X pop si
X pop bp
X ret
X
linename endp
X endm
SHAR_EOF
chmod 0666 gnuplot/lineproc.mac ||
echo 'restore of gnuplot/lineproc.mac failed'
Wc_c="`wc -c < 'gnuplot/lineproc.mac'`"
test 1980 -eq "$Wc_c" ||
echo 'gnuplot/lineproc.mac: original size 1980, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/linkopt.msc ==============
if test -f 'gnuplot/linkopt.msc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.msc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.msc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.msc' &&
pcgraph+hrcgraph+corgraph+bitmap+term+graphics+graph3d+contour+
plot+setshow+command+help+internal+misc+
parse+eval+scanner+standard+util+version
gnuplot
nul;
SHAR_EOF
chmod 0644 gnuplot/linkopt.msc ||
echo 'restore of gnuplot/linkopt.msc failed'
Wc_c="`wc -c < 'gnuplot/linkopt.msc'`"
test 159 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.msc: original size 159, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.tc ==============
if test -f 'gnuplot/makefile.tc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.tc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.tc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.tc' &&
# make file for Borland C++ 2.0/Turbo C++ 1.0/Turbo C 2.0
# uses Borland proprietry overlay manager
# Modified from the TurboC makefile by Maurice Castro
# The compile and link includes debug flags. Take them out if you
# do not want them included (-y -v -M, /m /s /v /l)
X
# where to place gnuplot.gih helpfile
HELPFILE = gnuplot.gih
# location of Turbo C compiler
# if this is changed then linkopt.tc/linkopt.tco will need to be edited.
TC = c:\tc
# name of C compiler
CC = bcc
#CC = tcc
# location of TLINK.EXE and TCC.EXE or BCC.EXE
BIN = $(TC)\bin\\
#BIN =
# location of BGI files,
# change this line if not in TC directory, i.e. $(TC)\bgi
BGI = $(TC)\bgi
# location of bgiobj.exe tool - convertion of BGI to a linkable OBJ file.
BGIOBJ = $(TC)\bgi\\
#BGIOBJ =
X
# -c means don't link, -f means emulate 8087 if not present
# -ml means use large model (large code, large data)
# -M means produce link map
# -y means include line numbers for debugger
# -v means include debug info
# -w- means ignore warnings and do not report them
# -DREADLINE to use the history/line editing capability. If you want this
# capability add -DREADLINE to CFLAGS then add 'readline' to linkopt.tc
# and to linkopt.tco in the /o section.
CFLAGS = -c -f -ml -M -y -v -w- -I$(TC)\include -DMSDOS -DPC
TERMFLAGS =
X
# With Overlay Support
#OVLY1 = -Y
#OVLY2 = -Yo
# Without Overlay Support
OVLY1 =
OVLY2 =
X
X
OBJS = bitmap.obj command.obj contour.obj eval.obj graphics.obj graph3d.obj \
X help.obj internal.obj misc.obj parse.obj plot.obj readline.obj \
X scanner.obj setshow.obj standard.obj term.obj util.obj version.obj \
X cgaf.obj egavgaf.obj hercf.obj attf.obj
X
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
CSOURCE6 = term\impcodes.h term\imagen.trm term\object.h \
X term\iris4d.trm term\kyo.trm term\latex.trm term\pc.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
CSOURCE8 = contour.c
X
all: gnuplot.exe $(HELPFILE)
X
# use linkopt.tc/linkopt.tco to avoid command-line overflow
X
gnuplot.exe: $(OBJS)
# With Overlay Support (select one)
# $(BIN)tlink /m /s /v /l @linkopt.tco
# $(BIN)tlink @linkopt.tco
# Without Overlay Support
# $(BIN)tlink /m /s /v /l @linkopt.tc
X $(BIN)tlink @linkopt.tc
X
# default rules
X
.c.obj:
X $(BIN)$(CC) $(OVLY2) $(CFLAGS) $<
X
# The default for files is to be compiled for overlaying if OVLY1 and
# OVLY2 are defined. plot.c and parse.c are not suitable for overlaying.
X
bitmap.obj: bitmap.c bitmap.h plot.h
X
command.obj: command.c plot.h setshow.h help.h
X $(BIN)$(CC) $(OVLY2) $(CFLAGS) -DHELPFILE="$(HELPFILE)" command.c
X
contour.obj: contour.c plot.h
X
eval.obj: eval.c plot.h
X
graphics.obj: graphics.c plot.h setshow.h
X
graph3d.obj: graphics.c plot.h setshow.h
X
help.obj: help.c plot.h help.h
X
internal.obj: internal.c plot.h
X
misc.obj: misc.c plot.h setshow.h help.h
X
parse.obj: parse.c plot.h
X $(BIN)$(CC) $(OVLY1) $(CFLAGS) parse.c
X
plot.obj: plot.c plot.h setshow.h
X $(BIN)$(CC) $(OVLY1) $(CFLAGS) plot.c
X
readline.obj: readline.c
X
scanner.obj: scanner.c plot.h
X
setshow.obj: setshow.c plot.h setshow.h
X
standard.obj: standard.c plot.h
X
term.obj: term.c term.h plot.h setshow.c bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
X $(BIN)$(CC) $(OVLY2) $(CFLAGS) $(TERMFLAGS) -Iterm term.c
X
util.obj: util.c plot.h
X
version.obj: version.c
X
# convert gnuplot.doc to gnuplot.gih
$(HELPFILE): doc2gih.exe docs\gnuplot.doc
X doc2gih docs\gnuplot.doc $(HELPFILE)
X
doc2gih.exe: docs\doc2gih.c
X $(BIN)$(CC) -I$(TC)\include -L$(TC)\lib docs\doc2gih.c
X
# convert Borland Graphics Interface files to object for linking
cgaf.obj: $(BGI)\cga.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\cga
X
egavgaf.obj: $(BGI)\egavga.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\egavga
X
hercf.obj: $(BGI)\herc.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\herc
X
attf.obj: $(BGI)\att.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\att
SHAR_EOF
chmod 0644 gnuplot/makefile.tc ||
echo 'restore of gnuplot/makefile.tc failed'
Wc_c="`wc -c < 'gnuplot/makefile.tc'`"
test 4014 -eq "$Wc_c" ||
echo 'gnuplot/makefile.tc: original size 4014, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/linkopt.vms ==============
if test -f 'gnuplot/linkopt.vms' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.vms (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.vms (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.vms' &&
sys$library:vaxcrtl/share
SHAR_EOF
chmod 0666 gnuplot/linkopt.vms ||
echo 'restore of gnuplot/linkopt.vms failed'
Wc_c="`wc -c < 'gnuplot/linkopt.vms'`"
test 26 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.vms: original size 26, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/README ==============
if test ! -d 'gnuplot/term'; then
echo 'x - creating directory gnuplot/term'
mkdir 'gnuplot/term'
fi
if test -f 'gnuplot/term/README' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/README (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/README' &&
DOCUMENTATION FOR GNUPLOT TERMINAL DRIVER WRITERS
By Russell Lang 1/90
X
Information on each terminal device driver is contained in term.c and
the term/*.trm files. Each driver is contained in a .trm file and is
#include'd into term.c. Each driver has a set of initialisers in
term.c for term_tbl[], an array of struct termentry.
X
Here is the definition of the struct termentry from plot.h:
X
struct termentry {
X char *name;
X char *description;
X unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
X FUNC_PTR options,init,reset,text,scale,graphics,move,vector,linetype,
X put_text,text_angle,justify_text,point,arrow;
};
X
Here's a brief description of each variable:
X
The char *name is a pointer to a string containing the name
of the terminal. This name is used by the 'set terminal' and
'show terminal' commands.
The name must be unique and must not be confused with an abbreviation
of another name. For example if the name "postscript" exists, it is not
possible to have another name "postscript2".
Keep the name under 15 characters.
X
The char *description is a pointer to a string containing a
description of the terminal, which is displayed in response
to the 'set terminal' command.
Keep the description under 60 characters.
X
xmax is the maximum number of points in the x direction.
The range of points used by gnuplot is 0 to xmax-1.
X
ymax is the maximum number of points in the y direction.
The range of points used by gnuplot is 0 to ymax-1.
X
v_char is the height of characters, in the same units as xmax and ymax.
The border for labelling at the top and bottom of the plot is
calculated using v_char.
v_char is used as the vertical line spacing for characters.
X
h_char is the width of characters, in the same units as xmax and ymax.
The border for labelling at the left and right of the plot is
calculated using h_char.
If the _justify_text function returns FALSE, h_char is used to justify
text right or centre. If characters are not fixed width, then the
_justify_text function must correctly justify the text.
X
v_tic is the vertical size of tics along the x axis,
in the same units as ymax.
X
h_tic is the horizontal size of tics along the y axis,
in the same units as xmax.
X
X
Here's a brief description of what each term.c function does:
X
_options() Called when terminal type is selected.
This procedure should parse options on the command line. A list of the
currently selected options should be stored in term_options[] in a form
suitable for use with the set term command. term_options[] is used by
the save command. Use options_null() if no options are available.
X
_init() Called once, when the device is first selected. This procedure
should set up things that only need to be set once, like handshaking and
character sets etc...
X
_reset() Called when gnuplot is exited, the output device changed or
the terminal type changed. This procedure should reset the device,
possibly flushing a buffer somewhere or generating a form feed.
X
_scale(xs,ys) Called just before _graphics(). This takes the x and y
scaling factors as information. If the terminal would like to do its
own scaling, it returns TRUE. Otherwise, it can ignore the information
and return FALSE: do_plot will do the scaling for you. null_scale is
provided to do just this, so most drivers can ignore this function
entirely. The Latex driver is currently the only one providing its own
scaling.
X
_graphics() Called just before a plot is going to be displayed. This
procedure should set the device into graphics mode. Devices which can't
be used as terminals (like plotters) will probably be in graphics mode
always and therefore won't need this.
X
_text() Called immediately after a plot is displayed. This procedure
should set the device back into text mode if it is also a terminal, so
that commands can be seen as they're typed. Again, this will probably
do nothing if the device can't be used as a terminal.
X
_move(x,y) Called at the start of a line. The cursor should move to the
(x,y) position without drawing.
X
_vector(x,y) Called when a line is to be drawn. This should display a line
from the last (x,y) position given by _move() or _vector() to this new (x,y)
position.
X
_linetype(lt) Called to set the line type before text is displayed or
line(s) plotted. This procedure should select a pen color or line
style if the device has these capabilities.
lt is an integer from -2 to 0 or greater.
An lt of -2 is used for the border of the plot.
An lt of -1 is used for the X and Y axes.
lt 0 and upwards are used for plots 0 and upwards.
If _linetype() is called with lt greater than the available line types,
it should map it to one of the available line types.
Most drivers provide 9 different linetypes (lt is 0 to 8).
X
_put_text(x,y,str) Called to display text at the (x,y) position,
while in graphics mode. The text should be vertically (with respect
to the text) justified about (x,y). The text is rotated according
to _text_angle and then horizontally (with respect to the text)
justified according to _justify_text.
X
_text_angle(ang) Called to rotate the text angle when placing the y label.
If ang = 0 then text is horizontal. If ang = 1 then text is vertically
upwards. Returns TRUE if text can be rotated, FALSE otherwise.
X
_justify_text(mode) Called to justify text left, right or centre.
If mode = LEFT then text placed by _put_text is flushed left against (x,y).
If mode = CENTRE then centre of text is at (x,y).
If mode = RIGHT then text is placed flushed right against (x,y).
Returns TRUE if text can be justified
Returns FALSE otherwise and then _put_text assumes text is flushed left;
justification of text is then performed by calculating the text width
using strlen(text) * h_char.
X
_point(x,y,point) Called to place a point at position (x,y).
point is -1 or an integer from 0 upwards.
6 point types (numbered 0 to 5) are normally provided.
Point type -1 is a dot.
If point is more than the available point types then it should
be mapped back to one of the available points.
Two _point() functions called do_point() and line_and_point() are
provided in term.c and should be suitable for most drivers.
do_point() draws the points in the current line type.
If your driver uses dotted line types (generally because it is
monochrome), you should use line_and_point() which changes to
line type 0 before drawing the point. line type 0 should be solid.
X
_arrow(sx,sy,ex,ey,head) Called to draw an arrrow from (sx,sy) to (ex,ey).
A head is drawn on the arrow if head = TRUE.
An _arrow() function called do_arrow() is provided in term.c which will
draw arrows using the _move() and _vector() functions.
Drivers should use do_arrow unless it causes problems.
X
The following should illustrate the order in which calls to these
routines are made:
X
X _init()
X _scale(xs,ys)
X _graphics()
X _linetype(lt)
X _move(x,y)
X _vector(x,y)
X _point(x,y,point)
X _text_angle(angle)
X _justify(mode)
X _put_text(x,y,text)
X _arrow(sx,sy,ex,ey)
X _text()
X _graphics()
X .
X .
X _text()
X _reset()
X
X
SHAR_EOF
chmod 0644 gnuplot/term/README ||
echo 'restore of gnuplot/term/README failed'
Wc_c="`wc -c < 'gnuplot/term/README'`"
test 7115 -eq "$Wc_c" ||
echo 'gnuplot/term/README: original size 7115, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/aed.trm ==============
if test -f 'gnuplot/term/aed.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/aed.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/aed.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/aed.trm' &&
/* GNUPLOT - aed.trm */
/*
X * Copyright (C) 1990
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 * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * AED terminals
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
X
#define AED_XMAX 768
#define AED_YMAX 575
X
#define AED_XLAST (AED_XMAX - 1)
#define AED_YLAST (AED_YMAX - 1)
X
#define AED_VCHAR 13
#define AED_HCHAR 8
#define AED_VTIC 8
#define AED_HTIC 7
X
/* slightly different for AED 512 */
#define AED5_XMAX 512
#define AED5_XLAST (AED5_XMAX - 1)
X
AED_init()
{
X fprintf(outfile,
X "\033SEN3DDDN.SEC.7.SCT.0.1.80.80.90.SBC.0.AAV2.MOV.0.9.CHR.0.FFD");
/* 2 3 4 5 7 6 1
X 1. Clear Screen
X 2. Set Encoding
X 3. Set Default Color
X 4. Set Backround Color Table Entry
X 5. Set Backround Color
X 6. Move to Bottom Lefthand Corner
X 7. Anti-Alias Vectors
*/
}
X
X
AED_graphics()
{
X fprintf(outfile,"\033FFD\033");
}
X
X
AED_text()
{
X fprintf(outfile,"\033MOV.0.9.SEC.7.XXX");
}
X
X
X
AED_linetype(linetype)
int linetype;
{
static int color[2+9] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 };
static int type[2+9] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 };
X
X if (linetype >= 10)
X linetype %= 10;
X fprintf(outfile,"\033SLS%d.255.",type[linetype+2]);
X fprintf(outfile,"\033SEC%d.",color[linetype+2]);
}
X
X
X
AED_move(x,y)
int x,y;
{
X fprintf(outfile,"\033MOV%d.%d.",x,y);
}
X
X
AED_vector(x,y)
int x,y;
{
X fprintf(outfile,"\033DVA%d.%d.",x,y);
}
X
X
AED_put_text(x,y,str)
int x,y;
char str[];
{
X AED_move(x,y - AED_VCHAR/2 + 2);
X fprintf(outfile,"\033XXX%s\033",str);
}
X
X
#define hxt (AED_HTIC/2)
#define hyt (AED_VTIC/2)
X
AED_reset()
{
X fprintf(outfile,"\033SCT0.1.0.0.0.SBC.0.FFD");
}
X
SHAR_EOF
chmod 0666 gnuplot/term/aed.trm ||
echo 'restore of gnuplot/term/aed.trm failed'
Wc_c="`wc -c < 'gnuplot/term/aed.trm'`"
test 2311 -eq "$Wc_c" ||
echo 'gnuplot/term/aed.trm: original size 2311, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/bigfig.trm ==============
if test -f 'gnuplot/term/bigfig.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/bigfig.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/bigfig.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/bigfig.trm' &&
/* GNUPLOT - fig.trm */
/*
X * Copyright (C) 1990
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 * This file is included by ../term.c.
X *
X * This terminal driver supports:
X * Fig graphics language
X *
X * AUTHORS
X * Micah Beck, David Kotz
X *
X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
X *
X */
X
/*
X * Original for Fig code output by Micah Beck, 1989
X * Department of Computer Science, Cornell University
X * Updated by David Kotz for gnuplot 2.0
X * More efficient output by Ian Dall
X * Increased size of plot by Ian Dall
X */
X
#define BFIG_HTIC (7*FIG_RES/80)
#define BFIG_VTIC (7*FIG_RES/80)
#define BFIG_HCHAR (9*FIG_RES/80)
#define BFIG_FONT_S (16)
#define BFIG_VCHAR ((BFIG_FONT_S)*FIG_RES/80) /* height in pixels of font
X */
X
#define BFIG_ARROW_WIDTH BFIG_HTIC
#define BFIG_ARROW_HEIGHT BFIG_HTIC
X
X
X
/* 7 inches wide by 5 inches high */
#define BFIG_XMAX (8 * FIG_RES)
#define BFIG_YMAX (5 * FIG_RES)
X
#define BFIG_XOFF (FIG_RES/2)
#define BFIG_YOFF (FIG_RES/2)
X
X
BFIG_vector(ux,uy)
X unsigned int ux,uy;
{
X int x=ux, y=uy;
X
X if (FIG_polyvec_stat != FIG_poly_part)
X {
X fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d\n",
X O_POLYLINE, T_POLYLINE,
X FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
X 0, 0);
X fprintf(outfile, "%d %d",
X BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
X FIG_poly_vec_cnt = 1;
X FIG_polyvec_stat = FIG_poly_part;
X }
X fprintf(outfile, " %d %d",
X BFIG_XOFF + x, BFIG_YMAX + BFIG_YOFF-y);
SHAR_EOF
true || echo 'restore of gnuplot/term/bigfig.trm failed'
fi
echo 'End of part 14'
echo 'File gnuplot/term/bigfig.trm is continued in part 15'
echo 15 > _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.