From: <and...@us...> - 2009-01-20 12:26:08
|
Revision: 9354 http://plplot.svn.sourceforge.net/plplot/?rev=9354&view=rev Author: andrewross Date: 2009-01-20 12:25:57 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Update octave bindings and examples to remove legacy code for octave 2.0 and 2.1. This was primarily to support different mechanisms for setting the path and for suppressing warnings. The changes mean octave 3.0 no long complains about variables no longer complains about obsolete variables Cmake now checks that at least octave 2.9 is installed and disables the bindings otherwise. Fix automatic_replot which was broken in octave 2.9 / 3.0 as the octave variable automatic_replot was removed. Replace with a plplot specific global variable pl_automatic_replot. This means that the p??.m examples now work correctly again. Modified Paths: -------------- trunk/bindings/octave/PLplot/autostyle.m trunk/bindings/octave/PLplot/axis.m trunk/bindings/octave/PLplot/colormap.m trunk/bindings/octave/PLplot/figure.m trunk/bindings/octave/PLplot/grid.m trunk/bindings/octave/PLplot/legend.m trunk/bindings/octave/PLplot/plot_margin.m trunk/bindings/octave/PLplot/plplot_octave_path.m.in trunk/bindings/octave/PLplot/shade.m trunk/bindings/octave/PLplot/shading.m trunk/bindings/octave/PLplot/support/__pl_contour.m trunk/bindings/octave/PLplot/support/__pl_matstr.m trunk/bindings/octave/PLplot/support/__pl_plotit.m trunk/bindings/octave/PLplot/title.m trunk/bindings/octave/PLplot/toggle_plplot_use.m trunk/bindings/octave/PLplot/xlabel.m trunk/bindings/octave/PLplot/xticks.m trunk/bindings/octave/PLplot/ylabel.m trunk/bindings/octave/PLplot/yticks.m trunk/bindings/octave/PLplot/zlabel.m trunk/bindings/octave/USAGE trunk/bindings/octave/demos/p1.m trunk/bindings/octave/demos/p10.m trunk/bindings/octave/demos/p11.m trunk/bindings/octave/demos/p12.m trunk/bindings/octave/demos/p13.m trunk/bindings/octave/demos/p14.m trunk/bindings/octave/demos/p15.m trunk/bindings/octave/demos/p16.m trunk/bindings/octave/demos/p17.m trunk/bindings/octave/demos/p18.m trunk/bindings/octave/demos/p19.m trunk/bindings/octave/demos/p2.m trunk/bindings/octave/demos/p21.m trunk/bindings/octave/demos/p3.m trunk/bindings/octave/demos/p4.m trunk/bindings/octave/demos/p5.m trunk/bindings/octave/demos/p6.m trunk/bindings/octave/demos/p7.m trunk/bindings/octave/demos/p8.m trunk/bindings/octave/demos/p9.m trunk/bindings/octave/octaverc.in trunk/cmake/modules/octave.cmake trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/PLplot/autostyle.m =================================================================== --- trunk/bindings/octave/PLplot/autostyle.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/autostyle.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -21,6 +21,7 @@ function st = autostyle(x) global __pl + global pl_automatic_replot strm = __pl_init; if (nargin == 1) @@ -49,8 +50,8 @@ st = __pl.line_style(strm); - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/axis.m =================================================================== --- trunk/bindings/octave/PLplot/axis.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/axis.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -61,6 +61,7 @@ ## as setup by the user, or automaticaly. It interacts with hold mode. global __pl + global pl_automatic_replot strm = __pl_init; if (nargin == 0) @@ -193,8 +194,8 @@ endswitch endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/colormap.m =================================================================== --- trunk/bindings/octave/PLplot/colormap.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/colormap.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -23,6 +23,7 @@ function ccmap = colormap(map) global __pl + global pl_automatic_replot __pl_init; if (nargin == 0) @@ -68,8 +69,8 @@ plscmap1(map(:,1), map(:,2), map(:,3)); plflush;#pleop; - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) ## can cause problems on plot scripts that dont support automatic _replot __pl_plotit; endif Modified: trunk/bindings/octave/PLplot/figure.m =================================================================== --- trunk/bindings/octave/PLplot/figure.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/figure.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -46,15 +46,15 @@ function [n, driver, intp]= figure (n, device, file, win_id, tk_file, plot_frame) global __pl __tk_name + global pl_automatic_replot if (!exist("__pl") || !struct_contains (__pl,"inited")) v = split(version ,'.'); if (! ((str2num(v(1,:)) > 2) || - (str2num(v(1,:)) == 2 && str2num(v(2,:)) > 1) || - (str2num(v(1,:)) == 2 && str2num(v(2,:)) == 1 && - str2num(v(3,:)) >= 57))) + (str2num(v(1,:)) == 2 && str2num(v(2,:)) == 9 && + str2num(v(3,:)) >= 0))) error("The PLplot-Octave scripts need an Octave version \n\ - greater than or equal to 2.1.57.\n"); + greater than or equal to 2.9.0.\n"); endif plplot_stub; @@ -65,13 +65,13 @@ __pl.inited = 1; - if (exist("automatic_replot")) - if (automatic_replot == 0) - warning("It is recommended that you set 'automatic_replot=1' \n\ - in your ~/.octaverc file."); - ##automatic_replot = 1; - endif - endif +## if (exist("pl_automatic_replot")) +## if (pl_automatic_replot == 0) +## warning("It is recommended that you set 'pl_automatic_replot=1' \n\ +## in your ~/.octaverc file."); +## ##automatic_replot = 1; +## endif +## endif endif if (nargin == 0) Modified: trunk/bindings/octave/PLplot/grid.m =================================================================== --- trunk/bindings/octave/PLplot/grid.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/grid.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -23,6 +23,7 @@ function st = grid (x) global __pl + global pl_automatic_replot strm = __pl_init; st = __pl.grid(strm); @@ -57,8 +58,8 @@ help grid endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/legend.m =================================================================== --- trunk/bindings/octave/PLplot/legend.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/legend.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -29,6 +29,7 @@ function st = legend (x, xpos, varargin) global __pl + global pl_automatic_replot strm = __pl_init; if (nargin == 0) @@ -66,8 +67,8 @@ help "legend" endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/plot_margin.m =================================================================== --- trunk/bindings/octave/PLplot/plot_margin.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/plot_margin.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -22,6 +22,7 @@ function ost = plot_margin(st) global __pl + global pl_automatic_replot n = __pl_init; ost = __pl.margin(n); @@ -30,8 +31,8 @@ __pl.margin(n) = st; endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/plplot_octave_path.m.in =================================================================== --- trunk/bindings/octave/PLplot/plplot_octave_path.m.in 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/plplot_octave_path.m.in 2009-01-20 12:25:57 UTC (rev 9354) @@ -22,7 +22,7 @@ global __pl_plplot_octave_path if (!exist("__pl_plplot_octave_path") || isempty(__pl_plplot_octave_path)) - __pl_plplot_octave_path = "@PLPLOT_OCTAVE_DIR@//"; + __pl_plplot_octave_path = "@PLPLOT_OCTAVE_DIR@"; endif if (nargin == 0) Modified: trunk/bindings/octave/PLplot/shade.m =================================================================== --- trunk/bindings/octave/PLplot/shade.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/shade.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -28,13 +28,8 @@ unwind_protect - if (exist("warn_empty_list_elements")) - old_empty_list_elements_ok = warn_empty_list_elements; - warn_empty_list_elements = 0; - else - old_empty_list_elements_ok = warning("query", "Octave:empty-list-elements"); - warning("off","Octave:empty-list-elements"); - endif + old_empty_list_elements_ok = warning("query", "Octave:empty-list-elements"); + warning("off","Octave:empty-list-elements"); if (nargin == 1 && ismatrix(x)) levels = 20; @@ -177,11 +172,7 @@ unwind_protect_cleanup - if (exist("warn_empty_list_elements")) - warn_empty_list_elements = old_empty_list_elements_ok; - else - warning(old_empty_list_elements_ok.state, "Octave:empty-list-elements"); - endif + warning(old_empty_list_elements_ok.state, "Octave:empty-list-elements"); end_unwind_protect Modified: trunk/bindings/octave/PLplot/shading.m =================================================================== --- trunk/bindings/octave/PLplot/shading.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/shading.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -19,6 +19,7 @@ function type = shading(type) global __pl + global pl_automatic_replot strm = __pl_init; if (nargin == 0) @@ -35,8 +36,8 @@ return; endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/support/__pl_contour.m =================================================================== --- trunk/bindings/octave/PLplot/support/__pl_contour.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/support/__pl_contour.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -21,13 +21,8 @@ unwind_protect - if (exist("warn_empty_list_elements")) - old_empty_list_elements_ok = warn_empty_list_elements; - warn_empty_list_elements = 0; - else - old_empty_list_elements_ok = warning("query","Octave:empty-list-elements"); - warning("off","Octave:empty-list-elements"); - endif + old_empty_list_elements_ok = warning("query","Octave:empty-list-elements"); + warning("off","Octave:empty-list-elements"); grid = 0; if (__pl.grid(strm)) @@ -117,11 +112,7 @@ unwind_protect_cleanup - if (exist("warn_empty_list_elements")) - warn_empty_list_elements = old_empty_list_elements_ok; - else - warning(old_empty_list_elements_ok.state,"Octave:empty-list-elements"); - endif + warning(old_empty_list_elements_ok.state,"Octave:empty-list-elements"); end_unwind_protect Modified: trunk/bindings/octave/PLplot/support/__pl_matstr.m =================================================================== --- trunk/bindings/octave/PLplot/support/__pl_matstr.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/support/__pl_matstr.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -34,17 +34,10 @@ out(nn,:) = ""; endif endif - if (exist("warn_fortran_indexing")) - old_dofi = warn_fortran_indexing; - warn_fortran_indexing = 0; - out(toascii (out) == 0) = " "; - warn_fortran_indexing = old_dofi; - else - old_dofi = warning("query","Octave:fortran-indexing"); - warning("off","Octave:fortran-indexing"); - out(toascii (out) == 0) = " "; - warning(old_dofi.state,"Octave:fortran-indexing"); - endif + old_dofi = warning("query","Octave:fortran-indexing"); + warning("off","Octave:fortran-indexing"); + out(toascii (out) == 0) = " "; + warning(old_dofi.state,"Octave:fortran-indexing"); else help __pl_matstr Modified: trunk/bindings/octave/PLplot/support/__pl_plotit.m =================================================================== --- trunk/bindings/octave/PLplot/support/__pl_plotit.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/support/__pl_plotit.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -28,13 +28,8 @@ unwind_protect - if (exist("warn_empty_list_elements")) - old_empty_list_elements_ok = warn_empty_list_elements; - warn_empty_list_elements = 0; - else - old_empty_list_elements_ok = warning("query","Octave:empty-list-elements"); - warning("off","Octave:empty-list-elements"); - endif + old_empty_list_elements_ok = warning("query","Octave:empty-list-elements"); + warning("off","Octave:empty-list-elements"); if (__pl.type(strm) >= 100 && __pl.type(strm) < 200) __pl_meshplotit; @@ -286,11 +281,7 @@ unwind_protect_cleanup - if (exist("warn_empty_list_elements")) - warn_empty_list_elements = old_empty_list_elements_ok; - else - warning(old_empty_list_elements_ok.state,"Octave:empty-list-elements"); - endif + warning(old_empty_list_elements_ok.state,"Octave:empty-list-elements"); end_unwind_protect Modified: trunk/bindings/octave/PLplot/title.m =================================================================== --- trunk/bindings/octave/PLplot/title.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/title.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -40,6 +40,7 @@ function text = title (text) global __pl + global pl_automatic_replot strm = __pl_init; @@ -57,8 +58,8 @@ __pl.tlabel = __pl_matstr(__pl.tlabel, text, strm); endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/toggle_plplot_use.m =================================================================== --- trunk/bindings/octave/PLplot/toggle_plplot_use.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/toggle_plplot_use.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -3,7 +3,7 @@ ## Use this script to activate/deactivate the default library for the ## PLplot plotting function (plot, mesh, etc.), as both the native ## gnuplot and the new octave-plplot libraries use similar names to the -## functions. toggle_plplot_use post-/pre-pends to LOADPATH the path for +## functions. toggle_plplot_use post-/pre-pends to the path for ## the PLplot functions in successive calls. ## File: toggle_plplot_use.m @@ -23,13 +23,6 @@ if ! exist ("use_plplot_state") global use_plplot_state use_plplot_state = "on"; - # Warn user about spurious warnings with octave 2.9 - ver = str2num(split(version,".")); - if ((ver(1) == 2 && ver(2) == 9) || (ver(1) >= 3)) - if (warning("query","Octave:built-in-variable-assignment").state == "on") - warning("You may want to call\n warning(\"off\",\"Octave:built-in-variable-assignment\");\nto prevent spurious warnings from the plplot code for compatability with octave 2.0/2.1.\n"); - endif - endif else if strcmp (use_plplot_state, "on") use_plplot_state = "off"; @@ -39,38 +32,22 @@ endif use_plplot_path = plplot_octave_path; -# Strip of trailing // for octave >= 2.9 -if (!exist("LOADPATH")) - use_plplot_path = use_plplot_path(1:end-2); -endif -if (exist("LOADPATH")) - use_plplot_i = findstr (LOADPATH, use_plplot_path); - if (!isempty (use_plplot_i)) - LOADPATH (use_plplot_i(1):use_plplot_i(1)+length(use_plplot_path)-1)= ""; - LOADPATH = strrep (LOADPATH, "::", ":"); +plplot_path_to_remove = split(genpath(use_plplot_path),pathsep); +for i=1:size(plplot_path_to_remove)(1) + if (findstr(path,deblank(plplot_path_to_remove(i,:))) > 0) + rmpath(deblank(plplot_path_to_remove(i,:))); endif -else - plplot_path_to_remove = split(genpath(use_plplot_path),pathsep); - for i=1:size(plplot_path_to_remove)(1) - if (findstr(path,deblank(plplot_path_to_remove(i,:))) > 0) - rmpath(deblank(plplot_path_to_remove(i,:))); - endif - endfor -endif +endfor if (strcmp (use_plplot_state, "on")) - if (exist("LOADPATH")) - LOADPATH = [use_plplot_path, ":", LOADPATH]; - else - addpath(genpath(use_plplot_path)); - endif + addpath(genpath(use_plplot_path)); plplot_stub; -elseif (strcmp (use_plplot_state, "off")) - if (exist("LOADPATH")) - LOADPATH = [LOADPATH, ":", use_plplot_path]; - else - addpath(genpath(use_plplot_path),"-end"); + if ! exist ("pl_automatic_replot") + global pl_automatic_replot + pl_automatic_replot = 1; endif +elseif (strcmp (use_plplot_state, "off")) + addpath(genpath(use_plplot_path),"-end"); endif use_plplot_lcd = pwd; Modified: trunk/bindings/octave/PLplot/xlabel.m =================================================================== --- trunk/bindings/octave/PLplot/xlabel.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/xlabel.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -21,6 +21,7 @@ function text = xlabel (text) global __pl + global pl_automatic_replot strm = __pl_init; @@ -38,8 +39,8 @@ __pl.xlabel = __pl_matstr(__pl.xlabel, text, strm); endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/xticks.m =================================================================== --- trunk/bindings/octave/PLplot/xticks.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/xticks.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -26,6 +26,7 @@ function xticks (int, num) global __pl + global pl_automatic_replot strm = __pl_init; @@ -55,8 +56,8 @@ endif endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/ylabel.m =================================================================== --- trunk/bindings/octave/PLplot/ylabel.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/ylabel.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -21,6 +21,7 @@ function text = ylabel (text) global __pl + global pl_automatic_replot strm = __pl_init; @@ -38,8 +39,8 @@ __pl.ylabel = __pl_matstr(__pl.ylabel, text, strm); endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/PLplot/yticks.m =================================================================== --- trunk/bindings/octave/PLplot/yticks.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/yticks.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -26,6 +26,7 @@ function yticks (int, num) global __pl + global pl_automatic_replot strm = __pl_init; @@ -55,10 +56,10 @@ endif endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif - endif +## endif endfunction Modified: trunk/bindings/octave/PLplot/zlabel.m =================================================================== --- trunk/bindings/octave/PLplot/zlabel.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/PLplot/zlabel.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -21,6 +21,7 @@ function text = zlabel (text) global __pl + global pl_automatic_replot strm =__pl_init; @@ -38,8 +39,8 @@ __pl.zlabel = __pl_matstr(__pl.zlabel, text, strm); endif - if (exist("automatic_replot")) - if (automatic_replot) + if (exist("pl_automatic_replot")) + if (pl_automatic_replot) __pl_plotit; endif endif Modified: trunk/bindings/octave/USAGE =================================================================== --- trunk/bindings/octave/USAGE 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/USAGE 2009-01-20 12:25:57 UTC (rev 9354) @@ -78,19 +78,10 @@ plfill(n, x, y) ... NOTES: - You don't need to specify vector or matrix dimensions. - - When setting Octave variable "automatic_replot = 1", changes take - effect immediately, otherwise they only take effect at the next plot. - (This does not yet apply to all plot types and does not work with - octave 2.9). - - With octave 2.9 you will see various spurious warnings about variables - which are no longer builtins. These warnings can safely be ignored. - Plplot is just testing to see if these variables exist as part of - the octave 2.1 compatibility code. To suppress these warnings add - warning("off","Octave:built-in-variable-assignment"); - to your .octaverc. - + - When setting the plplot variable "pl_automatic_replot = 1", + changes take effect immediately, otherwise they only take + effect at the next plot. - --- Plot window control fig, figure -- Set the current plot window or creates a new one. Modified: trunk/bindings/octave/demos/p1.m =================================================================== --- trunk/bindings/octave/demos/p1.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p1.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -15,10 +15,9 @@ function p1 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot; + t = pl_automatic_replot; + pl_automatic_replot = 0; xscale = 6.; yscale = 1.; @@ -41,9 +40,7 @@ plot(x, y, xs, ys, 'og; ;'); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p10.m =================================================================== --- trunk/bindings/octave/demos/p10.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p10.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -15,10 +15,9 @@ function p10 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; title("Comet"); xlabel ""; @@ -26,9 +25,7 @@ t = -pi:pi/200:0; comet(t,tan(sin(t))-sin(tan(t))); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p11.m =================================================================== --- trunk/bindings/octave/demos/p11.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p11.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p11 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; title("Stripchart demo 1 (sliding)"); xlabel("Time"); @@ -50,8 +49,6 @@ ## Destroy strip chart and it's memory */ stripc_del(id1); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p12.m =================================================================== --- trunk/bindings/octave/demos/p12.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p12.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p12 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; title("War Game"); legend("off"); @@ -32,8 +31,6 @@ endif legend("on"); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p13.m =================================================================== --- trunk/bindings/octave/demos/p13.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p13.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p13 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; legend("opaque"); title("Matrix with individual line attributes"); @@ -36,8 +35,6 @@ ## plot(randn(10,3),fmt) plot(g,fmt) - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p14.m =================================================================== --- trunk/bindings/octave/demos/p14.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p14.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -17,10 +17,9 @@ ## And now, in the Theatre near you, "Octave, the movie" - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; if (!nargin) plsetopt "db"; @@ -64,9 +63,7 @@ closefig; # the "db" option has negative side effects on other plots. plsetopt "reset"; # reset options endif - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p15.m =================================================================== --- trunk/bindings/octave/demos/p15.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p15.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -15,10 +15,9 @@ function p15 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; title "Lighted and shaded surface"; xlabel ""; @@ -35,9 +34,7 @@ surf(x, y, z); colormap('default'); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p16.m =================================================================== --- trunk/bindings/octave/demos/p16.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p16.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p16 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; multiplot(1, 2); p1; @@ -31,8 +30,6 @@ shade(x, y, z); oneplot; - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p17.m =================================================================== --- trunk/bindings/octave/demos/p17.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p17.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p17(fg) - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; title "Click and Drag button 1 to select"; xlabel "Button 2 to restart and button 3 to finish"; @@ -32,8 +31,6 @@ plimage (img, x1, x2, y1, y2); endif - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p18.m =================================================================== --- trunk/bindings/octave/demos/p18.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p18.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p18 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; plsetopt "db"; fig( free_fig); # unused plot window @@ -33,8 +32,6 @@ set_view("meshc", x, y, z); closefig - if (exist("automatic_replot")) - automatic_replot = 0; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p19.m =================================================================== --- trunk/bindings/octave/demos/p19.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p19.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p19 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; f0=figure; multiplot(1,2); @@ -100,8 +99,6 @@ closefig(f1); oneplot; - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p2.m =================================================================== --- trunk/bindings/octave/demos/p2.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p2.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p2 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot; + t = pl_automatic_replot; + pl_automatic_replot = 0; legend("opaque",0) title("PLplot Example 2"); @@ -30,9 +29,7 @@ x, y2, 'b;sin(x)*cos(2*x);', x, y3, 'g;x*sin(x);'); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p21.m =================================================================== --- trunk/bindings/octave/demos/p21.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p21.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -20,10 +20,9 @@ ##ocmap = colormap; colormap(bgr); - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; gx = 30; gy = 40; @@ -52,16 +51,15 @@ pladv(j++); zg = griddata(x, y, z, xg, yg, i, opt(i)); ## zg(isnan(zg)) = 0; - ofi = do_fortran_indexing; do_fortran_indexing = 1; + old_dofi = warning("query","Octave:fortran-indexing"); + warning("off","Octave:fortran-indexing"); zg(isnan(zg)) = 0; - do_fortran_indexing = ofi; + warning(old_dofi.state,"Octave:fortran-indexing"); title(alg(i,:)); meshc(xg, yg, zg'); endfor - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; ##colormap(ocmap); endfunction Modified: trunk/bindings/octave/demos/p3.m =================================================================== --- trunk/bindings/octave/demos/p3.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p3.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p3 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot; + t = pl_automatic_replot; + pl_automatic_replot = 0; xscale = 6.; yscale = 1.; @@ -39,8 +38,6 @@ title("#frPLplot Example 3 - y=x#u2 #d(with error bars)"); plot(x, y, [xs' xe'], [ys' yel' yer'], '~g; ;'); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p4.m =================================================================== --- trunk/bindings/octave/demos/p4.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p4.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p4 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot; + t = pl_automatic_replot; + pl_automatic_replot = 0; x=0.01:0.1:10; y=exp(x); @@ -27,8 +26,6 @@ loglog(x,y,'y') grid (og); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p5.m =================================================================== --- trunk/bindings/octave/demos/p5.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p5.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p5 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; x=-pi:0.01:pi; y=sin(x).+cos(3*x); @@ -27,8 +26,6 @@ polar(x,y,'y') grid (og); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p6.m =================================================================== --- trunk/bindings/octave/demos/p6.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p6.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -16,10 +16,9 @@ [x y z] = rosenbrock; z = log(z); - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; as = autostyle; autostyle "off"; @@ -28,8 +27,6 @@ contour(x,y,z) autostyle(as); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p7.m =================================================================== --- trunk/bindings/octave/demos/p7.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p7.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p7 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; [x y z]=rosenbrock;z=log(z); @@ -36,7 +35,5 @@ shade(x,y,z,15,3); axis; - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p8.m =================================================================== --- trunk/bindings/octave/demos/p8.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p8.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p8 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; xlabel("X"); ylabel("Y"); title("Mesh example"); @@ -27,9 +26,7 @@ pause(1); meshc(x,y,z) - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/demos/p9.m =================================================================== --- trunk/bindings/octave/demos/p9.m 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/demos/p9.m 2009-01-20 12:25:57 UTC (rev 9354) @@ -14,10 +14,9 @@ function p9 - if (exist("automatic_replot")) - t = automatic_replot; - automatic_replot = 0; - endif + global pl_automatic_replot + t = pl_automatic_replot; + pl_automatic_replot = 0; as = autostyle; autostyle ("off"); @@ -40,8 +39,6 @@ legend(ls); autostyle(as); - if (exist("automatic_replot")) - automatic_replot = t; - endif + pl_automatic_replot = t; endfunction Modified: trunk/bindings/octave/octaverc.in =================================================================== --- trunk/bindings/octave/octaverc.in 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/bindings/octave/octaverc.in 2009-01-20 12:25:57 UTC (rev 9354) @@ -1,9 +1,4 @@ -if (exist("LOADPATH")) - automatic_replot=1; - LOADPATH="@CMAKE_SOURCE_DIR@/bindings/octave//:@CMAKE_BINARY_DIR@/bindings/octave//:"; -else - addpath("@CMAKE_SOURCE_DIR@/bindings/octave/PLplot/","@CMAKE_SOURCE_DIR@/bindings/octave/PLplot/support/","@CMAKE_SOURCE_DIR@/bindings/octave/demos/","@CMAKE_SOURCE_DIR@/bindings/octave/misc/","@CMAKE_BINARY_DIR@/bindings/octave/","@CMAKE_BINARY_DIR@/bindings/octave/PLplot"); - # Suppress spurious warnings for the test. - warning("off","Octave:built-in-variable-assignment"); -endif +addpath("@CMAKE_SOURCE_DIR@/bindings/octave/PLplot/","@CMAKE_SOURCE_DIR@/bindings/octave/PLplot/support/","@CMAKE_SOURCE_DIR@/bindings/octave/demos/","@CMAKE_SOURCE_DIR@/bindings/octave/misc/","@CMAKE_BINARY_DIR@/bindings/octave/","@CMAKE_BINARY_DIR@/bindings/octave/PLplot"); putenv("PLPLOT_LIB","@CMAKE_SOURCE_DIR@/data/"); +global pl_automatic_replot +pl_automatic_replot=1; Modified: trunk/cmake/modules/octave.cmake =================================================================== --- trunk/cmake/modules/octave.cmake 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/cmake/modules/octave.cmake 2009-01-20 12:25:57 UTC (rev 9354) @@ -73,7 +73,25 @@ ${_OCTAVE_VERSION} ) message(STATUS "OCTAVE_VERSION = ${OCTAVE_VERSION}") + # Logic that depends on octave version + transform_version(NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION "2.9.0") + transform_version(NUMERICAL_OCTAVE_VERSION "${OCTAVE_VERSION}") + if( + NUMERICAL_OCTAVE_VERSION + LESS + "${NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION}" + ) + message(STATUS "WARNING: " + "plplot require octave version 2.9 or greater. Disabling octave bindings") + set(ENABLE_octave OFF CACHE BOOL "Enable Octave bindings" FORCE) + endif( + NUMERICAL_OCTAVE_VERSION + LESS + "${NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION}" + ) +endif(ENABLE_octave) +if(ENABLE_octave) # The following if block is required to keep from repeated pre-pending # of OCTAVE_INCLUDE_PATH_TRIMMED onto OCTAVE_INCLUDE_PATH which would # create 2^n components to OCTAVE_INCLUDE_PATH for n cmake calls. @@ -154,82 +172,28 @@ ) #message(STATUS "OCTAVE_PREFIX = ${OCTAVE_PREFIX}") - # Logic that depends on octave version - transform_version(NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION "2.1.0") - transform_version(NUMERICAL_OCTAVE_VERSION "${OCTAVE_VERSION}") - if( - NUMERICAL_OCTAVE_VERSION - LESS - "${NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION}" - ) - # octave-2.0 logic. - #_OCTAVE_M_DIR - file(WRITE ${CMAKE_BINARY_DIR}/octave_command - "printf(octave_config_info(\"localfcnfilepath\"));" - ) - execute_process( - COMMAND ${OCTAVE} -q -f octave_command - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_VARIABLE __OCTAVE_M_DIR - ) - #message(STATUS "__OCTAVE_M_DIR = ${__OCTAVE_M_DIR}") - string(REGEX REPLACE - "^.*:([^:][^:]*)//$" - "\\1" - _OCTAVE_M_DIR - ${__OCTAVE_M_DIR} - ) - #message(STATUS "_OCTAVE_M_DIR = ${_OCTAVE_M_DIR}") - #OCTAVE_OCT_DIR - if(NOT DEFINED OCTAVE_OCT_DIR) - file(WRITE ${CMAKE_BINARY_DIR}/octave_command - "printf(octave_config_info(\"localoctfilepath\"));" - ) - execute_process( - COMMAND ${OCTAVE} -q -f octave_command - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_VARIABLE _OCTAVE_OCT_DIR - ) - #message(STATUS "_OCTAVE_OCT_DIR = ${_OCTAVE_OCT_DIR}") - string(REGEX REPLACE - "^.*:([^:][^:]*)//$" - "\\1" - OCTAVE_OCT_DIR - ${_OCTAVE_OCT_DIR} - ) - endif(NOT DEFINED OCTAVE_OCT_DIR) - #message(STATUS "OCTAVE_OCT_DIR = ${OCTAVE_OCT_DIR}") - else( - NUMERICAL_OCTAVE_VERSION - LESS - "${NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION}" - ) - # octave-2.1 (or higher) logic. - #_OCTAVE_M_DIR - file(WRITE ${CMAKE_BINARY_DIR}/octave_command - "printf(octave_config_info(\"localfcnfiledir\"));" - ) - execute_process( - COMMAND ${OCTAVE} -q -f octave_command - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_VARIABLE _OCTAVE_M_DIR - ) - #OCTAVE_OCT_DIR - if(NOT DEFINED OCTAVE_OCT_DIR) - file(WRITE ${CMAKE_BINARY_DIR}/octave_command - "printf(octave_config_info(\"localoctfiledir\"));" - ) - execute_process( - COMMAND ${OCTAVE} -q -f octave_command - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_VARIABLE OCTAVE_OCT_DIR - ) - endif(NOT DEFINED OCTAVE_OCT_DIR) - endif( - NUMERICAL_OCTAVE_VERSION - LESS - "${NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION}" - ) + # octave-2.1 (or higher) logic. + #_OCTAVE_M_DIR + file(WRITE ${CMAKE_BINARY_DIR}/octave_command + "printf(octave_config_info(\"localfcnfiledir\"));" + ) + execute_process( + COMMAND ${OCTAVE} -q -f octave_command + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + OUTPUT_VARIABLE _OCTAVE_M_DIR + ) + #OCTAVE_OCT_DIR + if(NOT DEFINED OCTAVE_OCT_DIR) + file(WRITE ${CMAKE_BINARY_DIR}/octave_command + "printf(octave_config_info(\"localoctfiledir\"));" + ) + execute_process( + COMMAND ${OCTAVE} -q -f octave_command + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + OUTPUT_VARIABLE OCTAVE_OCT_DIR + ) + endif(NOT DEFINED OCTAVE_OCT_DIR) + # Replace the OCTAVE_PREFIX with the PLplot prefix in OCTAVE_M_DIR string(REPLACE "${OCTAVE_PREFIX}" Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2009-01-20 08:05:23 UTC (rev 9353) +++ trunk/plplot_test/test_octave.sh.in 2009-01-20 12:25:57 UTC (rev 9354) @@ -35,12 +35,6 @@ # Launch an Octave script that exercises all the demos $octave -f -q -p $octavedir <<EOF 2> test.error -# Suppress spurious warnings with octave 2.9 -ver = str2num(split(version,".")); -if ((ver(1) == 2 && ver(2) == 9) || (ver(1) >= 3)) - warning("off","Octave:built-in-variable-assignment"); -endif - # Check verbose_test variable if (strcmp(getenv("verbose_test"),"on") == 1) verbose_test = 1; @@ -59,10 +53,8 @@ endfor # p7 works OK with plmeta, e.g., but not ps or psc. pleop/plbop issue? -# These require octave-2.1.50 so comment out since not everybody has -# this. - for i=[1:7 8 9 13 15 16] ; + for i=[1:7 8 9 13 15 16 21] ; if (verbose_test) printf("p%d\n",i); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |