Mercurial > hg > octave-lyh
changeset 4675:f6d6335c08f6
[project @ 2003-12-16 05:11:26 by jwe]
author | jwe |
---|---|
date | Tue, 16 Dec 2003 05:11:27 +0000 |
parents | 7736835a5c8e |
children | c0aa75a64635 |
files | scripts/ChangeLog scripts/control/system/zp2ss.m src/ChangeLog src/DLD-FUNCTIONS/getgrent.cc src/DLD-FUNCTIONS/getpwent.cc src/DLD-FUNCTIONS/getrusage.cc src/DLD-FUNCTIONS/time.cc src/load-save.cc src/ls-hdf5.cc src/ls-mat5.cc src/oct-map.cc src/oct-map.h src/ov-fcn-handle.cc src/ov-struct.cc src/pt-idx.cc src/sighandlers.cc src/syscalls.cc src/toplev.cc |
diffstat | 18 files changed, 230 insertions(+), 173 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2003-12-15 John W. Eaton <jwe@bevo.che.wisc.edu> + + * control/system/zp2ss.m: Don't save and restore + warn_empty_list_elements. + +2003-12-15 Gabriele Pannocchia <g.pannocchia@ing.unipi.it> + + * control/system/zp2ss.m: Correct definition of pure gain system. + 2003-12-10 Quentin Spencer <qspencer@ieee.org> * statistics/base/mean.m: Remove special case for row vectors.
--- a/scripts/control/system/zp2ss.m +++ b/scripts/control/system/zp2ss.m @@ -51,10 +51,6 @@ function [a, b, c, d] = zp2ss (zer, pol, k) - save_warn_empty_list_elements = warn_empty_list_elements; - unwind_protect - warn_empty_list_elements = 0; - if(nargin != 3) error("Incorrect number of input arguments"); endif @@ -72,7 +68,7 @@ warning("zp2ss: k is complex") endif - zpsys = ss2sys([],[],[],k); + zpsys = ss2sys (zeros (0, 0), zeros (0, 1), zeros (1, 0), k); ## Find the number of zeros and the number of poles nzer=length(zer); @@ -150,9 +146,5 @@ [a,b,c,d] = sys2ss(zpsys); - unwind_protect_cleanup - warn_empty_list_elements = save_warn_empty_list_elements; - end_unwind_protect - endfunction
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,36 @@ +2003-12-15 John W. Eaton <jwe@bevo.che.wisc.edu> + + * oct-map.cc (Octave_map::assign): Use Octave_map::contents member + function instead of operator []. + * ov-struct.cc (octave_struct::subsasgn): Likewise. + * DLD-FUNCTIONS/time.cc (extract_tm): Likewise. + + * DLD-FUNCTIONS/time.cc (mk_tm_map): Use Octave_map::assign member + function instead of operator []. + * DLD-FUNCTIONS/getrusage.cc (Fgetrusage): Likewise. + * DLD-FUNCTIONS/getgrent.cc (mk_gr_map): Likewise. + * DLD-FUNCTIONS/getpwent.cc (mk_pw_map): Likewise. + * load-save.cc (do_load): Likewise. + * ls-hdf5.cc (hdf5_read_next_data): Likewise. + * ls-mat5.cc (read_mat5_binary_element): Likewise. + * oct-map.cc (Octave_map::reshape): Likewise. + * oct-map.cc (Octave_map::index): Likewise. + * ov-fcn-handle.cc (Ffunctions): Likewise. + * pt-idx.cc (make_arg_struct): Likewise. + * sighandlers.cc (make_sig_struct): Likewise. + * syscalls.cc (mk_stat_map): Likewise. + * toplev.cc (Foctave_config_info): Likewise. + + * ls-hdf5.cc (add_hdf5_data): Temporary Octave_map is now const. + * ls-mat5.cc (save_mat5_binary_element): Likewise. + + * oct-map.cc (Octave_map::assign (const std::string&, const + octave_value&)): New function. + * oct-map.h: Provide decl. + (Octave_map::contents (const std::string&)): New function. + (Octave_map::operator [] (const std::string&) const): Delete. + (Octave_map::operator [] (const std::string&)): Delete. + 2003-12-09 John W. Eaton <jwe@bevo.che.wisc.edu> * OPERATORS/op-cell.cc: Allow transpose for cell arrays.
--- a/src/DLD-FUNCTIONS/getgrent.cc +++ b/src/DLD-FUNCTIONS/getgrent.cc @@ -51,10 +51,10 @@ { Octave_map m; - m ["name"](0) = gr.name (); - m ["passwd"](0) = gr.passwd (); - m ["gid"](0) = static_cast<double> (gr.gid ()); - m ["mem"](0) = gr.mem (); + m.assign ("name", gr.name ()); + m.assign ("passwd", gr.passwd ()); + m.assign ("gid", static_cast<double> (gr.gid ())); + m.assign ("mem", octave_value (gr.mem ())); retval = m; }
--- a/src/DLD-FUNCTIONS/getpwent.cc +++ b/src/DLD-FUNCTIONS/getpwent.cc @@ -51,13 +51,13 @@ { Octave_map m; - m ["name"](0) = pw.name (); - m ["passwd"](0) = pw.passwd (); - m ["uid"](0) = static_cast<double> (pw.uid ()); - m ["gid"](0) = static_cast<double> (pw.gid ()); - m ["gecos"](0) = pw.gecos (); - m ["dir"](0) = pw.dir (); - m ["shell"](0) = pw.shell (); + m.assign ("name", pw.name ()); + m.assign ("passwd", pw.passwd ()); + m.assign ("uid", static_cast<double> (pw.uid ())); + m.assign ("gid", static_cast<double> (pw.gid ())); + m.assign ("gecos", pw.gecos ()); + m.assign ("dir", pw.dir ()); + m.assign ("shell", pw.shell ()); retval = m; }
--- a/src/DLD-FUNCTIONS/getrusage.cc +++ b/src/DLD-FUNCTIONS/getrusage.cc @@ -138,29 +138,29 @@ getrusage (RUSAGE_SELF, &ru); - tv_tmp ["sec"](0) = static_cast<double> (ru.ru_utime.tv_sec); - tv_tmp ["usec"](0) = static_cast<double> (ru.ru_utime.tv_usec); - m ["utime"](0) = octave_value (tv_tmp); + tv_tmp.assign ("sec", static_cast<double> (ru.ru_utime.tv_sec)); + tv_tmp.assign ("usec", static_cast<double> (ru.ru_utime.tv_usec)); + m.assign ("utime", octave_value (tv_tmp)); - tv_tmp ["sec"](0) = static_cast<double> (ru.ru_stime.tv_sec); - tv_tmp ["usec"](0) = static_cast<double> (ru.ru_stime.tv_usec); - m ["stime"](0) = octave_value (tv_tmp); + tv_tmp.assign ("sec", static_cast<double> (ru.ru_stime.tv_sec)); + tv_tmp.assign ("usec", static_cast<double> (ru.ru_stime.tv_usec)); + m.assign ("stime", octave_value (tv_tmp)); #if ! defined (RUSAGE_TIMES_ONLY) - m ["maxrss"](0) = static_cast<double> (ru.ru_maxrss); - m ["ixrss"](0) = static_cast<double> (ru.ru_ixrss); - m ["idrss"](0) = static_cast<double> (ru.ru_idrss); - m ["isrss"](0) = static_cast<double> (ru.ru_isrss); - m ["minflt"](0) = static_cast<double> (ru.ru_minflt); - m ["majflt"](0) = static_cast<double> (ru.ru_majflt); - m ["nswap"](0) = static_cast<double> (ru.ru_nswap); - m ["inblock"](0) = static_cast<double> (ru.ru_inblock); - m ["oublock"](0) = static_cast<double> (ru.ru_oublock); - m ["msgsnd"](0) = static_cast<double> (ru.ru_msgsnd); - m ["msgrcv"](0) = static_cast<double> (ru.ru_msgrcv); - m ["nsignals"](0) = static_cast<double> (ru.ru_nsignals); - m ["nvcsw"](0) = static_cast<double> (ru.ru_nvcsw); - m ["nivcsw"](0) = static_cast<double> (ru.ru_nivcsw); + m.assign ("maxrss", static_cast<double> (ru.ru_maxrss)); + m.assign ("ixrss", static_cast<double> (ru.ru_ixrss)); + m.assign ("idrss", static_cast<double> (ru.ru_idrss)); + m.assign ("isrss", static_cast<double> (ru.ru_isrss)); + m.assign ("minflt", static_cast<double> (ru.ru_minflt)); + m.assign ("majflt", static_cast<double> (ru.ru_majflt)); + m.assign ("nswap", static_cast<double> (ru.ru_nswap)); + m.assign ("inblock", static_cast<double> (ru.ru_inblock)); + m.assign ("oublock", static_cast<double> (ru.ru_oublock)); + m.assign ("msgsnd", static_cast<double> (ru.ru_msgsnd)); + m.assign ("msgrcv", static_cast<double> (ru.ru_msgrcv)); + m.assign ("nsignals", static_cast<double> (ru.ru_nsignals)); + m.assign ("nvcsw", static_cast<double> (ru.ru_nvcsw)); + m.assign ("nivcsw", static_cast<double> (ru.ru_nivcsw)); #endif #else @@ -178,46 +178,46 @@ fraction = ticks % HZ; seconds = ticks / HZ; - tv_tmp ["sec"](0) = static_cast<double> (seconds); - tv_tmp ["usec"](0) = static_cast<double> (fraction * 1e6 / HZ); - m ["utime"](0) = octave_value (tv_tmp); + tv_tmp.assign ("sec", static_cast<double> (seconds)); + tv_tmp.assign ("usec", static_cast<double> (fraction * 1e6 / HZ)); + m.assign ("utime", octave_value (tv_tmp)); ticks = t.tms_stime + t.tms_cstime; fraction = ticks % HZ; seconds = ticks / HZ; - tv_tmp ["sec"](0) = static_cast<double> (seconds); - tv_tmp ["usec"](0) = static_cast<double> (fraction * 1e6 / HZ); - m ["stime"](0) = octave_value (tv_tmp); + tv_tmp.assign ("sec", static_cast<double> (seconds)); + tv_tmp.assign ("usec", static_cast<double> (fraction * 1e6 / HZ)); + m.assign ("stime", octave_value (tv_tmp)); #else - tv_tmp ["sec"](0) = 0; - tv_tmp ["usec"](0) = 0; - m ["utime"](0) = octave_value (tv_tmp); + tv_tmp.assign ("sec", 0); + tv_tmp.assign ("usec", 0); + m.assign ("utime", octave_value (tv_tmp)); - tv_tmp ["sec"](0) = 0; - tv_tmp ["usec"](0) = 0; - m ["stime"](0) = octave_value (tv_tmp); + tv_tmp.assign ("sec", 0); + tv_tmp.assign ("usec", 0); + m.assign ("stime", octave_value (tv_tmp)); #endif double tmp = lo_ieee_nan_value (); - m ["maxrss"](0) = tmp; - m ["ixrss"](0) = tmp; - m ["idrss"](0) = tmp; - m ["isrss"](0) = tmp; - m ["minflt"](0) = tmp; - m ["majflt"](0) = tmp; - m ["nswap"](0) = tmp; - m ["inblock"](0) = tmp; - m ["oublock"](0) = tmp; - m ["msgsnd"](0) = tmp; - m ["msgrcv"](0) = tmp; - m ["nsignals"](0) = tmp; - m ["nvcsw"](0) = tmp; - m ["nivcsw"](0) = tmp; + m.assign ("maxrss", tmp); + m.assign ("ixrss", tmp); + m.assign ("idrss", tmp); + m.assign ("isrss", tmp); + m.assign ("minflt", tmp); + m.assign ("majflt", tmp); + m.assign ("nswap", tmp); + m.assign ("inblock", tmp); + m.assign ("oublock", tmp); + m.assign ("msgsnd", tmp); + m.assign ("msgrcv", tmp); + m.assign ("nsignals", tmp); + m.assign ("nvcsw", tmp); + m.assign ("nivcsw", tmp); #endif
--- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -40,17 +40,17 @@ { Octave_map m; - m ["usec"](0) = static_cast<double> (t.usec ()); - m ["sec"](0) = static_cast<double> (t.sec ()); - m ["min"](0) = static_cast<double> (t.min ()); - m ["hour"](0) = static_cast<double> (t.hour ()); - m ["mday"](0) = static_cast<double> (t.mday ()); - m ["mon"](0) = static_cast<double> (t.mon ()); - m ["year"](0) = static_cast<double> (t.year ()); - m ["wday"](0) = static_cast<double> (t.wday ()); - m ["yday"](0) = static_cast<double> (t.yday ()); - m ["isdst"](0) = static_cast<double> (t.isdst ()); - m ["zone"](0) = t.zone (); + m.assign ("usec", static_cast<double> (t.usec ())); + m.assign ("sec", static_cast<double> (t.sec ())); + m.assign ("min", static_cast<double> (t.min ())); + m.assign ("hour", static_cast<double> (t.hour ())); + m.assign ("mday", static_cast<double> (t.mday ())); + m.assign ("mon", static_cast<double> (t.mon ())); + m.assign ("year", static_cast<double> (t.year ())); + m.assign ("wday", static_cast<double> (t.wday ())); + m.assign ("yday", static_cast<double> (t.yday ())); + m.assign ("isdst", static_cast<double> (t.isdst ())); + m.assign ("zone", t.zone ()); return m; } @@ -60,17 +60,17 @@ { octave_base_tm tm; - tm.usec (m ["usec"](0) . int_value ()); - tm.sec (m ["sec"](0) . int_value ()); - tm.min (m ["min"](0) . int_value ()); - tm.hour (m ["hour"](0) . int_value ()); - tm.mday (m ["mday"](0) . int_value ()); - tm.mon (m ["mon"](0) . int_value ()); - tm.year (m ["year"](0) . int_value ()); - tm.wday (m ["wday"](0) . int_value ()); - tm.yday (m ["yday"](0) . int_value ()); - tm.isdst (m ["isdst"](0) . int_value ()); - tm.zone (m ["zone"](0) . string_value ()); + tm.usec (m.contents ("usec")(0) . int_value ()); + tm.sec (m.contents ("sec")(0) . int_value ()); + tm.min (m.contents ("min")(0) . int_value ()); + tm.hour (m.contents ("hour")(0) . int_value ()); + tm.mday (m.contents ("mday")(0) . int_value ()); + tm.mon (m.contents ("mon")(0) . int_value ()); + tm.year (m.contents ("year")(0) . int_value ()); + tm.wday (m.contents ("wday")(0) . int_value ()); + tm.yday (m.contents ("yday")(0) . int_value ()); + tm.isdst (m.contents ("isdst")(0) . int_value ()); + tm.zone (m.contents ("zone")(0) . string_value ()); return tm; }
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -471,7 +471,7 @@ if (format == LS_MAT_ASCII) retval = tc; else - retstruct[name] = tc; + retstruct.assign (name, tc); } else install_loaded_variable (force, name, tc, global, doc);
--- a/src/ls-hdf5.cc +++ b/src/ls-hdf5.cc @@ -715,9 +715,9 @@ octave_value ov = dsub.tc; if (ov.is_list ()) - m [dsub.name] = ov.list_value (); + m.assign (dsub.name, octave_value (ov.list_value ())); else - m [dsub.name] = ov; + m.assign (dsub.name, ov); } if (have_h5giterate_bug) @@ -1165,8 +1165,8 @@ data_is_group = 1; // recursively add each element of the structure to this group - Octave_map m = tc.map_value (); - Octave_map::iterator i = m.begin (); + const Octave_map m = tc.map_value (); + Octave_map::const_iterator i = m.begin (); while (i != m.end ()) { // XXX FIXME XXX -- if the length of the structure array is
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -425,8 +425,12 @@ { const char *key = elname + j*field_name_length; + Cell c (dim_vector (n, 1)); + for (int k = n-1; k >=0; k--) - m[key](k) = field_elts(j,k); + c(k) = field_elts(j,k); + + m.assign (key, c); } tc = m; @@ -851,21 +855,21 @@ { // an Octave structure */ // recursively write each element of the structure - Octave_map m = tc.map_value (); + const Octave_map m = tc.map_value (); { char buf[32]; FOUR_BYTE_INT maxfieldnamelength = 32; int fieldcnt = 0; - for (Octave_map::iterator i = m.begin (); i != m.end (); i++) + for (Octave_map::const_iterator i = m.begin (); i != m.end (); i++) fieldcnt++; write_mat5_tag (os, miINT32, 4); os.write ((char *)&maxfieldnamelength, 4); write_mat5_tag (os, miINT8, fieldcnt*32); - for (Octave_map::iterator i = m.begin (); i != m.end (); i++) + for (Octave_map::const_iterator i = m.begin (); i != m.end (); i++) { // write the name of each element std::string tstr = m.key (i); @@ -876,7 +880,7 @@ int len = m.numel (); - for (Octave_map::iterator i = m.begin (); i != m.end (); i++) + for (Octave_map::const_iterator i = m.begin (); i != m.end (); i++) { // write the data of each element Cell elts = m.contents (i);
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -35,7 +35,7 @@ #include "utils.h" Cell -Octave_map::operator [] (const std::string& k) const +Octave_map::contents (const std::string& k) const { const_iterator p = seek (k); @@ -64,7 +64,7 @@ if (new_dims != dims ()) { for (const_iterator p = begin (); p != end (); p++) - retval[key(p)] = contents(p).reshape (new_dims); + retval.assign (key(p), contents(p).reshape (new_dims)); dimensions = new_dims; } @@ -126,7 +126,7 @@ { std::string k = t_keys[i]; - Cell t_rhs = rhs[k]; + Cell t_rhs = rhs.contents (k); assign (idx, k, t_rhs); @@ -207,6 +207,28 @@ } Octave_map& +Octave_map::assign (const std::string& k, const octave_value& rhs) +{ + if (empty ()) + { + map[k] = Cell (rhs); + + dimensions = dim_vector (1, 1); + } + else + { + dim_vector dv = dims (); + + if (dv.all_ones ()) + map[k] = Cell (rhs); + else + error ("invalid structure assignment"); + } + + return *this; +} + +Octave_map& Octave_map::assign (const std::string& k, const Cell& rhs) { if (empty ()) @@ -238,7 +260,7 @@ if (error_state) break; - retval[key(p)] = tmp; + retval.assign (key(p), tmp); } return error_state ? Octave_map () : retval;
--- a/src/oct-map.h +++ b/src/oct-map.h @@ -76,10 +76,6 @@ int empty (void) const { return map.empty (); } - Cell& operator [] (const std::string& k) { return map[k]; } - - Cell operator [] (const std::string& k) const; - void del (const std::string& k) { iterator p = map.find (k); @@ -95,11 +91,10 @@ std::string key (const_iterator p) const { return p->first; } - Cell& contents (const_iterator p) - { return operator [] (key(p)); } + Cell contents (const std::string& k) const; Cell contents (const_iterator p) const - { return operator [] (key(p)); } + { return contents (key(p)); } const_iterator seek (const std::string& k) const { return map.find (k); } @@ -125,6 +120,8 @@ Octave_map& assign (const octave_value_list& idx, const std::string& k, const Cell& rhs); + Octave_map& assign (const std::string& k, const octave_value& rhs); + Octave_map& assign (const std::string& k, const Cell& rhs); Octave_map index (const octave_value_list& idx);
--- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -194,19 +194,19 @@ std::string fh_nm = fh->name (); - m ["function"](0) = fh_nm.substr (1); + m.assign ("function", fh_nm.substr (1)); if (fcn->is_nested_function ()) - m ["type"](0) = "subfunction"; + m.assign ("type", "subfunction"); else - m ["type"](0) = "simple"; + m.assign ("type", "simple"); std::string nm = fcn->fcn_file_name (); if (nm.empty ()) - m ["file"](0) = "built-in function"; + m.assign ("file", "built-in function"); else - m ["file"](0) = nm; + m.assign ("file", nm); retval = m; }
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -200,7 +200,7 @@ u = octave_value::empty_conv (type.substr (2), rhs); else { - Cell map_val = map[key]; + Cell map_val = map.contents (key); Cell map_elt = map_val.index (idx.front (), true); @@ -241,7 +241,7 @@ u = octave_value::empty_conv (type.substr (1), rhs); else { - Cell map_val = map[key]; + Cell map_val = map.contents (key); u = numeric_conv (map_val, type.substr (1)); }
--- a/src/pt-idx.cc +++ b/src/pt-idx.cc @@ -202,6 +202,7 @@ { int n = args.size (); + // XXX FIXME XXX -- why not just make these Cell objects? octave_value_list subs_list (n, octave_value ()); octave_value_list type_list (n, octave_value ()); @@ -244,8 +245,8 @@ p_dyn_field++; } - m ["subs"] = subs_list; - m ["type"] = type_list; + m.assign ("subs", Cell (subs_list)); + m.assign ("type", Cell (type_list)); return m; }
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -546,143 +546,143 @@ Octave_map m; #ifdef SIGABRT - m ["ABRT"](0) = SIGABRT; + m.assign ("ABRT", SIGABRT); #endif #ifdef SIGALRM - m ["ALRM"](0) = SIGALRM; + m.assign ("ALRM", SIGALRM); #endif #ifdef SIGBUS - m ["BUS"](0) = SIGBUS; + m.assign ("BUS", SIGBUS); #endif #ifdef SIGCHLD - m ["CHLD"](0) = SIGCHLD; + m.assign ("CHLD", SIGCHLD); #endif #ifdef SIGCLD - m ["CLD"](0) = SIGCLD; + m.assign ("CLD", SIGCLD); #endif #ifdef SIGCONT - m ["CONT"](0) = SIGCONT; + m.assign ("CONT", SIGCONT); #endif #ifdef SIGEMT - m ["EMT"](0) = SIGEMT; + m.assign ("EMT", SIGEMT); #endif #ifdef SIGFPE - m ["FPE"](0) = SIGFPE; + m.assign ("FPE", SIGFPE); #endif #ifdef SIGHUP - m ["HUP"](0) = SIGHUP; + m.assign ("HUP", SIGHUP); #endif #ifdef SIGILL - m ["ILL"](0) = SIGILL; + m.assign ("ILL", SIGILL); #endif #ifdef SIGINFO - m ["INFO"](0) = SIGINFO; + m.assign ("INFO", SIGINFO); #endif #ifdef SIGINT - m ["INT"](0) = SIGINT; + m.assign ("INT", SIGINT); #endif #ifdef SIGIOT - m ["IOT"](0) = SIGIOT; + m.assign ("IOT", SIGIOT); #endif #ifdef SIGLOST - m ["LOST"](0) = SIGLOST; + m.assign ("LOST", SIGLOST); #endif #ifdef SIGPIPE - m ["PIPE"](0) = SIGPIPE; + m.assign ("PIPE", SIGPIPE); #endif #ifdef SIGPOLL - m ["POLL"](0) = SIGPOLL; + m.assign ("POLL", SIGPOLL); #endif #ifdef SIGPROF - m ["PROF"](0) = SIGPROF; + m.assign ("PROF", SIGPROF); #endif #ifdef SIGPWR - m ["PWR"](0) = SIGPWR; + m.assign ("PWR", SIGPWR); #endif #ifdef SIGQUIT - m ["QUIT"](0) = SIGQUIT; + m.assign ("QUIT", SIGQUIT); #endif #ifdef SIGSEGV - m ["SEGV"](0) = SIGSEGV; + m.assign ("SEGV", SIGSEGV); #endif #ifdef SIGSTOP - m ["STOP"](0) = SIGSTOP; + m.assign ("STOP", SIGSTOP); #endif #ifdef SIGSYS - m ["SYS"](0) = SIGSYS; + m.assign ("SYS", SIGSYS); #endif #ifdef SIGTERM - m ["TERM"](0) = SIGTERM; + m.assign ("TERM", SIGTERM); #endif #ifdef SIGTRAP - m ["TRAP"](0) = SIGTRAP; + m.assign ("TRAP", SIGTRAP); #endif #ifdef SIGTSTP - m ["TSTP"](0) = SIGTSTP; + m.assign ("TSTP", SIGTSTP); #endif #ifdef SIGTTIN - m ["TTIN"](0) = SIGTTIN; + m.assign ("TTIN", SIGTTIN); #endif #ifdef SIGTTOU - m ["TTOU"](0) = SIGTTOU; + m.assign ("TTOU", SIGTTOU); #endif #ifdef SIGURG - m ["URG"](0) = SIGURG; + m.assign ("URG", SIGURG); #endif #ifdef SIGUSR1 - m ["USR1"](0) = SIGUSR1; + m.assign ("USR1", SIGUSR1); #endif #ifdef SIGUSR2 - m ["USR2"](0) = SIGUSR2; + m.assign ("USR2", SIGUSR2); #endif #ifdef SIGVTALRM - m ["VTALRM"](0) = SIGVTALRM; + m.assign ("VTALRM", SIGVTALRM); #endif #ifdef SIGIO - m ["IO"](0) = SIGIO; + m.assign ("IO", SIGIO); #endif #ifdef SIGWINCH - m ["WINCH"](0) = SIGWINCH; + m.assign ("WINCH", SIGWINCH); #endif #ifdef SIGXCPU - m ["XCPU"](0) = SIGXCPU; + m.assign ("XCPU", SIGXCPU); #endif #ifdef SIGXFSZ - m ["XFSZ"](0) = SIGXFSZ; + m.assign ("XFSZ", SIGXFSZ); #endif return m;
--- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -65,24 +65,24 @@ { Octave_map m; - m["dev"](0) = static_cast<double> (fs.dev ()); - m["ino"](0) = fs.ino (); - m["modestr"](0) = fs.mode_as_string (); - m["nlink"](0) = fs.nlink (); - m["uid"](0) = fs.uid (); - m["gid"](0) = fs.gid (); + m.assign ("dev", static_cast<double> (fs.dev ())); + m.assign ("ino", fs.ino ()); + m.assign ("modestr", fs.mode_as_string ()); + m.assign ("nlink", fs.nlink ()); + m.assign ("uid", fs.uid ()); + m.assign ("gid", fs.gid ()); #if defined (HAVE_STRUCT_STAT_ST_RDEV) - m["rdev"](0) = static_cast<double> (fs.rdev ()); + m.assign ("rdev", static_cast<double> (fs.rdev ())); #endif - m["size"](0) = fs.size (); - m["atime"](0) = fs.atime (); - m["mtime"](0) = fs.mtime (); - m["ctime"](0) = fs.ctime (); + m.assign ("size", fs.size ()); + m.assign ("atime", fs.atime ()); + m.assign ("mtime", fs.mtime ()); + m.assign ("ctime", fs.ctime ()); #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE) - m["blksize"](0) = fs.blksize (); + m.assign ("blksize", fs.blksize ()); #endif #if defined (HAVE_STRUCT_STAT_ST_BLOCKS) - m["blocks"](0) = fs.blocks (); + m.assign ("blocks", fs.blocks ()); #endif return m;
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -670,10 +670,6 @@ bool octave_supports_dynamic_linking = false; #endif - // We do it this way instead of using a series of "m[KEY](0) = VAL" - // statements to avoid problems with gcc 2.96 (and possibly other - // compilers) that can't handle a long series of lines like that. - static bool initialized = false; static Octave_map m; @@ -786,7 +782,7 @@ if (! initialized) { - m ["dld"](0) = octave_value (octave_supports_dynamic_linking); + m.assign ("dld", octave_value (octave_supports_dynamic_linking)); int i = 0; @@ -795,7 +791,7 @@ const char *key = conf_info[i++]; if (key) - m [key](0) = octave_value (conf_info[i++]); + m.assign (key, octave_value (conf_info[i++])); else break; } @@ -810,7 +806,10 @@ std::string arg = args(0).string_value (); if (! error_state) - retval = m [arg.c_str ()](0); + { + Cell c = m.contents (arg.c_str ()); + retval = c(0); + } } else if (nargin == 0) retval = m;