Mercurial > hg > octave-lyh
comparison scripts/plot/private/__gnuplot_has_terminal__.m @ 16108:3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
* scripts/plot/__gnuplot_drawnow__.m: Use default values in function header.
Check number of arguments to function immediately. Use single quotes to
avoid lots of backslashing. Use strtok() to replace hand-coded functionality.
Initialize persistent variables in declaration (10% faster).
* scripts/plot/gnuplot_binary.in: Replace tabs with spaces. Simplify input
validation. Add %!test block.
* scripts/plot/private/__gnuplot_get_var__.m: Use default values in function
header. Use "*char" in fread to automatically convert to char variable.
* scripts/plot/private/__gnuplot_ginput__.m: Check immediately for required
version of gnuplot. Use "*char" in fread to automatically convert to char
variable. Use fputs in place of fprintf to match rest of code.
* scripts/plot/private/__gnuplot_has_feature__.m: Initialize persistent varibles
in declaration. Use false () rather than logical (zeros()) construction.
* scripts/plot/private/__gnuplot_has_terminal__.m: Use strtok() to replace
hand-coded functionality
* scripts/plot/private/__gnuplot_print__.m: Replace sprintf calls with direct
string char matrix concatenation (2.4x faster) where possible. Replace for
loop with multiple argument form of set(). Use single quotes to avoid lots
of backslashing.
* scripts/plot/private/__gnuplot_version__.m: Use single quotes to avoid lots
of backslashing.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 25 Feb 2013 21:01:36 -0800 |
parents | 72c96de7a403 |
children |
comparison
equal
deleted
inserted
replaced
16107:3b791008b88e | 16108:3cce6b4e0f7c |
---|---|
23 | 23 |
24 ## Author: Ben Abbott <bpabbott@mac.com> | 24 ## Author: Ben Abbott <bpabbott@mac.com> |
25 ## Created: 2010-09-13 | 25 ## Created: 2010-09-13 |
26 | 26 |
27 function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream) | 27 function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream) |
28 term = deblank (term); | 28 |
29 n = find (term == " ", 1); | 29 term = strtrim (term); |
30 if (! isempty (n)) | 30 term = lower (strtok (term, " ")); |
31 term = term(1:n-1); | 31 |
32 endif | |
33 if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS")) | 32 if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS")) |
34 if (nargin < 2) | 33 if (nargin < 2) |
35 plot_stream = __gnuplot_open_stream__ (2); | 34 plot_stream = __gnuplot_open_stream__ (2); |
36 endif | 35 endif |
37 available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS"); | 36 available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS"); |
57 "pm", "png", "postscript", "pslatex", ... | 56 "pm", "png", "postscript", "pslatex", ... |
58 "pstex", "pstricks", "qms", "regis", "rgip", ... | 57 "pstex", "pstricks", "qms", "regis", "rgip", ... |
59 "svg", "texdraw", "tgif", "tkcanvas", ... | 58 "svg", "texdraw", "tgif", "tkcanvas", ... |
60 "tpic", "windows", "x11", "xlib", "xterm"}; | 59 "tpic", "windows", "x11", "xlib", "xterm"}; |
61 endif | 60 endif |
62 gnuplot_supports_term = any (strcmpi (available_terminals, term)); | 61 |
62 gnuplot_supports_term = any (strcmp (term, available_terminals)); | |
63 | |
63 endfunction | 64 endfunction |
64 | 65 |