Mercurial > hg > octave-terminal
changeset 2916:4e7bea116f24
[project @ 1997-04-30 20:56:31 by jwe]
author | jwe |
---|---|
date | Wed, 30 Apr 1997 20:57:48 +0000 |
parents | 649549662cf6 |
children | 5c285800ebe2 |
files | src/ChangeLog src/Makefile.in src/ov-base.h src/ov-bool-mat.cc src/ov-bool-mat.h src/ov-bool.cc src/ov-bool.h src/ov-ch-mat.cc src/ov-ch-mat.h src/ov-complex.cc src/ov-complex.h src/ov-cx-mat.cc src/ov-cx-mat.h src/ov-file.cc src/ov-file.h src/ov-list.cc src/ov-range.cc src/ov-range.h src/ov-re-mat.cc src/ov-re-mat.h src/ov-scalar.cc src/ov-scalar.h src/ov-str-mat.cc src/ov-struct.cc src/ov.h |
diffstat | 25 files changed, 168 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,119 @@ -Mon Apr 28 00:38:19 1997 John W. Eaton <jwe@bevo.che.wisc.edu> +Wed Apr 30 00:24:05 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool.cc, ov-bool.h, + ov-ch-mat.cc, ov-ch-mat.h, ov-complex.cc, ov-complex.h, + ov-cx-mat.cc, ov-cx-mat.h, ov-file.cc, ov-file.h, ov-list.cc, + ov-range.cc, ov-range.h, ov-re-mat.cc, ov-re-mat.h, ov-scalar.cc, + ov-scalar.h, ov-str-mat.cc, ov-struct.cc, ov.h (scalar_value): + New function. Same as double_value, but name is consistent with + octave_scalar class. + + * op-fil-b.cc, op-fil-cm.cc, op-fil-lis.cc, op-fil-rec.cc, + op-fil-str.cc, op-fil-bm.cc, op-fil-cs.cc, op-fil-m.cc, + op-fil-s.cc: New files. + + * ops.h (ASSIGNOPDECL, DEFASSIGNOP, DEFASSIGNOP_FN, CONVDECL, + DEFCONV, BINOPDECL, DEFBINOPX, DEFBINOP, DEFBINOP_OP, DEFBINOP_FN, + BINOP_NONCONFORMANT): New macros. + * op-b-b.cc, op-bm-bm.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, + op-cm-s.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, + op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-s-cm.cc, + op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-str-str.cc: Use them. + + * Makefile.in (octave): Also depend on ops.o. + + * builtins.h: Delete. + * octave.cc: Add extern declaration here. + + * mappers.h: Delete. + * Makefile.in (INCLUDES): Delete from list. + * mkbuiltins: Add extern declaration in builtins.cc. + + * mkops: New file. + * ops.cc: Delete. + * Makefile.in (SOURCES): Delete from the list. + (ops.cc): New target. + (OP_SOURCES): New list. Move all op-*.cc files here from SOURCES. + Add $(OP_SOURCES) to SOURCES list. + + * variables.cc (symbols_of_variables): No longer static. + * ov.cc (symbols_of_ov): Rename from symbols_of_value. + + * ov-base.h: Delete declaration for install_base_type_conversions. + * op-b-b.h, op-bm-bm.h, op-cm-cm.h, op-cm-cs.h, op-cm-m.h, + op-cm-s.h, op-cs-cm.h, op-cs-cs.h, op-cs-m.h, op-cs-s.h, + op-m-cm.h, op-m-cs.h, op-m-m.h, op-m-s.h, op-s-cm.h, op-s-cs.h, + op-s-m.h, op-s-s.h, op-str-str.h: Delete. + * Makefile.in (INCLUDES): Delete them from the list. + +Tue Apr 29 22:27:49 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * variables.h, variables.cc (install_builtin_variables): Delete. + * mkbuiltins: Also generate install_builtin_variables function. + * Makefile.in: Fix rule to call mkbuiltins with correct args. + (clean): Also delete def-files and var-files. + * defaults.h.in, dirfns.h, error.h, file-io.h, help.h, input.h, + lex.h, load-save.h, oct-usr-fcn.h, pager.h, parse.h, pr-output.cc, + pr-output.h, pt-mat.h, pt-misc.h, pt-plot.h, toplev.h: + Delete declarations of symbols_of_* functions. + * data.h, syscalls.h: Delete. + + * pr-output.cc (octave_print_internal): Leave printing of final + new line up to the caller. + + * ov.h, ov.cc (reset_indent_level, increment_indent_level, + decrement_indent_level, newline, indent, reset, + curr_print_indent_level, beginning_of_line): + New functions and static data to manage indent level for printing. + (print_as_scalar): Delete. + (print, print_with_name): Always require stream arg. + Change all callers. + + * oct-stream.h (octave_stream::input_stream): Make publicly available. + (octave_stream::output_stream): Likewise. + + * ov-base.h, ov-base.cc, ov.h, ov.cc, ov-file.h ov-base.h + (is_file, stream_value, stream_number): New functions. + * ov-file.h, ov-file.cc: New files for value class to manage files. + * file-io.cc (symbols_of_file_io): Define stdin, stdout, and + stderr as octve_file objects, not just integers. + (Ffopen, Fpopen): Return octave_file objects, not integer file ids. + * syscalls.cc (Fpipe): Likewise. + * oct-stream.h, oct-stream.cc (octave_stream_list::insert): + Return octave_file object, not integer file id. + + * ov-base.cc, ov-bool-mat.cc, ov-bool.cc, ov-ch-mat.cc, + ov-complex.cc, ov-cx-mat.cc, ov-file.cc, ov-list.cc, ov-range.cc, + ov-re-mat.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, ov.cc + (print_name_tag, print_raw): New functions. + + * help.cc (Ftype): Don't cast symbol definition to tree_constant *. + + * variables.cc (link_to_global_variable): Don't try to define + symbol with tree_constant objects. + (bind_ans): Call symbol_record::define directly and then + octave_value::print_with_name instead of creating a temporary + assignment expression. + + * pt-pr-code.cc (tree_print_code::indent): Don't use ostream::form. + + * pt-exp-base.h, pt-exp.h, pt-exp.cc (oper): Return string, not + char *. Change all where necessary. + +Mon Apr 28 16:33:49 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov.h (octave_value binary_op enum): Add lshift and rshift. + (octave_value assign_op enum): Add lshift_eq and rshift_eq. + * ov.cc (assign_op_as_string, binary_op_as_string): Include them. + * parse.y (LSHIFT_EQ RSHIFT_EQ LSHIFT RSHIFT): New tokens. + Add them to the precedence list. + (simple_expr): Add new operators. + (make_assign_op, make_binary_op): Handle new operators. + * lex.l: Recognize new operators. + + * lex.l: Recognize them. + +Sun Apr 27 20:17:49 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * pt-misc.cc (Vsilent_functions, silent_functions): Move here from oct-usr-fcn.cc. @@ -15,8 +130,6 @@ * dynamic-ld.h, dynamic-ld.cc: Rewrite to use singleton class. * variables.cc (load_fcn_from_file): Use new dynamic linking class. -Sun Apr 27 20:17:49 1997 John W. Eaton <jwe@bevo.che.wisc.edu> - * dynamic-ld.h (Octave_builtin_fcn): Delete typedef. * dynamic-ld.cc: Simplify via the magic of function pointers.
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -39,14 +39,12 @@ endif endif -DLD_SRC := - -#balance.cc chol.cc colloc.cc dassl.cc det.cc eig.cc \ -# expm.cc fft.cc fft2.cc filter.cc find.cc fsolve.cc \ -# fsqp.cc getgrent.cc getpwent.cc getrusage.cc givens.cc \ -# hess.cc ifft.cc ifft2.cc inv.cc log.cc lpsolve.cc lsode.cc \ -# lu.cc minmax.cc npsol.cc pinv.cc qpsol.cc qr.cc quad.cc \ -# qzval.cc rand.cc schur.cc sort.cc svd.cc syl.cc time.cc +DLD_SRC := balance.cc chol.cc colloc.cc dassl.cc det.cc eig.cc \ + expm.cc fft.cc fft2.cc filter.cc find.cc fsolve.cc \ + fsqp.cc getgrent.cc getpwent.cc getrusage.cc givens.cc \ + hess.cc ifft.cc ifft2.cc inv.cc log.cc lpsolve.cc lsode.cc \ + lu.cc minmax.cc npsol.cc pinv.cc qpsol.cc qr.cc quad.cc \ + qzval.cc rand.cc schur.cc sort.cc svd.cc syl.cc time.cc DLD_OBJ := $(patsubst %.cc, %.o, $(DLD_SRC)) @@ -99,7 +97,11 @@ OP_SOURCES := op-b-b.cc op-bm-bm.cc op-cm-cm.cc op-cm-cs.cc \ op-cm-m.cc op-cm-s.cc op-cs-cm.cc op-cs-cs.cc op-cs-m.cc \ op-cs-s.cc op-m-cm.cc op-m-cs.cc op-m-m.cc op-m-s.cc \ - op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc op-str-str.cc + op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc op-str-str.cc \ + op-fil-b.cc op-fil-bm.cc op-fil-cm.cc op-fil-cs.cc \ + op-fil-m.cc op-fil-s.cc op-fil-lis.cc op-fil-rec.cc \ + op-fil-str.cc + SOURCES := BaseSLList.cc Map.cc SLList.cc SLStack.cc Stack.cc \ data.cc defaults.cc dirfns.cc dynamic-ld.cc error.cc \ @@ -192,9 +194,9 @@ stamp-prereq: stamp-picdir defaults.h oct-conf.h touch stamp-prereq -octave: octave.o builtins.o $(DLD_STATIC_OBJ) libraries +octave: octave.o builtins.o ops.o $(DLD_STATIC_OBJ) libraries $(CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(ALL_LDFLAGS) -o octave \ - octave.o builtins.o $(DLD_STATIC_OBJ) \ + octave.o builtins.o ops.o $(DLD_STATIC_OBJ) \ $(OCTAVE_LFLAGS) \ $(OCTAVE_LIBS) \ $(FLIBS) $(LEXLIB) $(TERMLIBS) $(LIBS)
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -138,6 +138,8 @@ double double_value (bool) const; + double scalar_value (bool) const { return double_value (); } + Matrix matrix_value (bool frc_str_conv = false) const; Complex complex_value (bool frc_str_conv = false) const;
--- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -213,7 +213,6 @@ void octave_bool_matrix::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); }
--- a/src/ov-bool-mat.h +++ b/src/ov-bool-mat.h @@ -105,6 +105,8 @@ double double_value (bool = false) const; + double scalar_value (bool = false) const { return double_value (); } + Matrix matrix_value (bool = false) const { return matrix; } Complex complex_value (bool = false) const;
--- a/src/ov-bool.cc +++ b/src/ov-bool.cc @@ -115,7 +115,6 @@ void octave_bool::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); } @@ -123,6 +122,7 @@ void octave_bool::print_raw (ostream& os, bool pr_as_read_syntax) const { + indent (os); octave_print_internal (os, scalar, pr_as_read_syntax); }
--- a/src/ov-bool.h +++ b/src/ov-bool.h @@ -99,6 +99,8 @@ double double_value (bool = false) const { return scalar; } + double scalar_value (bool = false) const { return scalar; } + Matrix matrix_value (bool = false) const { return Matrix (1, 1, scalar); } Complex complex_value (bool = false) const { return scalar; }
--- a/src/ov-ch-mat.cc +++ b/src/ov-ch-mat.cc @@ -98,7 +98,6 @@ void octave_char_matrix::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); }
--- a/src/ov-ch-mat.h +++ b/src/ov-ch-mat.h @@ -105,6 +105,8 @@ double double_value (bool = false) const; + double scalar_value (bool = false) const { return double_value (); } + Matrix matrix_value (bool = false) const { return matrix; } Complex complex_value (bool = false) const;
--- a/src/ov-complex.cc +++ b/src/ov-complex.cc @@ -157,7 +157,6 @@ void octave_complex::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); } @@ -165,6 +164,7 @@ void octave_complex::print_raw (ostream& os, bool pr_as_read_syntax) const { + indent (os); octave_print_internal (os, scalar, pr_as_read_syntax); }
--- a/src/ov-complex.h +++ b/src/ov-complex.h @@ -102,6 +102,8 @@ double double_value (bool = false) const; + double scalar_value (bool = false) const { return double_value (); } + Matrix matrix_value (bool = false) const; Complex complex_value (bool = false) const;
--- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -309,7 +309,6 @@ void octave_complex_matrix::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); }
--- a/src/ov-cx-mat.h +++ b/src/ov-cx-mat.h @@ -112,6 +112,8 @@ double double_value (bool) const; + double scalar_value (bool) const { return double_value (); } + Matrix matrix_value (bool = false) const; Complex complex_value (bool = false) const;
--- a/src/ov-file.cc +++ b/src/ov-file.cc @@ -62,7 +62,6 @@ void octave_file::print (ostream& os, bool) const { - indent (os); print_raw (os); newline (os); } @@ -70,7 +69,7 @@ void octave_file::print_raw (ostream& os, bool) const { - os << "{"; newline (os); + indent (os); os << "{"; newline (os); if (stream) {
--- a/src/ov-file.h +++ b/src/ov-file.h @@ -70,7 +70,9 @@ type_conv_fcn numeric_conversion_function (void) const; - double double_value (void) const { return static_cast<double> (number); } + double double_value (bool) const { return static_cast<double> (number); } + + double scalar_value (bool) const { return static_cast<double> (number); } octave_stream *stream_value (void) const { return stream; }
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -29,6 +29,7 @@ #endif #include <iostream.h> +#include <strstream.h> #include "lo-utils.h" @@ -90,7 +91,6 @@ { begin_unwind_frame ("octave_list_print"); - newline (os); indent (os); os << "("; newline (os); @@ -101,9 +101,15 @@ for (int i = 0; i < n; i++) { + ostrstream buf; + buf << "[" << i+1 << "]" << ends; + const char *nm = buf.str (); + octave_value val = lst(i); - val.print (os); + val.print_with_name (os, nm); + + delete [] nm; } decrement_indent_level (); @@ -120,6 +126,7 @@ { indent (os); os << name << " ="; + newline (os); return false; }
--- a/src/ov-range.cc +++ b/src/ov-range.cc @@ -206,7 +206,6 @@ void octave_range::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); }
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -127,6 +127,8 @@ double double_value (bool) const; + double scalar_value (bool) const { return double_value (); } + Matrix matrix_value (bool) const { return range.matrix_value (); }
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -262,7 +262,6 @@ void octave_matrix::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); }
--- a/src/ov-re-mat.h +++ b/src/ov-re-mat.h @@ -111,6 +111,8 @@ double double_value (bool = false) const; + double scalar_value (bool = false) const { return double_value (); } + Matrix matrix_value (bool = false) const { return matrix; } Complex complex_value (bool = false) const;
--- a/src/ov-scalar.cc +++ b/src/ov-scalar.cc @@ -112,7 +112,6 @@ void octave_scalar::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); print_raw (os, pr_as_read_syntax); newline (os); } @@ -120,6 +119,7 @@ void octave_scalar::print_raw (ostream& os, bool pr_as_read_syntax) const { + indent (os); octave_print_internal (os, scalar, pr_as_read_syntax); }
--- a/src/ov-scalar.h +++ b/src/ov-scalar.h @@ -100,6 +100,8 @@ double double_value (bool = false) const { return scalar; } + double scalar_value (bool = false) const { return scalar; } + Matrix matrix_value (bool = false) const { return Matrix (1, 1, scalar); } Complex complex_value (bool = false) const { return scalar; }
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -220,7 +220,7 @@ void octave_char_matrix_str::print (ostream& os, bool pr_as_read_syntax) const { - indent (os); + // indent (os); print_raw (os, pr_as_read_syntax); newline (os); }
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -83,7 +83,6 @@ if (Vstruct_levels_to_print-- > 0) { - newline (os); indent (os); os << "{"; newline (os); @@ -118,6 +117,7 @@ { indent (os); os << name << " ="; + newline (os); return false; }
--- a/src/ov.h +++ b/src/ov.h @@ -338,6 +338,9 @@ virtual double double_value (bool frc_str_conv = false) const { return rep->double_value (frc_str_conv); } + virtual double scalar_value (bool frc_str_conv = false) const + { return rep->scalar_value (frc_str_conv); } + virtual Matrix matrix_value (bool frc_str_conv = false) const { return rep->matrix_value (frc_str_conv); }