# HG changeset patch # User jwe # Date 772474667 0 # Node ID de9de43ad21f3d72f6c4a0c5c201fe9991c034a0 # Parent 28167349d46a982c407769ee6b94aad1ed1faaa0 [project @ 1994-06-24 16:17:47 by jwe] diff --git a/src/builtins.cc b/src/builtins.cc --- a/src/builtins.cc +++ b/src/builtins.cc @@ -605,9 +605,6 @@ rand (\"seed\") -- get current seed\n\ rand (\"seed\", n) -- set seed", }, - { "replot", 1, 0, builtin_replot, - "replot (): redisplay current plot", }, - { "scanf", 2, -1, builtin_scanf, "[a, b, c, ...] = scanf (\"fmt\")", }, diff --git a/src/g-builtins.cc b/src/g-builtins.cc --- a/src/g-builtins.cc +++ b/src/g-builtins.cc @@ -1550,22 +1550,6 @@ } /* - * Replot current plot. - */ -tree_constant * -builtin_replot (const tree_constant *args, int nargin, int nargout) -{ - tree_constant *retval = NULL_TREE_CONST; - - if (nargin > 1) - warning ("replot: ignoring extra arguments"); - - send_to_plot_stream ("replot\n"); - - return retval; -} - -/* * Formatted reading. */ tree_constant * diff --git a/src/g-builtins.h b/src/g-builtins.h --- a/src/g-builtins.h +++ b/src/g-builtins.h @@ -115,7 +115,6 @@ extern tree_constant *builtin_quit (const tree_constant *, int, int); extern tree_constant *builtin_qzval (const tree_constant *, int, int); extern tree_constant *builtin_rand (const tree_constant *, int, int); -extern tree_constant *builtin_replot (const tree_constant *, int, int); extern tree_constant *builtin_setstr (tree_constant *, int, int); extern tree_constant *builtin_scanf (const tree_constant *, int, int); extern tree_constant *builtin_schur (const tree_constant *, int, int); diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -1057,6 +1057,7 @@ { plotting = 1; yylval.tok_val = new token (token::two_dee, l, c); + token_stack.push (yylval.tok_val); return PLOT; } else if (strcmp ("gsplot", s) == 0) @@ -1066,6 +1067,13 @@ token_stack.push (yylval.tok_val); return PLOT; } + else if (strcmp ("replot", s) == 0) + { + plotting = 1; + yylval.tok_val = new token (token::replot, l, c); + token_stack.push (yylval.tok_val); + return PLOT; + } else if (strcmp ("if", s) == 0) { iffing++; diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -381,13 +381,21 @@ } | PLOT ranges plot_command1 { - tree_subplot_list *tmp = $3->reverse (); - $$ = new tree_plot_command (tmp, $2, $1->pttype ()); - plotting = 0; - past_plot_range = 0; - in_plot_range = 0; - in_plot_using = 0; - in_plot_style = 0; + if ($1->pttype () == token::replot) + { + yyerror ("cannot specify new ranges with replot"); + ABORT_PARSE; + } + else + { + tree_subplot_list *tmp = $3->reverse (); + $$ = new tree_plot_command (tmp, $2, $1->pttype ()); + plotting = 0; + past_plot_range = 0; + in_plot_range = 0; + in_plot_using = 0; + in_plot_style = 0; + } } ; diff --git a/src/pt-plot.cc b/src/pt-plot.cc --- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -89,6 +89,9 @@ switch (ndim) { + case 1: + plot_buf << "replot"; + break; case 2: plot_buf << "plot"; break; diff --git a/src/token.h b/src/token.h --- a/src/token.h +++ b/src/token.h @@ -55,6 +55,7 @@ enum plot_tok_type { + replot = 1, two_dee = 2, three_dee = 3, };