Mercurial > hg > octave-nkf
changeset 2571:2480ef198c46
[project @ 1996-12-06 21:18:39 by jwe]
author | jwe |
---|---|
date | Fri, 06 Dec 1996 21:22:39 +0000 |
parents | 58113987ee03 |
children | 5c2be7c820ed |
files | PROJECTS src/Array-oc.cc src/Array-os.cc src/Array-string.cc src/Array-tc.cc src/BaseSLList.cc src/BaseSLList.h src/ChangeLog src/Makefile.in src/Map-fnc.cc src/Map-i.cc src/Map-tc.cc src/SLList-expr.cc src/SLList-i.cc src/SLList-misc.cc src/SLList-pc.cc src/SLList-plot.cc src/SLList-str.cc src/SLList-tc.cc src/SLList-tm.cc src/SLList.cc src/SLList.h src/SLStack-i.cc src/SLStack-pc.cc src/SLStack-str.cc src/SLStack-sym.cc src/SLStack-tm.cc src/SLStack-tok.cc src/SLStack-ue.cc src/SLStack-ui.cc src/SLStack.cc src/SLStack.h src/ov-str-mat.cc src/ov.h |
diffstat | 34 files changed, 490 insertions(+), 433 deletions(-) [+] |
line wrap: on
line diff
--- a/PROJECTS +++ b/PROJECTS @@ -140,6 +140,9 @@ * Consider making size ("") ==> [0, 0] for compatibility with Matlab, at least when some preference variable is set. + * Consider making [] equivalent to "" for compatibility with + Matlab, at least when some preference variable is set. + * Consider making ["test", []] ==> "test", for compatibility with Matlab, at least when some set of preferences are set.
--- a/src/Array-oc.cc +++ b/src/Array-oc.cc @@ -22,6 +22,10 @@ // Instantiate Arrays of octave_child objects. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "Array.h" #include "Array.cc"
--- a/src/Array-os.cc +++ b/src/Array-os.cc @@ -22,6 +22,10 @@ // Instantiate Arrays of octave_stream objects. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "Array.h" #include "Array.cc"
--- a/src/Array-string.cc +++ b/src/Array-string.cc @@ -1,4 +1,3 @@ -// Array-String.cc -*- C++ -*- /* Copyright (C) 1993, 1994, 1995 John W. Eaton @@ -23,6 +22,10 @@ // Instantiate Arrays of Strings. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "Array.h" #include "Array.cc"
--- a/src/Array-tc.cc +++ b/src/Array-tc.cc @@ -20,12 +20,12 @@ */ +// Instantiate Arrays of octave_values. + #ifdef HAVE_CONFIG_H #include <config.h> #endif -// Instantiate Arrays of octave_values. - #include "Array.h" #include "Array.cc"
new file mode 100644 --- /dev/null +++ b/src/BaseSLList.cc @@ -0,0 +1,256 @@ +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988, 1992 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#if defined (__GNUG__) +#pragma implementation +#endif + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <limits.h> +#include <stream.h> +#include <builtin.h> +#include "BaseSLList.h" + +void BaseSLList::error(const char* msg) const +{ + (*lib_error_handler)("SLList", msg); +} + +int BaseSLList::length() const +{ + int l = 0; + BaseSLNode* t = last; + if (t != 0) do { ++l; t = t->tl; } while (t != last); + return l; +} + +void BaseSLList::clear() +{ + if (last == 0) + return; + + BaseSLNode* p = last->tl; + last->tl = 0; + last = 0; + + while (p != 0) + { + BaseSLNode* nxt = p->tl; + delete_node(p); + p = nxt; + } +} + + +// Note: This is an internal method. It does *not* free old contents! + +void BaseSLList::copy(const BaseSLList& a) +{ + if (a.last == 0) + last = 0; + else + { + BaseSLNode* p = a.last->tl; + BaseSLNode* h = copy_node(p->item()); + last = h; + for (;;) + { + if (p == a.last) + { + last->tl = h; + return; + } + p = p->tl; + BaseSLNode* n = copy_node(p->item()); + last->tl = n; + last = n; + } + } +} + +BaseSLList& BaseSLList::operator = (const BaseSLList& a) +{ + if (last != a.last) + { + clear(); + copy(a); + } + return *this; +} + +Pix BaseSLList::prepend(const void *datum) +{ + return prepend(copy_node(datum)); +} + + +Pix BaseSLList::prepend(BaseSLNode* t) +{ + if (t == 0) return 0; + if (last == 0) + t->tl = last = t; + else + { + t->tl = last->tl; + last->tl = t; + } + return Pix(t); +} + + +Pix BaseSLList::append(const void *datum) +{ + return append(copy_node(datum)); +} + +Pix BaseSLList::append(BaseSLNode* t) +{ + if (t == 0) return 0; + if (last == 0) + t->tl = last = t; + else + { + t->tl = last->tl; + last->tl = t; + last = t; + } + return Pix(t); +} + +void BaseSLList::join(BaseSLList& b) +{ + BaseSLNode* t = b.last; + b.last = 0; + if (last == 0) + last = t; + else if (t != 0) + { + BaseSLNode* f = last->tl; + last->tl = t->tl; + t->tl = f; + last = t; + } +} + +Pix BaseSLList::ins_after(Pix p, const void *datum) +{ + BaseSLNode* u = (BaseSLNode*)p; + BaseSLNode* t = copy_node(datum); + if (last == 0) + t->tl = last = t; + else if (u == 0) // ins_after 0 means prepend + { + t->tl = last->tl; + last->tl = t; + } + else + { + t->tl = u->tl; + u->tl = t; + if (u == last) + last = t; + } + return Pix(t); +} + +void BaseSLList::del_after(Pix p) +{ + BaseSLNode* u = (BaseSLNode*)p; + if (last == 0 || u == last) error("cannot del_after last"); + if (u == 0) u = last; // del_after 0 means delete first + BaseSLNode* t = u->tl; + if (u == t) + last = 0; + else + { + u->tl = t->tl; + if (last == t) + last = u; + } + delete_node(t); +} + +int BaseSLList::owns(Pix p) const +{ + BaseSLNode* t = last; + if (t != 0 && p != 0) + { + do + { + if (Pix(t) == p) return 1; + t = t->tl; + } while (t != last); + } + return 0; +} + +int BaseSLList::remove_front(void *dst, int signal_error) +{ + if (last) + { + BaseSLNode* t = last->tl; + copy_item(dst, t->item()); + if (t == last) + last = 0; + else + last->tl = t->tl; + delete_node(t); + return 1; + } + if (signal_error) + error("remove_front of empty list"); + return 0; +} + +void BaseSLList::del_front() +{ + if (last == 0) error("del_front of empty list"); + BaseSLNode* t = last->tl; + if (t == last) + last = 0; + else + last->tl = t->tl; + delete_node(t); +} + +int BaseSLList::OK() const +{ + int v = 1; + if (last != 0) + { + BaseSLNode* t = last; + long count = LONG_MAX; // Lots of chances to find last! + do + { + count--; + t = t->tl; + } while (count > 0 && t != last); + v &= count > 0; + } + if (!v) error("invariant failure"); + return v; +} + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/BaseSLList.h @@ -0,0 +1,73 @@ +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988, 1992 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _BaseSLList_h +#define _BaseSLList_h 1 + +#if defined (__GNUG__) +#pragma interface +#endif + +#undef OK + +#include <Pix.h> + +struct BaseSLNode +{ + union { + struct BaseSLNode *tl; + double dummy; /* To force correct alignment */ + }; + void *item() {return (void*)(this+1);} // Return ((SLNode<T>*)this)->hd +}; + +class BaseSLList { + protected: + BaseSLNode *last; + virtual void delete_node(BaseSLNode*node) = 0; + virtual BaseSLNode* copy_node(const void* datum) = 0; + virtual void copy_item(void *dst, void *src) = 0; + virtual ~BaseSLList() { } + BaseSLList() { last = 0; } + void copy(const BaseSLList&); + BaseSLList& operator = (const BaseSLList& a); + Pix ins_after(Pix p, const void *datum); + Pix prepend(const void *datum); + Pix append(const void *datum); + int remove_front(void *dst, int signal_error = 0); + void join(BaseSLList&); + public: + int length() const; + int empty() const { return last == 0; } + void clear(); + Pix prepend(BaseSLNode*); + Pix append(BaseSLNode*); + int OK() const; + void error(const char* msg) const; + void del_after(Pix p); + int owns(Pix p) const; + void del_front(); +}; + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ Fri Dec 6 00:20:25 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + * Map-*.cc, SLList-*.cc, SLStack-*.cc: Include config.h. + + * ov.h: Don't include SLList.h. + + * SLStack.cc: Delete. Move everything to SLStack.h. + + * BaseSLList.h, BaseSLList.cc: New files. Split out the + non-template base class parts of SLList. + * Makefile.in (TEMPLATE_SRC): Delete. Move files to SOURCES. * Map.h, Map.cc: Add #pragma interface/implementation. * SLStack.h, SLStack.cc: Add #pragma interface/implementation.
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -80,7 +80,7 @@ pt-plot.h pt-pr-code.h pt-walk.h sighandlers.h symtab.h \ syscalls.h sysdep.h systime.h syswait.h token.h toplev.h \ unwind-prot.h utils.h variables.h version.h \ - xdiv.h xpow.h Map.h SLList.h SLStack.h Stack.h \ + xdiv.h xpow.h BaseSLList.h Map.h SLList.h SLStack.h Stack.h \ ov-re-mat.h ov-cx-mat.h ov-ch-mat.h ov-struct.h ov-scalar.h \ ov-range.h ov-complex.h ov-va-args.h ov-colon.h ov-base.h \ ov-str-mat.h ov.h ov-typeinfo.h ops.h \ @@ -104,8 +104,8 @@ endif endif -SOURCES := Map.cc SLList.cc SLStack.cc data.cc defaults.cc dirfns.cc \ - dynamic-ld.cc error.cc file-io.cc fn-cache.cc gripes.cc \ +SOURCES := BaseSLList.cc Map.cc data.cc defaults.cc \ + dirfns.cc dynamic-ld.cc error.cc file-io.cc fn-cache.cc gripes.cc \ help.cc input.cc lex.l load-save.cc mappers.cc oct-fstrm.cc \ oct-hist.cc oct-iostrm.cc oct-map.cc oct-obj.cc oct-prcstrm.cc \ oct-procbuf.cc oct-stdstrm.cc oct-stream.cc oct-strstrm.cc \
--- a/src/Map-fnc.cc +++ b/src/Map-fnc.cc @@ -22,6 +22,10 @@ // Instantiate Maps of file_name_cache_elts. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <string> #include "Map.h"
--- a/src/Map-i.cc +++ b/src/Map-i.cc @@ -22,6 +22,10 @@ // Instantiate Maps of octave_values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "Map.h" #include "Map.cc"
--- a/src/Map-tc.cc +++ b/src/Map-tc.cc @@ -22,6 +22,10 @@ // Instantiate Maps of octave_values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "Map.h" #include "Map.cc"
--- a/src/SLList-expr.cc +++ b/src/SLList-expr.cc @@ -26,7 +26,7 @@ #include <config.h> #endif -#include <SLList.h> +#include "SLList.h" #include "pt-exp.h" #include "pt-fvc.h"
--- a/src/SLList-i.cc +++ b/src/SLList-i.cc @@ -22,11 +22,18 @@ // Instantiate Stacks of int values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" #include "SLStack.cc" template class SLNode<int>; template class SLList<int>; + template class Stack<int>; template class SLStack<int>;
--- a/src/SLList-misc.cc +++ b/src/SLList-misc.cc @@ -26,7 +26,7 @@ #include <config.h> #endif -#include <SLList.h> +#include "SLList.h" #include "pt-exp.h" #include "ov.h"
--- a/src/SLList-pc.cc +++ b/src/SLList-pc.cc @@ -22,11 +22,18 @@ // Instantiate Stacks of char* values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" #include "SLStack.cc" template class SLNode<char *>; template class SLList<char *>; + template class Stack<char *>; template class SLStack<char *>;
--- a/src/SLList-plot.cc +++ b/src/SLList-plot.cc @@ -26,7 +26,7 @@ #include <config.h> #endif -#include <SLList.h> +#include "SLList.h" #include "pt-plot.h"
--- a/src/SLList-str.cc +++ b/src/SLList-str.cc @@ -26,7 +26,7 @@ #include <config.h> #endif -#include <SLList.h> +#include "SLList.h" #include <string>
--- a/src/SLList-tc.cc +++ b/src/SLList-tc.cc @@ -26,7 +26,7 @@ #include <config.h> #endif -#include <SLList.h> +#include "SLList.h" #include "ov.h"
--- a/src/SLList-tm.cc +++ b/src/SLList-tm.cc @@ -22,8 +22,11 @@ // Instantiate Stacks of tree_matrix* values. -#include "SLStack.h" -#include "SLStack.cc" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" #include "pt-mat.h"
--- a/src/SLList.cc +++ b/src/SLList.cc @@ -24,229 +24,15 @@ #include <config.h> #endif -#include <limits.h> -#include <stream.h> -#include <builtin.h> #include "SLList.h" -void BaseSLList::error(const char* msg) const -{ - (*lib_error_handler)("SLList", msg); -} - -int BaseSLList::length() const -{ - int l = 0; - BaseSLNode* t = last; - if (t != 0) do { ++l; t = t->tl; } while (t != last); - return l; -} - -void BaseSLList::clear() -{ - if (last == 0) - return; - - BaseSLNode* p = last->tl; - last->tl = 0; - last = 0; - - while (p != 0) - { - BaseSLNode* nxt = p->tl; - delete_node(p); - p = nxt; - } -} - - -// Note: This is an internal method. It does *not* free old contents! +// I'm not sure if putting this here is really necessary, but it +// shouldn't hurt. -void BaseSLList::copy(const BaseSLList& a) -{ - if (a.last == 0) - last = 0; - else - { - BaseSLNode* p = a.last->tl; - BaseSLNode* h = copy_node(p->item()); - last = h; - for (;;) - { - if (p == a.last) - { - last->tl = h; - return; - } - p = p->tl; - BaseSLNode* n = copy_node(p->item()); - last->tl = n; - last = n; - } - } -} - -BaseSLList& BaseSLList::operator = (const BaseSLList& a) -{ - if (last != a.last) - { - clear(); - copy(a); - } - return *this; -} - -Pix BaseSLList::prepend(const void *datum) -{ - return prepend(copy_node(datum)); -} - - -Pix BaseSLList::prepend(BaseSLNode* t) -{ - if (t == 0) return 0; - if (last == 0) - t->tl = last = t; - else - { - t->tl = last->tl; - last->tl = t; - } - return Pix(t); -} - - -Pix BaseSLList::append(const void *datum) -{ - return append(copy_node(datum)); -} - -Pix BaseSLList::append(BaseSLNode* t) -{ - if (t == 0) return 0; - if (last == 0) - t->tl = last = t; - else - { - t->tl = last->tl; - last->tl = t; - last = t; - } - return Pix(t); -} - -void BaseSLList::join(BaseSLList& b) +template <class T> +SLList<T>::~SLList (void) { - BaseSLNode* t = b.last; - b.last = 0; - if (last == 0) - last = t; - else if (t != 0) - { - BaseSLNode* f = last->tl; - last->tl = t->tl; - t->tl = f; - last = t; - } -} - -Pix BaseSLList::ins_after(Pix p, const void *datum) -{ - BaseSLNode* u = (BaseSLNode*)p; - BaseSLNode* t = copy_node(datum); - if (last == 0) - t->tl = last = t; - else if (u == 0) // ins_after 0 means prepend - { - t->tl = last->tl; - last->tl = t; - } - else - { - t->tl = u->tl; - u->tl = t; - if (u == last) - last = t; - } - return Pix(t); -} - -void BaseSLList::del_after(Pix p) -{ - BaseSLNode* u = (BaseSLNode*)p; - if (last == 0 || u == last) error("cannot del_after last"); - if (u == 0) u = last; // del_after 0 means delete first - BaseSLNode* t = u->tl; - if (u == t) - last = 0; - else - { - u->tl = t->tl; - if (last == t) - last = u; - } - delete_node(t); -} - -int BaseSLList::owns(Pix p) const -{ - BaseSLNode* t = last; - if (t != 0 && p != 0) - { - do - { - if (Pix(t) == p) return 1; - t = t->tl; - } while (t != last); - } - return 0; -} - -int BaseSLList::remove_front(void *dst, int signal_error) -{ - if (last) - { - BaseSLNode* t = last->tl; - copy_item(dst, t->item()); - if (t == last) - last = 0; - else - last->tl = t->tl; - delete_node(t); - return 1; - } - if (signal_error) - error("remove_front of empty list"); - return 0; -} - -void BaseSLList::del_front() -{ - if (last == 0) error("del_front of empty list"); - BaseSLNode* t = last->tl; - if (t == last) - last = 0; - else - last->tl = t->tl; - delete_node(t); -} - -int BaseSLList::OK() const -{ - int v = 1; - if (last != 0) - { - BaseSLNode* t = last; - long count = LONG_MAX; // Lots of chances to find last! - do - { - count--; - t = t->tl; - } while (count > 0 && t != last); - v &= count > 0; - } - if (!v) error("invariant failure"); - return v; + clear(); } /*
--- a/src/SLList.h +++ b/src/SLList.h @@ -19,22 +19,8 @@ #ifndef _SLList_h #define _SLList_h 1 -#if defined (__GNUG__) -#pragma interface -#endif - -#undef OK - #include <Pix.h> - -struct BaseSLNode -{ - union { - struct BaseSLNode *tl; - double dummy; /* To force correct alignment */ - }; - void *item() {return (void*)(this+1);} // Return ((SLNode<T>*)this)->hd -}; +#include <BaseSLList.h> template<class T> class SLNode : public BaseSLNode @@ -47,36 +33,6 @@ ~SLNode() { } }; -extern int __SLListLength(BaseSLNode *ptr); - -class BaseSLList { - protected: - BaseSLNode *last; - virtual void delete_node(BaseSLNode*node) = 0; - virtual BaseSLNode* copy_node(const void* datum) = 0; - virtual void copy_item(void *dst, void *src) = 0; - virtual ~BaseSLList() { } - BaseSLList() { last = 0; } - void copy(const BaseSLList&); - BaseSLList& operator = (const BaseSLList& a); - Pix ins_after(Pix p, const void *datum); - Pix prepend(const void *datum); - Pix append(const void *datum); - int remove_front(void *dst, int signal_error = 0); - void join(BaseSLList&); - public: - int length() const; - int empty() const { return last == 0; } - void clear(); - Pix prepend(BaseSLNode*); - Pix append(BaseSLNode*); - int OK() const; - void error(const char* msg) const; - void del_after(Pix p); - int owns(Pix p) const; - void del_front(); -}; - template <class T> class SLList : public BaseSLList { @@ -91,7 +47,7 @@ SLList(const SLList<T>& a) : BaseSLList() { copy(a); } SLList<T>& operator = (const SLList<T>& a) { BaseSLList::operator=((const BaseSLList&) a); return *this; } - virtual ~SLList() { clear(); } + ~SLList (void) { clear (); } Pix prepend(const T& item) {return BaseSLList::prepend(&item);} Pix append(const T& item) {return BaseSLList::append(&item);}
--- a/src/SLStack-i.cc +++ b/src/SLStack-i.cc @@ -22,11 +22,17 @@ // Instantiate Stacks of int values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" template class SLNode<int>; template class SLList<int>; + template class Stack<int>; template class SLStack<int>;
--- a/src/SLStack-pc.cc +++ b/src/SLStack-pc.cc @@ -22,11 +22,17 @@ // Instantiate Stacks of char* values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" template class SLNode<char*>; template class SLList<char*>; + template class Stack<char*>; template class SLStack<char*>;
--- a/src/SLStack-str.cc +++ b/src/SLStack-str.cc @@ -22,8 +22,11 @@ // Instantiate Stacks of string values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "SLStack.h" -#include "SLStack.cc" #include <string>
--- a/src/SLStack-sym.cc +++ b/src/SLStack-sym.cc @@ -22,18 +22,25 @@ // Instantiate Stacks of symbol_def* values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" #include "symtab.h" extern template class SLNode<unsigned>; extern template class SLList<unsigned>; + extern template class Stack<unsigned>; extern template class SLStack<unsigned>; template class SLNode<symbol_def *>; template class SLList<symbol_def *>; + template class Stack<symbol_def *>; template class SLStack<symbol_def *>;
--- a/src/SLStack-tm.cc +++ b/src/SLStack-tm.cc @@ -1,4 +1,3 @@ -// SLStack-tm.cc -*- C++ -*- /* Copyright (C) 1993, 1994, 1995 John W. Eaton @@ -23,13 +22,19 @@ // Instantiate Stacks of tree_matrix* values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" #include "pt-mat.h" template class SLNode<tree_matrix *>; template class SLList<tree_matrix *>; + template class Stack<tree_matrix *>; template class SLStack<tree_matrix *>;
--- a/src/SLStack-tok.cc +++ b/src/SLStack-tok.cc @@ -22,13 +22,19 @@ // Instantiate Stacks of token* values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" #include "token.h" template class SLNode<token *>; template class SLList<token *>; + template class Stack<token *>; template class SLStack<token *>;
--- a/src/SLStack-ue.cc +++ b/src/SLStack-ue.cc @@ -22,13 +22,19 @@ // Instantiate Stacks of unwind_elem values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" #include "unwind-prot.h" template class SLNode<unwind_elem>; template class SLList<unwind_elem>; + template class Stack<unwind_elem>; template class SLStack<unwind_elem>;
--- a/src/SLStack-ui.cc +++ b/src/SLStack-ui.cc @@ -22,11 +22,17 @@ // Instantiate Stacks of unsigned values. +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "SLList.h" + #include "SLStack.h" -#include "SLStack.cc" template class SLNode<unsigned>; template class SLList<unsigned>; + template class Stack<unsigned>; template class SLStack<unsigned>;
deleted file mode 100644 --- a/src/SLStack.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* - -Copyright (C) 1996 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#if defined (__GNUG__) -#pragma implementation -#endif - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "SLStack.h" - -template <class T> -SLStack<T>::SLStack (void) : p () -{ -} - -template <class T> -SLStack<T>::SLStack (const SLStack<T>& a) : p (a.p) -{ -} - -template <class T> -SLStack<T>::~SLStack (void) -{ -} - -template <class T> -void -SLStack<T>::push (const T& item) -{ - p.prepend (item); -} - -template <class T> -T -SLStack<T>::pop (void) -{ - return p.remove_front (); -} - -template <class T> -T& -SLStack<T>::top (void) -{ - return p.front (); -} - -template <class T> -void -SLStack<T>::del_top (void) -{ - p.del_front (); -} - -template <class T> -SLStack<T>& -SLStack<T>::operator = (const SLStack<T>& s) -{ - p = s.p; - return *this; -} - -template <class T> -int -SLStack<T>::empty (void) -{ - return p.empty (); -} - -template <class T> -int -SLStack<T>::full (void) -{ - return 0; -} - -template <class T> -int -SLStack<T>::length (void) -{ - return p.length (); -} - -template <class T> -int -SLStack<T>::OK (void) -{ - return p.OK (); -} - -template <class T> -void -SLStack<T>::clear (void) -{ - p.clear (); -} - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
--- a/src/SLStack.h +++ b/src/SLStack.h @@ -36,10 +36,6 @@ #if !defined (_SLStack_h) #define _SLStack_h 1 -#if defined (__GNUG__) -#pragma interface -#endif - #include "SLList.h" #include "Stack.h" @@ -47,28 +43,41 @@ class SLStack : public Stack<T> { - private: +private: + SLList<T> p; - public: - SLStack (void); - SLStack (const SLStack<T>& s); - ~SLStack (void); +public: + + SLStack (void) : p () { } + + SLStack (const SLStack<T>& s) : p (s.p) { } + + ~SLStack (void) { } - SLStack<T>& operator = (const SLStack<T>&); + SLStack<T>& operator = (const SLStack<T>& s) + { + p = s.p; + return *this; + } + + void push (const T& item) { p.prepend (item); } - void push (const T& item); - T pop (void); - T& top (void); - void del_top (void); + T pop (void) { return p.remove_front (); } + + T& top (void) { return p.front (); } + + void del_top (void) { p.del_front (); } + + int empty (void) { return p.empty (); } - int empty (void); - int full (void); - int length (void); + int full (void) { return 0; } + + int length (void) { return p.length (); } - void clear (void); + void clear (void) { p.clear (); } - int OK (void); + int OK (void) { return p.OK (); } }; #endif
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -98,6 +98,11 @@ { int len = idx.length (); + // XXX FIXME XXX + charMatrix tmp = rhs; + if (tmp.rows () == 1 && tmp.columns () == 0) + tmp.resize (0, 0); + switch (len) { case 2: @@ -108,7 +113,7 @@ matrix.set_index (i); matrix.set_index (j); - ::assign (matrix, rhs); + ::assign (matrix, tmp); } break; @@ -118,7 +123,7 @@ matrix.set_index (i); - ::assign (matrix, rhs); + ::assign (matrix, tmp); } break;