@@ -1,1650 +1,1650 @@ -From hearn@rand.orgSat Feb 3 09:55:22 1996 -Date: Sat, 03 Feb 96 01:00:05 -0800 -From: Tony Hearn -To: shar-list@rand.org -Subject: Shar File - - -# This is a shell archive. Remove anything before this line, then -# unpack it by saving it in a file and typing "sh file". (Files -# unpacked will be owned by you and have default permissions.) -# -# This archive contains: -# plot/plot.red - -echo x - plot/plot.red -if [ -f plot/plot.red ] - then - mv plot/plot.red \ - plot/plot.red.old - else - echo "*** New file plot/plot.red created" -fi -cat > "plot/plot.red" \ - << '//E*O*F plot/plot.red//' -module plot; % device and driver independent plot services. - -% Author: Herbert Melenk. - -% Minor corrections by Winfried Neun (October 1995) - -create!-package('(plot),nil); - -global '( - - plotdriver!* % modulename of the actual driver. - - plotmax!* % maximal floating point number which - % gnuplot supports on the machine - % (mostly IEEE double or single precision). - - plotmin!* % lower bound (=1/plotmax!*) - - variation!* % defintion of y-bigstep for smooth - - plotoptions!* % list for collecting the options. - -); - -fluid '( - - plotderiv!* % derivative for 2d plot - -); - -!#if(or (errorp (errorset '!*writingfaslfile nil nil)) - (not !*writingfaslfile) - (errorp (errorset '(load fcomp) nil nil))) - prin2t "no support for fast float!"; - eval'(dm fdeclare (x) nil); - eval'(dm thefloat (x)(cadr x)); -!#endif - -endmodule; - -module plotsynt; % Support for the syntax of the plot command. - -% Author: Herbert Melenk. - -% Create .. as the infix operator if not yet done. - -!*msg := nil; % prevent message ".. redefined" during load - -newtok '( (!. !.) !*interval!*); - -if not(gettype '!*interval!* = 'operator) then -<< - precedence .., or; - algebraic operator ..; - put('!*interval!*,'PRTCH,'! !.!.! ); ->>; - -mkop 'point; - -!*msg := t; - -fluid '(plot!-points!* plot!-refine!* plot!-contour!*); - -global '(plot_xrange plot_yrange plot_zrange); -share plot_xmesh,plot_ymesh,plot_xrange,plot_yrange,plot_zrange; - -fluid '(plotprecision!*); - -plotprecision!* := 0.9995; - -fluid '(!*show_grid test_plot); - -switch show_grid; -switch test_plot; % for test printouts - -if null plotmax!* then -<< - load!-package 'arith; - if not !!plumax then roundconstants(); - plotmax!* := !!plumax; % IEEE double precision ->>; - -plotmin!*:= 1.0/plotmax!*; - - -fluid '(plotranges!* plotfunctions!* plotstyle!* !*plotoverflow - !*roundbf); - -put('plot,'psopfn,'ploteval); - -% I need the following definition only at compile time. -macro procedure plotdriver u; - {'apply,{'get,'plotdriver!*,mkquote cadr u},'list.cddr u}; - -symbolic procedure ploteval u; - begin scalar m,!*exp; - if null plotdriver!* then - rederr "no active device driver for PLOT"; - m:=plotrounded(nil); - plot!-points!* := {20}; - plot!-refine!* := 8; - !*plotoverflow := nil; - plotranges!* := plotfunctions!* := nil; - plotstyle!* := 'lines; - plotdriver(init); - for each option in u do ploteval1 plot!-reval option; - errorset('(ploteval2),t,nil); - plotrounded(m); - end; - -symbolic procedure plot!-reval u; - % Protected call reval: simplify u, but don't call any - % algebraic procedure. - begin scalar w; - w:={nil}; - u:=plot!-reval1(u,w); - return car w and u or reval u; - end; - -symbolic procedure plot!-reval1(u,w); - if idp u then reval u else - if atom u or eqcar(u,'!:dn!:) or get(car u,'dname) then u else %WN - if eq(car u,'!*sq) then plot!-reval1 (reval u,w) else %WN - <> else - << if flagp(car u,'opfn) then car w:=t; - car u . for each q in cdr u collect plot!-reval1(q,w) >> >>; - -symbolic procedure ploteval1 option; - begin scalar x,do; - do := get(plotdriver!*,'do); - if pairp option and (x:=get(car option,do)) - then apply(x,list option) else - if pairp option and (x:=get(car option,'plot!-do)) - then apply(x,list option) else - if eqcar(option,'equal) and (x:=get(cadr option,do)) - then apply(x,list caddr option) else - if eqcar(option,'equal) and (x:=get(cadr option,'plot!-do)) - then apply(x,list caddr option) - else ploteval0 option; - end; - -symbolic procedure ploteval0 option; - begin scalar l,r,opt,w; - opt:=get(plotdriver!*,'option); - if flagp(option,opt) then - <>; - if eqcar(option,'list) then - <