Mercurial > hg > octave-terminal
changeset 3246:a41cc560087a
[project @ 1999-06-19 06:46:20 by jwe]
author | jwe |
---|---|
date | Sat, 19 Jun 1999 06:46:35 +0000 |
parents | 2270329efd14 |
children | 256f98d26275 |
files | doc/ChangeLog doc/faq/Makefile.in doc/interpreter/Makefile.in doc/interpreter/basics.texi doc/interpreter/io.texi doc/liboctave/Makefile.in scripts/ChangeLog scripts/polynomial/polyfit.m src/ChangeLog src/file-io.cc src/help.cc src/lex.l test/octave.test/index/dfi-f/v-3.m |
diffstat | 13 files changed, 164 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +Fri Jun 18 23:17:02 1999 John W. Eaton <jwe@bevo.che.wisc.edu> + + * interpreter/Makefile.in (octave_toc.html): Add -expandinfo to + tex12html options. + * liboctave/Makefile.in (liboctave_toc.html): Likewise. + * faq/Makefile.in (Octave-FAQ_toc.html): Likewise. + Fri Oct 9 00:27:33 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * faq/Makefile.in, interpreter/Makefile.in, liboctave/Makefile.in:
--- a/doc/faq/Makefile.in +++ b/doc/faq/Makefile.in @@ -50,7 +50,7 @@ -dvips -o Octave-FAQ.ps Octave-FAQ.dvi Octave-FAQ_toc.html: - -texi2html -split_chapter $(srcdir)/Octave-FAQ.texi + -texi2html -expandinfo -split_chapter $(srcdir)/Octave-FAQ.texi check install install-strip uninstall: .PHONY: check install install-strip uninstall
--- a/doc/interpreter/Makefile.in +++ b/doc/interpreter/Makefile.in @@ -81,7 +81,8 @@ mv BUGS ../../BUGS octave_toc.html: - -texi2html -split_chapter -I$(srcdir)/.. $(srcdir)/octave.texi + -texi2html -expandinfo -split_chapter -I$(srcdir)/.. \ + $(srcdir)/octave.texi check: all .PHONY: check
--- a/doc/interpreter/basics.texi +++ b/doc/interpreter/basics.texi @@ -217,7 +217,7 @@ @code{"@value{OCTAVEHOME}/bin/octave"}, and @code{program_name} would have the value @code{"octave"}. -If executing a script from the command line (e.g., @code{octave foo.m} +If executing a script from the command line (e.g., @code{octave foo.m}) or using an executable Octave script, the program name is set to the name of the script. @xref{Executable Octave Programs} for an example of how to create an executable Octave script.
--- a/doc/interpreter/io.texi +++ b/doc/interpreter/io.texi @@ -1165,7 +1165,7 @@ read for this specification. When @code{scanf} finds a conversion specification that uses this flag, it reads input as directed by the rest of the conversion specification, but it discards this input, does -not use a pointer argument, and does not increment the count of +not return any value, and does not increment the count of successful assignments. @cindex flag character (@code{scanf}) @@ -1174,8 +1174,9 @@ width}. Reading of characters from the input stream stops either when this maximum is reached or when a non-matching character is found, whichever happens first. Most conversions discard initial whitespace -characters (those that don't are explicitly documented), and these -discarded characters don't count towards the maximum field width. +characters, and these discarded characters don't count towards the +maximum field width. Conversions that do not discard initial whitespace +are explicitly documented. @cindex maximum field width (@code{scanf}) @item
--- a/doc/liboctave/Makefile.in +++ b/doc/liboctave/Makefile.in @@ -54,7 +54,8 @@ -dvips -o liboctave.ps liboctave.dvi liboctave_toc.html: - -texi2html -split_chapter -I$(srcdir)/.. $(srcdir)/liboctave.texi + -texi2html -expandinfo -split_chapter -I$(srcdir)/.. \ + $(srcdir)/liboctave.texi check: .PHONY: check
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +Fri Jun 18 12:19:22 1999 John W. Eaton <jwe@bevo.che.wisc.edu> + + * polynomial/polyfit.m: Correct previous change. + Wed Apr 7 13:57:26 1999 John W. Eaton <jwe@bevo.che.wisc.edu> * linear-algebra/qrhouse.m, linear-algebra/krygetq.m: Delete.
--- a/scripts/polynomial/polyfit.m +++ b/scripts/polynomial/polyfit.m @@ -59,7 +59,7 @@ yf = X * p; if (y_is_row_vector) - yf = yf'; + yf = yf.'; endif endif
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +Mon Jun 7 09:54:51 1999 John W. Eaton <jwe@bevo.che.wisc.edu> + + * lex.l (next_token_is_bin_op, next_token_is_postfix_unary_op, + handle_number): Delete yytext arg. Change all callers. + (next_token_is_postfix_unary_op): Check the first character + obtained from yyinput before calling it again. + (next_token_is_bin_op): Do a more thorough check. + (handle_identifier): Also enter token in local symbol table if the + following token is a dot and it looks like a binary operator. + (whitespace_in_literal_matrix): Now static. + + * lex.l: Always use unput, not yyunput. + Fri May 28 11:02:37 1999 John W. Eaton <jwe@bevo.che.wisc.edu> * DLD-FUNCTIONS/chol.cc (Fchol): If two output arguments, never
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -946,14 +946,14 @@ values are\n\ \n\ native -- the format of the current machine (default)\n\ - ieee-le -- IEEE big endian\n\ - ieee-be -- IEEE little endian\n\ + ieee-be -- IEEE big endian\n\ + ieee-le -- IEEE little endian\n\ vaxd -- VAX D floating format\n\ vaxg -- VAX G floating format\n\ cray -- Cray floating format\n\ \n\ however, conversions are currently only supported for\n\ - ieee-be, and ieee-le formats.\n\ + ieee-be and ieee-le formats.\n\ \n\ \n\ DATA : matrix in which the data is stored\n\
--- a/src/help.cc +++ b/src/help.cc @@ -865,15 +865,13 @@ { octave_value defn = sym_rec->def (); - assert (defn.is_constant ()); - int var_ok = 1; // XXX FIXME XXX -- need to handle structure // references correctly. - if (defn.is_map ()) - error ("type: operations on structs not implemented"); + //if (defn.is_map ()) + // error ("type: operations on structs not implemented"); if (! error_state) {
--- a/src/lex.l +++ b/src/lex.l @@ -170,10 +170,10 @@ static symbol_record *lookup_identifier (const string& s); static void grab_help_text (void); static bool match_any (char c, const char *s); -static bool next_token_is_bin_op (int spc_prev, char *yytext); -static bool next_token_is_postfix_unary_op (int spc_prev, char *yytext); +static bool next_token_is_bin_op (bool spc_prev); +static bool next_token_is_postfix_unary_op (bool spc_prev); static string strip_trailing_whitespace (char *s); -static void handle_number (char *yytext); +static void handle_number (void); static int handle_string (char delim, int text_style = 0); static int handle_close_brace (int spc_gobbled); static int handle_identifier (const string& tok, int spc_gobbled); @@ -236,7 +236,7 @@ <TEXT_FCN>[\"\'] { current_input_column++; - return handle_string (yytext[0], 1); + return handle_string (yytext[0], true); } <TEXT_FCN>[^ \t\n\;\,\"\'][^ \t\n\;\,]*{S}* { @@ -294,8 +294,8 @@ if (Vwhitespace_in_literal_matrix != 2) { int tmp = eat_continuation (); - int bin_op = next_token_is_bin_op (1, yytext); - int postfix_un_op = next_token_is_postfix_unary_op (1, yytext); + int bin_op = next_token_is_bin_op (true); + int postfix_un_op = next_token_is_postfix_unary_op (true); if (! (postfix_un_op || bin_op) && nesting_level.is_brace () @@ -397,7 +397,7 @@ %} {NUMBER}{Im} { - handle_number (yytext); + handle_number (); return IMAG_NUM; } @@ -408,7 +408,7 @@ {D}+/\.[\*/\\^'] | {NUMBER} { - handle_number (yytext); + handle_number (); return NUM; } @@ -668,10 +668,10 @@ int c = yyinput (); - yyunput (c, yytext); + unput (c); if (spc_gobbled) - yyunput (' ', yytext); + unput (' '); lexer_flags.do_comma_insert = (lexer_flags.braceflag && c == '['); } @@ -1172,7 +1172,7 @@ done: if (c) - yyunput (c, yytext); + unput (c); } // Return 1 if the given character matches any character in the given @@ -1197,8 +1197,10 @@ // [ 1 + 2 ] or [ 1+ 2] or [ 1+2 ] ==> binary static bool -looks_like_bin_op (int spc_prev, int spc_next) +looks_like_bin_op (bool spc_prev, int next_char) { + bool spc_next = (next_char == ' ' || next_char == '\t'); + return ((spc_prev && spc_next) || ! spc_prev); } @@ -1206,47 +1208,39 @@ // unary operator. This is ugly, but it seems to do the right thing. static bool -next_token_is_postfix_unary_op (int spc_prev, char *yytext) +next_token_is_postfix_unary_op (bool spc_prev) { bool un_op = false; int c0 = yyinput (); - int c1 = yyinput (); - - yyunput (c1, yytext); - yyunput (c0, yytext); - int transpose = (c0 == '.' && c1 == '\''); - int hermitian = (c0 == '\''); + if (c0 == '\'' && ! spc_prev) + { + un_op = true; + } + else if (c0 == '.') + { + int c1 = yyinput (); + un_op = (c1 == '\''); + unput (c1); + } - un_op = (transpose || (hermitian && ! spc_prev)); + unput (c0); return un_op; } // Try to determine if the next token should be treated as a binary -// operator. This is even uglier, but it also seems to do the right -// thing. Note that it is only necessary to check the spacing for `+' -// and `-', since those are the only tokens that can appear as unary -// ops too. -// -// Note that this never returns true for `.', even though it can be a -// binary operator (the structure reference thing). The only time -// this appears to matter is for things like +// operator. // -// [ a . b ] +// This kluge exists because whitespace is not always ignored inside +// the square brackets that are used to create matrix objects. // -// which probably doesn't occur that often, can be worked around by -// eliminating the whitespace, putting the expression in parentheses, -// or using `whitespace_in_literal_matrix = "ignored"', so I think it -// is an acceptable change. It would be quite a bit harder to `fix' -// this. (Well, maybe not. the best fix would be to do away with the -// specialness of whitespace inside of `[ ... ]'). -// -// However, we still do check for `.+', `.*', etc. +// Line continuations directly after the operator will cause this +// function to return FALSE. static bool -next_token_is_bin_op (int spc_prev, char *yytext) +next_token_is_bin_op (bool spc_prev) { bool bin_op = false; @@ -1254,44 +1248,101 @@ switch (c0) { + case ':': case '+': case '-': + case '/': + case '\\': + case '^': { int c1 = yyinput (); - yyunput (c1, yytext); - int spc_next = (c1 == ' ' || c1 == '\t'); - bin_op = looks_like_bin_op (spc_prev, spc_next); + bin_op = looks_like_bin_op (spc_prev, c1); + unput (c1); } break; + // .+ .- ./ .\ .^ .* .** case '.': { int c1 = yyinput (); - yyunput (c1, yytext); - bin_op = match_any (c1, "+-*/\\^"); + + if (match_any (c1, "+-/\\^")) + { + int c2 = yyinput (); + bin_op = looks_like_bin_op (spc_prev, c2); + unput (c2); + } + else if (c1 == '*') + { + int c2 = yyinput (); + + if (c2 == '*') + { + int c3 = yyinput (); + bin_op = looks_like_bin_op (spc_prev, c3); + unput (c3); + } + else + bin_op = looks_like_bin_op (spc_prev, c2); + + unput (c2); + } + else if (! isdigit (c1) && c1 != ' ' && c1 != '\t') + { + bin_op = true; + } + + unput (c1); } break; - case '/': - case ':': - case '\\': - case '^': + // = == & && | || * ** + case '=': case '&': + case '|': case '*': - case '|': + { + int c1 = yyinput (); + + if (c1 == c0) + { + int c2 = yyinput (); + bin_op = looks_like_bin_op (spc_prev, c2); + unput (c2); + } + else + bin_op = looks_like_bin_op (spc_prev, c1); + + unput (c1); + } + break; + + // <= >= <> ~= != < > case '<': case '>': case '~': case '!': - case '=': - bin_op = true; + { + int c1 = yyinput (); + + if ((c1 == '=') || (c1 == '<' && c1 == '>')) + { + int c2 = yyinput (); + bin_op = looks_like_bin_op (spc_prev, c2); + unput (c2); + } + else if (c1 != '~' && c1 != '!') + bin_op = looks_like_bin_op (spc_prev, c1); + + unput (c1); + } break; default: break; } - yyunput (c0, yytext); + unput (c0); return bin_op; } @@ -1378,7 +1429,7 @@ } done: - yyunput (c, yytext); + unput (c); current_input_column--; return retval; } @@ -1390,7 +1441,7 @@ } static void -handle_number (char *yytext) +handle_number (void) { char *tmp = strsave (yytext); @@ -1480,7 +1531,7 @@ } } - yyunput (c, yytext); + unput (c); return false; cleanup: @@ -1490,7 +1541,7 @@ { int len = strlen (s); while (len--) - yyunput (s[len], yytext); + unput (s[len]); } delete [] s; @@ -1512,12 +1563,12 @@ return true; else { - yyunput (c2, yytext); - yyunput (c1, yytext); + unput (c2); + unput (c1); } } else - yyunput (c1, yytext); + unput (c1); return false; } @@ -1536,7 +1587,7 @@ || (c == '\\' && have_continuation ())) retval = eat_whitespace (); else - yyunput (c, yytext); + unput (c); return retval; } @@ -1593,7 +1644,7 @@ buf << (char) c; else { - yyunput (c, yytext); + unput (c); buf << ends; char *t = buf.str (); string s = do_string_escapes (t); @@ -1736,9 +1787,8 @@ if (lexer_flags.braceflag && Vwhitespace_in_literal_matrix != 2) { - int bin_op = next_token_is_bin_op (spc_gobbled, yytext); - int postfix_un_op = next_token_is_postfix_unary_op - (spc_gobbled, yytext); + int bin_op = next_token_is_bin_op (spc_gobbled); + int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled); int other_op = match_any (c1, ",;\n]"); @@ -1764,10 +1814,9 @@ { if (Vwhitespace_in_literal_matrix != 2 && nesting_level.is_brace ()) { - int bin_op = next_token_is_bin_op (spc_gobbled, yytext); + int bin_op = next_token_is_bin_op (spc_gobbled); - int postfix_un_op - = next_token_is_postfix_unary_op (spc_gobbled, yytext); + int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled); int c1 = yyinput (); int c2 = yyinput (); @@ -1869,8 +1918,9 @@ } int c = yyinput (); - yyunput (c, yytext); + unput (c); bool next_tok_is_eq = (c == '='); + bool next_tok_is_dot = (c == '.'); bool next_tok_is_paren = (c == '('); // Make sure we put the return values of a function in the symbol @@ -1901,7 +1951,8 @@ if (next_tok_is_eq || lexer_flags.looking_at_return_list || lexer_flags.looking_at_parameter_list - || lexer_flags.looking_at_matrix_or_assign_lhs) + || lexer_flags.looking_at_matrix_or_assign_lhs + || (next_tok_is_dot && next_token_is_bin_op (spc_gobbled))) { force_local_variable (tok); } @@ -1950,7 +2001,7 @@ { // By making a newline be the next character to be read, we will // force the parser to return after reading the function. Calling - // yyunput with EOF seems not to work... + // unput with EOF does not work. bool in_comment = false; int lineno = input_line_number; @@ -1983,12 +2034,12 @@ warning ("ignoring trailing garbage after end of function\n\ near line %d of file `%s.m'", lineno, curr_fcn_file_name.c_str ()); - yyunput ('\n', yytext); + unput ('\n'); return; } } } - yyunput ('\n', yytext); + unput ('\n'); } void @@ -2033,7 +2084,7 @@ quote_is_transpose = false; } -int +static int whitespace_in_literal_matrix (void) { int pref = 0;