Mercurial > hg > octave-terminal
changeset 610:14b2a186a5c0
[project @ 1994-08-14 00:55:49 by jwe]
author | jwe |
---|---|
date | Sun, 14 Aug 1994 01:01:32 +0000 |
parents | cdc194110938 |
children | 60f885cd0d87 |
files | src/balance.cc src/colloc.cc src/dassl.cc src/data.cc src/error.cc src/file-io.cc src/fsolve.cc src/input.cc src/lsode.cc src/npsol.cc src/octave.cc src/pt-const.h src/pt-exp-base.cc src/pt-plot.cc src/qpsol.cc src/quad.cc src/rand.cc src/sysdep.cc src/tc-rep.h src/utils.cc src/variables.cc |
diffstat | 21 files changed, 44 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/src/balance.cc +++ b/src/balance.cc @@ -76,7 +76,7 @@ // determine if balancing option is listed // set my_nargin to the number of matrix inputs - if (args(nargin-1).const_type () == tree_constant_rep::string_constant) + if (args(nargin-1).is_string ()) { bal_job = args(nargin-1).string_value (); my_nargin = nargin-2;
--- a/src/colloc.cc +++ b/src/colloc.cc @@ -68,7 +68,7 @@ { if (args(i).is_defined ()) { - if (! args(i).is_string_type ()) + if (! args(i).is_string ()) { error ("colloc: expecting string argument"); return retval;
--- a/src/dassl.cc +++ b/src/dassl.cc @@ -283,7 +283,7 @@ } else if (nargin == 3) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { char *keyword = args(1).string_value (); double val = args(2).double_value ();
--- a/src/data.cc +++ b/src/data.cc @@ -339,6 +339,9 @@ switch (nargin) { + case 1: + retval = 1.0; + break; case 2: retval = fill_matrix (args(1), 1.0, "ones"); break; @@ -362,6 +365,9 @@ switch (nargin) { + case 1: + retval = 0.0; + break; case 2: retval = fill_matrix (args(1), 0.0, "zeros"); break; @@ -427,6 +433,9 @@ switch (nargin) { + case 1: + retval = 1.0; + break; case 2: retval = identity_matrix (args(1)); break;
--- a/src/error.cc +++ b/src/error.cc @@ -144,7 +144,7 @@ if (nargin == 2 && args(1).is_defined ()) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { msg = args(1).string_value ();
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -177,7 +177,7 @@ Pix return_valid_file (const tree_constant& arg) { - if (arg.is_string_type ()) + if (arg.is_string ()) { Pix p = file_list.first (); file_info file; @@ -252,7 +252,7 @@ if (! p) { - if (arg.is_string_type ()) + if (arg.is_string ()) { char *name = arg.string_value (); @@ -488,7 +488,7 @@ Octave_object retval; Pix p; - if (! args(1).is_string_type ()) + if (! args(1).is_string ()) { error ("fopen: file name must be a string"); return retval; @@ -506,7 +506,7 @@ return retval; } - if (! args(2).is_string_type ()) + if (! args(2).is_string ()) { error ("fopen: file mode must be a string"); return retval; @@ -895,7 +895,7 @@ case 's': - if (! args(fmt_arg_count).is_string_type ()) + if (! args(fmt_arg_count).is_string ()) goto invalid_conversion; else { @@ -909,7 +909,7 @@ case 'c': - if (! args(fmt_arg_count).is_string_type ()) + if (! args(fmt_arg_count).is_string ()) goto invalid_conversion; else { @@ -1005,7 +1005,7 @@ if (strcmp (type, "fprintf") == 0) { - if (args(2).is_string_type ()) + if (args(2).is_string ()) { fmt = args(2).string_value (); fmt_arg_count++; @@ -1033,7 +1033,7 @@ fmt_arg_count++; } - else if (args(1).is_string_type ()) + else if (args(1).is_string ()) { fmt = args(1).string_value (); fmt_arg_count++; @@ -1326,7 +1326,7 @@ if (strcmp (type, "scanf") != 0) { - if (args(2).is_string_type ()) + if (args(2).is_string ()) scanf_fmt = args(2).string_value (); else { @@ -1355,7 +1355,7 @@ fptr = file.fptr (); } - if ((! fptr && args(1).is_string_type ()) + if ((! fptr && args(1).is_string ()) || (doing_fscanf && file.number () == 0)) { char *string; @@ -1557,7 +1557,7 @@ char *prec = "uchar"; if (nargin > 3) { - if (args(3).is_string_type ()) + if (args(3).is_string ()) prec = args(3).string_value (); else { @@ -1719,7 +1719,7 @@ char *prec = "uchar"; if (nargin > 3) { - if (args(3).is_string_type ()) + if (args(3).is_string ()) prec = args(3).string_value (); else {
--- a/src/fsolve.cc +++ b/src/fsolve.cc @@ -265,7 +265,7 @@ } else if (nargin == 3) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { char *keyword = args(1).string_value (); double val = args(2).double_value ();
--- a/src/input.cc +++ b/src/input.cc @@ -752,7 +752,7 @@ char *prompt = "debug> "; if (nargin > 1) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) prompt = args(1).string_value (); else {
--- a/src/lsode.cc +++ b/src/lsode.cc @@ -270,7 +270,7 @@ } else if (nargin == 3) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { char *keyword = args(1).string_value (); double val = args(2).double_value ();
--- a/src/npsol.cc +++ b/src/npsol.cc @@ -755,7 +755,7 @@ } else if (nargin == 3) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { char *keyword = args(1).string_value (); double val = args(2).double_value ();
--- a/src/octave.cc +++ b/src/octave.cc @@ -733,7 +733,7 @@ tree_constant eval_string (const tree_constant& arg, int& parse_status) { - if (! arg.is_string_type ()) + if (! arg.is_string ()) { error ("eval: expecting string argument"); return -1; @@ -773,7 +773,7 @@ int nargin = args.length (); - if (nargin == 2 && args(1).is_string_type ()) + if (nargin == 2 && args(1).is_string ()) { iprocstream cmd (args(1).string_value ()); char ch;
--- a/src/pt-const.h +++ b/src/pt-const.h @@ -121,8 +121,6 @@ int is_numeric_or_range_type (void) const { return rep->is_numeric_or_range_type (); } - int is_string_type (void) const { return rep->is_string_type (); } - int valid_as_scalar_index (void) const { return rep->valid_as_scalar_index (); }
--- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -94,7 +94,7 @@ int nr = val.rows (); int nc = val.columns (); return (val.is_scalar_type () - || val.is_string_type () + || val.is_string () || (val.is_matrix_type () && ((nr == 1 && nc == 1) || nr == 0 @@ -356,7 +356,7 @@ list[len].nr = nr; list[len].nc = nc; - if (all_strings && ! tmp.is_string_type ()) + if (all_strings && ! tmp.is_string ()) all_strings = 0; if (! found_complex && tmp.is_complex_type ())
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -651,7 +651,7 @@ if (! error_state && data.is_defined ()) { char *file = 0; - if (data.is_string_type ()) + if (data.is_string ()) { file = tilde_expand (data.string_value ()); ifstream ftmp (file); @@ -711,7 +711,7 @@ if (title) { tree_constant tmp = title->eval (0); - if (! error_state && tmp.is_string_type ()) + if (! error_state && tmp.is_string ()) plot_buf << " title " << '"' << tmp.string_value () << '"'; else {
--- a/src/qpsol.cc +++ b/src/qpsol.cc @@ -363,7 +363,7 @@ } else if (nargin == 3) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { char *keyword = args(1).string_value (); double val = args(2).double_value ();
--- a/src/quad.cc +++ b/src/quad.cc @@ -302,7 +302,7 @@ print_quad_option_list (); else if (nargin == 3) { - if (args(1).is_string_type ()) + if (args(1).is_string ()) { char *keyword = args(1).string_value (); double val = args(2).double_value ();
--- a/src/rand.cc +++ b/src/rand.cc @@ -200,7 +200,7 @@ } else if (nargin == 3) { - if (args(1).is_string_type () + if (args(1).is_string () && strcmp (args(1).string_value (), "seed") == 0) { double d = args(2).to_scalar ();
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -396,7 +396,7 @@ int nargin = args.length (); - if (nargin == 2 && args(1).is_string_type ()) + if (nargin == 2 && args(1).is_string ()) { char *value = getenv (args(1).string_value ()); if (value)
--- a/src/tc-rep.h +++ b/src/tc-rep.h @@ -142,9 +142,6 @@ int is_undefined (void) const { return type_tag == tree_constant_rep::unknown_constant; } - int is_string_type (void) const - { return type_tag == tree_constant_rep::string_constant; } - int is_scalar_type (void) const { return type_tag == scalar_constant || type_tag == complex_scalar_constant; }
--- a/src/utils.cc +++ b/src/utils.cc @@ -483,7 +483,7 @@ { int n = args.length (); for (int i = 1; i < n; i++) - if (! args(i).is_string_type ()) + if (! args(i).is_string ()) return 0; return 1; }
--- a/src/variables.cc +++ b/src/variables.cc @@ -133,7 +133,7 @@ { tree_fvc *ans = 0; - if (! arg.is_string_type ()) + if (! arg.is_string ()) { if (warn) error ("%s: expecting function name as argument", warn_for); @@ -186,7 +186,7 @@ int nargin = args.length (); - if (nargin != 2 || ! args(1).is_string_type ()) + if (nargin != 2 || ! args(1).is_string ()) { print_usage ("is_global"); return retval; @@ -211,7 +211,7 @@ int nargin = args.length (); - if (nargin != 2 || ! args(1).is_string_type ()) + if (nargin != 2 || ! args(1).is_string ()) { print_usage ("exist"); return retval; @@ -675,7 +675,7 @@ { tree_constant val = defn->eval (0); - if (! error_state && val.is_string_type ()) + if (! error_state && val.is_string ()) { char *s = val.string_value (); if (s)