Mercurial > hg > octave-terminal
changeset 4150:0d411821682c
[project @ 2002-11-04 22:03:05 by jwe]
author | jwe |
---|---|
date | Mon, 04 Nov 2002 22:03:05 +0000 |
parents | 5d9f4688590a |
children | 8b113cca48f1 |
files | scripts/ChangeLog scripts/control/base/lsim.m scripts/control/system/syssub.m src/ChangeLog src/cutils.c src/oct-obj.h |
diffstat | 6 files changed, 55 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,11 @@ +2002-11-04 Nicholas Piper <nick-octave@nickpiper.co.uk> + + * control/base/lsim.m: Correct doc string. + +2002-11-04 A S Hodel <a.s.hodel@Eng.Auburn.EDU> + + * control/system/syssub.m: Call tf2sys with Gnum-Hnum, not Gnum+Hnum. + 2002-11-01 John W. Eaton <jwe@bevo.che.wisc.edu> * plot/contour.m: Handle x and y as matrices too.
--- a/scripts/control/base/lsim.m +++ b/scripts/control/base/lsim.m @@ -22,8 +22,8 @@ ## ## Produces a plot for the output of the system, sys. ## -## U is an array that contains the system's inputs. Each column in u -## corresponds to a different time step. Each row in u corresponds to a +## U is an array that contains the system's inputs. Each row in u +## corresponds to a different time step. Each column in u corresponds to a ## different input. T is an array that contains the time index of the ## system. T should be regularly spaced. If initial conditions are required ## on the system, the x0 vector should be added to the argument list.
--- a/scripts/control/system/syssub.m +++ b/scripts/control/system/syssub.m @@ -80,7 +80,7 @@ [Hnum,Hden,HT,Hin,Hout] = sys2tf(Hsys); if(length(Hden) == length(Gden) ) if( (Hden == Gden) & (HT == GT) ) - sys = tf2sys(Gnum+Hnum,Gden,GT,Gin,Gout); + sys = tf2sys(Gnum-Hnum,Gden,GT,Gin,Gout); return endif ## if not, we go on and do the usual thing...
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-11-04 John W. Eaton <jwe@bevo.che.wisc.edu> + + * cutils.c (octave_vsnprintf): Handle C99 snprintf semantics. + + * oct-obj.h (octave_value_list::operator =): Copy names too. + (octave_value_list::octave_value_list (const octave_value_list&)): + Likewise. + 2002-11-01 John W. Eaton <jwe@bevo.che.wisc.edu> * version.h (OCTAVE_VERSION): Now 2.1.39.
--- a/src/cutils.c +++ b/src/cutils.c @@ -122,6 +122,10 @@ // We manage storage. User should not free it, and its contents are // only valid until next call to vsnprintf. +#if defined __GNUC__ && __GNUC__ >= 3 +#define HAVE_C99_VSNPRINTF 1 +#endif + char * octave_vsnprintf (const char *fmt, va_list args) { @@ -130,21 +134,47 @@ static char *buf = 0; + int nchars; + if (! buf) buf = malloc (size); +#if defined (HAVE_C99_VSNPRINTF) + + nchars = vsnprintf (buf, size, fmt, args); + + if (nchars >= size) + { + size = nchars + 1; + buf = realloc (buf, size); + + if (buf) + vsnprintf (buf, size, fmt, args); + + return buf; + } + +#else + while (1) { - int nchars = vsnprintf (buf, size, fmt, args); + nchars = vsnprintf (buf, size, fmt, args); if (nchars > -1) return buf; else { size *= 2; + buf = realloc (buf, size); + + if (! buf) + return 0; } } + +#endif + #else return 0; #endif
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -95,7 +95,7 @@ : data (1, octave_value (r)) { } octave_value_list (const octave_value_list& obj) - : data (obj.data) { } + : data (obj.data), names (obj.names) { } void *operator new (size_t size) { return allocator.alloc (size); } @@ -106,7 +106,10 @@ octave_value_list& operator = (const octave_value_list& obj) { if (this != &obj) - data = obj.data; + { + data = obj.data; + names = obj.names; + } return *this; }