Mercurial > octave-nkf
comparison scripts/plot/private/__gnuplot_version__.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 |
---|---|
28 function version = __gnuplot_version__ () | 28 function version = __gnuplot_version__ () |
29 | 29 |
30 persistent __version__ = ""; | 30 persistent __version__ = ""; |
31 | 31 |
32 if (isempty (__version__)) | 32 if (isempty (__version__)) |
33 [status, output] = system (sprintf ("\"%s\" --version", gnuplot_binary ())); | 33 [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ())); |
34 if (status != 0) | 34 if (status != 0) |
35 ## This message ends in a newline so that the traceback messages | 35 ## This message ends in a newline so that the traceback messages |
36 ## are skipped and people might actually see the message, read it, | 36 ## are skipped and people might actually see the message, read it, |
37 ## comprehend it, actually take the advice it gives, and stop | 37 ## comprehend it, take the advice it gives, and stop asking us |
38 ## asking us why plotting fails when gnuplot is not found. | 38 ## why plotting fails when gnuplot is not found. |
39 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n"); | 39 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n"); |
40 endif | 40 endif |
41 output = strrep (output, "gnuplot", ""); | 41 output = strrep (output, "gnuplot", ""); |
42 output = strrep (output, "patchlevel", "."); | 42 output = strrep (output, "patchlevel", "."); |
43 output = strrep (output, "\n", ""); | 43 output = strrep (output, "\n", ""); |