]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/dstream.cc
release: 1.0.1
[lilypond.git] / flower / dstream.cc
index f22365bf551f520c8a26a114b187bc35f3df1f46..fc15680d92af70110fefa5f34929bea4d0dccdde 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the Flower Library
 
-  (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include <fstream.h>
@@ -13,6 +13,7 @@
 #include "text-db.hh"
 #include "string-convert.hh"
 #include "assoc-iter.hh"
+#include "rational.hh"
 
 /// indent of each level
 const INDTAB = 2;
@@ -58,7 +59,7 @@ Dstream::identify_as (String name)
     idx = cl;
   else
     {
-      (*silent_assoc_p_)[idx] = false;
+      (*silent_assoc_p_)[idx] = default_silence_b_;
     }
   local_silence_b_ = (*silent_assoc_p_)[idx];
   if (current_classname_str_ != idx && !local_silence_b_)
@@ -79,23 +80,23 @@ Dstream::silent_b (String s) const
 }
 
 Dstream &
-Dstream::operator<<(String s)
+Dstream::operator<<(void const *v_l)
 {
-  output (s);
+  output (String_convert::pointer_str (v_l));
   return *this;
 }
 
 Dstream &
-Dstream::operator<<(void const *v_l)
+Dstream::operator <<(Scalar s)
 {
-  output (String_convert::pointer_str (v_l));
+  output (s);
   return *this;
 }
 
 Dstream &
-Dstream::operator<<(char const *ch_l)
+Dstream::operator <<(const char * s)
 {
-  output (ch_l);
+  output (String (s));
   return *this;
 }
 
@@ -124,7 +125,7 @@ Dstream::output (String s)
        break;
 
       case '\n':
-       *os_l_ << '\n' << String (' ', indent_level_i_) << flush;
+       *os_l_ << '\n' << to_str (' ', indent_level_i_) << flush;
        break;
       default:
        *os_l_ << *cp;
@@ -138,28 +139,31 @@ Dstream::Dstream (ostream *r, char const * cfg_nm)
 {
   os_l_ = r;
   silent_assoc_p_ = new Assoc<String,bool>;
+  default_silence_b_ = false;
   indent_level_i_ = 0;
   if (!os_l_)
     return;
 
   char const * fn =cfg_nm ? cfg_nm : ".dstreamrc";
   {
-    ifstream ifs (fn); // can't open
+    ifstream ifs (fn); // can 't open
     if (!ifs)
       return;
   }
 
   Text_db cfg (fn);
-  while (! cfg.eof()){
+  while (!cfg.eof_b ()){
     Text_record  r (cfg++);
     if (r.size() != 2)
       {
-       r.message (_("not enough fields in Dstream init."));
+       r.message (_ ("Not enough fields in Dstream init."));
        continue;
       }
     (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
   }
 
+  if ((*silent_assoc_p_).elt_b ("Dstream_default_silence"))
+    default_silence_b_ = (*silent_assoc_p_)["Dstream_default_silence"];
 }
 
 
@@ -177,3 +181,4 @@ Dstream::clear_silence()
       i.val() = false;
     }
 }
+