From 86d62cc7c9a0721de976b34c83456f633ba65f9d Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 5 Nov 1996 16:49:36 +0000 Subject: [PATCH] flower-1.0.5 --- flower/Sources.make | 3 ++- flower/assoc.hh | 2 ++ flower/dstream.cc | 26 +++++++++++++++----------- flower/dstream.hh | 6 ++++-- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/flower/Sources.make b/flower/Sources.make index fd5dcf4146..e8b2250ad1 100644 --- a/flower/Sources.make +++ b/flower/Sources.make @@ -9,4 +9,5 @@ hh=cursor.hh pcursor.hh lgetopt.hh link.hh list.hh dstream.hh \ string.hh stringutil.hh vray.hh textdb.hh textstr.hh assoc.hh\ findcurs.hh unionfind.hh compare.hh handle.hh matrix.hh\ smat.hh vsmat.hh vector.hh real.hh choleski.hh\ - tsmat.hh tvsmat.hh plist.hh\ + tsmat.hh tvsmat.hh plist.hh associter.hh\ + diff --git a/flower/assoc.hh b/flower/assoc.hh index 84a54c9a72..2409985668 100644 --- a/flower/assoc.hh +++ b/flower/assoc.hh @@ -2,6 +2,7 @@ #define ASSOC_HH #include "vray.hh" +#include template struct Assoc_ent_ { @@ -72,4 +73,5 @@ public: }; /** mindblowingly stupid Associative array implementation */ + #endif diff --git a/flower/dstream.cc b/flower/dstream.cc index d8cff69041..8540e734cf 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -1,5 +1,5 @@ #include - +#include "assoc.hh" #include "dstream.hh" #include "string.hh" #include "textdb.hh" @@ -36,14 +36,14 @@ Dstream::identify_as(String name) String cl(strip_member(mem)); String idx = cl; - if (silent.elt_query(mem)) + if (silent->elt_query(mem)) idx = mem; - else if (silent.elt_query(cl)) + else if (silent->elt_query(cl)) idx = cl; else { - silent[idx] = false; + (*silent)[idx] = false; } - local_silence = silent[idx]; + local_silence = (*silent)[idx]; if (classname != idx && !local_silence) { classname=idx; *os << "[" << classname << ":]"; @@ -54,9 +54,9 @@ Dstream::identify_as(String name) bool Dstream::silence(String s) { - if (!silent.elt_query(s)) + if (!silent->elt_query(s)) return false; - return silent[s]; + return (*silent)[s]; } /// Dstream & @@ -99,6 +99,7 @@ Dstream::operator<<(String s) Dstream::Dstream(ostream *r, const char * cfg_nm ) { os = r; + silent = new Assoc; if (!os) return; indentlvl = 0; @@ -109,15 +110,18 @@ Dstream::Dstream(ostream *r, const char * cfg_nm ) if (!ifs) return; } - // cerr << "(" << fn; + Text_db cfg(fn); while (! cfg.eof()){ Text_record r( cfg++); assert(r.sz() == 2); - silent[r[0]] = r[1].to_bool(); + (*silent)[r[0]] = r[1].to_bool(); } - // cerr <<")"; -} +} +Dstream::~Dstream() +{ + delete silent; +} diff --git a/flower/dstream.hh b/flower/dstream.hh index 72d0897201..aae52a7838 100644 --- a/flower/dstream.hh +++ b/flower/dstream.hh @@ -4,10 +4,12 @@ #define DSTREAM_HH #include "string.hh" -#include "assoc.hh" const char eol= '\n'; +template +struct Assoc; + /// debug stream class Dstream { @@ -16,7 +18,7 @@ class Dstream bool local_silence; String classname; - Assoc silent; + Assoc *silent; public: bool silence(String); -- 2.39.5