Mercurial > octave-nkf
comparison scripts/plot/gnuplot_drawnow.m @ 9945:b4661b498a7e
gnuplot_drawnow.m: Prunec prompt lines from dumb terminal output.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 08 Dec 2009 18:48:25 -0500 |
parents | ccad98db781b |
children | 1ca904d74f78 |
comparison
equal
deleted
inserted
replaced
9944:fea3d4868692 | 9945:b4661b498a7e |
---|---|
104 pause (0.1); | 104 pause (0.1); |
105 fid = fopen (dumb_tmp_file, 'r'); | 105 fid = fopen (dumb_tmp_file, 'r'); |
106 endwhile | 106 endwhile |
107 ## reprint the plot on screen | 107 ## reprint the plot on screen |
108 [a, count] = fscanf (fid, '%c', Inf); | 108 [a, count] = fscanf (fid, '%c', Inf); |
109 puts (a); | |
110 fclose (fid); | 109 fclose (fid); |
110 if (count>0) | |
111 if (a(1)==12) | |
112 ## avoid ^L at the beginning | |
113 a = a(2:end); | |
114 end | |
115 puts (a); | |
116 end | |
111 unlink (dumb_tmp_file); | 117 unlink (dumb_tmp_file); |
112 endif | 118 endif |
113 else | 119 else |
114 print_usage (); | 120 print_usage (); |
115 endif | 121 endif |
262 ## Aqua has size, but the format is different. | 268 ## Aqua has size, but the format is different. |
263 size_str = sprintf ("size %d %d", gnuplot_size); | 269 size_str = sprintf ("size %d %d", gnuplot_size); |
264 elseif (strncmpi (term, "dumb", 3)) | 270 elseif (strncmpi (term, "dumb", 3)) |
265 new_stream = 1; | 271 new_stream = 1; |
266 if (~isempty (getenv ("COLUMNS")) && ~isempty (getenv ("LINES"))) | 272 if (~isempty (getenv ("COLUMNS")) && ~isempty (getenv ("LINES"))) |
267 ## Let dumb use full text screen size. | 273 ## Let dumb use full text screen size (minus prompt lines). |
268 size_str = ["size ", getenv("COLUMNS"), " ", getenv("LINES")]; | 274 n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n"))); |
275 ## n = the number of times \n appears in PS1 | |
276 size_str = ["size ", getenv("COLUMNS"), ",", getenv("LINES"), n]; | |
269 else | 277 else |
270 ## Use the gnuplot default. | 278 ## Use the gnuplot default. |
271 size_str = ""; | 279 size_str = ""; |
272 end | 280 end |
273 elseif (strncmpi (term, "fig", 3)) | 281 elseif (strncmpi (term, "fig", 3)) |