taw@vu-vlsi.UUCP (Thomas Williams) (11/18/86)
Here is a brief description of the GNUPLOT program: Gnuplot is an interactive plotting program with many features, including multiple terminal support, auto-scaling, log scaling, smart tic marks, data plots, user defined functions and more. The program runs under VMS, UNIX, and MSDOS. I am much too tired to write anything else about it. Try it, you'll like it. -Thomas Williams -------------------------------------------------------------------------- UUCP: vu-vlsi!plot
taw@vu-vlsi.UUCP (Thomas Williams) (11/18/86)
This is part 2 of 4 gnuplot shar files. ---------------------------------CUT HERE------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # parse.c # plot.c # scanner.c # standard.c # term.c # util.c # version.c # This archive created: Mon Nov 17 18:12:40 1986 export PATH; PATH=/bin:$PATH echo shar: extracting "'parse.c'" '(6308 characters)' if test -f 'parse.c' then echo shar: will not over-write existing file "'parse.c'" else cat << \SHAR_EOF > 'parse.c' /* * * G N U P L O T -- parse.c * * Copyright (C) 1986 Colin Kelley, Thomas Williams * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include <setjmp.h> #include <signal.h> #include <errno.h> #include "plot.h" extern BOOLEAN undefined; #ifndef vms extern int errno; #endif extern int next_function,c_function /* next available space in udft */; extern int num_tokens,c_token; extern struct lexical_unit token[]; extern char dummy_var[]; extern struct at_type *curr_at; struct value *pop(),*integer(),*complex(); static struct at_type temp_at; static jmp_buf fpe_env; #define dummy (struct value *) 0 fpe() { (void) signal(SIGFPE, fpe); undefined = TRUE; longjmp(fpe_env, TRUE); } evaluate_at(at,valptr) struct at_type *at; struct value *valptr; { undefined = FALSE; errno = 0; reset_stack(); if (setjmp(fpe_env)) return; /* just bail out */ (void) signal(SIGFPE, fpe); /* catch core dumps on FPEs */ execute_at(at); (void) signal(SIGFPE, SIG_DFL); if (errno == EDOM || errno == ERANGE) { undefined = TRUE; } else { (void) pop(valptr); check_stack(); } } struct value * const_express(valptr) struct value *valptr; { register int tkn = c_token; if (END_OF_COMMAND) int_error("constant expression required",c_token); build_at(&temp_at); /* make a temporary action table */ evaluate_at(&temp_at,valptr); /* run it and send answer back */ if (undefined) { int_error("undefined value",tkn); } return(valptr); } build_at(at) /* build full expressions */ struct at_type *at; { curr_at = at; /* set global variable */ curr_at->count = 0; /* reset action table !!! */ express(); } express() /* full expressions */ { xterm(); xterms(); } xterm() /* NEW! ? : expressions */ { aterm(); aterms(); } aterm() { bterm(); bterms(); } bterm() { cterm(); cterms(); } cterm() { dterm(); dterms(); } dterm() { eterm(); eterms(); } eterm() { fterm(); fterms(); } fterm() { gterm(); gterms(); } gterm() { hterm(); hterms(); } hterm() { unary(); /* - things */ iterms(); /* * / % */ } factor() { register int value; struct value a, real_value; if (equals(c_token,"(")) { c_token++; express(); if (!equals(c_token,")")) int_error("')' expected",c_token); c_token++; } else if (isnumber(c_token)) { convert(&real_value,c_token); c_token++; add_action(PUSHC, &real_value); } else if (isletter(c_token)) { if ((c_token+1 < num_tokens) && equals(c_token+1,"(")) { value = standard(c_token); if (value) { /* it's a standard function */ c_token += 2; express(); if (!equals(c_token,")")) int_error("')' expected",c_token); c_token++; add_action(value,dummy); } else { value = user_defined(c_token); c_token += 2; express(); if (!equals(c_token,")")) int_error("')' expected",c_token); c_token++; add_action(CALL,integer(&a,value)); } } else { if (equals(c_token,dummy_var)) { value = c_function; c_token++; add_action(PUSHD,integer(&a,value)); } else { value = add_value(c_token); c_token++; add_action(PUSH,integer(&a,value)); } } } /* end if letter */ else int_error("invalid expression ",c_token); /* add action code for ** operator */ if (equals(c_token,"**")) { c_token++; unary(); add_action(POWER,dummy); } } xterms() { /* create action code for ? : expressions */ while (equals(c_token,"?")) { c_token++; express(); if (!equals(c_token,":")) int_error("expecting ':'",c_token); c_token++; express(); add_action(TERNIARY,dummy); } } aterms() { /* create action codes for || operator */ while (equals(c_token,"||")) { c_token++; aterm(); add_action(LOR,dummy); } } bterms() { /* create action code for && operator */ while (equals(c_token,"&&")) { c_token++; bterm(); add_action(LAND,dummy); } } cterms() { /* create action code for | operator */ while (equals(c_token,"|")) { c_token++; cterm(); add_action(BOR,dummy); } } dterms() { /* create action code for ^ operator */ while (equals(c_token,"^")) { c_token++; dterm(); add_action(XOR,dummy); } } eterms() { /* create action code for & operator */ while (equals(c_token,"&")) { c_token++; eterm(); add_action(BAND,dummy); } } fterms() { /* create action codes for == and != operators */ while (TRUE) { if (equals(c_token,"==")) { c_token++; fterm(); add_action(EQ,dummy); } else if (equals(c_token,"!=")) { c_token++; fterm(); add_action(NE,dummy); } else break; } } gterms() { /* create action code for < > >= or <= operators */ while (TRUE) { /* I hate "else if" statements */ if (equals(c_token,">")) { c_token++; gterm(); add_action(GT,dummy); } else if (equals(c_token,"<")) { c_token++; gterm(); add_action(LT,dummy); } else if (equals(c_token,">=")) { c_token++; gterm(); add_action(GE,dummy); } else if (equals(c_token,"<=")) { c_token++; gterm(); add_action(LE,dummy); } else break; } } hterms() { /* create action codes for + and - operators */ while (TRUE) { if (equals(c_token,"+")) { c_token++; hterm(); add_action(PLUS,dummy); } else if (equals(c_token,"-")) { c_token++; hterm(); add_action(MINUS,dummy); } else break; } } iterms() { /* add action code for * / and % operators */ while (TRUE) { if (equals(c_token,"*")) { c_token++; unary(); add_action(MULT,dummy); } else if (equals(c_token,"/")) { c_token++; unary(); add_action(DIV,dummy); } else if (equals(c_token,"%")) { c_token++; unary(); add_action(MOD,dummy); } else break; } } unary() { /* add code for unary operators */ if (equals(c_token,"!")) { c_token++; unary(); add_action(LNOT,dummy); } else if (equals(c_token,"~")) { c_token++; unary(); add_action(BNOT,dummy); } else if (equals(c_token,"-")) { c_token++; unary(); add_action(UMINUS,dummy); } else factor(); } SHAR_EOF if test 6308 -ne "`wc -c < 'parse.c'`" then echo shar: error transmitting "'parse.c'" '(should have been 6308 characters)' fi fi # end of overwriting check echo shar: extracting "'plot.c'" '(3628 characters)' if test -f 'plot.c' then echo shar: will not over-write existing file "'plot.c'" else cat << \SHAR_EOF > 'plot.c' /* * * G N U P L O T -- plot.c * * Copyright (C) 1986 Thomas Williams, Colin Kelley * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include <setjmp.h> #include <signal.h> #include "plot.h" extern FILE *outfile; extern int term; #ifndef STDOUT #define STDOUT 1 #endif jmp_buf env; struct value stack[STACK_DEPTH]; struct lexical_unit token[MAX_TOKENS]; struct value *integer(),*complex(); extern struct termentry term_tbl[]; extern f_push(),f_pushc(),f_pushd(),f_call(),f_terniary(),f_lnot(),f_bnot(), f_uminus(),f_lor(),f_land(),f_bor(),f_xor(),f_band(),f_eq(),f_ne(), f_gt(),f_lt(),f_ge(),f_le(),f_plus(),f_minus(),f_mult(),f_div(), f_mod(),f_power(); extern f_real(),f_imag(),f_arg(),f_conjg(),f_sin(),f_cos(),f_tan(),f_asin(), f_acos(),f_atan(),f_sinh(),f_cosh(),f_tanh(),f_int(),f_abs(),f_sgn(), f_sqrt(),f_exp(),f_log10(),f_log(),f_besj0(),f_besj1(),f_besy0(),f_besy1(), f_floor(),f_ceil(); struct ft_entry ft[] = { /* built-in function table */ /* internal functions: */ {"push", f_push}, {"pushc", f_pushc}, {"pushd", f_pushd}, {"call", f_call}, {"?:", f_terniary}, {"lnot", f_lnot}, {"bnot", f_bnot}, {"uminus", f_uminus}, {"lor", f_lor}, {"land", f_land}, {"bor", f_bor}, {"xor", f_xor}, {"band", f_band}, {"eq", f_eq}, {"ne", f_ne}, {"gt", f_gt}, {"lt", f_lt}, {"ge", f_ge}, {"le", f_le}, {"plus", f_plus}, {"minus", f_minus}, {"mult", f_mult}, {"div", f_div}, {"mod", f_mod}, {"power", f_power}, /* standard functions: */ {"real", f_real}, {"imag", f_imag}, {"arg", f_arg}, {"conjg", f_conjg}, {"sin", f_sin}, {"cos", f_cos}, {"tan", f_tan}, {"asin", f_asin}, {"acos", f_acos}, {"atan", f_atan}, {"sinh", f_sinh}, {"cosh", f_cosh}, {"tanh", f_tanh}, {"int", f_int}, {"abs", f_abs}, {"sgn", f_sgn}, {"sqrt", f_sqrt}, {"exp", f_exp}, {"log10", f_log10}, {"log", f_log}, {"besj0", f_besj0}, {"besj1", f_besj1}, {"besy0", f_besy0}, {"besy1", f_besy1}, {"floor", f_floor}, {"ceil", f_ceil}, {NULL, NULL} }; struct udft_entry udft[MAX_UDFS+1]; struct vt_entry vt[MAX_VALUES] = { {"pi"}, {"xmin"}, {"xmax"}, {"ymin"}, {"ymax"}, {"autoscale"} }; #ifdef vms #define HOME "sys$login:" #else /* vms */ #ifdef MSDOS #define HOME "GNUPLOT" #else /* MSDOS */ #define HOME "HOME" #endif /* MSDOS */ #endif /* vms */ #ifdef unix #define PLOTRC ".gnuplot" #else #define PLOTRC "gnuplot.ini" #endif interrupt() { (void) signal(SIGINT, interrupt); (void) signal(SIGFPE, SIG_DFL); /* turn off FPE trapping */ if (term) (*term_tbl[term].text)(); /* hopefully reset text mode */ (void) fflush(outfile); (void) putc('\n',stderr); longjmp(env, TRUE); /* return to prompt */ } main() { char *getenv(),*strcat(),*strcpy(); FILE *plotrc; static char home[sizeof(PLOTRC)+40]; setbuf(stderr,NULL); outfile = fdopen(dup(STDOUT),"w"); (void) complex(&vt[(int)C_PI].vt_value, Pi, 0.0); pointmem(SAMPLES); /* malloc memory to keep plot points in */ if (!setjmp(env)) { /* come back here from printerror() */ (void) signal(SIGINT, interrupt); /* go there on interrupt char */ if (!(plotrc = (fopen(PLOTRC,"r")))) { #ifdef vms (void) strcpy(home,HOME); plotrc = fopen(strcat(home,PLOTRC),"r"); #else (void) strcat(strcpy(home,getenv(HOME)),"/"); plotrc = fopen(strcat(home,PLOTRC),"r"); #endif /* vms */ } if (plotrc) load_file(plotrc); } loop: com_line(); goto loop; } SHAR_EOF if test 3628 -ne "`wc -c < 'plot.c'`" then echo shar: error transmitting "'plot.c'" '(should have been 3628 characters)' fi fi # end of overwriting check echo shar: extracting "'scanner.c'" '(6979 characters)' if test -f 'scanner.c' then echo shar: will not over-write existing file "'scanner.c'" else cat << \SHAR_EOF > 'scanner.c' /* * * G N U P L O T -- scanner.c * * Copyright (C) 1986 Colin Kelley, Thomas Williams * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include <ctype.h> #include "plot.h" extern BOOLEAN screen_ok; #ifdef vms #include stdio #include descrip #include errno #define MAILBOX "PLOT$MAILBOX" #define pclose(f) fclose(f) #endif /* vms */ #ifndef STDOUT #define STDOUT 1 #endif #define LBRACE '{' #define RBRACE '}' #define APPEND_TOKEN {token[t_num].length++; current++;} #define SCAN_IDENTIFIER while (isalpha(expression[current + 1]) ||\ isdigit(expression[current + 1]))\ APPEND_TOKEN extern struct lexical_unit token[MAX_TOKENS]; static int t_num; /* number of token I'm working on */ char *strcat(), *strcpy(); /* * scanner() breaks expression[] into lexical units, storing them in token[]. * The total number of tokens found is returned as the function value. * Scanning will stop when '\0' is found in expression[], or when token[] * is full. * * Scanning is performed by following rules: * * Current char token should contain * ------------- ----------------------- * 1. alpha all following alpha-numerics * 2. digit 0 or more following digits, 0 or 1 decimal point, * 0 or more digits, 0 or 1 'e' or 'E', * 0 or more digits. * 3. ^,+,-,/ only current char * %,~,(,) * [,],;,:, * ?,comma * 4. &,|,=,* current char; also next if next is same * 5. !,<,> current char; also next if next is = * 6. ", ' all chars up until matching quote * * white space between tokens is ignored */ scanner(expression) char expression[]; { register int current; /* index of current char in expression[] */ register int quote; char brace; for (current = t_num = 0; t_num < MAX_TOKENS && expression[current] != '\0'; current++) { again: if (isspace(expression[current])) continue; /* skip the whitespace */ token[t_num].start_index = current; token[t_num].length = 1; token[t_num].is_token = TRUE; /* to start with...*/ if (expression[current] == '`') { substitute(&expression[current],MAX_LINE_LEN - current); goto again; } if (isalpha(expression[current])) { SCAN_IDENTIFIER; } else if (isdigit(expression[current]) || expression[current] == '.') { token[t_num].is_token = FALSE; token[t_num].length = get_num(&expression[current]); current += (token[t_num].length - 1); } else if (expression[current] == LBRACE) { token[t_num].is_token = FALSE; token[t_num].l_val.type = CMPLX; if ((sscanf(&expression[++current],"%lf , %lf %c", &token[t_num].l_val.v.cmplx_val.real, &token[t_num].l_val.v.cmplx_val.imag, &brace) != 3) || (brace != RBRACE)) int_error("invalid complex constant",t_num); token[t_num].length += 2; while (expression[++current] != RBRACE) { token[t_num].length++; if (expression[current] == '\0') int_error("no matching '}'", t_num); } } else if (expression[current] == '\'' || expression[current] == '\"') { token[t_num].length++; quote = expression[current]; while (expression[++current] != quote) { if (expression[current] == '\0') int_error("unmatched quote",t_num); token[t_num].length++; } } else switch (expression[current]) { case '^': case '+': case '-': case '/': case '%': case '~': case '(': case ')': case '[': case ']': case ';': case ':': case '?': case ',': break; case '&': case '|': case '=': case '*': if (expression[current] == expression[current + 1]) APPEND_TOKEN; break; case '!': case '<': case '>': if (expression[current + 1] == '=') APPEND_TOKEN; break; default: int_error("invalid character",t_num); } ++t_num; /* next token if not white space */ } /* Now kludge an extra token which points to '\0' at end of expression[]. This is useful so printerror() looks nice even if we've fallen off the line. */ token[t_num].start_index = current; token[t_num].length = 0; return(t_num); } get_num(str) char str[]; { double atof(); register int count = 0; long atol(); register long lval; token[t_num].is_token = FALSE; token[t_num].l_val.type = INT; /* assume unless . or E found */ while (isdigit(str[count])) count++; if (str[count] == '.') { token[t_num].l_val.type = CMPLX; while (isdigit(str[++count])) /* swallow up digits until non-digit */ ; /* now str[count] is other than a digit */ } if (str[count] == 'e' || str[count] == 'E') { token[t_num].l_val.type = CMPLX; if (str[++count] == '-') count++; if (!isdigit(str[count])) { token[t_num].start_index += count; int_error("expecting exponent",t_num); } while (isdigit(str[++count])) ; } if (token[t_num].l_val.type == INT) { lval = atol(str); if ((token[t_num].l_val.v.int_val = lval) != lval) int_error("integer overflow; change to floating point",t_num); } else { token[t_num].l_val.v.cmplx_val.imag = 0.0; token[t_num].l_val.v.cmplx_val.real = atof(str); } return(count); } #ifdef MSDOS substitute() { int_error("substitution not supported by MS-DOS!",t_num); } #else /* MSDOS */ substitute(str,max) /* substitute output from ` ` */ char *str; int max; { register char *last; register int i,c; register FILE *f; FILE *popen(); static char pgm[MAX_LINE_LEN],output[MAX_LINE_LEN]; #ifdef vms int chan; static $DESCRIPTOR(pgmdsc,pgm); static $DESCRIPTOR(lognamedsc,MAILBOX); #endif /* vms */ i = 0; last = str; while (*(++last) != '`') { if (*last == '\0') int_error("unmatched `",t_num); pgm[i++] = *last; } pgm[i] = '\0'; /* end with null */ max -= strlen(last); /* max is now the max length of output sub. */ #ifdef vms pgmdsc.dsc$w_length = i; if (!((vaxc$errno = sys$crembx(0,&chan,0,0,0,0,&lognamedsc)) & 1)) os_error("sys$crembx failed",NO_CARET); if (!((vaxc$errno = lib$spawn(&pgmdsc,0,&lognamedsc,&1)) & 1)) os_error("lib$spawn failed",NO_CARET); if ((f = fopen(MAILBOX,"r")) == NULL) os_error("mailbox open failed",NO_CARET); #else /* vms */ if ((f = popen(pgm,"r")) == NULL) os_error("popen failed",NO_CARET); #endif /* vms */ i = 0; while ((c = getc(f)) != EOF) { output[i++] = ((c == '\n') ? ' ' : c); /* newlines become blanks*/ if (i == max) { (void) pclose(f); int_error("substitution overflow", t_num); } } (void) pclose(f); if (i + strlen(last) > max) int_error("substitution overflowed rest of line", t_num); (void) strcpy(output+i,last+1); /* tack on rest of line to output */ (void) strcpy(str,output); /* now replace ` ` with output */ screen_ok = FALSE; } #endif /* MS-DOS */ SHAR_EOF if test 6979 -ne "`wc -c < 'scanner.c'`" then echo shar: error transmitting "'scanner.c'" '(should have been 6979 characters)' fi fi # end of overwriting check echo shar: extracting "'standard.c'" '(5457 characters)' if test -f 'standard.c' then echo shar: will not over-write existing file "'standard.c'" else cat << \SHAR_EOF > 'standard.c' /* * * G N U P L O T -- header.c * * Copyright (C) 1986 Thomas Williams, Colin Kelley * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <math.h> #include <stdio.h> #include "plot.h" extern BOOLEAN undefined; #ifdef vms #include <errno.h> #else extern int errno; #endif /* vms */ extern struct value stack[STACK_DEPTH]; extern int s_p; struct value *pop(), *complex(), *integer(); double magnitude(), angle(), real(), imag(); f_real() { struct value a; push( complex(&a,real(pop(&a)), 0.0) ); } f_imag() { struct value a; push( complex(&a,imag(pop(&a)), 0.0) ); } f_arg() { struct value a; push( complex(&a,angle(pop(&a)), 0.0) ); } f_conjg() { struct value a; (void) pop(&a); push( complex(&a,real(&a),-imag(&a) )); } f_sin() { struct value a; (void) pop(&a); push( complex(&a,sin(real(&a))*cosh(imag(&a)), cos(real(&a))*sinh(imag(&a))) ); } f_cos() { struct value a; (void) pop(&a); push( complex(&a,cos(real(&a))*cosh(imag(&a)), -sin(real(&a))*sinh(imag(&a)))); } f_tan() { struct value a; register double den; (void) pop(&a); den = cos(2*real(&a))+cosh(2*imag(&a)); push( complex(&a,sin(2*real(&a))/den, sinh(2*imag(&a))/den) ); } f_asin() { struct value a; register double alpha, beta, x, y; (void) pop(&a); x = real(&a); y = imag(&a); if (y == 0.0) { if (fabs(x) > 1.0) { undefined = TRUE; push(complex(&a,0.0, 0.0)); } else push( complex(&a,asin(x),0.0) ); } else { beta = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2; alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2; push( complex(&a,asin(beta), log(alpha + sqrt(alpha*alpha-1))) ); } } f_acos() { struct value a; register double alpha, beta, x, y; (void) pop(&a); x = real(&a); y = imag(&a); if (y == 0.0) { if (fabs(x) > 1.0) { undefined = TRUE; push(complex(&a,0.0, 0.0)); } else push( complex(&a,acos(x),0.0) ); } else { alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2; beta = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2; push( complex(&a,acos(beta), log(alpha + sqrt(alpha*alpha-1))) ); } } f_atan() { struct value a; register double x, y; (void) pop(&a); x = real(&a); y = imag(&a); if (y == 0.0) push( complex(&a,atan(x), 0.0) ); else if (x == 0.0 && fabs(y) == 1.0) { undefined = TRUE; push(complex(&a,0.0, 0.0)); } else push( complex(&a,atan(2*x/(1-x*x-y*y)), log((x*x+(y+1)*(y+1))/(x*x+(y-1)*(y-1)))/4) ); } f_sinh() { struct value a; (void) pop(&a); push( complex(&a,sinh(real(&a))*cos(imag(&a)), cosh(real(&a))*sin(imag(&a))) ); } f_cosh() { struct value a; (void) pop(&a); push( complex(&a,cosh(real(&a))*cos(imag(&a)), sinh(real(&a))*sin(imag(&a))) ); } f_tanh() { struct value a; register double den; (void) pop(&a); den = cosh(2*real(&a)) + cos(2*imag(&a)); push( complex(&a,sinh(2*real(&a))/den, sin(2*imag(&a))/den) ); } f_int() { struct value a; push( integer(&a,(int)real(pop(&a))) ); } f_abs() { struct value a; (void) pop(&a); switch (a.type) { case INT: push( integer(&a,abs(a.v.int_val)) ); break; case CMPLX: push( complex(&a,magnitude(&a), 0.0) ); } } f_sgn() { struct value a; (void) pop(&a); switch(a.type) { case INT: push( integer(&a,(a.v.int_val > 0) ? 1 : (a.v.int_val < 0) ? -1 : 0) ); break; case CMPLX: push( integer(&a,(a.v.cmplx_val.real > 0.0) ? 1 : (a.v.cmplx_val.real < 0.0) ? -1 : 0) ); break; } } f_sqrt() { struct value a; double mag, ang; (void) pop(&a); mag = sqrt(magnitude(&a)); if ( (ang = angle(&a)) < 0.0) ang += 2*Pi; ang /= 2; push( complex(&a,mag*cos(ang), mag*sin(ang)) ); } f_exp() { register double mag, ang; struct value a; (void) pop(&a); mag = exp(real(&a)); ang = imag(&a); push( complex(&a,mag*cos(ang), mag*sin(ang)) ); } f_log10() { struct value a; register double l10;; (void) pop(&a); l10 = log(10.0); /***** replace with a constant! ******/ push( complex(&a,log(magnitude(&a))/l10, angle(&a)/l10) ); } f_log() { struct value a; (void) pop(&a); push( complex(&a,log(magnitude(&a)), angle(&a)) ); } f_besj0() /* j0(a) = sin(a)/a */ { struct value a; a = top_of_stack; f_sin(); push(&a); f_div(); } f_besj1() /* j1(a) = sin(a)/(a**2) - cos(a)/a */ { struct value a; a = top_of_stack; f_sin(); push(&a); push(&a); f_mult(); f_div(); push(&a); f_cos(); push(&a); f_div(); f_minus(); } f_besy0() /* y0(a) = -cos(a)/a */ { struct value a; a = top_of_stack; f_cos(); push(&a); f_div(); f_uminus(); } f_besy1() /* y1(a) = -cos(a)/(a**2) - sin(a)/a */ { struct value a; a = top_of_stack; f_cos(); push(&a); push(&a); f_mult(); f_div(); push(&a); f_sin(); push(&a); f_div(); f_plus(); f_uminus(); } f_floor() { struct value a; (void) pop(&a); switch (a.type) { case INT: push( integer(&a,(int)floor((double)a.v.int_val))); break; case CMPLX: push( complex(&a,floor(a.v.cmplx_val.real), floor(a.v.cmplx_val.imag)) ); } } f_ceil() { struct value a; (void) pop(&a); switch (a.type) { case INT: push( integer(&a,(int)ceil((double)a.v.int_val))); break; case CMPLX: push( complex(&a,ceil(a.v.cmplx_val.real), ceil(a.v.cmplx_val.imag)) ); } } SHAR_EOF if test 5457 -ne "`wc -c < 'standard.c'`" then echo shar: error transmitting "'standard.c'" '(should have been 5457 characters)' fi fi # end of overwriting check echo shar: extracting "'term.c'" '(17424 characters)' if test -f 'term.c' then echo shar: will not over-write existing file "'term.c'" else cat << \SHAR_EOF > 'term.c' /* * * G N U P L O T -- term.c * * Copyright (C) 1986 Colin Kelley, Thomas Williams * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include "plot.h" #define NICE_LINE 0 #define POINT_TYPES 6 extern FILE *outfile; extern BOOLEAN term_init; extern int term; extern char input_line[]; extern struct lexical_unit token[]; extern struct termentry term_tbl[]; #ifdef PC static int pattern[] = {0xffff, 0x0f0f, 0xffff, 0x3333, 0x3f3f}; #ifdef CORONA char screen[65535]; #endif /* CORONA */ int mask; static int graphics_on = FALSE; int startx, starty; #define EGA_XMAX 640 #define EGA_YMAX 350 #define EGA_XLAST (EGA_XMAX - 1) #define EGA_YLAST (EGA_YMAX - 1) #define EGA_VCHAR 14 #define EGA_HCHAR 8 #define EGA_VTIC 5 #define EGA_HTIC 5 #define CGA_XMAX 640 #define CGA_YMAX 200 #define CGA_XLAST (CGA_XMAX - 1) #define CGA_YLAST (CGA_YMAX - 1) #define CGA_VCHAR 8 #define CGA_HCHAR 8 #define CGA_VTIC 3 #define CGA_HTIC 3 #ifdef CORONA #define COR_XMAX 640 #define COR_YMAX 325 #define COR_XLAST (COR_XMAX - 1) #define COR_YLAST (COR_YMAX - 1) #define COR_VCHAR 13 #define COR_HCHAR 8 #define COR_VTIC 4 #define COR_HTIC 4 #endif /* CORONA */ #endif /* PC */ /* * general point routine */ line_and_point(x,y,number) int x,y,number; { /* temporary(?) kludge to allow terminals with bad linetypes to make nice marks */ (*term_tbl[term].linetype)(NICE_LINE); do_point(x,y,number); } do_point(x,y,number) int x,y; int number; { register struct termentry *t; register int htic,vtic; number %= POINT_TYPES; t = &term_tbl[term]; htic = (t->h_tic/2); /* should be in term_tbl[] in later version */ vtic = (t->v_tic/2); if ( x < t->h_tic || y < t->v_tic || x >= t->xmax-t->h_tic || y >= t->ymax-t->v_tic ) return; /* add clipping in later version !!! */ switch(number) { case 0: /* do diamond */ (*t->move)(x-htic,y); (*t->vector)(x,y-vtic); (*t->vector)(x+htic,y); (*t->vector)(x,y+vtic); (*t->vector)(x-htic,y); (*t->move)(x,y); (*t->vector)(x,y); break; case 1: /* do plus */ (*t->move)(x-htic,y); (*t->vector)(x+htic,y); (*t->move)(x,y-vtic); (*t->vector)(x,y+vtic); break; case 2: /* do box */ (*t->move)(x-htic,y-vtic); (*t->vector)(x+htic,y-vtic); (*t->vector)(x+htic,y+vtic); (*t->vector)(x-htic,y+vtic); (*t->vector)(x-htic,y-vtic); (*t->move)(x,y); (*t->vector)(x,y); break; case 3: /* do X */ (*t->move)(x-htic,y-vtic); (*t->vector)(x+htic,y+vtic); (*t->move)(x-htic,y+vtic); (*t->vector)(x+htic,y-vtic); break; case 4: /* do triangle */ (*t->move)(x,y+(4*vtic/3)); (*t->vector)(x-(4*htic/3),y-(2*vtic/3)); (*t->vector)(x+(4*htic/3),y-(2*vtic/3)); (*t->vector)(x,y+(4*vtic/3)); (*t->move)(x,y); (*t->vector)(x,y); break; case 5: /* do star */ (*t->move)(x-htic,y); (*t->vector)(x+htic,y); (*t->move)(x,y-vtic); (*t->vector)(x,y+vtic); (*t->move)(x-htic,y-vtic); (*t->vector)(x+htic,y+vtic); (*t->move)(x-htic,y+vtic); (*t->vector)(x+htic,y-vtic); break; } } #define AED_XMAX 768 #define AED_YMAX 575 #define AED_XLAST (AED_XMAX - 1) #define AED_YLAST (AED_YMAX - 1) #define AED_VCHAR 13 #define AED_HCHAR 8 #define AED_VTIC 8 #define AED_HTIC 7 #define HP75_XMAX 6000 #define HP75_YMAX 6000 #define HP75_XLAST (HP75_XMAX - 1) #define HP75_YLAST (HP75_XMAX - 1) /* HP75_VCHAR, HP75_HCHAR are not used */ #define HP75_VCHAR (HP75_YMAX/20) #define HP75_HCHAR (HP75_XMAX/20) #define HP75_VTIC (HP75_YMAX/70) #define HP75_HTIC (HP75_XMAX/75) #define REGISXMAX 800 #define REGISYMAX 440 #define REGISXLAST (REGISXMAX - 1) #define REGISYLAST (REGISYMAX - 1) #define REGISVCHAR 20 #define REGISHCHAR 8 #define REGISVTIC 8 #define REGISHTIC 6 #define QMS_XMAX 9000 #define QMS_YMAX 6000 #define QMS_XLAST (QMS_XMAX - 1) #define QMS_YLAST (QMS_YMAX - 1) #define QMS_VCHAR 120 #define QMS_HCHAR 75 #define QMS_VTIC 70 #define QMS_HTIC 70 #define TEK40XMAX 1024 #define TEK40YMAX 780 #define TEK40XLAST (TEK40XMAX - 1) #define TEK40YLAST (TEK40YMAX - 1) #define TEK40VCHAR 25 #define TEK40HCHAR 14 #define TEK40VTIC 11 #define TEK40HTIC 11 #ifdef UNIXPLOT #define UP_XMAX 4096 #define UP_YMAX 4096 #define UP_XLAST (UP_XMAX - 1) #define UP_YLAST (UP_YMAX - 1) #define UP_VCHAR (UP_YMAX/30) #define UP_HCHAR (UP_XMAX/72) /* just a guess--no way to know this! */ #define UP_VTIC (UP_YMAX/80) #define UP_HTIC (UP_XMAX/80) #endif /* UNIXPLOT */ #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry)) #ifdef PC PC_lrput_text(row,str) int row; char str[]; { PC_curloc(24-row,78-strlen(str)); PC_puts(str); } PC_ulput_text(row,str) int row; char str[]; { PC_curloc(row+1,2); PC_puts(str); } #ifdef CORONA COR_init() { } COR_graphics() { graphics_on = TRUE; Vmode(3); grinit(screen); grandtx(); } COR_text() { if (graphics_on) { graphics_on = FALSE; while (!kbhit()) ; } grreset(); txonly(); Vmode(3); } COR_linetype(linetype) { if (linetype > 2) linetype %= 3; mask = pattern[linetype+2]; } COR_move(x,y) { if (x < 0) startx = 0; else if (x > COR_XLAST) startx = COR_XLAST; else startx = x; if (y < 0) starty = 0; else if (y > COR_YLAST) starty = COR_YLAST; else starty = y; } COR_vector(x,y) { if (x < 0) x = 0; else if (x > COR_XLAST) x = COR_XLAST; if (y < 0) y = 0; else if (y > COR_YLAST) y = COR_YLAST; Cor_line(startx,COR_YLAST-starty,x,COR_YLAST-y); startx = x; starty = y; } #define COR_lrput_text PC_lrput_text #define COR_ulput_text PC_ulput_text COR_reset() { } #endif /* CORONA */ CGA_init() { PC_color(1); /* monochrome */ } CGA_graphics() { graphics_on = TRUE; Vmode(6); } CGA_text() { if (graphics_on) { graphics_on = FALSE; while (!kbhit()) ; Vmode(3); } } CGA_linetype(linetype) { if (linetype > 2) linetype %= 3; PC_mask(pattern[linetype+2]); } CGA_move(x,y) { startx = x; starty = y; } CGA_vector(x,y) { PC_line(startx,CGA_YLAST-starty,x,CGA_YLAST-y); startx = x; starty = y; } #define CGA_lrput_text PC_lrput_text #define CGA_ulput_text PC_ulput_text CGA_reset() { } EGA_init() { PC_mask(0xffff); } EGA_graphics() { graphics_on = TRUE; Vmode(16); } EGA_text() { PC_curloc(24,0); if (graphics_on) { graphics_on = FALSE; while (!kbhit()) ; } } EGA_linetype(linetype) { static int c[] = {9, 8, 10, 11, 12, 13, 14, 15, 7, 5, 4, 3, 2, 6}; PC_color(c[linetype+2]); } EGA_move(x,y) { startx = x; starty = y; } EGA_vector(x,y) { PC_line(startx,EGA_YLAST-starty,x,EGA_YLAST-y); startx = x; starty = y; } #define EGA_lrput_text PC_lrput_text #define EGA_ulput_text PC_ulput_text EGA_reset() { Vmode(3); } #endif /* PC */ #ifdef AED AED_init() { fprintf(outfile, "\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 1. Clear Screen 2. Set Encoding 3. Set Default Color 4. Set Backround Color Table Entry 5. Set Backround Color 6. Move to Bottom Lefthand Corner 7. Anti-Alias Vectors */ } AED_graphics() { fprintf(outfile,"\033FFD\033"); } AED_text() { fprintf(outfile,"\033MOV.0.9.SEC.7.XXX"); } AED_linetype(linetype) int linetype; { static int color[9+2] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 }; static int type[9+2] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 }; fprintf(outfile,"\033SLS%d.255.",type[linetype+2]); fprintf(outfile,"\033SEC%d.",color[linetype+2]); } AED_move(x,y) int x,y; { fprintf(outfile,"\033MOV%d.%d.",x,y); } AED_vector(x,y) int x,y; { fprintf(outfile,"\033DVA%d.%d.",x,y); } AED_lrput_text(row,str) /* write text to screen while still in graphics mode */ int row; char str[]; { AED_move(AED_XMAX-((strlen(str)+2)*AED_HCHAR),AED_VTIC+AED_VCHAR*(row+1)); fprintf(outfile,"\033XXX%s\033",str); } AED_ulput_text(row,str) /* write text to screen while still in graphics mode */ int row; char str[]; { AED_move(AED_HTIC*2,AED_YMAX-AED_VTIC-AED_VCHAR*(row+1)); fprintf(outfile,"\033XXX%s\033",str); } #define hxt (AED_HTIC/2) #define hyt (AED_VTIC/2) AED_reset() { fprintf(outfile,"\033SCT0.1.0.0.0.SBC.0.FFD"); } #endif /* AED */ #ifdef HP75 HP75_init() { fprintf(outfile, "\033.Y;IN;\033.P1:SC0,%d,0,%d;\nRO90;IP;CS20;SI0.2137,0.2812;\n", HP75_XMAX,HP75_YMAX); /* 1 2 3 4 5 6 7 1. turn on eavesdropping 2. reset to power-up defaults 3. enable XON/XOFF flow control 4. set SCaling to 2000 x 2000 5. rotate page 90 degrees 6. ??? 7. set some character set stuff */ } HP75_graphics() { fputs("\033.Y",outfile); /* 1 1. enable eavesdropping */ } HP75_text() { fputs("NR;\033.Z",outfile); /* 1 2 1. go into 'view' mode 2. disable plotter eavesdropping */ } HP75_linetype(linetype) int linetype; { fprintf(outfile,"SP%d;\n",3+(linetype%8)); } HP75_move(x,y) int x,y; { fprintf(outfile,"PU%d,%d;\n",x,y); } HP75_vector(x,y) int x,y; { fprintf(outfile,"PD%d,%d;\n",x,y); } HP75_lrput_text(row,str) int row; char str[]; { HP75_move(HP75_XMAX-HP75_HTIC*2,HP75_VTIC*2+HP75_VCHAR*row); fprintf(outfile,"LO17;LB%s\003\n",str); } HP75_ulput_text(row,str) int row; char str[]; { HP75_move(HP75_HTIC*2,HP75_YMAX-HP75_VTIC*2-HP75_VCHAR*row); fprintf(outfile,"LO13;LB%s\003\n",str); } HP75_reset() { } #endif /* HP75 */ #ifdef REGIS REGISinit() { fprintf(outfile,"\033[r\033[24;1H"); /* 1 2 1. reset scrolling region 2. locate cursor on bottom line */ } REGISgraphics() { fprintf(outfile,"\033[2J\033P1pS(C0)"); /* 1 2 3 1. clear screen 2. enter ReGIS graphics 3. turn off graphics diamond cursor */ } REGIStext() { fprintf(outfile,"\033[24;1H"); /* 1 1. locate cursor on last line of screen (and leave ReGIS) */ } REGISlinetype(linetype) int linetype; { static int in_map[9+2] = {2,2,3,2,3,2,3,2,1,1,1}; static int lt_map[9+2] = {1,4,1,1,4,4,6,6,1,4,6}; fprintf(outfile,"W(I%d)",in_map[linetype+2]); fprintf(outfile,"W(P%d)",lt_map[linetype+2]); } REGISmove(x,y) int x,y; { fprintf(outfile,"P[%d,%d]v[]",x,REGISYLAST-y,x,REGISYLAST-y); } REGISvector(x,y) int x,y; { fprintf(outfile,"v[%d,%d]",x,REGISYLAST - y); } REGISlrput_text(row,str) int row; char *str; { REGISmove(REGISXMAX-REGISHTIC-REGISHCHAR*(strlen(str)+3), REGISVTIC+REGISVCHAR*(row+1)); (void) putc('T',outfile); (void) putc('\'',outfile); while (*str) { (void) putc(*str,outfile); if (*str == '\'') (void) putc('\'',outfile); /* send out another one */ str++; } (void) putc('\'',outfile); } REGISulput_text(row,str) int row; char *str; { REGISmove(REGISVTIC,REGISYMAX-REGISVTIC*2-REGISVCHAR*row); (void) putc('T',outfile); (void) putc('\'',outfile); while (*str) { (void) putc(*str,outfile); if (*str == '\'') (void) putc('\'',outfile); /* send out another one */ str++; } (void) putc('\'',outfile); } REGISreset() { fprintf(outfile,"\033[2J\033[24;1H"); } #endif /* REGIS */ #ifdef QMS QMS_init() { fprintf(outfile,"^IOL\n"); } QMS_graphics() { fprintf(outfile,"^IGV\n"); } QMS_text() { fprintf(outfile,"^IGE\n^,"); } QMS_linetype(linetype) int linetype; { static int width[9+2] = {7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7}; static int type[9+2] = {0, 0, 0, 2, 5, 0, 2, 5, 0, 2, 5}; fprintf(outfile,"^PW%02d\n^V%x\n",width[linetype+2], type[linetype+2]); } QMS_move(x,y) int x,y; { fprintf(outfile,"^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y); } QMS_vector(x2,y2) int x2,y2; { fprintf(outfile,"^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2); } QMS_lrput_text(row,str) int row; char str[]; { QMS_move(QMS_XMAX-QMS_HTIC-QMS_HCHAR*(strlen(str)+1), QMS_VTIC+QMS_VCHAR*(row+1)); fprintf(outfile,"^IGE\n%s\n^IGV\n",str); } QMS_ulput_text(row,str) int row; char str[]; { QMS_move(QMS_HTIC*2,QMS_YMAX-QMS_VTIC-QMS_VCHAR*(row+1)); fprintf(outfile,"^IGE\n%s\n^IGV\n",str); } QMS_reset() { fprintf(outfile,"^,\n"); } #endif /* QMS */ #ifdef TEK #define HX 0x20 /* bit pattern to OR over 5-bit data */ #define HY 0x20 #define LX 0x40 #define LY 0x60 #define LOWER5 31 #define UPPER5 (31<<5) TEK40init() { } TEK40graphics() { fprintf(outfile,"\033\014"); /* 1 1. clear screen */ } TEK40text() { TEK40move(0,12); fprintf(outfile,"\037"); /* 1 1. into alphanumerics */ } TEK40linetype(linetype) int linetype; { } TEK40move(x,y) unsigned int x,y; { (void) putc('\035', outfile); /* into graphics */ TEK40vector(x,y); } TEK40vector(x,y) unsigned int x,y; { (void) putc((HY | (y & UPPER5)>>5), outfile); (void) putc((LY | (y & LOWER5)), outfile); (void) putc((HX | (x & UPPER5)>>5), outfile); (void) putc((LX | (x & LOWER5)), outfile); } TEK40lrput_text(row,str) unsigned int row; char str[]; { TEK40move(TEK40XMAX - TEK40HTIC - TEK40HCHAR*(strlen(str)+1), TEK40VTIC + TEK40VCHAR*(row+1)); fprintf(outfile,"\037%s\n",str); } TEK40ulput_text(row,str) unsigned int row; char str[]; { TEK40move(TEK40HTIC, TEK40YMAX - TEK40VTIC - TEK40VCHAR*(row+1)); fprintf(outfile,"\037%s\n",str); } TEK40reset() { } #endif /* TEK */ #ifdef UNIXPLOT UP_init() { openpl(); space(0, 0, UP_XMAX, UP_YMAX); } UP_graphics() { erase(); } UP_text() { } UP_linetype(linetype) int linetype; { static char *lt[] = {"solid", "longdashed", "solid", "dotted", "shortdashed", "dotdashed", "longdashed"}; if (linetype >= 5) linetype %= 5; linemod(lt[linetype+2]); } UP_move(x,y) unsigned int x,y; { move(x,y); } UP_vector(x,y) unsigned int x,y; { cont(x,y); } UP_lrput_text(row,str) unsigned int row; char str[]; { move(UP_XMAX - UP_HTIC - UP_HCHAR*(strlen(str)+1), UP_VTIC + UP_VCHAR*(row+1)); label(str); } UP_ulput_text(row,str) unsigned int row; char str[]; { UP_move(UP_HTIC, UP_YMAX - UP_VTIC - UP_VCHAR*(row+1)); label(str); } UP_reset() { closepl(); } #endif /* UNIXPLOT */ UNKNOWN_null() { int_error("you must set your terminal type before plotting!",NO_CARET); } /* * term_tbl[] contains an entry for each terminal. "unknown" must be the * first, since term is initialized to 0. */ struct termentry term_tbl[] = { {"unknown", 100, 100, 1, 1, 1, 1, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null} #ifdef PC ,{"cga", CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR, CGA_VTIC, CGA_HTIC, CGA_init, CGA_reset, CGA_text, CGA_graphics, CGA_move, CGA_vector, CGA_linetype, CGA_lrput_text, CGA_ulput_text, line_and_point} ,{"ega", EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR, EGA_VTIC, EGA_HTIC, EGA_init, EGA_reset, EGA_text, EGA_graphics, EGA_move, EGA_vector, EGA_linetype, EGA_lrput_text, EGA_ulput_text, do_point} #ifdef CORONA ,{"corona", COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR, COR_VTIC, COR_HTIC, COR_init, COR_reset, COR_text, COR_graphics, COR_move, COR_vector, COR_linetype, COR_lrput_text, COR_ulput_text, line_and_point} #endif /* CORONA */ #endif /* PC */ #ifdef AED ,{"aed767", AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR, AED_VTIC, AED_HTIC, AED_init, AED_reset, AED_text, AED_graphics, AED_move, AED_vector, AED_linetype, AED_lrput_text, AED_ulput_text, do_point} #endif #ifdef HP75 ,{"hp75xx",HP75_XMAX,HP75_YMAX, HP75_VCHAR, HP75_HCHAR,HP75_VTIC,HP75_HTIC, HP75_init,HP75_reset,HP75_text, HP75_graphics, HP75_move, HP75_vector, HP75_linetype, HP75_lrput_text, HP75_ulput_text, do_point} #endif #ifdef QMS ,{"qms",QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, QMS_VTIC, QMS_HTIC, QMS_init,QMS_reset, QMS_text, QMS_graphics, QMS_move, QMS_vector, QMS_linetype,QMS_lrput_text,QMS_ulput_text,line_and_point} #endif #ifdef REGIS ,{"regis", REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, REGISVTIC, REGISHTIC, REGISinit, REGISreset, REGIStext, REGISgraphics, REGISmove,REGISvector,REGISlinetype, REGISlrput_text, REGISulput_text, line_and_point} #endif #ifdef TEK ,{"tek40xx",TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR, TEK40VTIC, TEK40HTIC, TEK40init,TEK40reset, TEK40text, TEK40graphics, TEK40move, TEK40vector,TEK40linetype,TEK40lrput_text, TEK40ulput_text, line_and_point} #endif #ifdef UNIXPLOT ,{"unixplot", UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, UP_VTIC, UP_HTIC, UP_init, UP_reset, UP_text, UP_graphics, UP_move, UP_vector, UP_linetype, UP_lrput_text, UP_ulput_text, line_and_point} #endif }; list_terms() { register int i; (void) putc('\n',stderr); fprintf(stderr,"available terminals types: \n"); for (i = 0; i < TERMCOUNT; i++) fprintf(stderr,"\t%s\n",term_tbl[i].name); (void) putc('\n',stderr); } set_term(c_token) int c_token; { register int i,t; if (!token[c_token].is_token) int_error("terminal name expected",c_token); t = -1; for (i = 0; i < TERMCOUNT; i++) { if (!strncmp(input_line + token[c_token].start_index,term_tbl[i].name, token[c_token].length)) { if (t != -1) int_error("ambiguous terminal name",c_token); t = i; } } if (t == -1) int_error("unknown terminal type; type just 'set terminal' for a list", c_token); term_init = FALSE; return(t); } SHAR_EOF if test 17424 -ne "`wc -c < 'term.c'`" then echo shar: error transmitting "'term.c'" '(should have been 17424 characters)' fi fi # end of overwriting check echo shar: extracting "'util.c'" '(7934 characters)' if test -f 'util.c' then echo shar: will not over-write existing file "'util.c'" else cat << \SHAR_EOF > 'util.c' /* * * G N U P L O T -- util.c * * Copyright (C) 1986 Thomas Williams, Colin Kelley * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <ctype.h> #include <setjmp.h> #include <stdio.h> #include <errno.h> #include "plot.h" extern BOOLEAN screen_ok; /* TRUE if command just typed; becomes FALSE whenever we send some other output to screen. If FALSE, the command line will be echoed to the screen before the ^ error message. */ #ifndef vms extern int errno, sys_nerr; extern char *sys_errlist[]; #endif /* vms */ extern char input_line[MAX_LINE_LEN]; extern struct lexical_unit token[MAX_TOKENS]; extern jmp_buf env; /* from plot.c */ /* * equals() compares string value of token number t_num with str[], and * returns TRUE if they are identical. */ equals(t_num, str) int t_num; char *str; { register int i; if (!token[t_num].is_token) return(FALSE); /* must be a value--can't be equal */ for (i = 0; i < token[t_num].length; i++) { if (input_line[token[t_num].start_index+i] != str[i]) return(FALSE); } /* now return TRUE if at end of str[], FALSE if not */ return(str[i] == '\0'); } /* * almost_equals() compares string value of token number t_num with str[], and * returns TRUE if they are identical up to the first $ in str[]. */ almost_equals(t_num, str) int t_num; char *str; { register int i; register int after = 0; register start = token[t_num].start_index; register length = token[t_num].length; if (!token[t_num].is_token) return(FALSE); /* must be a value--can't be equal */ for (i = 0; i < length + after; i++) { if (str[i] != input_line[start + i]) { if (str[i] != '$') return(FALSE); else { after = 1; start--; /* back up token ptr */ } } } /* i now beyond end of token string */ return(after || str[i] == '$' || str[i] == '\0'); } isstring(t_num) int t_num; { return(token[t_num].is_token && (input_line[token[t_num].start_index] == '\'' || input_line[token[t_num].start_index] == '\"')); } isnumber(t_num) int t_num; { return(!token[t_num].is_token); } isletter(t_num) int t_num; { return(token[t_num].is_token && (isalpha(input_line[token[t_num].start_index]))); } /* * is_definition() returns TRUE if the next tokens are of the form * identifier = * -or- * identifier ( identifer ) = */ is_definition(t_num) int t_num; { return (isletter(t_num) && (equals(t_num+1,"=") || /* variable */ (equals(t_num+1,"(") && /* function */ isletter(t_num+2) && equals(t_num+3,")") && equals(t_num+4,"=") ) )); } /* * copy_str() copies the string in token number t_num into str, appending * a null. No more than MAX_ID_LEN chars are copied. */ copy_str(str, t_num) char str[]; int t_num; { register int i = 0; register int start = token[t_num].start_index; register int count; if ((count = token[t_num].length) > MAX_ID_LEN) count = MAX_ID_LEN; do { str[i++] = input_line[start++]; } while (i != count); str[i] = '\0'; } /* * quote_str() does the same thing as copy_str, except it ignores the * quotes at both ends. This seems redundant, but is done for * efficency. */ quote_str(str, t_num) char str[]; int t_num; { register int i = 0; register int start = token[t_num].start_index + 1; register int count; if ((count = token[t_num].length - 2) > MAX_ID_LEN) count = MAX_ID_LEN; do { str[i++] = input_line[start++]; } while (i != count); str[i] = '\0'; } /* * capture() returns in str[] the the part of input_line[] which lies * between the begining of token[start] and end of token[end] */ capture(str,start,end) char str[]; int start,end; { register int i,j; char *s = str; j = token[end].start_index + token[end].length; for (i = token[start].start_index; i < j && input_line[i] != '\0'; i++) *s++ = input_line[i]; *s = '\0'; } convert(val_ptr, t_num) struct value *val_ptr; int t_num; { *val_ptr = token[t_num].l_val; } show_value(fp,val) FILE *fp; struct value *val; { switch(val->type) { case INT: fprintf(fp,"%d",val->v.int_val); break; case CMPLX: if (val->v.cmplx_val.imag != 0.0 ) fprintf(fp,"{%g, %g}", val->v.cmplx_val.real,val->v.cmplx_val.imag); else fprintf(fp,"%g", val->v.cmplx_val.real); break; default: int_error("unknown type in show_value()",NO_CARET); } } double real(val) /* returns the real part of val */ struct value *val; { switch(val->type) { case INT: return((double) val->v.int_val); break; case CMPLX: return(val->v.cmplx_val.real); } int_error("unknown type in real()",NO_CARET); /* NOTREACHED */ } double imag(val) /* returns the imag part of val */ struct value *val; { switch(val->type) { case INT: return(0.0); break; case CMPLX: return(val->v.cmplx_val.imag); } int_error("unknown type in real()",NO_CARET); /* NOTREACHED */ } double magnitude(val) /* returns the magnitude of val */ struct value *val; { double sqrt(); switch(val->type) { case INT: return((double) abs(val->v.int_val)); break; case CMPLX: return(sqrt(val->v.cmplx_val.real* val->v.cmplx_val.real + val->v.cmplx_val.imag* val->v.cmplx_val.imag)); } int_error("unknown type in magnitude()",NO_CARET); /* NOTREACHED */ } double angle(val) /* returns the angle of val */ struct value *val; { double atan2(); switch(val->type) { case INT: return((val->v.int_val > 0) ? 0.0 : Pi); break; case CMPLX: if (val->v.cmplx_val.imag == 0.0) { if (val->v.cmplx_val.real >= 0.0) return(0.0); else return(Pi); } return(atan2(val->v.cmplx_val.imag, val->v.cmplx_val.real)); } int_error("unknown type in angle()",NO_CARET); /* NOTREACHED */ } struct value * complex(a,realpart,imagpart) struct value *a; double realpart, imagpart; { a->type = CMPLX; a->v.cmplx_val.real = realpart; a->v.cmplx_val.imag = imagpart; return(a); } struct value * integer(a,i) struct value *a; int i; { a->type = INT; a->v.int_val = i; return(a); } os_error(str,t_num) char str[]; int t_num; { #ifdef vms static status[2] = {1, 0}; /* 1 is count of error msgs */ #endif register int i; /* reprint line if screen has been written to */ if (t_num != NO_CARET) { /* put caret under error */ if (!screen_ok) fprintf(stderr,"\n%s%s\n", PROMPT, input_line); for (i = 0; i < sizeof(PROMPT) - 1; i++) (void) putc(' ',stderr); for (i = 0; i < token[t_num].start_index; i++) { (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr); } (void) putc('^',stderr); (void) putc('\n',stderr); } for (i = 0; i < sizeof(PROMPT) - 1; i++) (void) putc(' ',stderr); fprintf(stderr,"%s\n",str); for (i = 0; i < sizeof(PROMPT) - 1; i++) (void) putc(' ',stderr); #ifdef vms status[1] = vaxc$errno; sys$putmsg(status); (void) putc('\n',stderr); #else if (errno >= sys_nerr) fprintf(stderr, "unknown errno %d\n\n", errno); else fprintf(stderr,"(%s)\n\n",sys_errlist[errno]); #endif longjmp(env, TRUE); /* bail out to command line */ } int_error(str,t_num) char str[]; int t_num; { register int i; /* reprint line if screen has been written to */ if (t_num != NO_CARET) { /* put caret under error */ if (!screen_ok) fprintf(stderr,"\n%s%s\n", PROMPT, input_line); for (i = 0; i < sizeof(PROMPT) - 1; i++) (void) putc(' ',stderr); for (i = 0; i < token[t_num].start_index; i++) { (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr); } (void) putc('^',stderr); (void) putc('\n',stderr); } for (i = 0; i < sizeof(PROMPT) - 1; i++) (void) putc(' ',stderr); fprintf(stderr,"%s\n\n",str); longjmp(env, TRUE); /* bail out to command line */ } SHAR_EOF if test 7934 -ne "`wc -c < 'util.c'`" then echo shar: error transmitting "'util.c'" '(should have been 7934 characters)' fi fi # end of overwriting check echo shar: extracting "'version.c'" '(72 characters)' if test -f 'version.c' then echo shar: will not over-write existing file "'version.c'" else cat << \SHAR_EOF > 'version.c' char version[] = "1.0.3"; char date[] = "Sun Nov 16 20:31:40 EST 1986"; SHAR_EOF if test 72 -ne "`wc -c < 'version.c'`" then echo shar: error transmitting "'version.c'" '(should have been 72 characters)' fi fi # end of overwriting check # End of shell archive exit 0
taw@vu-vlsi.UUCP (Thomas Williams) (11/18/86)
This is part 3 of 4 gnuplot shar files. ---------------------------CUT HERE----------------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # README # gnuplot.1 # Makefile # make.msc # corgraph.asm # pcgraph.asm # plot.h # vmshelp.csh # simple.demo # 1.dat # 2.dat # 3.dat # This archive created: Mon Nov 17 19:08:27 1986 export PATH; PATH=/bin:$PATH echo shar: extracting "'README'" '(1701 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else cat << \SHAR_EOF > 'README' GNUPLOT has been tested on a Pyramid 90x (ucb 4.2 and att V), a VAX 8200 (VMS 4.3), IBM PC's and AT's (MS-DOS 3.1, Microsoft C 4.0). The code is written with portability in mind, and it passes lint! If you have problems, send mail to vu-vlsi!plot. And please send any modifications you make so they can be #ifdef'd into later releases. These #defines should be checked before compilation: VFORK Makefile define if you've got vfork() system call vms Makefile define if compiling under VMS; automatically defined by DEC C PC Makefile define if compiling on a PClone MSDOS Makefile define if compiling under MSDOS; automatically defined by Microsoft C 4.0 AED Makefile define these if you want this terminal driver HP75 . included QMS . REGIS . TEK . UNIXPLOT . CGA . same, but only if PC is defined CORONA . EGA . HUGE plot.h define to be largest double if not defined in <math.h> HELP plot.h program run by 'help' command SHELL plot.h default shell to spawn if SHELL environment variable not found at run-time To compile: under UNIX: type 'make' under VMS: type '@compile', then '@link'. Use the 'vmshelp.csh' script to convert the help files. If you don't have access to a Unix machine, send us mail and we'll send you the VMS GNUPLOT.HLB. under MSDOS: use 'make make.msc' for Microsoft C 4.0. If you've got another compiler, you're on your own! SHAR_EOF if test 1701 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 1701 characters)' fi chmod +x 'README' fi # end of overwriting check echo shar: extracting "'gnuplot.1'" '(1364 characters)' if test -f 'gnuplot.1' then echo shar: will not over-write existing file "'gnuplot.1'" else cat << \SHAR_EOF > 'gnuplot.1' .\" dummy line .TH GNUPLOT 1 "17 November 1986" .UC 4 .SH NAME gnuplot \- an interactive plotting program .SH SYNOPSIS .B gnuplot .br .SH DESCRIPTION .I GNUPLOT is a command-driven interactive function plotting program. Here are some of its features: .PP Plots any number of functions, built up of C operators, C library functions, and some things C doesn't have like **, sgn(), etc. Also support for plotting scatter-plots of data files for comparing actual data to theoretical curves. .PP User-defined X and Y ranges (optional Y auto-ranging), smart Y scaling, smart tic marks. .PP User-defined constants and functions. .PP Support through a generalized graphics driver for ReGis (VT125 and VT2xx), Tek 401x, AED 767, HP plotters, and QMS laser printers. The PC version supports IBM CGA & EGA and Corona 325 graphics. Other devices can be added simply, but will require recompiling. .PP Shell escapes and command line substitution. .PP Load and save capability. .PP Output redirection. .PP All computations performed in the complex domain. Just the real part is plotted by default, but functions like imag() and abs() and arg() are available to override this. .SH AUTHORS Colin Kelley and Tom Williams (vu-vlsi!plot) .SH BUGS The unixplot driver automatically writes to stdout, so you have to redirect the gnuplot's output from the shell. SHAR_EOF if test 1364 -ne "`wc -c < 'gnuplot.1'`" then echo shar: error transmitting "'gnuplot.1'" '(should have been 1364 characters)' fi chmod +x 'gnuplot.1' fi # end of overwriting check echo shar: extracting "'Makefile'" '(1512 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else cat << \SHAR_EOF > 'Makefile' # where to install on 'make install' DEST=/usr/local/bin/gnuplot OBJS = plot.o scanner.o parse.o command.o eval.o standard.o internal.o util.o\ graphics.o term.o misc.o version.o CSOURCE1 = command.c eval.c graphics.c internal.c misc.c CSOURCE2 = parse.c plot.c scanner.c standard.c term.c util.c version.c # not C code, but still needed ETC = README gnuplot.1 Makefile make.msc corgraph.asm pcgraph.asm plot.h\ vmshelp.csh simple.demo 1.dat 2.dat 3.dat # -lplot iff UNIXPLOT you have -DUNIXPLOT LIBS = -lm -lplot # -DFORK iff vfork() supported CFLAGS = -O -DVFORK # -D<terminal> only if you wish to support <terminal> # -DAED Aed767 # -HP75 HP7580, and probably other HPs # -DQMS QMS/QUIC laserprinter (Talaris 1200 and others) # -DREGIS ReGis graphics (vt220, vt240, Gigis...) # -DTEK Tektronix 4010, and probably others # -DUNIXPLOT unixplot TERMFLAGS = -DAED -DHP75 -DQMS -DREGIS -DTEK -DUNIXPLOT gnuplot: $(OBJS) cc $(CFLAGS) $(OBJS) version.o $(LIBS) -o gnuplot install: gnuplot cp gnuplot $(DEST) strip $(DEST) term.o: term.c cc $(CFLAGS) $(TERMFLAGS) -c term.c $(OBJS): plot.h lint: lint -hx $(CSOURCE1) $(CSOURCE2) shar: gnuplot.shar.1 gnuplot.shar.2 gnuplot.shar.3 gnuplot.shar.4 gnuplot.shar.1: $(CSOURCE1) shar -vc $(CSOURCE1) > gnuplot.shar.1 gnuplot.shar.2: $(CSOURCE2) shar -vc $(CSOURCE2) > gnuplot.shar.2 gnuplot.shar.3: $(ETC) shar -vc $(ETC) > gnuplot.shar.3 gnuplot.shar.4: cd /usr/help; shar -vc gnuplot > gnuplot.shar.4 SHAR_EOF if test 1512 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 1512 characters)' fi chmod +x 'Makefile' fi # end of overwriting check echo shar: extracting "'make.msc'" '(1097 characters)' if test -f 'make.msc' then echo shar: will not over-write existing file "'make.msc'" else cat << \SHAR_EOF > 'make.msc' OBJS = command.obj eval.obj graphics.obj internal.obj misc.obj parse.obj plot.obj scanner.obj standard.obj term.obj util.obj version.obj pcgraph.obj corgraph.obj LIBFLAGS = # corgraph will include code for Corona 325 graphics # if omitted, be sure to delete corgraph elsewhere, and get rid of # /DCORONA in CFLAGS GRAPHICS = pcgraph+corgraph # /AL means use large model (necessary!) CFLAGS = /AL /DPC /DCORONA # default rules .c.obj: msc $(CFLAGS) $*; .asm.obj: masm $*; pcgraph.obj: pcgraph.asm corgraph.obj: corgraph.asm command.obj: command.c plot.h eval.obj: eval.c plot.h graphics.obj: graphics.c plot.h internal.obj: internal.c plot.h misc.obj: misc.c plot.h parse.obj: parse.c plot.h plot.obj: plot.c plot.h scanner.obj: scanner.c plot.h standard.obj: standard.c plot.h term.obj: term.c plot.h util.obj: util.c plot.h version.obj: version.c gnuplot.exe: $(OBJS) link$(LIBFLAGS) command+eval+graphics+internal+misc+parse+plot+scanner+standard+term+util+version+$(GRAPHICS),gnuplot,nul,; x ; sum,dx add bx,si ; y1,y2 i27: inc ax ; x1 cmp ax,cx ; x1,x2 jbe SHAR_EOF echo shar: a missing newline was added to "'make.msc'" if test 1097 -ne "`wc -c < 'make.msc'`" then echo shar: error transmitting "'make.msc'" '(should have been 1097 characters)' fi chmod +x 'make.msc' fi # end of overwriting check echo shar: extracting "'corgraph.asm'" '(3592 characters)' if test -f 'corgraph.asm' then echo shar: will not over-write existing file "'corgraph.asm'" else cat << \SHAR_EOF > 'corgraph.asm' TITLE Corona graphics module ; Colin Kelley ; November 9, 1986 xmax equ 640 ; Corona Screen ymax equ 325 ; X equ 6 public _GrInit,_GrReset,_GrAddr,_GrOnly,_TxOnly,_GrandTx,_Cor_line _prog segment para 'code' assume cs:_prog X equ 6 _Cor_line proc far push bp mov bp,sp push si push di mov ax,[bp+X] ; x1 mov bx,[bp+X+2] ; y1 mov cx,[bp+X+4] ; x2 mov si,[bp+X+6] ; y2 cmp ax,cx ; x1,x2 jne i19 cmp bx,si ; y1,y2 jne i19 call near ptr corpixel jmp short i28 i19: mov dx,ax ; dx,x1 sub dx,cx ; x2 jnc noabsx neg dx noabsx: mov di,bx ; dy,y1 sub di,si ; y2 jnc noabsy neg di ; dy noabsy: cmp dx,di ; dx,dy ja jcc91 jmp short i21 jcc91: cmp ax,cx ; x1,x2 jbe i22 xchg ax,cx ; x1,x2 xchg bx,si ; y1,y2 i22: cmp bx,si ; y1,y2 jae l20004 mov si,1 ; y2,1 jmp short l20005 l20004: mov si,-1 ; y2,-1 l20005: mov bp,dx ; sum,dx shr bp,1 ; sum,1 d23: ;check out mask call near ptr corpixel add bp,di ; sum,dy cmp bp,dx jb i27 sub bp,dx ; sum,dx add bx,si ; y1,y2 i27: inc ax ; x1 cmp ax,cx ; x1,x2 jbe d23 jmp short i28 ; else iterate y's i21: cmp bx,si ; y1,y2 jbe i29 xchg ax,cx ; x1,x2 xchg bx,si ; y1,y2 i29: cmp ax,cx ; x1,x2 jae l20006 mov cx,1 ; x2,1 jmp short l20007 l20006: mov cx,-1 ; x2,-1 l20007: mov bp,di ; sum,dy shr bp,1 ; sum,1 d30: ; check out mask call near ptr corpixel add bp,dx ; sum,dx cmp bp,di ; sum,dy jb i34 sub bp,di ; sum,dy add ax,cx ; x1,x2 i34: inc bx ; y1 cmp bx,si ; y2 jbe d30 i28: pop di pop si pop bp ret _Cor_line endp _GrInit proc far push bp mov bp,sp push di mov ax, [bp+X] ; offset of screen add ax,15 mov cl,4 shr ax,cl add ax, [bp+X+2] ; add segment add ax, (32768/16)-1 and ax, 65535-((32768/16)-1) ; round up to 32K boundary mov cs:ScSeg,ax ; save segment for later push ax mov es, ax xor ax,ax mov di,ax mov cx, 4000h cld rep stosw pop cx call far ptr _GrAddr mov ax,es pop di pop bp ret _GrInit endp _GrReset proc far mov cx, 0 call far ptr _GrAddr ret _GrReset endp _GrAddr proc far mov dx,3b4h ; address of 6845 mov al,0ch ; register 12 out dx,al inc dx mov al,ch ; Graphics Segment High out dx,al dec dx mov al,0dh ; register 13 out dx,al mov al,cl ; Graphics Segment Low inc dx out dx,al ret _GrAddr endp _GrOnly proc far mov dx,3b8h mov al,0a0h out dx,al ret _GrOnly endp _TxOnly proc far mov dx,3b8h mov al,28h out dx,al ret _TxOnly endp _GrandTx proc far mov dx,3b8h mov al,0a8h out dx,al ret _GrandTx endp corpixel proc near push bp mov bp,sp push ax push bx push cx mov es,cs:ScSeg shl bx,1 ; y mov bx,word ptr cs:LookUp[bx] ; bx has y mem address mov cl,al ; x and cl,7 shr ax,1 shr ax,1 shr ax,1 ; ax /= 8 add bx,ax mov al,1 shl al,cl ; al contains bit mask or byte ptr es:[bx],al pop cx pop bx pop ax pop bp ret K equ 1024 mem_mac MACRO 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 dw 18*K+x,20*K+x,22*K+x,24*K+x ENDM ScSeg dw 0 LookUp equ $ mem_mac 0 mem_mac 80 mem_mac (80*2) mem_mac (80*3) mem_mac (80*4) mem_mac (80*5) mem_mac (80*6) mem_mac (80*7) mem_mac (80*8) mem_mac (80*9) mem_mac (80*10) mem_mac (80*11) mem_mac (80*12) mem_mac (80*13) mem_mac (80*14) mem_mac (80*15) mem_mac (80*16) mem_mac (80*17) mem_mac (80*18) mem_mac (80*19) mem_mac (80*20) mem_mac (80*21) mem_mac (80*22) mem_mac (80*23) mem_mac (80*24) corpixel endp _prog ends end ................ ... ...-....1200 N81N ......................... ... ...-....1200 N81N SHAR_EOF echo shar: a missing newline was added to "'corgraph.asm'" echo shar: 8 control characters may be missing from "'corgraph.asm'" if test 3592 -ne "`wc -c < 'corgraph.asm'`" then echo shar: error transmitting "'corgraph.asm'" '(should have been 3592 characters)' fi chmod +x 'corgraph.asm' fi # end of overwriting check echo shar: extracting "'pcgraph.asm'" '(2618 characters)' if test -f 'pcgraph.asm' then echo shar: will not over-write existing file "'pcgraph.asm'" else cat << \SHAR_EOF > 'pcgraph.asm' TITLE PC graphics module ; Colin Kelley ; November 9, 1986 public _PC_line, _PC_color, _PC_mask, _PC_curloc, _PC_puts, _Vmode _prog segment para 'code' assume cs:_prog X equ 6 _PC_line proc far push bp mov bp,sp push si push di mov ax,[bp+X] ; x1 mov bx,[bp+X+2] ; y1 mov cx,[bp+X+4] ; x2 mov si,[bp+X+6] ; y2 cmp ax,cx ; x1,x2 jne i19 cmp bx,si ; y1,y2 jne i19 call near ptr pcpixel jmp short i28 i19: mov dx,ax ; dx,x1 sub dx,cx ; x2 jnc noabsx neg dx noabsx: mov di,bx ; dy,y1 sub di,si ; y2 jnc noabsy neg di ; dy noabsy: cmp dx,di ; dx,dy ja jcc91 jmp short i21 jcc91: cmp ax,cx ; x1,x2 jbe i22 xchg ax,cx ; x1,x2 xchg bx,si ; y1,y2 i22: cmp bx,si ; y1,y2 jae l20004 mov si,1 ; y2,1 jmp short l20005 l20004: mov si,-1 ; y2,-1 l20005: mov bp,dx ; sum,dx shr bp,1 ; sum,1 d23: call near ptr pcpixel add bp,di ; sum,dy cmp bp,dx jb i27 sub bp,dx ; sum,dx add bx,si ; y1,y2 i27: inc ax ; x1 cmp ax,cx ; x1,x2 jbe d23 jmp short i28 ; else iterate y's i21: cmp bx,si ; y1,y2 jbe i29 xchg ax,cx ; x1,x2 xchg bx,si ; y1,y2 i29: cmp ax,cx ; x1,x2 jae l20006 mov cx,1 ; x2,1 jmp short l20007 l20006: mov cx,-1 ; x2,-1 l20007: mov bp,di ; sum,dy shr bp,1 ; sum,1 d30: call near ptr pcpixel add bp,dx ; sum,dx cmp bp,di ; sum,dy jb i34 sub bp,di ; sum,dy add ax,cx ; x1,x2 i34: inc bx ; y1 cmp bx,si ; y2 jbe d30 i28: pop di pop si pop bp ret _PC_line endp _PC_color proc far push bp mov bp,sp mov al,[bp+X] ; color mov byte ptr cs:color,al pop bp ret _PC_color endp _PC_mask proc far push bp mov bp,sp mov ax,[bp+X] ; mask mov word ptr cs:mask,ax pop bp ret _PC_mask endp mask dw -1 color db 1 _Vmode proc far push bp mov bp,sp push si push di mov ax,[bp+X] int 10h pop di pop si pop bp ret _Vmode endp pcpixel proc near ror word ptr cs:mask,1 jc cont ret cont: push ax push bx push cx push dx mov cx,ax ; x mov dx,bx ; y mov ah,0ch ; ah = write pixel mov al,byte ptr cs:color mov bh, 0 ; page 0 int 10h pop dx pop cx pop bx pop ax ret pcpixel endp _PC_curloc proc far push bp mov bp,sp mov dh, byte ptr [bp+X] ; row number mov dl, byte ptr [bp+X+2] ; col number mov bh, 0 mov ah, 2 int 10h pop bp ret _PC_curloc endp _PC_puts proc far push bp mov bp,sp mov ah,0eh ; write TTY char mov bl,byte ptr cs:color mov es,[bp+X+2] ; segment mov bp,[bp+X] ; offset puts2: mov al,es:[bp] or al,al jz puts3 int 10h inc bp jmp short puts2 puts3: pop bp ret _PC_puts endp _prog ends end ov bp,sp push ax push bx push cx mov es,c SHAR_EOF echo shar: a missing newline was added to "'pcgraph.asm'" if test 2618 -ne "`wc -c < 'pcgraph.asm'`" then echo shar: error transmitting "'pcgraph.asm'" '(should have been 2618 characters)' fi chmod +x 'pcgraph.asm' fi # end of overwriting check echo shar: extracting "'plot.h'" '(4216 characters)' if test -f 'plot.h' then echo shar: will not over-write existing file "'plot.h'" else cat << \SHAR_EOF > 'plot.h' /* * * G N U P L O T -- plot.h * * Copyright (C) 1986 Colin Kelley, Thomas Williams * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #define PATCHLEVEL 0 #define PROGRAM "gnuplot" #define PROMPT "gnuplot> " #define SHELL "/bin/sh" #ifdef vms #define HELP "" #else /* vms */ #define HELP "/usr/local/bin/help gnuplot" #endif #define TRUE 1 #define FALSE 0 #define Pi 3.141592653589793 #define MAX_PLOTS 9 /* max number of overlapping plots */ #define MAX_LINE_LEN 255 /* maximum number of chars allowed on line */ #define MAX_TOKENS 200 #define MAX_ID_LEN 20 /* max length of an identifier */ #ifdef PC #define MAX_UDFS 30 /* max number of user-defined functions */ #else /* PC */ #define MAX_UDFS 100 #endif /* PC */ #define MAX_VALUES 50 /* max number of user-defined constants */ #define MAX_AT_LEN 100 /* max number of entries in action table */ #define STACK_DEPTH 100 #define NO_CARET (-1) #define SAMPLES 160 /* default number of samples for a plot */ #define ZERO 1e-8 /* default for 'zero' set option */ /* * note about HUGE: this number is just used as a flag for really * big numbers, so it doesn't have to be the absolutely biggest number * on the machine. */ #ifdef PC #define HUGE 1e38 #endif /* PC */ #define END_OF_COMMAND (c_token == num_tokens || equals(c_token,";")) #define push(arg) f_pushc(arg) /* same thing! */ #define top_of_stack stack[s_p] typedef int BOOLEAN; typedef int (*FUNC_PTR)(); enum { C_PI, NEXT_VALUE }; enum operators { PUSH, PUSHC, PUSHD, CALL, TERNIARY, LNOT, BNOT, UMINUS, LOR, LAND, BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT, DIV, MOD, POWER, SF_START }; enum DATA_TYPES { INT, CMPLX }; enum PLOT_TYPES { FUNC, DATA }; enum PLOT_STYLE { LINES, POINTS, IMPULSES }; struct cmplx { double real, imag; }; struct value { enum DATA_TYPES type; union { char *str_val; int int_val; struct cmplx cmplx_val; } v; }; struct lexical_unit { BOOLEAN is_token; /* true if token, false if a value */ struct value l_val; int start_index; /* index of first char in token */ int length; /* length of token in chars */ }; struct at_entry { /* action table entry */ int index; /* index into function table */ struct value arg; }; struct at_type { int count; struct at_entry actions[MAX_AT_LEN]; }; struct ft_entry { /* standard function table entry */ char *ft_name; /* pointer to name of this function */ FUNC_PTR funct; /* address of function to call */ }; struct udft_entry { /* user-defined function table entry */ char udft_name[MAX_ID_LEN+1];/* name of this function entry */ struct at_type at; /* action table to execute */ char definition[MAX_LINE_LEN+1]; /* definition of function as typed */ struct value dummy_value;/* current value of dummy variable */ }; struct vt_entry { /* value table entry */ char vt_name[MAX_ID_LEN+1];/* name of this value entry */ BOOLEAN vt_undef; /* true if not defined yet */ struct value vt_value; /* value it has */ }; struct coordinate { BOOLEAN undefined; /* TRUE if value off screen */ #ifdef PC float x, y; /* memory is tight on PCs! */ #else double x, y; #endif /* PC */ }; struct curve_points { enum PLOT_TYPES plot_type; enum PLOT_STYLE plot_style; char title[MAX_LINE_LEN + 1]; int count; struct coordinate *points; }; struct termentry { char name[MAX_ID_LEN + 1]; unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic; FUNC_PTR init,reset,text,graphics,move,vector,linetype,lrput_text, ulput_text,point; }; /* * SS$_NORMAL is "normal completion", STS$M_INHIB_MSG supresses * printing a status message. * SS$_ABORT is the general abort status code. from: Martin Minow decvax!minow */ #ifdef vms #include <ssdef.h> #include <stsdef.h> #define IO_SUCCESS (SS$_NORMAL | STS$M_INHIB_MSG) #define IO_ERROR SS$_ABORT #endif /* vms */ #ifndef IO_SUCCESS /* DECUS or VMS C will have defined these already */ #define IO_SUCCESS 0 #endif #ifndef IO_ERROR #define IO_ERROR 1 #endif SHAR_EOF if test 4216 -ne "`wc -c < 'plot.h'`" then echo shar: error transmitting "'plot.h'" '(should have been 4216 characters)' fi chmod +x 'plot.h' fi # end of overwriting check echo shar: extracting "'vmshelp.csh'" '(500 characters)' if test -f 'vmshelp.csh' then echo shar: will not over-write existing file "'vmshelp.csh'" else cat << \SHAR_EOF > 'vmshelp.csh' #! /bin/csh # # vmshelp.csh /usr/help/gnuplot/* > gnuplot.hlp # will convert the Unix help tree to VMS format, # then use $ LIB/HELP GNUPLOT GNUPLOT under VMS to create the VMS .HLB if (! $?level) then setenv level 0 endif @ leveltmp = ($level + 1) setenv level $leveltmp foreach i ($*) if (-f $i) then # plain file echo -n "$level " basename $i .HLP sed 's/^/ /' $i else if (-d $i) then # directory echo -n "$level " basename $i sed 's/^/ /' $i/.HLP # recurse! $0 $i/* endif end SHAR_EOF if test 500 -ne "`wc -c < 'vmshelp.csh'`" then echo shar: error transmitting "'vmshelp.csh'" '(should have been 500 characters)' fi chmod +x 'vmshelp.csh' fi # end of overwriting check echo shar: extracting "'simple.demo'" '(488 characters)' if test -f 'simple.demo' then echo shar: will not over-write existing file "'simple.demo'" else cat << \SHAR_EOF > 'simple.demo' set samples 50 plot [-10:10] sin(x),atan(x),cos(atan(x)) set samples 100 plot [-pi/2:pi] cos(x),-(sin(x) > sin(x+1) ? sin(x) : sin(x+1)) set samples 200 plot [-3:5] asin(x),acos(x) plot [-30:20] besj0(x)*0.12e1 with impulses, (x**besj0(x))-2.5 with points set samples 400 plot [-10:10] real(sin(x)**besj0(x)) plot [-5*pi:5*pi] [-5:5] real(tan(x)/atan(x)), 1/x set autoscale set samples 800 plot [-30:20] sin(x*20)*atan(x) plot [-19:19] '1.dat'with impulses ,'2.dat' ,'3.dat' with lines SHAR_EOF if test 488 -ne "`wc -c < 'simple.demo'`" then echo shar: error transmitting "'simple.demo'" '(should have been 488 characters)' fi chmod +x 'simple.demo' fi # end of overwriting check echo shar: extracting "'1.dat'" '(781 characters)' if test -f '1.dat' then echo shar: will not over-write existing file "'1.dat'" else cat << \SHAR_EOF > '1.dat' -20.000000 -3.041676 -19.000000 -3.036427 -18.000000 -3.030596 -17.000000 -3.024081 -16.000000 -3.016755 -15.000000 -3.008456 -14.000000 -2.998978 -13.000000 -2.988049 -12.000000 -2.975310 -11.000000 -2.960273 -10.000000 -2.942255 -9.000000 -2.920278 -8.000000 -2.892883 -7.000000 -2.857799 -6.000000 -2.811295 -5.000000 -2.746802 -4.000000 -2.651635 -3.000000 -2.498092 -2.000000 -2.214297 -1.000000 -1.570796 0.000000 0.000000 1.000000 1.570796 2.000000 2.214297 3.000000 2.498092 4.000000 2.651635 5.000000 2.746802 6.000000 2.811295 7.000000 2.857799 8.000000 2.892883 9.000000 2.920278 10.000000 2.942255 11.000000 2.960273 12.000000 2.975310 13.000000 2.988049 14.000000 2.998978 15.000000 3.008456 16.000000 3.016755 17.000000 3.024081 18.000000 3.030596 19.000000 3.036427 SHAR_EOF if test 781 -ne "`wc -c < '1.dat'`" then echo shar: error transmitting "'1.dat'" '(should have been 781 characters)' fi chmod +x '1.dat' fi # end of overwriting check echo shar: extracting "'2.dat'" '(781 characters)' if test -f '2.dat' then echo shar: will not over-write existing file "'2.dat'" else cat << \SHAR_EOF > '2.dat' -20.000000 -6.083352 -19.000000 -6.072853 -18.000000 -6.061191 -17.000000 -6.048162 -16.000000 -6.033510 -15.000000 -6.016913 -14.000000 -5.997955 -13.000000 -5.976098 -12.000000 -5.950620 -11.000000 -5.920546 -10.000000 -5.884511 -9.000000 -5.840556 -8.000000 -5.785765 -7.000000 -5.715597 -6.000000 -5.622591 -5.000000 -5.493603 -4.000000 -5.303271 -3.000000 -4.996183 -2.000000 -4.428595 -1.000000 -3.141593 0.000000 0.000000 1.000000 3.141593 2.000000 4.428595 3.000000 4.996183 4.000000 5.303271 5.000000 5.493603 6.000000 5.622591 7.000000 5.715597 8.000000 5.785765 9.000000 5.840556 10.000000 5.884511 11.000000 5.920546 12.000000 5.950620 13.000000 5.976098 14.000000 5.997955 15.000000 6.016913 16.000000 6.033510 17.000000 6.048162 18.000000 6.061191 19.000000 6.072853 SHAR_EOF if test 781 -ne "`wc -c < '2.dat'`" then echo shar: error transmitting "'2.dat'" '(should have been 781 characters)' fi chmod +x '2.dat' fi # end of overwriting check echo shar: extracting "'3.dat'" '(781 characters)' if test -f '3.dat' then echo shar: will not over-write existing file "'3.dat'" else cat << \SHAR_EOF > '3.dat' -20.000000 -9.125028 -19.000000 -9.109280 -18.000000 -9.091787 -17.000000 -9.072243 -16.000000 -9.050265 -15.000000 -9.025369 -14.000000 -8.996933 -13.000000 -8.964147 -12.000000 -8.925931 -11.000000 -8.880819 -10.000000 -8.826766 -9.000000 -8.760835 -8.000000 -8.678648 -7.000000 -8.573396 -6.000000 -8.433886 -5.000000 -8.240405 -4.000000 -7.954906 -3.000000 -7.494275 -2.000000 -6.642892 -1.000000 -4.712389 0.000000 0.000000 1.000000 4.712389 2.000000 6.642892 3.000000 7.494275 4.000000 7.954906 5.000000 8.240405 6.000000 8.433886 7.000000 8.573396 8.000000 8.678648 9.000000 8.760835 10.000000 8.826766 11.000000 8.880819 12.000000 8.925931 13.000000 8.964147 14.000000 8.996933 15.000000 9.025369 16.000000 9.050265 17.000000 9.072243 18.000000 9.091787 19.000000 9.109280 SHAR_EOF if test 781 -ne "`wc -c < '3.dat'`" then echo shar: error transmitting "'3.dat'" '(should have been 781 characters)' fi chmod +x '3.dat' fi # end of overwriting check # End of shell archive exit 0
taw@vu-vlsi.UUCP (Thomas Williams) (11/18/86)
This is part 1 of 4 gnuplot shar files. ---------------------------CUT HERE------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # command.c # eval.c # graphics.c # internal.c # misc.c # This archive created: Mon Nov 17 19:30:35 1986 export PATH; PATH=/bin:$PATH echo shar: extracting "'command.c'" '(21464 characters)' if test -f 'command.c' then echo shar: will not over-write existing file "'command.c'" else cat << \SHAR_EOF > 'command.c' /* * * G N U P L O T -- command.c * * Copyright (C) 1986 Thomas Williams, Colin Kelley * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include <math.h> #include "plot.h" #ifndef STDOUT #define STDOUT 1 #endif /* * global variables to hold status of 'set' options * */ BOOLEAN autoscale = TRUE; enum PLOT_STYLE data_style = POINTS, func_style = LINES; BOOLEAN log_x = FALSE, log_y = FALSE; FILE* outfile; char outstr[MAX_ID_LEN+1] = "STDOUT"; int samples = SAMPLES; int term = 0; /* unknown term is 0 */ double xmin = -10, xmax = 10, ymin = -10, ymax = 10; double zero = ZERO; /* zero threshold, not 0! */ BOOLEAN screen_ok; BOOLEAN term_init; BOOLEAN undefined; /* * instead of <strings.h> */ char *gets(),*getenv(); char *strcpy(),*strcat(); double magnitude(),angle(),real(),imag(); struct value *const_express(), *pop(), *complex(); extern struct vt_entry vt[]; extern struct udft_entry udft[]; extern struct termentry term_tbl[]; char input_line[MAX_LINE_LEN],dummy_var[MAX_ID_LEN + 1]; struct at_type *curr_at; int c_token; int next_value = (int)NEXT_VALUE,next_function = 0,c_function = 0; int num_tokens; struct curve_points plot[MAX_PLOTS]; static char help[80] = HELP; #ifdef MSDOS #include <process.h> #endif /* MSDOS */ #ifdef vms #include <descrip.h> #include <rmsdef.h> #include <errno.h> extern lib$get_input(), lib$put_output(); int vms_len; unsigned int status[2] = {1, 0}; $DESCRIPTOR(prompt_desc,PROMPT); $DESCRIPTOR(line_desc,input_line); $DESCRIPTOR(null_desc,""); $DESCRIPTOR(help_desc,help); $DESCRIPTOR(helpfile_desc,"GNUPLOT$HELP"); struct dsc$descriptor_s *cmd_ptr; #endif com_line() { #ifdef vms switch(status[1] = lib$get_input(&line_desc, &prompt_desc, &vms_len)){ case RMS$_EOF: done(IO_SUCCESS); /* ^Z isn't really an error */ break; case RMS$_TNS: /* didn't press return in time */ vms_len--; /* skip the last character */ break; /* and parse anyway */ case RMS$_BES: /* Bad Escape Sequence */ case RMS$_PES: /* Partial Escape Sequence */ sys$putmsg(status); vms_len = 0; /* ignore the line */ break; case SS$_NORMAL: break; /* everything's fine */ default: done(status[1]); /* give the error message */ } if (vms_len && (input_line[0] == '!' || input_line[0] == '$')) { if (vms_len == 1) /* spawn an interactive shell */ cmd_ptr = &null_desc; else { cmd_ptr = &line_desc; input_line[0] = ' '; /* an embarrassment, but... */ } if ((status[1] = lib$spawn(cmd_ptr)) != SS$_NORMAL) { sys$putmsg(status); } (void) putchar('\n'); } else { input_line[vms_len] = '\0'; #else /* not VMS */ fprintf(stderr,PROMPT); #ifdef MSDOS input_line[0] = MAX_LINE_LEN - 2; cgets(input_line); /* console input so CED will work */ (void) putc('\n',stderr); if (input_line[2] == 26) { (void) putc('\n',stderr); /* end-of-file */ done(IO_SUCCESS); } { register int i = -1; do /* yuck! move everything down two characters */ i++; while (input_line[i] = input_line[i+2]); } #else /* MSDOS */ /* plain old Unix */ if (!(int) gets(input_line)) { (void) putc('\n',stderr); /* end-of-file */ done(IO_SUCCESS); } #endif /* MSDOS */ screen_ok = TRUE; /* so we can flag any new output */ if (input_line[0] == '!') { if (system(input_line + 1)) os_error("system() failed",NO_CARET); } else { #endif /* vms */ do_line(); } } do_line() /* also used in load_file */ { num_tokens = scanner(input_line); c_token = 0; while(c_token < num_tokens) { command(); if (c_token < num_tokens) /* something after command */ if (equals(c_token,";")) c_token++; else int_error("';' expected",c_token); } } command() { register int tsamp,len; register FILE *f; struct value a; static char sv_file[MAX_ID_LEN+1]; /* string holding name of save or load file */ dummy_var[0] = '\0'; /* no dummy variable */ if (is_definition(c_token)) define(); else if (equals(c_token,"help") || equals(c_token,"?")) { c_token++; len = sizeof(HELP)-1; help[len] = '\0'; /* remove previous help arguments */ while (!(END_OF_COMMAND)) { help[len] = ' '; /* put blank between help segments */ copy_str(help+len+1,c_token++); len = strlen(help); } #ifdef vms help_desc.dsc$w_length = len; if ((vaxc$errno = lbr$output_help(lib$put_output,0,&help_desc, &helpfile_desc,0,lib$get_input)) != SS$_NORMAL) os_error("can't open GNUPLOT$HELP"); #else /* vms */ if (system(help)) os_error("can't spawn help"); #endif /* vms */ screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"pr$int")) { c_token++; (void) const_express(&a); (void) putc('\t',stderr); show_value(stderr,&a); (void) putc('\n',stderr); screen_ok = FALSE; } else if (almost_equals(c_token,"p$lot")) { c_token++; plotrequest(); } else if (almost_equals(c_token,"se$t")) { if (almost_equals(++c_token,"t$erminal")) { c_token++; if (END_OF_COMMAND) list_terms(); else term = set_term(c_token); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"sa$mples")) { c_token++; tsamp = (int)magnitude(const_express(&a)); if (tsamp < 1) int_error("sampling rate must be > 0; sampling unchanged", c_token); else { samples = tsamp; pointmem(samples); } } else if (almost_equals(c_token,"o$utput")) { c_token++; if (END_OF_COMMAND) { /* no file specified */ (void) fclose(outfile); outfile = fdopen(dup(STDOUT), "w"); term_init = FALSE; (void) strcpy(outstr,"STDOUT"); } else if (!isstring(c_token)) int_error("expecting filename",c_token); else { quote_str(sv_file,c_token); if (!(f = fopen(sv_file,"w"))) { os_error("cannot open file; output not changed",c_token); } (void) fclose(outfile); outfile = f; term_init = FALSE; outstr[0] = '\''; strcat(strcpy(outstr+1,sv_file),"'"); } c_token++; } else if (almost_equals(c_token,"a$utoscale")) { autoscale = TRUE; c_token++; } else if (almost_equals(c_token,"noa$utoscale")) { autoscale = FALSE; c_token++; } else if (almost_equals(c_token,"nol$ogscale")) { log_x = log_y = FALSE; c_token++; } else if (almost_equals(c_token,"z$ero")) { c_token++; zero = magnitude(const_express(&a)); } else if (almost_equals(c_token,"x$range")) { c_token++; if (!equals(c_token,"[")) int_error("expecting '['",c_token); c_token++; load_range(&xmin,&xmax); if (!equals(c_token,"]")) int_error("expecting ']'",c_token); c_token++; } else if (almost_equals(c_token,"y$range")) { c_token++; if (!equals(c_token,"[")) int_error("expecting '['",c_token); c_token++; load_range(&ymin,&ymax); autoscale = FALSE; if (!equals(c_token,"]")) int_error("expecting ']'",c_token); c_token++; } else if (almost_equals(c_token,"l$ogscale")) { c_token++; if (equals(c_token,"x")) { log_y = FALSE; log_x = TRUE; c_token++; } else if (equals(c_token,"y")) { log_x = FALSE; log_y = TRUE; c_token++; } else if (equals(c_token,"xy") || equals(c_token,"yx")) { log_x = log_y = TRUE; c_token++; } else int_error("expecting 'x', 'y', or 'xy'",c_token); } else if (almost_equals(c_token,"d$ata")) { c_token++; if (!almost_equals(c_token,"s$tyle")) int_error("expecting keyword 'style'",c_token); c_token++; if (almost_equals(c_token,"l$ines")) { data_style = LINES; } else if (almost_equals(c_token,"i$mpulses")) { data_style = IMPULSES; } else if (almost_equals(c_token,"p$oints")) { data_style = POINTS; } else int_error("expecting 'lines', 'points', or 'impulses'",c_token); c_token++; } else if (almost_equals(c_token,"f$unction")) { c_token++; if (!almost_equals(c_token,"s$tyle")) int_error("expecting keyword 'style'",c_token); c_token++; if (almost_equals(c_token,"l$ines")) { func_style = LINES; } else if (almost_equals(c_token,"i$mpulses")) { func_style = IMPULSES; } else if (almost_equals(c_token,"p$oints")) { func_style = POINTS; } else int_error("expecting 'lines', 'points', or 'impulses'",c_token); c_token++; } else int_error("unknown set option (try 'help set')",c_token); } else if (almost_equals(c_token,"sh$ow")) { if (almost_equals(++c_token,"f$unctions")) { c_token++; if (almost_equals(c_token,"s$tyle")) { fprintf(stderr,"\nfunctions are plotted with "); switch (func_style) { case LINES: fprintf(stderr,"lines.\n\n"); break; case POINTS: fprintf(stderr,"points.\n\n"); break; case IMPULSES: fprintf(stderr,"impulses.\n\n"); break; } screen_ok = FALSE; c_token++; } else view_functions(); } else if (almost_equals(c_token,"v$ariables")) { view_variables(); c_token++; } else if (almost_equals(c_token,"ac$tion_table") || equals(c_token,"at") ) { c_token++; view_at(); c_token++; } else if (almost_equals(c_token,"d$ata")) { c_token++; if (!almost_equals(c_token,"s$tyle")) int_error("expecting keyword 'style'",c_token); fprintf(stderr,"\ndata is plotted with "); switch (data_style) { case LINES: fprintf(stderr,"lines.\n\n"); break; case POINTS: fprintf(stderr,"points.\n\n"); break; case IMPULSES: fprintf(stderr,"impulses.\n\n"); break; } screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"x$range")) { fprintf(stderr,"\nxrange is [%g : %g]\n\n",xmin,xmax); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"y$range")) { fprintf(stderr,"\nyrange is [%g : %g]\n\n",ymin,ymax); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"z$ero")) { fprintf(stderr,"\nzero is %g\n\n",zero); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"sa$mples")) { fprintf(stderr,"\nsampling rate is %d\n\n",samples); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"o$utput")) { fprintf(stderr,"\noutput is sent to %s\n\n",outstr); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"t$erminal")) { fprintf(stderr,"\nterminal type is %s\n\n",term_tbl[term].name); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"au$toscale")) { fprintf(stderr,"\nautoscaling is %s\n\n",(autoscale)? "ON" : "OFF"); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"ve$rsion")) { (void) putc('\n',stderr); show_version(); c_token++; } else if (almost_equals(c_token,"l$ogscale")) { if (log_x && log_y) fprintf(stderr,"\nlogscaling both x and y axes\n\n"); else if (log_x) fprintf(stderr,"\nlogscaling x axis\n\n"); else if (log_y) fprintf(stderr,"\nlogscaling y axis\n\n"); else fprintf(stderr,"\nno logscaling\n\n"); c_token++; } else if (almost_equals(c_token,"a$ll")) { c_token++; (void) putc('\n',stderr); show_version(); fprintf(stderr,"data is plotted with "); switch (data_style) { case LINES: fprintf(stderr,"lines.\n"); break; case POINTS: fprintf(stderr,"points.\n"); break; case IMPULSES: fprintf(stderr,"impulses.\n"); break; } fprintf(stderr,"functions are plotted with "); switch (func_style) { case LINES: fprintf(stderr,"lines.\n"); break; case POINTS: fprintf(stderr,"points.\n"); break; case IMPULSES: fprintf(stderr,"impulses.\n"); break; } fprintf(stderr,"output is sent to %s\n",outstr); fprintf(stderr,"terminal type is %s\n",term_tbl[term].name); fprintf(stderr,"sampling rate is %d\n\n",samples); if (log_x && log_y) fprintf(stderr,"logscaling both x and y axes\n"); else if (log_x) fprintf(stderr,"logscaling x axis\n"); else if (log_y) fprintf(stderr,"logscaling y axis\n"); else fprintf(stderr,"no logscaling\n"); fprintf(stderr,"autoscaling is %s\n",(autoscale)? "ON" : "OFF"); fprintf(stderr,"zero is %g\n",zero); fprintf(stderr,"xrange is [%g : %g]\n",xmin,xmax); fprintf(stderr,"yrange is [%g : %g]\n",ymin,ymax); view_variables(); view_functions(); c_token++; } else int_error("unknown show option (try 'help show')",c_token); } else if (almost_equals(c_token,"cl$ear")) { /* now does clear screen! */ if (!term_init) { (*term_tbl[term].init)(); term_init = TRUE; } (*term_tbl[term].graphics)(); (*term_tbl[term].text)(); (void) fflush(outfile); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"she$ll")) { do_shell(); screen_ok = FALSE; c_token++; } else if (almost_equals(c_token,"sa$ve")) { if (almost_equals(++c_token,"f$unctions")) { if (!isstring(++c_token)) int_error("expecting filename",c_token); else { quote_str(sv_file,c_token); save_functions(fopen(sv_file,"w")); } } else if (almost_equals(c_token,"v$ariables")) { if (!isstring(++c_token)) int_error("expecting filename",c_token); else { quote_str(sv_file,c_token); save_variables(fopen(sv_file,"w")); } } else if (isstring(c_token)) { quote_str(sv_file,c_token); save_all(fopen(sv_file,"w")); } else { int_error( "filename or keyword 'functions' or 'variables' expected",c_token); } c_token++; } else if (almost_equals(c_token,"l$oad")) { if (!isstring(++c_token)) int_error("expecting filename",c_token); else { quote_str(sv_file,c_token); load_file(fopen(sv_file,"r")); } /* input_line[] and token[] now destroyed! */ } else if (almost_equals(c_token,"ex$it") || almost_equals(c_token,"q$uit")) { done(IO_SUCCESS); } else if (!equals(c_token,";")) { /* null statement */ int_error("invalid command",c_token); } } load_range(a,b) double *a,*b; { struct value t; if (equals(c_token,"]")) return; if (END_OF_COMMAND) { int_error("starting range value or 'to' expected",c_token); } else if (!equals(c_token,"to") && !equals(c_token,":")) { *a = real(const_express(&t)); } if (!equals(c_token,"to") && !equals(c_token,":")) int_error("Keyword 'to' or ':' expected",c_token); c_token++; if (!equals(c_token,"]")) *b = real(const_express(&t)); } plotrequest() { dummy_var[0] = 'x'; /* default */ dummy_var[1] = '\0'; if (equals(c_token,"[")) { c_token++; if (isletter(c_token)) { copy_str(dummy_var,c_token++); if (equals(c_token,"=")) c_token++; else int_error("'=' expected",c_token); } load_range(&xmin,&xmax); if (!equals(c_token,"]")) int_error("']' expected",c_token); c_token++; } if (equals(c_token,"[")) { /* set optional y ranges */ c_token++; load_range(&ymin,&ymax); autoscale = FALSE; if (!equals(c_token,"]")) int_error("']' expected",c_token); c_token++; } eval_plots(); } define() { register int value,start_token; /* start_token is the 1st token in the */ /* function definition. */ if (equals(c_token+1,"(")) { /* function ! */ start_token = c_token; copy_str(dummy_var, c_token + 2); c_token += 5; /* skip (, dummy, ) and = */ value = c_function = user_defined(start_token); build_at(&(udft[value].at)); /* define User Defined Function (parse.c)*/ capture(udft[value].definition,start_token,c_token-1); } else { /* variable ! */ c_token +=2; (void) const_express(&vt[value = add_value(c_token - 2) ].vt_value); vt[value].vt_undef = FALSE; } } #define iscomment(c) (c == '!' || c == '#') get_data(plot_num) int plot_num; { static char data_file[MAX_ID_LEN+1], line[MAX_LINE_LEN+1]; register int i, l_num; register FILE *fp; float x, y; quote_str(data_file, c_token); plot[plot_num].plot_type = DATA; if (!(fp = fopen(data_file, "r"))) os_error("can't open data file", c_token); l_num = 0; i = 0; while (fgets(line, MAX_LINE_LEN, fp)) { l_num++; if (iscomment(line[0]) || ! line[1]) /* line[0] will be '\n' */ continue; /* ignore comments and blank lines */ switch (sscanf(line, "%f %f", &x, &y)) { case 1: /* only one number on the line */ y = x; /* assign that number to y */ x = i; /* and make the index into x */ /* no break; !!! */ case 2: if (x >= xmin && x <= xmax && (autoscale || (y >= ymin && y <= ymax))) { if (log_x) { if (x <= 0.0) break; plot[plot_num].points[i].x = log10(x); } else plot[plot_num].points[i].x = x; if (log_y) { if (y <= 0.0) break; plot[plot_num].points[i].y = log10(y); } else plot[plot_num].points[i].y = y; if (autoscale) { if (y < ymin) ymin = y; if (y > ymax) ymax = y; } i++; } break; default: (void) sprintf(line, "bad data on line %d", l_num); int_error(line,c_token); } } plot[plot_num].count = i; } eval_plots() { register int i, plot_num, start_token, mysamples; register double x_min, x_max, y_min, y_max, x; register double xdiff, temp; struct value a; /* don't sample higher than output device can handle! */ mysamples = (samples <= term_tbl[term].xmax) ?samples :term_tbl[term].xmax; if (log_x) { if (xmin < 0.0 || xmax < 0.0) int_error("x range must be greater than 0 for log scale!",NO_CARET); x_min = log10(xmin); x_max = log10(xmax); } else { x_min = xmin; x_max = xmax; } if (autoscale) { ymin = HUGE; ymax = -HUGE; } else if (log_y && (ymin <= 0.0 || ymax <= 0.0)) int_error("y range must be greater than 0 for log scale!", NO_CARET); xdiff = (x_max - x_min) / mysamples; c_function = MAX_UDFS; /* last udft[] entry used for plots */ plot_num = 0; while (TRUE) { if (END_OF_COMMAND) int_error("function to plot expected",c_token); if (plot_num == MAX_PLOTS || plot[plot_num].points == NULL) int_error("maximum number of plots exceeded",NO_CARET); start_token = c_token; if (is_definition(c_token)) { define(); } else { if (isstring(c_token)) { /* data file to plot */ plot[plot_num].plot_type = DATA; plot[plot_num].plot_style = data_style; get_data(plot_num); c_token++; } else { /* function to plot */ plot[plot_num].plot_type = FUNC; plot[plot_num].plot_style = func_style; build_at(&udft[MAX_UDFS].at); for (i = 0; i <= mysamples; i++) { if (i == samples+1) int_error("number of points exceeded samples", NO_CARET); x = x_min + i*xdiff; if (log_x) x = pow(10.0,x); (void) complex(&udft[MAX_UDFS].dummy_value, x, 0.0); evaluate_at(&udft[MAX_UDFS].at,&a); if (plot[plot_num].points[i].undefined = undefined || (fabs(imag(&a)) > zero)) continue; temp = real(&a); if (log_y && temp <= 0.0) { plot[plot_num].points[i].undefined = TRUE; continue; } if (autoscale) { if (temp < ymin) ymin = temp; if (temp > ymax) ymax = temp; } else if (temp < ymin || temp > ymax) { plot[plot_num].points[i].undefined = TRUE; continue; } plot[plot_num].points[i].y = log_y ? log10(temp) : temp; } plot[plot_num].count = i; /* mysamples + 1 */ } capture(plot[plot_num].title,start_token,c_token-1); if (almost_equals(c_token,"w$ith")) { c_token++; if (almost_equals(c_token,"l$ines")) { plot[plot_num].plot_style = LINES; } else if (almost_equals(c_token,"i$mpulses")) { plot[plot_num].plot_style = IMPULSES; } else if (almost_equals(c_token,"p$oints")) { plot[plot_num].plot_style = POINTS; } else int_error("expecting 'lines', 'points', or 'impulses'", c_token); c_token++; } plot_num++; } if (equals(c_token,",")) c_token++; else break; } if (autoscale && (ymin == ymax)) ymax += 1.0; /* kludge to avoid divide-by-zero in do_plot */ if (log_y) { y_min = log10(ymin); y_max = log10(ymax); } else { y_min = ymin; y_max = ymax; } do_plot(plot,plot_num,x_min,x_max,y_min,y_max); } done(status) int status; { if (term) (*term_tbl[term].reset)(); exit(status); } #ifdef vms do_shell() { if ((vaxc$errno = lib$spawn()) != SS$_NORMAL) { os_error("spawn error"); } } #else /* vms */ #ifdef MSDOS do_shell() { register char *comspec; if (!(comspec = getenv("COMSPEC"))) comspec = "\command.com"; if (spawnl(P_WAIT,comspec,NULL)) os_error("unable to spawn shell"); } #else /* MSDOS */ #ifdef VFORK do_shell() { register char *shell; register int p; static int execstat; if (!(shell = getenv("SHELL"))) shell = SHELL; if ((p = vfork()) == 0) { execstat = execl(shell,shell,NULL); _exit(1); } else if (p == -1) os_error("vfork failed",c_token); else while (wait(NULL) != p) ; if (execstat == -1) os_error("shell exec failed",c_token); (void) putc('\n',stderr); } #else /* VFORK */ #define EXEC "exec " do_shell() { static char exec[100] = EXEC; register char *shell; if (!(shell = getenv("SHELL"))) shell = SHELL; if (system(strcpy(&exec[sizeof(EXEC)-1],shell))) os_error("system() failed",NO_CARET); (void) putc('\n',stderr); } #endif /* VFORK */ #endif /* MSDOS */ #endif /* vms */ SHAR_EOF if test 21464 -ne "`wc -c < 'command.c'`" then echo shar: error transmitting "'command.c'" '(should have been 21464 characters)' fi chmod +x 'command.c' fi # end of overwriting check echo shar: extracting "'eval.c'" '(2739 characters)' if test -f 'eval.c' then echo shar: will not over-write existing file "'eval.c'" else cat << \SHAR_EOF > 'eval.c' /* * * G N U P L O T -- eval.c * * Copyright (C) 1986 Colin Kelley, Thomas Williams * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include "plot.h" extern int c_token,next_value,next_function; extern struct udft_entry udft[]; extern struct ft_entry ft[]; extern struct vt_entry vt[]; extern struct at_type *curr_at; extern struct lexical_unit token[]; struct value *integer(); int add_value(t_num) int t_num; { register int i; /* check if it's already in the table... */ for (i = 0; i < next_value; i++) { if (equals(t_num,vt[i].vt_name)) return(i); } if (next_value == MAX_VALUES) int_error("user defined constant space full",NO_CARET); copy_str(vt[next_value].vt_name,t_num); vt[next_value].vt_value.type = INT; /* not necessary, but safe! */ vt[next_value].vt_undef = TRUE; return(next_value++); } add_action(sf_index,arg) enum operators sf_index; struct value *arg; /* argument to pass to standard function indexed by sf_index */ { if ( curr_at->count >= MAX_AT_LEN ) int_error("action table overflow",NO_CARET); curr_at->actions[curr_at->count].index = ((int)sf_index); if (arg != (struct value *)0) curr_at->actions[curr_at->count].arg = *arg; curr_at->count++; } int standard(t_num) /* return standard function index or 0 */ { register int i; for (i = (int)SF_START; ft[i].ft_name != NULL; i++) { if (equals(t_num,ft[i].ft_name)) return(i); } return(0); } int user_defined(t_num) /* find or add function and return index */ int t_num; /* index to token[] */ { register int i; for (i = 0; i < next_function; i++) { if (equals(t_num,udft[i].udft_name)) return(i); } if (next_function == MAX_UDFS) int_error("user defined function space full",t_num); copy_str(udft[next_function].udft_name,t_num); udft[next_function].definition[0] = '\0'; udft[next_function].at.count = 0; (void) integer(&udft[next_function].dummy_value, 0); return(next_function++); } execute_at(at_ptr) struct at_type *at_ptr; { register int i; for (i = 0; i < at_ptr->count; i++) { (*ft[at_ptr->actions[i].index].funct)(&(at_ptr->actions[i].arg)); } } /* 'ft' is a table containing C functions within this program. An 'action_table' contains pointers to these functions and arguments to be passed to them. at_ptr is a pointer to the action table which must be executed (evaluated) so the iterated line exectues the function indexed by the at_ptr and passes the argument which is pointed to by the arg_ptr */ SHAR_EOF if test 2739 -ne "`wc -c < 'eval.c'`" then echo shar: error transmitting "'eval.c'" '(should have been 2739 characters)' fi chmod +x 'eval.c' fi # end of overwriting check echo shar: extracting "'graphics.c'" '(7182 characters)' if test -f 'graphics.c' then echo shar: will not over-write existing file "'graphics.c'" else cat << \SHAR_EOF > 'graphics.c' /* * * G N U P L O T -- graphics.c * * Copyright (C) 1986 Thomas Williams, Colin Kelley * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include <math.h> #include "plot.h" char *strcpy(),*strncpy(),*strcat(); extern BOOLEAN autoscale; extern FILE *outfile; extern BOOLEAN log_x, log_y; extern int term; extern BOOLEAN screen_ok; extern BOOLEAN term_init; extern struct termentry term_tbl[]; #ifndef max /* Lattice C has max() in math.h, but shouldn't! */ #define max(a,b) ((a > b) ? a : b) #endif #define map_x(x) (int)((x-xmin)*xscale) /* maps floating point x to screen */ #define map_y(y) (int)((y-ymin)*yscale) /* same for y */ double raise(x,y) double x; int y; { register int i; double val; val = 1.0; for (i=0; i < abs(y); i++) val *= x; if (y < 0 ) return (1.0/val); return(val); } double make_tics(tmin,tmax,logscale) double tmin,tmax; BOOLEAN logscale; { double xr,xnorm,tics,tic,l10; xr = fabs(tmin-tmax); l10 = log10(xr); if (logscale) { tic = raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)); if (tic < 1.0) tic = 1.0; } else { xnorm = pow(10.0,l10-(double)((l10 >= 0.0 ) ? (int)l10 : ((int)l10-1))); if (xnorm <= 2) tics = 0.2; else if (xnorm <= 5) tics = 0.5; else tics = 1.0; tic = tics * raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)); } return(tic); } char *idx(a,b) register char *a,b; { do { if (*a == b) return(a); } while (*a++); return(0); } num2str(num,str) double num; char str[]; { char temp[80]; char *a,*b; if (fabs(num) > 9999.0 || fabs(num) < 0.001 && fabs(num) != 0.0) (void) sprintf(temp,"%-.3e",num); else (void) sprintf(temp,"%-.3g",num); if (b = idx(temp,'e')) { a = b-1; /* b points to 'e'. a points before 'e' */ while ( *a == '0') /* trailing zeros */ a--; if ( *a == '.') a--; (void) strncpy(str,temp,(int)(a-temp)+1); str[(int)(a-temp)+1] = '\0'; a = b+1; /* point to 1 after 'e' */ if ( *a == '-') (void) strcat(str,"e-"); else (void) strcat(str,"e"); a++; /* advance a past '+' or '-' */ while ( *a == '0' && *(a+1) != '\0') /* leading blanks */ a++; (void) strcat(str,a); /* copy rest of string */ } else (void) strcpy(str,temp); } do_plot(plots, p_count, xmin, xmax, ymin, ymax) struct curve_points plots[MAX_PLOTS]; int p_count; /* count of plots to do */ double xmin, xmax; double ymin, ymax; { register int curve, i, x, xaxis_y, yaxis_x,dp_count; register BOOLEAN prev_undef; register enum PLOT_TYPES p_type; register double xscale, yscale; register double ytic, xtic, least, most, ticplace; register struct termentry *t = &term_tbl[term]; register int mms,mts; static char xns[20],xms[20],yns[20],yms[20],xts[20],yts[20]; static char label[80]; if (ymin == HUGE || ymax == -HUGE) int_error("all points undefined!", NO_CARET); ytic = make_tics(ymin,ymax,log_y); xtic = make_tics(xmin,xmax,log_x); dp_count = 0; if (ymin < ymax ) { ymin = ytic * floor(ymin/ytic); ymax = ytic * ceil(ymax/ytic); } else { ymin = ytic * ceil(ymin/ytic); ymax = ytic * floor(ymax/ytic); } if (xmin == xmax) int_error("xmin should not equal xmax!",NO_CARET); if (ymin == ymax) int_error("ymin should not equal ymax!",NO_CARET); yscale = (t->ymax - 2)/(ymax - ymin); xscale = (t->xmax - 2)/(xmax - xmin); if (!term_init) { (*t->init)(); term_init = TRUE; } screen_ok = FALSE; (*t->graphics)(); (*t->linetype)(-2); /* border linetype */ /* draw plot border */ (*t->move)(0,0); (*t->vector)(t->xmax-1,0); (*t->vector)(t->xmax-1,t->ymax-1); (*t->vector)(0,t->ymax-1); (*t->vector)(0,0); least = (ymin < ymax) ? ymin : ymax; most = (ymin < ymax) ? ymax : ymin; for (ticplace = ytic + least; ticplace < most ; ticplace += ytic) { (*t->move)(0,map_y(ticplace)); (*t->vector)(t->h_tic,map_y(ticplace)); (*t->move)(t->xmax-1,map_y(ticplace)); (*t->vector)(t->xmax-1-t->h_tic,map_y(ticplace)); } if (xmin < xmax ) { least = xtic * floor(xmin/xtic); most = xtic * ceil(xmax/xtic); } else { least = xtic * ceil(xmin/xtic); most = xtic * floor(xmax/xtic); } for (ticplace = xtic + least; ticplace < most ; ticplace += xtic) { (*t->move)(map_x(ticplace),0); (*t->vector)(map_x(ticplace),t->v_tic); (*t->move)(map_x(ticplace),t->ymax-1); (*t->vector)(map_x(ticplace),t->ymax-1-t->v_tic); } if (log_x) { num2str(pow(10.0,xmin),xns); num2str(pow(10.0,xmax),xms); num2str(pow(10.0,xtic),xts); } else { num2str(xmin,xns); num2str(xmax,xms); num2str(xtic,xts); } if (log_y) { num2str(pow(10.0,ymin),yns); num2str(pow(10.0,ymax),yms); num2str(pow(10.0,ytic),yts); } else { num2str(ymin,yns); num2str(ymax,yms); num2str(ytic,yts); } mms = max(strlen(xms),strlen(yms)); mts = max(strlen(xts),strlen(yts)); (void) sprintf(label,"%s < y < %-*s inc = %-*s",yns,mms,yms,mts,yts); (*t->lrput_text)(0, label); (void) sprintf(label,"%s < x < %-*s inc = %-*s",xns,mms,xms,mts,xts); (*t->lrput_text)(1, label); /* DRAW AXES */ (*t->linetype)(-1); /* axis line type */ xaxis_y = map_y(0.0); yaxis_x = map_x(0.0); if (xaxis_y < 0) xaxis_y = 0; /* save for impulse plotting */ else if (xaxis_y >= t->ymax) xaxis_y = t->ymax - 1; else if (!log_y) { (*t->move)(0,xaxis_y); (*t->vector)((t->xmax-1),xaxis_y); } if (!log_x && yaxis_x >= 0 && yaxis_x < t->xmax) { (*t->move)(yaxis_x,0); (*t->vector)(yaxis_x,(t->ymax-1)); } /* DRAW CURVES */ for (curve = 0; curve < p_count; curve++) { (*t->linetype)(curve); (*t->ulput_text)(curve, plots[curve].title); (*t->linetype)(curve); p_type = plots[curve].plot_type; switch(plots[curve].plot_style) { case IMPULSES: for (i = 0; i < plots[curve].count; i++) { if (!plots[curve].points[i].undefined) { if (p_type == DATA) x = map_x(plots[curve].points[i].x); else x = (long)(t->xmax-1)*i/(plots[curve].count-1); (*t->move)(x,xaxis_y); (*t->vector)(x,map_y(plots[curve].points[i].y)); } } break; case LINES: prev_undef = TRUE; for (i = 0; i < plots[curve].count; i++) { if (!plots[curve].points[i].undefined) { if (p_type == DATA) x = map_x(plots[curve].points[i].x); else x = (long)(t->xmax-1)*i/(plots[curve].count-1); if (prev_undef) (*t->move)(x, map_y(plots[curve].points[i].y)); (*t->vector)(x, map_y(plots[curve].points[i].y)); } prev_undef = plots[curve].points[i].undefined; } break; case POINTS: for (i = 0; i < plots[curve].count; i++) { if (!plots[curve].points[i].undefined) { if (p_type == DATA) x = map_x(plots[curve].points[i].x); else x = (long)(t->xmax-1)*i/(plots[curve].count-1); (*t->point)(x,map_y(plots[curve].points[i].y),dp_count); } } dp_count++; break; } } (*t->text)(); (void) fflush(outfile); } SHAR_EOF if test 7182 -ne "`wc -c < 'graphics.c'`" then echo shar: error transmitting "'graphics.c'" '(should have been 7182 characters)' fi chmod +x 'graphics.c' fi # end of overwriting check echo shar: extracting "'internal.c'" '(12514 characters)' if test -f 'internal.c' then echo shar: will not over-write existing file "'internal.c'" else cat << \SHAR_EOF > 'internal.c' /* * * G N U P L O T -- internal.c * * Copyright (C) 1986 Colin Kelley, Thomas Williams * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <math.h> #include <stdio.h> #include "plot.h" extern BOOLEAN undefined; extern struct vt_entry vt[MAX_VALUES]; extern struct udft_entry udft[MAX_UDFS]; char *strcpy(); struct value *pop(), *complex(), *integer(); double magnitude(), angle(), real(); struct value stack[STACK_DEPTH]; int s_p = -1; /* stack pointer */ /* * System V and MSC 4.0 call this when they wants to print an error message. * Don't! */ matherr() { return (undefined = TRUE); /* don't print error message */ } reset_stack() { s_p = -1; } check_stack() /* make sure stack's empty */ { if (s_p != -1) fprintf(stderr,"\nwarning: internal error--stack not empty!\n"); } struct value *pop(x) struct value *x; { if (s_p < 0 ) int_error("stack underflow",NO_CARET); *x = stack[s_p--]; return(x); } #define ERR_VAR "undefined variable: " f_push(x) struct value *x; /* contains index of value to push; must be integer! */ { static char err_str[sizeof(ERR_VAR) + MAX_ID_LEN] = ERR_VAR; register int index; if (x->type != INT) int_error("internal error--non-int passed to f_push!",NO_CARET); index = x->v.int_val; if (vt[index].vt_undef) { /* undefined */ (void) strcpy(&err_str[sizeof(ERR_VAR) - 1], vt[index].vt_name); int_error(err_str,NO_CARET); } push(&vt[index].vt_value); } f_pushc(x) struct value *x; { if (s_p == STACK_DEPTH - 1) int_error("stack overflow",NO_CARET); stack[++s_p] = *x; } f_pushd(x) struct value *x; { f_pushc(&udft[x->v.int_val].dummy_value); } #define ERR_FUN "undefined function: " f_call(f_index) /* execute a udf */ struct value *f_index; { static char err_str[sizeof(ERR_FUN) + MAX_ID_LEN] = ERR_FUN; if (udft[f_index->v.int_val].at.count == 0) { /* undefined */ (void) strcpy(&err_str[sizeof(ERR_FUN) - 1], udft[f_index->v.int_val].udft_name); int_error(err_str,NO_CARET); } (void) pop(&udft[f_index->v.int_val].dummy_value); execute_at(&udft[f_index->v.int_val].at); } static int_check(v) struct value *v; { if (v->type != INT) int_error("non-integer passed to boolean operator",NO_CARET); } f_terniary() /* code for (a) ? b : c */ { struct value a, b, c; (void) pop(&c); (void) pop(&b); int_check(pop(&a)); push((a.v.int_val) ? &b : &c); /* I just had to use ? : here! */ } f_lnot() { struct value a; int_check(pop(&a)); push(integer(&a,!a.v.int_val) ); } f_bnot() { struct value a; int_check(pop(&a)); push( integer(&a,~a.v.int_val) ); } f_lor() { struct value a,b; int_check(pop(&b)); int_check(pop(&a)); push( integer(&a,a.v.int_val || b.v.int_val) ); } f_land() { struct value a,b; int_check(pop(&b)); int_check(pop(&a)); push( integer(&a,a.v.int_val && b.v.int_val) ); } f_bor() { struct value a,b; int_check(pop(&b)); int_check(pop(&a)); push( integer(&a,a.v.int_val | b.v.int_val) ); } f_xor() { struct value a,b; int_check(pop(&b)); int_check(pop(&a)); push( integer(&a,a.v.int_val ^ b.v.int_val) ); } f_band() { struct value a,b; int_check(pop(&b)); int_check(pop(&a)); push( integer(&a,a.v.int_val & b.v.int_val) ); } f_uminus() { struct value a; (void) pop(&a); switch(a.type) { case INT: a.v.int_val = -a.v.int_val; break; case CMPLX: a.v.cmplx_val.real = -a.v.cmplx_val.real; a.v.cmplx_val.imag = -a.v.cmplx_val.imag; } push(&a); } f_eq() /* note: floating point equality is rare because of roundoff error! */ { struct value a, b; register int result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: result = (a.v.int_val == b.v.int_val); break; case CMPLX: result = (a.v.int_val == b.v.cmplx_val.real && b.v.cmplx_val.imag == 0.0); } break; case CMPLX: switch (b.type) { case INT: result = (b.v.int_val == a.v.cmplx_val.real && a.v.cmplx_val.imag == 0.0); break; case CMPLX: result = (a.v.cmplx_val.real== b.v.cmplx_val.real && a.v.cmplx_val.imag== b.v.cmplx_val.imag); } } push(integer(&a,result)); } f_ne() { struct value a, b; register int result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: result = (a.v.int_val != b.v.int_val); break; case CMPLX: result = (a.v.int_val != b.v.cmplx_val.real || b.v.cmplx_val.imag != 0.0); } break; case CMPLX: switch (b.type) { case INT: result = (b.v.int_val != a.v.cmplx_val.real || a.v.cmplx_val.imag != 0.0); break; case CMPLX: result = (a.v.cmplx_val.real != b.v.cmplx_val.real || a.v.cmplx_val.imag != b.v.cmplx_val.imag); } } push(integer(&a,result)); } f_gt() { struct value a, b; register int result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: result = (a.v.int_val > b.v.int_val); break; case CMPLX: result = (a.v.int_val > b.v.cmplx_val.real); } break; case CMPLX: switch (b.type) { case INT: result = (a.v.cmplx_val.real > b.v.int_val); break; case CMPLX: result = (a.v.cmplx_val.real > b.v.cmplx_val.real); } } push(integer(&a,result)); } f_lt() { struct value a, b; register int result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: result = (a.v.int_val < b.v.int_val); break; case CMPLX: result = (a.v.int_val < b.v.cmplx_val.real); } break; case CMPLX: switch (b.type) { case INT: result = (a.v.cmplx_val.real < b.v.int_val); break; case CMPLX: result = (a.v.cmplx_val.real < b.v.cmplx_val.real); } } push(integer(&a,result)); } f_ge() { struct value a, b; register int result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: result = (a.v.int_val >= b.v.int_val); break; case CMPLX: result = (a.v.int_val >= b.v.cmplx_val.real); } break; case CMPLX: switch (b.type) { case INT: result = (a.v.cmplx_val.real >= b.v.int_val); break; case CMPLX: result = (a.v.cmplx_val.real >= b.v.cmplx_val.real); } } push(integer(&a,result)); } f_le() { struct value a, b; register int result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: result = (a.v.int_val <= b.v.int_val); break; case CMPLX: result = (a.v.int_val <= b.v.cmplx_val.real); } break; case CMPLX: switch (b.type) { case INT: result = (a.v.cmplx_val.real <= b.v.int_val); break; case CMPLX: result = (a.v.cmplx_val.real <= b.v.cmplx_val.real); } } push(integer(&a,result)); } f_plus() { struct value a, b, result; (void) pop(&b); (void) pop(&a); switch(a.type) { case INT: switch (b.type) { case INT: (void) integer(&result,a.v.int_val + b.v.int_val); break; case CMPLX: (void) complex(&result,a.v.int_val + b.v.cmplx_val.real, b.v.cmplx_val.imag); } break; case CMPLX: switch (b.type) { case INT: (void) complex(&result,b.v.int_val + a.v.cmplx_val.real, a.v.cmplx_val.imag); break; case CMPLX: (void) complex(&result,a.v.cmplx_val.real+ b.v.cmplx_val.real, a.v.cmplx_val.imag+ b.v.cmplx_val.imag); } } push(&result); } f_minus() { struct value a, b, result; (void) pop(&b); (void) pop(&a); /* now do a - b */ switch(a.type) { case INT: switch (b.type) { case INT: (void) integer(&result,a.v.int_val - b.v.int_val); break; case CMPLX: (void) complex(&result,a.v.int_val - b.v.cmplx_val.real, -b.v.cmplx_val.imag); } break; case CMPLX: switch (b.type) { case INT: (void) complex(&result,a.v.cmplx_val.real - b.v.int_val, a.v.cmplx_val.imag); break; case CMPLX: (void) complex(&result,a.v.cmplx_val.real- b.v.cmplx_val.real, a.v.cmplx_val.imag- b.v.cmplx_val.imag); } } push(&result); } f_mult() { struct value a, b, result; (void) pop(&b); (void) pop(&a); /* now do a*b */ switch(a.type) { case INT: switch (b.type) { case INT: (void) integer(&result,a.v.int_val * b.v.int_val); break; case CMPLX: (void) complex(&result,a.v.int_val * b.v.cmplx_val.real, a.v.int_val * b.v.cmplx_val.imag); } break; case CMPLX: switch (b.type) { case INT: (void) complex(&result,b.v.int_val * a.v.cmplx_val.real, b.v.int_val * a.v.cmplx_val.imag); break; case CMPLX: (void) complex(&result,a.v.cmplx_val.real* b.v.cmplx_val.real- a.v.cmplx_val.imag* b.v.cmplx_val.imag, a.v.cmplx_val.real* b.v.cmplx_val.imag+ a.v.cmplx_val.imag* b.v.cmplx_val.real); } } push(&result); } f_div() { struct value a, b, result; register double square; (void) pop(&b); (void) pop(&a); /* now do a/b */ switch(a.type) { case INT: switch (b.type) { case INT: if (b.v.int_val) (void) integer(&result,a.v.int_val / b.v.int_val); else { (void) integer(&result,0); undefined = TRUE; } break; case CMPLX: square = b.v.cmplx_val.real* b.v.cmplx_val.real + b.v.cmplx_val.imag* b.v.cmplx_val.imag; if (square) (void) complex(&result,a.v.int_val* b.v.cmplx_val.real/square, -a.v.int_val* b.v.cmplx_val.imag/square); else { (void) complex(&result,0.0,0.0); undefined = TRUE; } } break; case CMPLX: switch (b.type) { case INT: if (b.v.int_val) (void) complex(&result,a.v.cmplx_val.real/ b.v.int_val, a.v.cmplx_val.imag/ b.v.int_val); else { (void) complex(&result,0.0,0.0); undefined = TRUE; } break; case CMPLX: square = b.v.cmplx_val.real* b.v.cmplx_val.real + b.v.cmplx_val.imag* b.v.cmplx_val.imag; if (square) (void) complex(&result,(a.v.cmplx_val.real* b.v.cmplx_val.real+ a.v.cmplx_val.imag* b.v.cmplx_val.imag)/square, (a.v.cmplx_val.imag* b.v.cmplx_val.real- a.v.cmplx_val.real* b.v.cmplx_val.imag)/ square); else { (void) complex(&result,0.0,0.0); undefined = TRUE; } } } push(&result); } f_mod() { struct value a, b; (void) pop(&b); (void) pop(&a); /* now do a%b */ if (a.type != INT || b.type != INT) int_error("can only mod ints",NO_CARET); if (b.v.int_val) push(integer(&a,a.v.int_val % b.v.int_val)); else { push(integer(&a,0)); undefined = TRUE; } } f_power() { struct value a, b, result; register int i, t, count; register double mag, ang; (void) pop(&b); (void) pop(&a); /* now find a**b */ switch(a.type) { case INT: switch (b.type) { case INT: count = abs(b.v.int_val); t = 1; for(i=0; i < count; i++) t *= a.v.int_val; if (b.v.int_val >= 0) (void) integer(&result,t); else (void) complex(&result,1.0/t,0.0); break; case CMPLX: mag = pow(magnitude(&a),fabs(b.v.cmplx_val.real)); if (b.v.cmplx_val.real < 0.0) mag = 1.0/mag; ang = angle(&a)*b.v.cmplx_val.real+ b.v.cmplx_val.imag; (void) complex(&result,mag*cos(ang), mag*sin(ang)); } break; case CMPLX: switch (b.type) { case INT: /* not so good, but...! */ mag = pow(magnitude(&a),(double)abs(b.v.int_val)); if (b.v.int_val < 0) mag = 1.0/mag; ang = angle(&a)*b.v.int_val; (void) complex(&result,mag*cos(ang), mag*sin(ang)); break; case CMPLX: mag = pow(magnitude(&a),fabs(b.v.cmplx_val.real)); if (b.v.cmplx_val.real < 0.0) mag = 1.0/mag; ang = angle(&a)*b.v.cmplx_val.real+ b.v.cmplx_val.imag; (void) complex(&result,mag*cos(ang), mag*sin(ang)); } } push(&result); } SHAR_EOF if test 12514 -ne "`wc -c < 'internal.c'`" then echo shar: error transmitting "'internal.c'" '(should have been 12514 characters)' fi chmod +x 'internal.c' fi # end of overwriting check echo shar: extracting "'misc.c'" '(4466 characters)' if test -f 'misc.c' then echo shar: will not over-write existing file "'misc.c'" else cat << \SHAR_EOF > 'misc.c' /* * * G N U P L O T -- misc.c * * Copyright (C) 1986 Thomas Williams, Colin Kelley * * You may use this code as you wish if credit is given and this message * is retained. * * Please e-mail any useful additions to vu-vlsi!plot so they may be * included in later releases. * * This file should be edited with 4-column tabs! (:set ts=4 sw=4 in vi) */ #include <stdio.h> #include "plot.h" extern BOOLEAN screen_ok; extern struct curve_points plot[]; extern int c_token,next_value,next_function; extern struct udft_entry udft[]; extern struct at_type *curr_at; extern struct ft_entry ft[]; extern struct vt_entry vt[]; char *malloc(); pointmem(samples) int samples; { register int i; for (i = MAX_PLOTS-1; i >= 0; i--) if (plot[i].points != NULL) { free(plot[i].points); plot[i].points = NULL; } for (i = 0; i < MAX_PLOTS; i++) if ((plot[i].points = (struct coordinate *) malloc((samples+1) * sizeof(struct coordinate))) == NULL) { fprintf(stderr,"only space for %d plots\n",i); screen_ok = FALSE; break; } } save_functions(fp) FILE *fp; { int i; if (fp == 0) os_error("Cannot open save file",c_token); else { for (i=0; i < next_function; i++) fprintf(fp,"%s\n",udft[i].definition); } (void) fclose(fp); } save_variables(fp) FILE *fp; { int i; if (fp == 0) os_error("Cannot open save file",c_token); else { for (i=0; i < next_value; i++) { fprintf(fp,"%s = ",vt[i].vt_name); show_value(fp,&vt[i].vt_value); (void) putc('\n',fp); } } (void) fclose(fp); } save_all(fp) FILE *fp; { int i; if (fp == 0) os_error("Cannot open save file",c_token); else { for (i=0; i < next_function; i++) fprintf(fp,"%s\n",udft[i].definition); for (i=0; i < next_value; i++) { fprintf(fp,"%s = ",vt[i].vt_name); show_value(fp,&vt[i].vt_value); (void) putc('\n',fp); } } (void) fclose(fp); } load_file(fp) FILE *fp; { register int len; extern char input_line[]; if ( fp == 0 ) os_error("Cannot open load file",c_token); else { while (fgets(input_line,MAX_LINE_LEN,fp)) { len = strlen(input_line) - 1; if (input_line[len] == '\n') input_line[len] = '\0'; screen_ok = FALSE; /* make sure command line is echoed on error */ do_line(); } } (void) fclose(fp); } view_variables() { int i; screen_ok = FALSE; fprintf(stderr,"\nVariables:\n"); for (i=0; i < next_value; i++) { fprintf(stderr,"%-*s ",MAX_ID_LEN,vt[i].vt_name); if (vt[i].vt_undef) fputs("is undefined\n",stderr); else { fputs("= ",stderr); show_value(stderr,&vt[i].vt_value); (void) putc('\n',stderr); } } (void) putc('\n',stderr); } view_functions() { int i; screen_ok = FALSE; fprintf(stderr,"\nUser-Defined Functions:\n"); for (i=0; i < next_function; i++) if (udft[i].at.count == 0) fprintf(stderr,"%s is undefined\n",udft[i].udft_name); else fprintf(stderr,"%s\n",udft[i].definition); (void) putc('\n',stderr); } view_at() { static struct at_type at; screen_ok = FALSE; build_at(&at); /* build action table in at */ (void) putc('\n',stderr); show_at(0); (void) putc('\n',stderr); } show_at(level) int level; { struct at_type *at_address; int i, j; struct value *arg; at_address = curr_at; for (i = 0; i < at_address->count; i++) { for (j = 0; j < level; j++) (void) putc(' ',stderr); /* indent */ /* print name of action instruction */ fputs(ft[at_address->actions[i].index].ft_name,stderr); arg = &(at_address->actions[i].arg); /* now print optional argument */ switch(at_address->actions[i].index) { case (int)PUSH: fprintf(stderr," (%s)\n", vt[arg->v.int_val].vt_name); break; case (int)PUSHC: (void) putc('(',stderr); show_value(stderr,arg); fputs(")\n",stderr); break; case (int)PUSHD: fprintf(stderr," (%s dummy)\n", udft[arg->v.int_val].udft_name); break; case (int)CALL: fprintf(stderr," (%s)\n", udft[arg->v.int_val].udft_name); curr_at = &udft[arg->v.int_val].at; show_at(level+2); /* recurse! */ curr_at = at_address; break; default: (void) putc('\n',stderr); } } } #ifdef vms #define OS "vms" #endif #ifdef unix #define OS "unix" #endif #ifdef MSDOS #define OS "MS-DOS" #endif #ifndef OS #define OS "" #endif show_version() { extern char version[]; extern char date[]; screen_ok = FALSE; fprintf(stderr,"%s v%s (%s); %s\n\n", PROGRAM, version, OS, date); } SHAR_EOF if test 4466 -ne "`wc -c < 'misc.c'`" then echo shar: error transmitting "'misc.c'" '(should have been 4466 characters)' fi chmod +x 'misc.c' fi # end of overwriting check # End of shell archive exit 0
taw@vu-vlsi.UUCP (Thomas Williams) (11/18/86)
This is the last (4th) gnuplot shar file. It contains the entire help directory tree for GNUPLOT. Make a help subdirectory and unshar this file inside of it. NOTE: This help works with the recently posted vms-like 'help' program (sorry, couldn't find authors name) or it can be converted into a VMS .HLP file with the "vmshelp.csh" script. ---------------------------------CUT HERE------------------------------ #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # gnuplot # This archive created: Mon Nov 17 19:36:15 1986 export PATH; PATH=/bin:$PATH if test ! -d 'gnuplot' then echo shar: creating directory "'gnuplot'" mkdir 'gnuplot' fi echo shar: entering directory "'gnuplot'" cd 'gnuplot' echo shar: extracting "'.HLP'" '(267 characters)' if test -f '.HLP' then echo shar: will not over-write existing file "'.HLP'" else cat << \SHAR_EOF > '.HLP' GNUPLOT is a command-driven interactive function plotting program. It is case sensitive (commands and function names written in lowercase are not the same as those written in CAPS). All command names may be abbreviated, as long as the abbreviation is not ambiguous. SHAR_EOF if test 267 -ne "`wc -c < '.HLP'`" then echo shar: error transmitting "'.HLP'" '(should have been 267 characters)' fi chmod +x '.HLP' fi # end of overwriting check echo shar: extracting "'save.HLP'" '(373 characters)' if test -f 'save.HLP' then echo shar: will not over-write existing file "'save.HLP'" else cat << \SHAR_EOF > 'save.HLP' This command saves either user-defined functions, variables, or both to the specified file. Syntax: save {option} <filename> Where <option> is either 'functions' or 'variables'. If no option is used GNUPLOT saves both functions and variables. 'save'd files are written in text format and may be read by the 'load' command. The filename must be enclose in quotes. SHAR_EOF if test 373 -ne "`wc -c < 'save.HLP'`" then echo shar: error transmitting "'save.HLP'" '(should have been 373 characters)' fi chmod +x 'save.HLP' fi # end of overwriting check echo shar: extracting "'print.HLP'" '(97 characters)' if test -f 'print.HLP' then echo shar: will not over-write existing file "'print.HLP'" else cat << \SHAR_EOF > 'print.HLP' This command prints the value of <expression>. Syntax: print <expression> See 'expressions'. SHAR_EOF if test 97 -ne "`wc -c < 'print.HLP'`" then echo shar: error transmitting "'print.HLP'" '(should have been 97 characters)' fi chmod +x 'print.HLP' fi # end of overwriting check if test ! -d 'plot' then echo shar: creating directory "'plot'" mkdir 'plot' fi echo shar: entering directory "'plot'" cd 'plot' echo shar: extracting "'.HLP'" '(559 characters)' if test -f '.HLP' then echo shar: will not over-write existing file "'.HLP'" else cat << \SHAR_EOF > '.HLP' The 'plot' primary command of the program. It displays functions and data in many, many ways. The full syntax of this command is: plot {ranges} <function> {style} {, <function> {style}...} Where <function> is either a mathematical expression or the name of a data file enclosed in quotes. User-defined functions and variables may also be defined here. Curly braces {,} denote optional items. A 'plot' command can be as simple as plot sin(x) or as complex as (!) plot [t=1:100] [-pi:pi*2] tan(t), "data.1" with lines, besj0(t) with points SHAR_EOF if test 559 -ne "`wc -c < '.HLP'`" then echo shar: error transmitting "'.HLP'" '(should have been 559 characters)' fi chmod +x '.HLP' fi # end of overwriting check echo shar: extracting "'style.HLP'" '(815 characters)' if test -f 'style.HLP' then echo shar: will not over-write existing file "'style.HLP'" else cat << \SHAR_EOF > 'style.HLP' Plots may be displayed in one of three styles: 'lines', 'points', or 'impulses'. The 'lines' style connects adjacent points with lines. The 'points' style displays a small symbol at each point. The 'impulses' style displays a vertical line from the X axis to each point. Default styles are chosen with the 'set function style' and 'set data style' commands. Syntax: with <style> Where <style> is one of 'lines', 'points', or 'impulses'. These keywords may be abbreviated. Examples: Displays: plot sin(x) with impulses ; sin(x) with impulses plot [-9:30] sin(x) w points, cos(x) ; sin(x) with points, cos(x) default plot [] [-2:5] tan(x), "data.1" with l ; tan(x) default, "data.1" with lines plot "leastsq.dat" w i ; "leastsq.dat" with impulses SHAR_EOF if test 815 -ne "`wc -c < 'style.HLP'`" then echo shar: error transmitting "'style.HLP'" '(should have been 815 characters)' fi chmod +x 'style.HLP' fi # end of overwriting check echo shar: extracting "'ranges.HLP'" '(978 characters)' if test -f 'ranges.HLP' then echo shar: will not over-write existing file "'ranges.HLP'" else cat << \SHAR_EOF > 'ranges.HLP' These two options specify the region of the plot which will be displayed. Ranges may be provided on the 'plot' command line as synonyms for the 'set xrange' and 'set yrange' commands. Syntax: [{dummy-var =} {xmin : xmax}] { [{ymin : ymax}] } Where dummy-var is the independent variable ('x' is used by default) and the min and max terms can be expressions or constants. Both the min and max terms are optional. The ':' is also optional if neither a min nor a max term is specified. This allows '[]' to be used as a null range specification. Specifying a Y range turns autoscaling OFF. Examples: plot cos(x) ; use current ranges plot [-10:30] sin(pi*x)/(pi*x) ; set xrange only plot [t = -10 :30] sin(pi*t)/(pi*t) ; same, but use t as dummy-var plot [-pi:pi] [-3:3] tan(x), 1/x ; set y and xranges plot [] [-2:sin(5)*-8] sin(x)**besj0(x) ; set only yrange plot [:200] [-pi:] exp(sin(x)) ; set xmax and ymin only SHAR_EOF if test 978 -ne "`wc -c < 'ranges.HLP'`" then echo shar: error transmitting "'ranges.HLP'" '(should have been 978 characters)' fi chmod +x 'ranges.HLP' fi # end of overwriting check echo shar: extracting "'data_file.HLP'" '(852 characters)' if test -f 'data_file.HLP' then echo shar: will not over-write existing file "'data_file.HLP'" else cat << \SHAR_EOF > 'data_file.HLP' Discrete data contained in a file can displayed by specifying the name of the data file (enclosed in quotes) on the 'plot' command line. Data files should contain one data point per line. A data point may be specified either as an X and Y value separated by blank space, or as just the Y value, in which case the program will use the number of the coordinate as the X value. Coordinate numbers starts at 0 and are incremented for each data point read. Blank lines and lines beginning with ! or # will be treated as comments and ignored. This example compares the data in the file population.dat to a theoretical curve: pop(x) = 103*exp((1965-x)/10) plot [1960:1990] 'population.dat', pop(x) The file population.dat might contain: ! Gnu population in Antarctica since 1965 1965 103 1970 55 1975 34 1980 24 1985 10 SHAR_EOF if test 852 -ne "`wc -c < 'data_file.HLP'`" then echo shar: error transmitting "'data_file.HLP'" '(should have been 852 characters)' fi chmod +x 'data_file.HLP' fi # end of overwriting check echo shar: done with directory "'plot'" cd .. echo shar: extracting "'shell.HLP'" '(491 characters)' if test -f 'shell.HLP' then echo shar: will not over-write existing file "'shell.HLP'" else cat << \SHAR_EOF > 'shell.HLP' The 'shell' command spawns an interactive shell. To return to GNUPLOT, type 'logout' if using VMS, 'exit' or your END-OF-FILE character if using Unix, or 'exit' if using MS-DOS. A single shell command may be spawned by preceding it with the ! character at the beginning of a command line. Control will return immediately to GNUPLOT after this command is executed. For example, ! dir prints a directory listing and then returns to GNUPLOT. $ is accepted as a synonym for ! in VMS. SHAR_EOF if test 491 -ne "`wc -c < 'shell.HLP'`" then echo shar: error transmitting "'shell.HLP'" '(should have been 491 characters)' fi chmod +x 'shell.HLP' fi # end of overwriting check echo shar: extracting "'clear.HLP'" '(185 characters)' if test -f 'clear.HLP' then echo shar: will not over-write existing file "'clear.HLP'" else cat << \SHAR_EOF > 'clear.HLP' This command erases the current screen or output device as specified by 'set output'. This usually generates a formfeed on hardcopy devices. Use 'set terminal' to set the device type. SHAR_EOF if test 185 -ne "`wc -c < 'clear.HLP'`" then echo shar: error transmitting "'clear.HLP'" '(should have been 185 characters)' fi chmod +x 'clear.HLP' fi # end of overwriting check echo shar: extracting "'load.HLP'" '(479 characters)' if test -f 'load.HLP' then echo shar: will not over-write existing file "'load.HLP'" else cat << \SHAR_EOF > 'load.HLP' This command executes each line of the specified input file as if it had been typed in interactively. Files created by the 'save' command can later be 'load'ed. Any text file containing valid commands can be created and then executed by the 'load' command. Files being 'load'ed may themselves contain 'load' commands. The 'load' command must be the last command on the line. Syntax: load <input-file> The name of the input file must be enclosed in quotes. SHAR_EOF if test 479 -ne "`wc -c < 'load.HLP'`" then echo shar: error transmitting "'load.HLP'" '(should have been 479 characters)' fi chmod +x 'load.HLP' fi # end of overwriting check echo shar: extracting "'exit.HLP'" '(171 characters)' if test -f 'exit.HLP' then echo shar: will not over-write existing file "'exit.HLP'" else cat << \SHAR_EOF > 'exit.HLP' 'exit', 'quit' and your computer's END-OF-FILE character will exit GNUPLOT. All these commands will clear the output device (as the 'clear' command does) before exiting. SHAR_EOF if test 171 -ne "`wc -c < 'exit.HLP'`" then echo shar: error transmitting "'exit.HLP'" '(should have been 171 characters)' fi chmod +x 'exit.HLP' fi # end of overwriting check echo shar: extracting "'quit.HLP'" '(45 characters)' if test -f 'quit.HLP' then echo shar: will not over-write existing file "'quit.HLP'" else cat << \SHAR_EOF > 'quit.HLP' 'quit' is a synonym for 'exit'. See 'exit'. SHAR_EOF if test 45 -ne "`wc -c < 'quit.HLP'`" then echo shar: error transmitting "'quit.HLP'" '(should have been 45 characters)' fi chmod +x 'quit.HLP' fi # end of overwriting check if test ! -d 'expressions' then echo shar: creating directory "'expressions'" mkdir 'expressions' fi echo shar: entering directory "'expressions'" cd 'expressions' echo shar: extracting "'.HLP'" '(431 characters)' if test -f '.HLP' then echo shar: will not over-write existing file "'.HLP'" else cat << \SHAR_EOF > '.HLP' In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC is valid. The precedence of these operators is determined by the specifications of the C programming language. White space (spaces and tabs) is ignored inside expressions. Complex constants may be expressed as the {real,imag}, where <real> and <imag> must be numerical constants. For example {3,2} represents 3 + 2i; {0,1} represents 'i' itself. SHAR_EOF if test 431 -ne "`wc -c < '.HLP'`" then echo shar: error transmitting "'.HLP'" '(should have been 431 characters)' fi chmod +x '.HLP' fi # end of overwriting check if test ! -d 'functions' then echo shar: creating directory "'functions'" mkdir 'functions' fi echo shar: entering directory "'functions'" cd 'functions' echo shar: extracting "'.HLP'" '(235 characters)' if test -f '.HLP' then echo shar: will not over-write existing file "'.HLP'" else cat << \SHAR_EOF > '.HLP' The functions in GNUPLOT are the same as the corresponding functions in the UNIX math library, except that all functions accept integer, real, and complex arguments, unless otherwise noted. The BASIC sgn() function is also supported. SHAR_EOF if test 235 -ne "`wc -c < '.HLP'`" then echo shar: error transmitting "'.HLP'" '(should have been 235 characters)' fi chmod +x '.HLP' fi # end of overwriting check echo shar: extracting "'real.HLP'" '(53 characters)' if test -f 'real.HLP' then echo shar: will not over-write existing file "'real.HLP'" else cat << \SHAR_EOF > 'real.HLP' This function returns the real part of its argument. SHAR_EOF if test 53 -ne "`wc -c < 'real.HLP'`" then echo shar: error transmitting "'real.HLP'" '(should have been 53 characters)' fi chmod +x 'real.HLP' fi # end of overwriting check echo shar: extracting "'imag.HLP'" '(75 characters)' if test -f 'imag.HLP' then echo shar: will not over-write existing file "'imag.HLP'" else cat << \SHAR_EOF > 'imag.HLP' This function returns the imaginary part of its argument as a real number. SHAR_EOF if test 75 -ne "`wc -c < 'imag.HLP'`" then echo shar: error transmitting "'imag.HLP'" '(should have been 75 characters)' fi chmod +x 'imag.HLP' fi # end of overwriting check echo shar: extracting "'arg.HLP'" '(67 characters)' if test -f 'arg.HLP' then echo shar: will not over-write existing file "'arg.HLP'" else cat << \SHAR_EOF > 'arg.HLP' This function returns the phase of a complex number, in radians. SHAR_EOF if test 67 -ne "`wc -c < 'arg.HLP'`" then echo shar: error transmitting "'arg.HLP'" '(should have been 67 characters)' fi chmod +x 'arg.HLP' fi # end of overwriting check echo shar: extracting "'sin.HLP'" '(95 characters)' if test -f 'sin.HLP' then echo shar: will not over-write existing file "'sin.HLP'" else cat << \SHAR_EOF > 'sin.HLP' This function returns the sine of its argument. 'sin' expects its argument to be in radians. SHAR_EOF if test 95 -ne "`wc -c < 'sin.HLP'`" then echo shar: error transmitting "'sin.HLP'" '(should have been 95 characters)' fi chmod +x 'sin.HLP' fi # end of overwriting check echo shar: extracting "'cos.HLP'" '(97 characters)' if test -f 'cos.HLP' then echo shar: will not over-write existing file "'cos.HLP'" else cat << \SHAR_EOF > 'cos.HLP' This function returns the cosine of its argument. 'cos' expects its argument to be in radians. SHAR_EOF if test 97 -ne "`wc -c < 'cos.HLP'`" then echo shar: error transmitting "'cos.HLP'" '(should have been 97 characters)' fi chmod +x 'cos.HLP' fi # end of overwriting check echo shar: extracting "'tan.HLP'" '(98 characters)' if test -f 'tan.HLP' then echo shar: will not over-write existing file "'tan.HLP'" else cat << \SHAR_EOF > 'tan.HLP' This function returns the tangent of its argument. 'tan' expects its argument to be in radians. SHAR_EOF if test 98 -ne "`wc -c < 'tan.HLP'`" then echo shar: error transmitting "'tan.HLP'" '(should have been 98 characters)' fi chmod +x 'tan.HLP' fi # end of overwriting check echo shar: extracting "'asin.HLP'" '(107 characters)' if test -f 'asin.HLP' then echo shar: will not over-write existing file "'asin.HLP'" else cat << \SHAR_EOF > 'asin.HLP' This function returns the arc sin (inverse sin) of its argument. 'asin' returns its argument in radians. SHAR_EOF if test 107 -ne "`wc -c < 'asin.HLP'`" then echo shar: error transmitting "'asin.HLP'" '(should have been 107 characters)' fi chmod +x 'asin.HLP' fi # end of overwriting check echo shar: extracting "'acos.HLP'" '(113 characters)' if test -f 'acos.HLP' then echo shar: will not over-write existing file "'acos.HLP'" else cat << \SHAR_EOF > 'acos.HLP' This function returns the arc cosine (inverse cosine) of its argument. 'acos' returns its argument in radians. SHAR_EOF if test 113 -ne "`wc -c < 'acos.HLP'`" then echo shar: error transmitting "'acos.HLP'" '(should have been 113 characters)' fi chmod +x 'acos.HLP' fi # end of overwriting check echo shar: extracting "'atan.HLP'" '(114 characters)' if test -f 'atan.HLP' then echo shar: will not over-write existing file "'atan.HLP'" else cat << \SHAR_EOF > 'atan.HLP' This function returns the arc tangent (inverse tangent) of its argument. 'atan' returns its argument in radians. SHAR_EOF if test 114 -ne "`wc -c < 'atan.HLP'`" then echo shar: error transmitting "'atan.HLP'" '(should have been 114 characters)' fi chmod +x 'atan.HLP' fi # end of overwriting check echo shar: extracting "'sinh.HLP'" '(107 characters)' if test -f 'sinh.HLP' then echo shar: will not over-write existing file "'sinh.HLP'" else cat << \SHAR_EOF > 'sinh.HLP' This function returns the hyperbolic sine of its argument. 'sinh' expects its argument to be in radians. SHAR_EOF if test 107 -ne "`wc -c < 'sinh.HLP'`" then echo shar: error transmitting "'sinh.HLP'" '(should have been 107 characters)' fi chmod +x 'sinh.HLP' fi # end of overwriting check echo shar: extracting "'cosh.HLP'" '(109 characters)' if test -f 'cosh.HLP' then echo shar: will not over-write existing file "'cosh.HLP'" else cat << \SHAR_EOF > 'cosh.HLP' This function returns the hyperbolic cosine of its argument. 'cosh' expects its argument to be in radians. SHAR_EOF if test 109 -ne "`wc -c < 'cosh.HLP'`" then echo shar: error transmitting "'cosh.HLP'" '(should have been 109 characters)' fi chmod +x 'cosh.HLP' fi # end of overwriting check echo shar: extracting "'tanh.HLP'" '(110 characters)' if test -f 'tanh.HLP' then echo shar: will not over-write existing file "'tanh.HLP'" else cat << \SHAR_EOF > 'tanh.HLP' This function returns the hyperbolic tangent of its argument. 'tanh' expects its argument to be in radians. SHAR_EOF if test 110 -ne "`wc -c < 'tanh.HLP'`" then echo shar: error transmitting "'tanh.HLP'" '(should have been 110 characters)' fi chmod +x 'tanh.HLP' fi # end of overwriting check echo shar: extracting "'int.HLP'" '(79 characters)' if test -f 'int.HLP' then echo shar: will not over-write existing file "'int.HLP'" else cat << \SHAR_EOF > 'int.HLP' This function returns the integer part of its argument, truncated toward zero. SHAR_EOF if test 79 -ne "`wc -c < 'int.HLP'`" then echo shar: error transmitting "'int.HLP'" '(should have been 79 characters)' fi chmod +x 'int.HLP' fi # end of overwriting check echo shar: extracting "'abs.HLP'" '(240 characters)' if test -f 'abs.HLP' then echo shar: will not over-write existing file "'abs.HLP'" else cat << \SHAR_EOF > 'abs.HLP' This function returns the absolute value of its argument. The returned value is of the same type as the argument. For complex arguments, abs(x) is defined as the length of x in the complex plane [i.e. sqrt(real(arg)**2 + imag(arg)**2) ]. SHAR_EOF if test 240 -ne "`wc -c < 'abs.HLP'`" then echo shar: error transmitting "'abs.HLP'" '(should have been 240 characters)' fi chmod +x 'abs.HLP' fi # end of overwriting check echo shar: extracting "'sgn.HLP'" '(189 characters)' if test -f 'sgn.HLP' then echo shar: will not over-write existing file "'sgn.HLP'" else cat << \SHAR_EOF > 'sgn.HLP' This function returns 1 if its argument is positive, -1 if its argument is negative, and 0 if its argument is 0. If the argument is a complex value, the imaginary component is ignored. SHAR_EOF if test 189 -ne "`wc -c < 'sgn.HLP'`" then echo shar: error transmitting "'sgn.HLP'" '(should have been 189 characters)' fi chmod +x 'sgn.HLP' fi # end of overwriting check echo shar: extracting "'sqrt.HLP'" '(55 characters)' if test -f 'sqrt.HLP' then echo shar: will not over-write existing file "'sqrt.HLP'" else cat << \SHAR_EOF > 'sqrt.HLP' This function returns the square root of its argument. SHAR_EOF if test 55 -ne "`wc -c < 'sqrt.HLP'`" then echo shar: error transmitting "'sqrt.HLP'" '(should have been 55 characters)' fi chmod +x 'sqrt.HLP' fi # end of overwriting check echo shar: extracting "'exp.HLP'" '(104 characters)' if test -f 'exp.HLP' then echo shar: will not over-write existing file "'exp.HLP'" else cat << \SHAR_EOF > 'exp.HLP' This function returns the exponential function of its argument (e raised to the power of its argument). SHAR_EOF if test 104 -ne "`wc -c < 'exp.HLP'`" then echo shar: error transmitting "'exp.HLP'" '(should have been 104 characters)' fi chmod +x 'exp.HLP' fi # end of overwriting check echo shar: extracting "'log.HLP'" '(70 characters)' if test -f 'log.HLP' then echo shar: will not over-write existing file "'log.HLP'" else cat << \SHAR_EOF > 'log.HLP' This function returns the natural logarithm (base e) of its argument. SHAR_EOF if test 70 -ne "`wc -c < 'log.HLP'`" then echo shar: error transmitting "'log.HLP'" '(should have been 70 characters)' fi chmod +x 'log.HLP' fi # end of overwriting check echo shar: extracting "'log10.HLP'" '(63 characters)' if test -f 'log10.HLP' then echo shar: will not over-write existing file "'log10.HLP'" else cat << \SHAR_EOF > 'log10.HLP' This function returns the logarithm (base 10) of its argument. SHAR_EOF if test 63 -ne "`wc -c < 'log10.HLP'`" then echo shar: error transmitting "'log10.HLP'" '(should have been 63 characters)' fi chmod +x 'log10.HLP' fi # end of overwriting check echo shar: extracting "'besj0.HLP'" '(112 characters)' if test -f 'besj0.HLP' then echo shar: will not over-write existing file "'besj0.HLP'" else cat << \SHAR_EOF > 'besj0.HLP' This function returns the j0th Bessel function of its argument. 'besj0' expects its argument to be in radians. SHAR_EOF if test 112 -ne "`wc -c < 'besj0.HLP'`" then echo shar: error transmitting "'besj0.HLP'" '(should have been 112 characters)' fi chmod +x 'besj0.HLP' fi # end of overwriting check echo shar: extracting "'besj1.HLP'" '(112 characters)' if test -f 'besj1.HLP' then echo shar: will not over-write existing file "'besj1.HLP'" else cat << \SHAR_EOF > 'besj1.HLP' This function returns the j1st Bessel function of its argument. 'besj1' expects its argument to be in radians. SHAR_EOF if test 112 -ne "`wc -c < 'besj1.HLP'`" then echo shar: error transmitting "'besj1.HLP'" '(should have been 112 characters)' fi chmod +x 'besj1.HLP' fi # end of overwriting check echo shar: extracting "'besy0.HLP'" '(112 characters)' if test -f 'besy0.HLP' then echo shar: will not over-write existing file "'besy0.HLP'" else cat << \SHAR_EOF > 'besy0.HLP' This function returns the y0th Bessel function of its argument. 'besy0' expects its argument to be in radians. SHAR_EOF if test 112 -ne "`wc -c < 'besy0.HLP'`" then echo shar: error transmitting "'besy0.HLP'" '(should have been 112 characters)' fi chmod +x 'besy0.HLP' fi # end of overwriting check echo shar: extracting "'besy1.HLP'" '(112 characters)' if test -f 'besy1.HLP' then echo shar: will not over-write existing file "'besy1.HLP'" else cat << \SHAR_EOF > 'besy1.HLP' This function returns the y1st Bessel function of its argument. 'besy1' expects its argument to be in radians. SHAR_EOF if test 112 -ne "`wc -c < 'besy1.HLP'`" then echo shar: error transmitting "'besy1.HLP'" '(should have been 112 characters)' fi chmod +x 'besy1.HLP' fi # end of overwriting check echo shar: extracting "'floor.HLP'" '(180 characters)' if test -f 'floor.HLP' then echo shar: will not over-write existing file "'floor.HLP'" else cat << \SHAR_EOF > 'floor.HLP' This function returns the smallest integer not greater than its argument. For complex numbers, 'floor' returns the smallest integer not greater than the real part of its argument. SHAR_EOF if test 180 -ne "`wc -c < 'floor.HLP'`" then echo shar: error transmitting "'floor.HLP'" '(should have been 180 characters)' fi chmod +x 'floor.HLP' fi # end of overwriting check echo shar: extracting "'ceil.HLP'" '(171 characters)' if test -f 'ceil.HLP' then echo shar: will not over-write existing file "'ceil.HLP'" else cat << \SHAR_EOF > 'ceil.HLP' This function returns the largest integer not less than its argument. For complex numbers, 'ceil' returns the largest integer not less than the real part of its argument. SHAR_EOF if test 171 -ne "`wc -c < 'ceil.HLP'`" then echo shar: error transmitting "'ceil.HLP'" '(should have been 171 characters)' fi chmod +x 'ceil.HLP' fi # end of overwriting check echo shar: done with directory "'functions'" cd .. if test ! -d 'operators' then echo shar: creating directory "'operators'" mkdir 'operators' fi echo shar: entering directory "'operators'" cd 'operators' echo shar: extracting "'.HLP'" '(312 characters)' if test -f '.HLP' then echo shar: will not over-write existing file "'.HLP'" else cat << \SHAR_EOF > '.HLP' The operators in GNUPLOT are the same as the corresponding operators in the C programming language, except that all operators accept integer, real, and complex arguments, unless otherwise noted. The FORTRAN ** (exponentiation) operator is also supported. Parentheses may be used to change order of evaluation. SHAR_EOF if test 312 -ne "`wc -c < '.HLP'`" then echo shar: error transmitting "'.HLP'" '(should have been 312 characters)' fi chmod +x '.HLP' fi # end of overwriting check echo shar: extracting "'binary.HLP'" '(791 characters)' if test -f 'binary.HLP' then echo shar: will not over-write existing file "'binary.HLP'" else cat << \SHAR_EOF > 'binary.HLP' The following is a list of all the binary operators and their usage: Symbol Example Explantion ** a**b exponentiation * a*b multiplication / a/b division % a%b modulo + a+b addition - a-b subtraction == a==b equality != a!=b inequality & a&b bitwise and ^ a^b bitwise exclusive or | a|b bitwise inclusive or && a&&b logical and || a||b logical or ?: a?b:c terniary operation The terniary operator evaluates its first argument (a). If it is true (non-zero) the second argument (b) is returned, otherwise the third argument (c) is returned. SHAR_EOF if test 791 -ne "`wc -c < 'binary.HLP'`" then echo shar: error transmitting "'binary.HLP'" '(should have been 791 characters)' fi chmod +x 'binary.HLP' fi # end of overwriting check echo shar: extracting "'unary.HLP'" '(222 characters)' if test -f 'unary.HLP' then echo shar: will not over-write existing file "'unary.HLP'" else cat << \SHAR_EOF > 'unary.HLP' The following is a list of all the unary operators and their usage: Symbol Example Explantion - -a unary minus ~ ~a one's complement ! !a logical negation SHAR_EOF if test 222 -ne "`wc -c < 'unary.HLP'`" then echo shar: error transmitting "'unary.HLP'" '(should have been 222 characters)' fi chmod +x 'unary.HLP' fi # end of overwriting check echo shar: done with directory "'operators'" cd .. echo shar: done with directory "'expressions'" cd .. echo shar: extracting "'start_up.HLP'" '(582 characters)' if test -f 'start_up.HLP' then echo shar: will not over-write existing file "'start_up.HLP'" else cat << \SHAR_EOF > 'start_up.HLP' When GNUPLOT is run, it looks for an initialization file to execute. This file is called '.gnuplot' on Unix systems, and 'GNUPLOT.INI' on other systems. If this file is not found in the current directory, the program will look for it in your home directory (under MS-DOS, the environment variable GNUPLOT should contain the name of this directory). If this file is found, GNUPLOT executes the commands in this file. This is most useful for setting your terminal type and defining any functions or variables which you use often. The variable 'pi' is already defined for you. SHAR_EOF if test 582 -ne "`wc -c < 'start_up.HLP'`" then echo shar: error transmitting "'start_up.HLP'" '(should have been 582 characters)' fi chmod +x 'start_up.HLP' fi # end of overwriting check echo shar: extracting "'user_defined.HLP'" '(568 characters)' if test -f 'user_defined.HLP' then echo shar: will not over-write existing file "'user_defined.HLP'" else cat << \SHAR_EOF > 'user_defined.HLP' You may define your own functions and variables. User-defined functions and variables may be used anywhere. User-defined function syntax: <function-name> ( <dummy-var> ) = <expression> Where <expression> is defined in terms of <dummy-var>. User-defined variable syntax: <variable-name> = <constant-expression> Examples: w = 2 q = floor(tan(pi/2 - 0.1)) f(x) = sin(w*x) sinc(x) = sin(pi*x)/(pi*x) delta(t) = (t == 0) ramp(t) = (t > 0) ? t : 0 The variable 'pi' is already defined for you. See 'show functions' and 'show variables'. SHAR_EOF if test 568 -ne "`wc -c < 'user_defined.HLP'`" then echo shar: error transmitting "'user_defined.HLP'" '(should have been 568 characters)' fi chmod +x 'user_defined.HLP' fi # end of overwriting check echo shar: extracting "'.MANUAL'" '(45 characters)' if test -f '.MANUAL' then echo shar: will not over-write existing file "'.MANUAL'" else cat << \SHAR_EOF > '.MANUAL' nroff -man /usr/man/manl/gnuplot.l | more -s SHAR_EOF if test 45 -ne "`wc -c < '.MANUAL'`" then echo shar: error transmitting "'.MANUAL'" '(should have been 45 characters)' fi chmod +x '.MANUAL' fi # end of overwriting check if test ! -d 'set-show' then echo shar: creating directory "'set-show'" mkdir 'set-show' fi echo shar: entering directory "'set-show'" cd 'set-show' echo shar: extracting "'.HLP'" '(118 characters)' if test -f '.HLP' then echo shar: will not over-write existing file "'.HLP'" else cat << \SHAR_EOF > '.HLP' The 'set' command sets LOTS of options. The 'show' command shows their settings. 'show all' shows all the settings. SHAR_EOF if test 118 -ne "`wc -c < '.HLP'`" then echo shar: error transmitting "'.HLP'" '(should have been 118 characters)' fi chmod +x '.HLP' fi # end of overwriting check echo shar: extracting "'autoscale.HLP'" '(263 characters)' if test -f 'autoscale.HLP' then echo shar: will not over-write existing file "'autoscale.HLP'" else cat << \SHAR_EOF > 'autoscale.HLP' If autoscaling is set, the Y axis is automatically scaled to fit the range of the function or data being plotted. If autoscaling is not set, the current Y range is used. See 'set yrange'. Syntax: set autoscale set noautoscale show autoscale SHAR_EOF if test 263 -ne "`wc -c < 'autoscale.HLP'`" then echo shar: error transmitting "'autoscale.HLP'" '(should have been 263 characters)' fi chmod +x 'autoscale.HLP' fi # end of overwriting check echo shar: extracting "'output.HLP'" '(306 characters)' if test -f 'output.HLP' then echo shar: will not over-write existing file "'output.HLP'" else cat << \SHAR_EOF > 'output.HLP' By default, plots are displayed to the standard output. The 'set output' command redirects the displays to the specified file or device. Syntax: set output {filename} show output The filename must be enclosed in quotes. If the filename is omitted, output will be sent to the standard output. SHAR_EOF if test 306 -ne "`wc -c < 'output.HLP'`" then echo shar: error transmitting "'output.HLP'" '(should have been 306 characters)' fi chmod +x 'output.HLP' fi # end of overwriting check echo shar: extracting "'style.HLP'" '(543 characters)' if test -f 'style.HLP' then echo shar: will not over-write existing file "'style.HLP'" else cat << \SHAR_EOF > 'style.HLP' Plots may be displayed in one of three styles: 'lines', 'points', or 'impulses'. The 'lines' style connects adjacent points with lines. The 'points' style displays a small symbol at each point. The 'impulses' style displays a vertical line from the X axis to each point. Default styles are chosen with the 'set function style' and 'set data style' commands. Syntax: set function style <style> set data style <style> show function style show data style Where style is either 'lines', 'points', or 'impulses'. SHAR_EOF if test 543 -ne "`wc -c < 'style.HLP'`" then echo shar: error transmitting "'style.HLP'" '(should have been 543 characters)' fi chmod +x 'style.HLP' fi # end of overwriting check echo shar: extracting "'logscale.HLP'" '(167 characters)' if test -f 'logscale.HLP' then echo shar: will not over-write existing file "'logscale.HLP'" else cat << \SHAR_EOF > 'logscale.HLP' Log scaling may be set on the X and/or Y axis. Syntax: set logscale <axes> set nologscale show logscale Where <axes> is either 'x', 'y', or 'xy'. SHAR_EOF if test 167 -ne "`wc -c < 'logscale.HLP'`" then echo shar: error transmitting "'logscale.HLP'" '(should have been 167 characters)' fi chmod +x 'logscale.HLP' fi # end of overwriting check echo shar: extracting "'variables.HLP'" '(105 characters)' if test -f 'variables.HLP' then echo shar: will not over-write existing file "'variables.HLP'" else cat << \SHAR_EOF > 'variables.HLP' The 'show variables' command lists all user-defined variables and their values. Syntax: show variables SHAR_EOF if test 105 -ne "`wc -c < 'variables.HLP'`" then echo shar: error transmitting "'variables.HLP'" '(should have been 105 characters)' fi chmod +x 'variables.HLP' fi # end of overwriting check echo shar: extracting "'functions.HLP'" '(110 characters)' if test -f 'functions.HLP' then echo shar: will not over-write existing file "'functions.HLP'" else cat << \SHAR_EOF > 'functions.HLP' The 'show functions' command lists all user-defined functions and their definitions. Syntax: show functions SHAR_EOF if test 110 -ne "`wc -c < 'functions.HLP'`" then echo shar: error transmitting "'functions.HLP'" '(should have been 110 characters)' fi chmod +x 'functions.HLP' fi # end of overwriting check echo shar: extracting "'samples.HLP'" '(396 characters)' if test -f 'samples.HLP' then echo shar: will not over-write existing file "'samples.HLP'" else cat << \SHAR_EOF > 'samples.HLP' The sampling rates of functions may be changed by the 'set samples' command. By default, sampling is set to 160 points. A higher sampling rate will produce more accurate plots, but will take longer. In generating plots, GNUPLOT will use either the sampling rate set or the resolution of the current output device, whichever is smaller. Syntax: set samples <expression> show samples SHAR_EOF if test 396 -ne "`wc -c < 'samples.HLP'`" then echo shar: error transmitting "'samples.HLP'" '(should have been 396 characters)' fi chmod +x 'samples.HLP' fi # end of overwriting check echo shar: extracting "'terminal.HLP'" '(396 characters)' if test -f 'terminal.HLP' then echo shar: will not over-write existing file "'terminal.HLP'" else cat << \SHAR_EOF > 'terminal.HLP' GNUPLOT supports many different graphics devices. Use the 'set terminal' command to select the type of device for which GNUPLOT will produce output. Syntax: set terminal {terminal-type} show terminal If <terminal-type> is omitted, the program will list the available terminal types. <terminal-type> may be abbreviated. Use 'set output' to redirect this output to a file or device. SHAR_EOF if test 396 -ne "`wc -c < 'terminal.HLP'`" then echo shar: error transmitting "'terminal.HLP'" '(should have been 396 characters)' fi chmod +x 'terminal.HLP' fi # end of overwriting check echo shar: extracting "'zero.HLP'" '(184 characters)' if test -f 'zero.HLP' then echo shar: will not over-write existing file "'zero.HLP'" else cat << \SHAR_EOF > 'zero.HLP' GNUPLOT will not display points when their imaginary parts are greater than the 'zero' threshold. The default 'zero' value is 1e-8. Syntax: set zero <expression> show zero SHAR_EOF if test 184 -ne "`wc -c < 'zero.HLP'`" then echo shar: error transmitting "'zero.HLP'" '(should have been 184 characters)' fi chmod +x 'zero.HLP' fi # end of overwriting check echo shar: extracting "'xrange.HLP'" '(294 characters)' if test -f 'xrange.HLP' then echo shar: will not over-write existing file "'xrange.HLP'" else cat << \SHAR_EOF > 'xrange.HLP' The 'set xrange' command sets the horizontal range of values which will be displayed. This range may also be specified on the 'plot' command line. Syntax: set xrange [{xmin : xmax}] Where <xmin> and <xmax> terms are expressions or constants. Both the <xmin> and <xmax> terms are optional. SHAR_EOF if test 294 -ne "`wc -c < 'xrange.HLP'`" then echo shar: error transmitting "'xrange.HLP'" '(should have been 294 characters)' fi chmod +x 'xrange.HLP' fi # end of overwriting check echo shar: extracting "'yrange.HLP'" '(329 characters)' if test -f 'yrange.HLP' then echo shar: will not over-write existing file "'yrange.HLP'" else cat << \SHAR_EOF > 'yrange.HLP' The 'set yrange' command sets the vertical range of values which will be displayed. This command turns autoscaling OFF. This range may also be specified on the 'plot' command line. Syntax: set yrange [{ymin : ymax}] Where <ymin> and <ymax> terms are expressions or constants. Both the <ymin> and <ymax> terms are optional. SHAR_EOF if test 329 -ne "`wc -c < 'yrange.HLP'`" then echo shar: error transmitting "'yrange.HLP'" '(should have been 329 characters)' fi chmod +x 'yrange.HLP' fi # end of overwriting check echo shar: done with directory "'set-show'" cd .. echo shar: extracting "'help.HLP'" '(310 characters)' if test -f 'help.HLP' then echo shar: will not over-write existing file "'help.HLP'" else cat << \SHAR_EOF > 'help.HLP' The 'help' command will display on-line help. To specify information on a particular topic use the syntax: help <topic> You may exit the help utility and return to the plot program by either pressing <return> at the 'Topic?' prompt or pressing your computer's END-OF-FILE character at any help prompt. SHAR_EOF if test 310 -ne "`wc -c < 'help.HLP'`" then echo shar: error transmitting "'help.HLP'" '(should have been 310 characters)' fi chmod +x 'help.HLP' fi # end of overwriting check echo shar: extracting "'subsitution.HLP'" '(566 characters)' if test -f 'subsitution.HLP' then echo shar: will not over-write existing file "'subsitution.HLP'" else cat << \SHAR_EOF > 'subsitution.HLP' Command-line subsitution is specified by a system command encolsed in backquotes (``). This command is spawned and the output it produces replaces the name of the command (and backquotes) on the command line. Newlines in the output produced by the spawned command are replaced with blanks. Command-line subsitution can be used anywhere on the GNUPLOT command line. Examples: a(x) = `leastsq` ; subsitutes "`leastsq`" with output produced by a program named leastsq. a(x) = `run leastsq.exe` ; same but for VMS. SHAR_EOF if test 566 -ne "`wc -c < 'subsitution.HLP'`" then echo shar: error transmitting "'subsitution.HLP'" '(should have been 566 characters)' fi chmod +x 'subsitution.HLP' fi # end of overwriting check echo shar: done with directory "'gnuplot'" cd .. # End of shell archive exit 0
jmg@cernvax.UUCP (jmg) (11/24/86)
In article <430@vu-vlsi.UUCP> taw@vu-vlsi.UUCP (Thomas Williams) writes: >NOTE: This help works with the recently posted vms-like 'help' program >(sorry, couldn't find authors name) or it can be converted into a >VMS .HLP file with the "vmshelp.csh" script. I can find no trace of this 'help' program: who knows where/when it floated by?