# HG changeset patch # User jwe # Date 980785928 0 # Node ID f0e7c832e0e261bada2f0a04152f0625ccb48a2b # Parent df962bbf17888ab75421ad190177f0b3dd3b020d [project @ 2001-01-29 16:32:08 by jwe] diff -r df962bbf1788 -r f0e7c832e0e2 liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Jan 29 14:33:08 2001 +0000 +++ b/liboctave/ChangeLog Mon Jan 29 16:32:08 2001 +0000 @@ -1,3 +1,7 @@ +2001-01-29 John W. Eaton + + * lo-cutils.c: Don't delcare strptime. + 2001-01-02 John W. Eaton * CMatrix.cc (operator * (const ComplexMatrix&, const ComplexMatrix&): diff -r df962bbf1788 -r f0e7c832e0e2 src/ChangeLog --- a/src/ChangeLog Mon Jan 29 14:33:08 2001 +0000 +++ b/src/ChangeLog Mon Jan 29 16:32:08 2001 +0000 @@ -1,3 +1,17 @@ +2001-01-29 John W. Eaton + + * Map.h, Map.cc (CHMap::operator = (const CHMap&)): New function. + (Map::operator = (const Map&)): Likewise. + (Map (const Map&)): Likewise. + + * OPERATORS/op-cm-cs.cc, OPERATORS/op-cm-s.cc, + OPERATORS/op-m-cs.cc, OPERATORS/op-m-s.cc: + Make ldiv operator work for row vector by scalar ops. + + * OPERATORS/op-cs-cm.cc, OPERATORS/op-cs-m.cc, + OPERATORS/op-s-cm.cc, OPERATORS/op-s-m.cc: + Make div operator work for scalar by column vector ops. + 2001-01-17 John W. Eaton * parse.y (safe_fclose): Discard comments at the end of a file. diff -r df962bbf1788 -r f0e7c832e0e2 src/Map.cc --- a/src/Map.cc Mon Jan 29 14:33:08 2001 +0000 +++ b/src/Map.cc Mon Jan 29 16:32:08 2001 +0000 @@ -132,6 +132,42 @@ } template +CHMap& +CHMap::operator = (const CHMap& a) +{ + Map::operator = (*this); + + unsigned int old_size = a.size; + + CHNode **old_tab = tab; + old_size = a.size; + + size = old_size; + tab = new CHNode* [size]; + + for (unsigned int i = 0; i < size; ++i) + tab[i] = static_cast *> (index_to_CHptr (i+1)); + + for (Pix p = a.first (); p; a.next (p)) + (*this) [a.key (p)] = a.contents (p); + + for (unsigned int i = 0; i < old_size; ++i) + { + CHNode *p = old_tab[i]; + old_tab[i] = static_cast *> (index_to_CHptr (i+1)); + while (p->goodCHptr ()) + { + CHNode *nxt = p->tl; + delete p; + p = nxt; + } + } + delete [] old_tab; + + return *this; +} + +template Pix CHMap::seek (const std::string& key) const { diff -r df962bbf1788 -r f0e7c832e0e2 src/Map.h --- a/src/Map.h Mon Jan 29 14:33:08 2001 +0000 +++ b/src/Map.h Mon Jan 29 16:32:08 2001 +0000 @@ -53,7 +53,17 @@ C def; public: - Map (const C& dflt) : def (dflt) { count = 0; } + Map (const C& dflt) : count (0), def (dflt) { } + + Map (const Map& m) : count (m.count), def (m.def) { } + + Map& operator = (const Map& m) + { + count = m.count; + def = m.def; + + return *this; + } virtual ~Map (void) { } @@ -125,10 +135,12 @@ CHMap (const CHMap& a); + CHMap& operator = (const CHMap& a); + ~CHMap (void) { clear (); - delete tab; + delete [] tab; } C& operator [] (const std::string& key); @@ -151,8 +163,8 @@ if (p == 0) error ("null Pix"); - return ((CHNode *) p)->cont; - } + return ((CHNode *) p)->cont; + } Pix seek (const std::string& key) const;