Mercurial > octave-nkf
comparison src/DLD-FUNCTIONS/gplot.l @ 5215:32c569794216
[project @ 2005-03-16 18:54:42 by jwe]
author | jwe |
---|---|
date | Wed, 16 Mar 2005 18:54:52 +0000 |
parents | b111ca4715c6 |
children | 454e3c98300d |
comparison
equal
deleted
inserted
replaced
5214:eecc24b92d97 | 5215:32c569794216 |
---|---|
1 %option prefix="gpt" | 1 %option prefix="gpt" |
2 %option noyywrap | 2 %option noyywrap |
3 | 3 |
4 %{ | 4 %{ |
5 // PKG_ADD: mark_as_rawcommand ("__gnuplot_plot__"); | |
6 // PKG_ADD: mark_as_rawcommand ("__gnuplot_set__"); | |
7 // PKG_ADD: mark_as_rawcommand ("__gnuplot_splot__"); | |
8 // PKG_ADD: mark_as_rawcommand ("__gnuplot_replot__"); | |
9 | |
5 // PKG_ADD: mark_as_rawcommand ("gplot"); | 10 // PKG_ADD: mark_as_rawcommand ("gplot"); |
6 // PKG_ADD: mark_as_rawcommand ("gset"); | 11 // PKG_ADD: mark_as_rawcommand ("gset"); |
7 // PKG_ADD: mark_as_rawcommand ("gsplot"); | 12 // PKG_ADD: mark_as_rawcommand ("gsplot"); |
8 | |
9 // PKG_ADD: mark_as_rawcommand ("replot"); | 13 // PKG_ADD: mark_as_rawcommand ("replot"); |
10 | 14 |
15 // PKG_ADD: mark_as_command ("__gnuplot_show__"); | |
16 | |
11 // PKG_ADD: mark_as_command ("gshow"); | 17 // PKG_ADD: mark_as_command ("gshow"); |
18 | |
12 // PKG_ADD: mark_as_command ("hold"); | 19 // PKG_ADD: mark_as_command ("hold"); |
20 | |
13 // PKG_ADD: mark_as_command ("set"); | 21 // PKG_ADD: mark_as_command ("set"); |
14 // PKG_ADD: mark_as_command ("show"); | 22 // PKG_ADD: mark_as_command ("show"); |
15 | 23 |
16 // PKG_ADD: __gplot_init__ (); | 24 // PKG_ADD: __gnuplot_init__ (); |
17 | 25 |
18 // PKG_ADD: atexit ("closeplot"); | 26 // PKG_ADD: atexit ("closeplot"); |
19 | 27 |
20 #ifdef HAVE_CONFIG_H | 28 #ifdef HAVE_CONFIG_H |
21 #include <config.h> | 29 #include <config.h> |
1116 else | 1124 else |
1117 error (e.msg.c_str ()); | 1125 error (e.msg.c_str ()); |
1118 } | 1126 } |
1119 } | 1127 } |
1120 | 1128 |
1121 DEFUN_DLD (gplot, args, , | |
1122 "Plot with gnuplot.\n") | |
1123 { | |
1124 doplot ("plot", args); | |
1125 return octave_value_list (); | |
1126 } | |
1127 | |
1128 DEFUN_DLD (gsplot, args, , | |
1129 "Plot with gnuplot.\n") | |
1130 { | |
1131 doplot ("splot", args); | |
1132 return octave_value_list (); | |
1133 } | |
1134 | |
1135 DEFUN_DLD (replot, args, , | |
1136 "Plot with gnuplot.\n") | |
1137 { | |
1138 doplot ("replot", args); | |
1139 return octave_value_list (); | |
1140 } | |
1141 | |
1142 DEFUN_DLD (clearplot, , , | 1129 DEFUN_DLD (clearplot, , , |
1143 "-*- texinfo -*-\n\ | 1130 "-*- texinfo -*-\n\ |
1144 @deftypefn {Built-in Function} {} clearplot\n\ | 1131 @deftypefn {Built-in Function} {} clearplot\n\ |
1145 @deftypefnx {Built-in Function} {} clg\n\ | 1132 @deftypefnx {Built-in Function} {} clg\n\ |
1146 Clear the plot window and any titles or axis labels. The name\n\ | 1133 Clear the plot window and any titles or axis labels. The name\n\ |
1147 @code{clg} is aliased to @code{clearplot} for compatibility with\n\ | 1134 @code{clg} is aliased to @code{clearplot} for compatibility with\n\ |
1148 @sc{Matlab}.\n\ | 1135 @sc{Matlab}.\n\ |
1149 \n\ | |
1150 The commands @kbd{gplot clear}, @kbd{gsplot clear}, and @kbd{replot\n\ | |
1151 clear} are equivalent to @code{clearplot}. (Previously, commands like\n\ | |
1152 @kbd{gplot clear} would evaluate @code{clear} as an ordinary expression\n\ | |
1153 and clear all the visible variables.)\n\ | |
1154 @end deftypefn") | 1136 @end deftypefn") |
1155 { | 1137 { |
1156 octave_value_list retval; | 1138 octave_value_list retval; |
1157 | 1139 |
1158 send_to_plot_stream ("clear\n"); | 1140 send_to_plot_stream ("clear\n"); |
1264 octave_value_list retval; | 1246 octave_value_list retval; |
1265 cleanup_tmp_files (); | 1247 cleanup_tmp_files (); |
1266 return retval; | 1248 return retval; |
1267 } | 1249 } |
1268 | 1250 |
1269 DEFUN_DLD (graw, args, , | 1251 DEFUN_DLD (__gnuplot_raw__, args, , |
1270 "-*- texinfo -*-\n\ | 1252 "-*- texinfo -*-\n\ |
1271 @deftypefn {Built-in Function} {} graw (@var{string})\n\ | 1253 @deftypefn {Built-in Function} {} __gnuplot_raw__ (@var{string})\n\ |
1272 Send @var{string} directly to gnuplot subprocess.\n\ | 1254 Send @var{string} directly to gnuplot subprocess.\n\ |
1273 @end deftypefn") | 1255 @end deftypefn") |
1274 { | 1256 { |
1275 octave_value_list retval; | 1257 octave_value_list retval; |
1276 | 1258 |
1292 print_usage ("raw"); | 1274 print_usage ("raw"); |
1293 | 1275 |
1294 return retval; | 1276 return retval; |
1295 } | 1277 } |
1296 | 1278 |
1297 DEFUN_DLD (gset, args, , | 1279 DEFUN_DLD (__gnuplot_set__, args, , |
1298 "-*- texinfo -*-\n\ | 1280 "-*- texinfo -*-\n\ |
1299 @deffn {Command} gset options\n\ | 1281 @deffn {Command} __gnuplot_set__ options\n\ |
1300 Set plotting options for gnuplot\n\ | 1282 Set plotting options for gnuplot\n\ |
1301 @end deffn") | 1283 @end deffn") |
1302 { | 1284 { |
1303 octave_value_list retval; | 1285 octave_value_list retval; |
1304 | 1286 |
1346 OSSTREAM_FREEZE (plot_buf); | 1328 OSSTREAM_FREEZE (plot_buf); |
1347 | 1329 |
1348 return retval; | 1330 return retval; |
1349 } | 1331 } |
1350 | 1332 |
1351 DEFUN_DLD (set, args, nargout, | 1333 DEFUN_DLD (__gnuplot_show__, args, , |
1352 "-*- texinfo -*-\n\ | 1334 "-*- texinfo -*-\n\ |
1353 This command is has been replaced by @code{gset}.") | 1335 @deffn {Command} __gnuplot_show__ options\n\ |
1354 { | |
1355 warning ("set is obsolete -- use gset instead"); | |
1356 return Fgset (args, nargout); | |
1357 } | |
1358 | |
1359 DEFUN_DLD (gshow, args, , | |
1360 "-*- texinfo -*-\n\ | |
1361 @deffn {Command} gshow options\n\ | |
1362 Show plotting options.\n\ | 1336 Show plotting options.\n\ |
1363 @end deffn") | 1337 @end deffn") |
1364 { | 1338 { |
1365 octave_value_list retval; | 1339 octave_value_list retval; |
1366 | 1340 |
1386 OSSTREAM_FREEZE (plot_buf); | 1360 OSSTREAM_FREEZE (plot_buf); |
1387 | 1361 |
1388 return retval; | 1362 return retval; |
1389 } | 1363 } |
1390 | 1364 |
1391 DEFUN_DLD (show, args, nargout, | 1365 DEFUN_DLD (__gnuplot_plot__, args, , |
1392 "-*- texinfo -*-\n\ | 1366 "Plot with gnuplot.\n") |
1393 This command is has been replaced by @code{gshow}.") | 1367 { |
1394 { | 1368 doplot ("plot", args); |
1395 warning ("show is obsolete -- use gshow instead"); | 1369 return octave_value_list (); |
1396 return Fgshow (args, nargout); | 1370 } |
1371 | |
1372 DEFUN_DLD (__gnuplot_splot__, args, , | |
1373 "Plot with gnuplot.\n") | |
1374 { | |
1375 doplot ("splot", args); | |
1376 return octave_value_list (); | |
1377 } | |
1378 | |
1379 DEFUN_DLD (__gnuplot_replot__, args, , | |
1380 "Plot with gnuplot.\n") | |
1381 { | |
1382 doplot ("replot", args); | |
1383 return octave_value_list (); | |
1384 } | |
1385 | |
1386 // Deprecated functions. | |
1387 | |
1388 #define WARN_DEPRECATED(FOLD, FNEW) \ | |
1389 do \ | |
1390 { \ | |
1391 static bool warned = false; \ | |
1392 if (! warned) \ | |
1393 { \ | |
1394 warned = true; \ | |
1395 warning (#FOLD " is deprecated and will be removed from a future"); \ | |
1396 warning ("version of Octave."); \ | |
1397 warning ("You should use the higher-level plot functions"); \ | |
1398 warning ("(\"plot\", \"mesh\", \"semilogx\", etc.) instead"); \ | |
1399 warning ("of the low-level plotting commands."); \ | |
1400 warning ("If you absolutely must use this function, use the"); \ | |
1401 warning ("internal version " #FNEW " instead."); \ | |
1402 } \ | |
1403 } \ | |
1404 while (0) | |
1405 | |
1406 #define DEPRECATED_BODY(FOLD, FNEW) \ | |
1407 WARN_DEPRECATED (FOLD, FNEW); \ | |
1408 return feval (#FNEW, args) | |
1409 | |
1410 // We can't further simplify this by putting the DEFUN_DLD in a macro | |
1411 // because then the mk-oct-links script will fail. | |
1412 | |
1413 DEFUN_DLD (gplot, args, , | |
1414 "") | |
1415 { | |
1416 DEPRECATED_BODY (gplot, __gnuplot_plot__); | |
1417 } | |
1418 | |
1419 DEFUN_DLD (gsplot, args, , | |
1420 "") | |
1421 { | |
1422 DEPRECATED_BODY (gsplot, __gnuplot_splot__); | |
1423 } | |
1424 | |
1425 DEFUN_DLD (graw, args, , | |
1426 "") | |
1427 { | |
1428 DEPRECATED_BODY (graw, __gnuplot__raw__); | |
1429 } | |
1430 | |
1431 DEFUN_DLD (gset, args, , | |
1432 "") | |
1433 { | |
1434 DEPRECATED_BODY (gset, __gnuplot_set__); | |
1435 } | |
1436 | |
1437 DEFUN_DLD (gshow, args, , | |
1438 "") | |
1439 { | |
1440 DEPRECATED_BODY (gshow, __gnuplot__show__); | |
1397 } | 1441 } |
1398 | 1442 |
1399 static int | 1443 static int |
1400 automatic_replot (void) | 1444 automatic_replot (void) |
1401 { | 1445 { |
1482 Vgnuplot_has_frames = check_preference ("gnuplot_has_frames"); | 1526 Vgnuplot_has_frames = check_preference ("gnuplot_has_frames"); |
1483 | 1527 |
1484 return 0; | 1528 return 0; |
1485 } | 1529 } |
1486 | 1530 |
1487 DEFUN_DLD (__gplot_init__, , , | 1531 DEFUN_DLD (__gnuplot_init__, , , |
1488 "-*- texinfo -*-\n\ | 1532 "-*- texinfo -*-\n\ |
1489 @deftypefn {Loadable Function} __gplot_init__ ()\n\ | 1533 @deftypefn {Loadable Function} __gnuplot_init__ ()\n\ |
1490 @end deftypefn") | 1534 @end deftypefn") |
1491 { | 1535 { |
1492 octave_value_list retval; | 1536 octave_value_list retval; |
1493 | 1537 |
1494 static bool gplot_initialized = false; | 1538 static bool gnuplot_initialized = false; |
1495 | 1539 |
1496 if (gplot_initialized) | 1540 if (gnuplot_initialized) |
1497 return retval; | 1541 return retval; |
1498 | 1542 |
1499 gplot_initialized = true; | 1543 gnuplot_initialized = true; |
1500 | 1544 |
1501 DEFVAR (automatic_replot, true, automatic_replot, | 1545 DEFVAR (automatic_replot, true, automatic_replot, |
1502 "-*- texinfo -*-\n\ | 1546 "-*- texinfo -*-\n\ |
1503 @defvr {Built-in Variable} automatic_replot\n\ | 1547 @defvr {Built-in Variable} automatic_replot\n\ |
1504 You can tell Octave to redisplay the plot each time anything about it\n\ | 1548 You can tell Octave to redisplay the plot each time anything about it\n\ |