]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.1.0
authorfred <fred>
Wed, 19 Feb 1997 20:46:22 +0000 (20:46 +0000)
committerfred <fred>
Wed, 19 Feb 1997 20:46:22 +0000 (20:46 +0000)
flower/Sources.make
flower/Variables.make
flower/dataf.cc [deleted file]
flower/datafile.cc [new file with mode: 0644]
flower/datafile.hh [new file with mode: 0644]
flower/dstream.cc
flower/textdb.hh
flower/textstr.hh [deleted file]
flower/textstream.cc [new file with mode: 0644]
flower/textstream.hh [new file with mode: 0644]

index 23d5164f0a9c99548e71cd1124229740f61390e1..4b7cca4ec6fc5a9cda46ff8f8808c7856e64a9a7 100644 (file)
@@ -1,6 +1,7 @@
 
-cc=choleski.cc dataf.cc dstream.cc lgetopt.cc matdebug.cc matrix.cc\
-path.cc scalar.cc smat.cc string.cc textdb.cc unionfind.cc vector.cc
+cc=choleski.cc datafile.cc dstream.cc lgetopt.cc matdebug.cc matrix.cc\
+path.cc scalar.cc smat.cc string.cc stringconversion.cc stringutil.cc\
+textdb.cc textstream.cc unionfind.cc vector.cc 
 
 templatecc=cursor.tcc list.tcc plist.tcc interval.tcc\
        pcursor.tcc
@@ -9,5 +10,8 @@ inl=link.inl list.inl  cursor.inl plist.inl
 hh=assoc.hh associter.hh choleski.hh compare.hh cursor.hh dstream.hh\
 fproto.hh handle.hh interval.hh iterate.hh lgetopt.hh link.hh list.hh\
 matrix.hh path.hh pcursor.hh plist.hh rational.hh real.hh scalar.hh\
-smat.hh string.hh stringutil.hh textdb.hh textstr.hh unionfind.hh\
-varray.hh vector.hh vsmat.hh
+smat.hh string.hh stringconversion.hh stringutil.hh \
+textdb.hh textstream.hh unionfind.hh\
+varray.hh vector.hh vsmat.hh datafile.hh
+
+extra=stringtest.cc
index 6d0cec88bde3e83fe959ec39984e9449af1bdc46..d2a35182bdac3a7981dab269dd45367b9fcdd6df 100644 (file)
@@ -1,12 +1,12 @@
 MAJVER=1
-MINVER=0
-PATCHLEVEL=27
+MINVER=1
+PATCHLEVEL=0
 
 PACKAGENAME=flower
 
 #PROFILEFLAG=-pg
-DEBUGFLAG= -O2 -DNDEBUG # -g
-OPTIFLAG=-DNDEBUG -DNPRINT -O2
+DEBUGFLAG= -g
+OPTIFLAG= -DNPRINT -O2 -DSTRING_UTILS_INLINED -DNDEBUG 
 
 #########################################
 
@@ -32,7 +32,7 @@ include Sources.make
 
 obs=$(cc:.cc=.o)
 staticlib=libflower.a
-ALLSOURCES=$(hh) $(cc) $(inl) $(templatecc) 
+ALLSOURCES=$(hh) $(cc) $(inl) $(templatecc) $(extra)
 DFILES=$(ALLSOURCES) Makefile Variables.make make_version\
        Sources.make TODO README NEWS
 DDIR=$(DNAME)
diff --git a/flower/dataf.cc b/flower/dataf.cc
deleted file mode 100644 (file)
index 29b366c..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <fstream.h>
-#include <ctype.h>
-
-#include "textstr.hh"
-Text_stream::Text_stream(String fn)
-{      
-        if (fn == "") 
-           {
-           name = "<STDIN>";       
-           f = stdin;
-           }
-       
-       else 
-           {
-           name = fn;      
-           f = fopen(fn, "r");
-           }
-       
-       if (!f) {
-           cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
-           exit(1);
-       }
-
-       line_no = 1;
-    }
-
-void
-Text_stream::message(String s)
-{
-    cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
-}
-
-void 
-Data_file::gobble_white()
-{
-    char c;
-    
-    while ((c=data_get()) == ' ' ||c == '\t')
-       if (eof()) 
-           break;
-
-    data_unget(c);
-}
-
-String
-Data_file::get_word() 
-{// should handle escape seq's
-    String s;
-
-    while (1) 
-       {
-       char    c  = data_get();
-       
-       if (isspace(c) || eof()) 
-           {
-           data_unget(c);
-           break;
-           }
-       
-       
-       if (c == '\"')
-           {
-           rawmode= true;
-
-           while ((c  = data_get()) != '\"')
-               if (eof())
-                   error("EOF in a string");           
-               else
-                   s += c;
-           
-
-           rawmode= false;
-           }       
-       else
-           s += c;             
-       }
-    
-    return s;        
-}
-
-/**  get a char 
-   Only class member who uses text_file::get
-   */
-char
-Data_file::data_get() {
-    char c =  get(); 
-    if (!rawmode && c == '#') // gobble comment
-       {       
-       while ((c = get()) != '\n' && !eof()) 
-           ;
-           return '\n';
-       }    
-
-    return c;
-}
-
-/// read line, gobble '\n'    
-String Data_file::get_line()     
-{
-    char c; 
-    String s;
-
-    while ((c  = data_get()) != '\n' && !eof())
-       s += c;
-    return s;  
-}
-
-/// gobble stuff before first entry on a line.    
-void
-Data_file::gobble_leading_white() 
-{
-    // eat blank lines.
-    while (!eof()) {
-       char c = data_get();                
-       if (!isspace(c)) {
-           data_unget(c);
-           break;
-       }
-    }
-}
-
-
diff --git a/flower/datafile.cc b/flower/datafile.cc
new file mode 100644 (file)
index 0000000..e5940b4
--- /dev/null
@@ -0,0 +1,95 @@
+#include <fstream.h>
+#include <ctype.h>
+
+#include "datafile.hh"
+
+void 
+Data_file::gobble_white()
+{
+    char c;
+    
+    while ((c=data_get()) == ' ' ||c == '\t')
+       if (eof()) 
+           break;
+
+    data_unget(c);
+}
+
+String
+Data_file::get_word() 
+{// should handle escape seq's
+    String s;
+
+    while (1) 
+       {
+       char    c  = data_get();
+       
+       if (isspace(c) || eof()) 
+           {
+           data_unget(c);
+           break;
+           }
+       
+       
+       if (c == '\"')
+           {
+           rawmode= true;
+
+           while ((c  = data_get()) != '\"')
+               if (eof())
+                   error("EOF in a string");           
+               else
+                   s += c;
+           
+
+           rawmode= false;
+           }       
+       else
+           s += c;             
+       }
+    
+    return s;        
+}
+
+/**  get a char 
+   Only class member who uses text_file::get
+   */
+char
+Data_file::data_get() {
+    char c =  get(); 
+    if (!rawmode && c == '#') // gobble comment
+       {       
+       while ((c = get()) != '\n' && !eof()) 
+           ;
+           return '\n';
+       }    
+
+    return c;
+}
+
+/// read line, gobble '\n'    
+String Data_file::get_line()     
+{
+    char c; 
+    String s;
+
+    while ((c  = data_get()) != '\n' && !eof())
+       s += c;
+    return s;  
+}
+
+/// gobble stuff before first entry on a line.    
+void
+Data_file::gobble_leading_white() 
+{
+    // eat blank lines.
+    while (!eof()) {
+       char c = data_get();                
+       if (!isspace(c)) {
+           data_unget(c);
+           break;
+       }
+    }
+}
+
+
diff --git a/flower/datafile.hh b/flower/datafile.hh
new file mode 100644 (file)
index 0000000..14d5736
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+  datafile.hh -- declare Data_file
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DATAFILE_HH
+#define DATAFILE_HH
+
+#include "textstream.hh"
+
+/// read a data file
+class Data_file : private Text_stream
+{
+    
+ public:
+    bool rawmode;
+
+    Text_stream::line;    
+    Text_stream::eof;
+    Text_stream::get_name;    
+
+    char data_get();    
+    void data_unget(char c) {
+       unget(c);
+    }
+
+    /// read line, eat #\n#
+    String get_line();
+    
+    /// read a word till next space, leave space. Also does quotes
+    String get_word();
+
+    /// gobble horizontal white stuff.
+    void gobble_white();
+
+    /// gobble empty stuff before first field.
+    void gobble_leading_white();
+    Data_file(String s) : Text_stream(s) {
+       //*mlog << "(" << s << flush;   
+       rawmode=  false;        
+    }
+
+    ~Data_file()  {
+       //      *mlog << ")"<<flush;    
+    }    
+
+    warning(String s) {
+       message("warning: " + s);
+    }
+    error(String s){
+       message(s);
+       exit(1);    
+    }
+};
+#endif // DATAFILE_HH
index b045a0f455bf4d53cf4a5fff7c89cd7693e52bb6..92790b5a08113c425aa9ca4d31bdb8fde5ae0c74 100644 (file)
@@ -100,9 +100,9 @@ Dstream::Dstream(ostream *r, const char * cfg_nm )
 {
     os = r;
     silent = new Assoc<String,bool>;
+    indentlvl = 0;
     if (!os)
        return;
-    indentlvl = 0;
     
     const char * fn =cfg_nm ? cfg_nm : ".dstreamrc";
     {
index 3586c0d180628fd611e3f99ef4a02e22592afa33..c2cff2461be07ba0319d0d06271350b9589b02d5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TEXTDB_HH
 #define TEXTDB_HH
 
-#include "textstr.hh"
+#include "datafile.hh"
 
 /**a "const" Array. Contents can't be changed. do "#" comments, read quote enclosed  fields */
 
diff --git a/flower/textstr.hh b/flower/textstr.hh
deleted file mode 100644 (file)
index 2d648d4..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-
-#ifndef TEXTSTR_HH
-#define TEXTSTR_HH
-
-#include <stdio.h>
-#include <ctype.h>
-#include "string.hh"
-#include "varray.hh"
-
-/**  line counting input stream. 
- a stream for textfiles. linecounting. Thin interface getchar and
- ungetchar.  (ungetc is unlimited) 
-
- should protect get and unget against improper use
-*/
-
-
-class Text_stream
-{
-    int line_no;
-
-    // could just have used streams. 
-    FILE *f;  
-    Array<char> pushback;
-    String name;
-    
- public:
-    Text_stream(String fn);
-    String get_name() { return name; }
-    bool eof() {
-       return feof(f);
-    }
-    bool eol() {
-       return (peek() == '\n');
-    }
-    char peek() {
-       char c = get();
-       unget(c);
-       return c;
-    }
-    int line(){
-       return line_no;
-    }
-
-    char    get() {
-       char c;
-       
-       if (pushback.empty())
-           c = getc(f);        
-       else 
-           c = pushback.pop();
-
-       if (c =='\n')
-           line_no++;
-       return c;       
-    }
-    void unget(char c) {
-       if (c =='\n')
-           line_no--;
-       pushback.push(c);
-    }
-    ~Text_stream (){
-       if (!eof()) 
-           cerr <<__FUNCTION__<< ": closing unended file";
-    
-       fclose(f);
-    }
-
-    /// GNU format message.
-    void message(String s); 
-};
-/// read a data file
-class Data_file : private Text_stream
-{
-    
- public:
-    bool rawmode;
-
-    Text_stream::line;    
-    Text_stream::eof;
-    Text_stream::get_name;    
-
-    char data_get();    
-    void data_unget(char c) {
-       unget(c);
-    }
-
-    /// read line, eat #\n#
-    String get_line();
-    
-    /// read a word till next space, leave space. Also does quotes
-    String get_word();
-
-    /// gobble horizontal white stuff.
-    void gobble_white();
-
-    /// gobble empty stuff before first field.
-    void gobble_leading_white();
-    Data_file(String s) : Text_stream(s) {
-       //*mlog << "(" << s << flush;   
-       rawmode=  false;        
-    }
-
-    ~Data_file()  {
-       //      *mlog << ")"<<flush;    
-    }    
-
-    warning(String s) {
-       message("warning: " + s);
-    }
-    error(String s){
-       message(s);
-       exit(1);    
-    }
-};
-#endif
diff --git a/flower/textstream.cc b/flower/textstream.cc
new file mode 100644 (file)
index 0000000..5ab3f3f
--- /dev/null
@@ -0,0 +1,31 @@
+#include "textstream.hh"
+
+Text_stream::Text_stream(String fn)
+{
+    ios::sync_with_stdio();
+    if (fn == "") 
+           {
+           name = "<STDIN>";       
+           f = stdin;
+           }
+       
+       else 
+           {
+           name = fn;      
+           f = fopen(fn, "r");
+           }
+       
+       if (!f) {
+           cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
+           exit(1);
+       }
+
+       line_no = 1;
+    }
+
+void
+Text_stream::message(String s)
+{
+    cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
+}
+
diff --git a/flower/textstream.hh b/flower/textstream.hh
new file mode 100644 (file)
index 0000000..437f869
--- /dev/null
@@ -0,0 +1,74 @@
+
+#ifndef TEXTSTR_HH
+#define TEXTSTR_HH
+
+#include <stdio.h>
+#include <ctype.h>
+#include "string.hh"
+#include "varray.hh"
+
+/**
+  line counting input stream. 
+  a stream for textfiles. linecounting. Thin interface getchar and
+  ungetchar.  (ungetc is unlimited) 
+  
+  should protect get and unget against improper use
+*/
+
+
+class Text_stream
+{
+    int line_no;
+
+    // could just have used streams. 
+    FILE *f;  
+    Array<char> pushback;
+    String name;
+    
+ public:
+    Text_stream(String fn);
+    String get_name() { return name; }
+    bool eof() {
+       return feof(f);
+    }
+    bool eol() {
+       return (peek() == '\n');
+    }
+    char peek() {
+       char c = get();
+       unget(c);
+       return c;
+    }
+    int line(){
+       return line_no;
+    }
+
+    char    get() {
+       char c;
+       
+       if (pushback.empty())
+           c = getc(f);        
+       else 
+           c = pushback.pop();
+
+       if (c =='\n')
+           line_no++;
+       return c;       
+    }
+    void unget(char c) {
+       if (c =='\n')
+           line_no--;
+       pushback.push(c);
+    }
+    ~Text_stream (){
+       if (!eof()) 
+           cerr <<__FUNCTION__<< ": closing unended file";
+    
+       fclose(f);
+    }
+
+    /// GNU format message.
+    void message(String s); 
+};
+
+#endif