]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/data-file.cc
release: 0.1.24
[lilypond.git] / flower / data-file.cc
index 251380d3c806f5a11a16a0696253019e181ccccb..5a273c5dbb6b33b5f022b289a05f3a26d8266169 100644 (file)
+/*   
+  data-file.cc --  implement Data_file 
+  
+  source file of the Flower Library
+  
+  (c) '95, '96, '97 Han-Wen Nienhuys <hanwen@stack.nl>
+  
+  */
 #include <fstream.h>
 #include <ctype.h>
 
+#include "international.hh"
 #include "data-file.hh"
 
-void 
+void
 Data_file::gobble_white()
 {
   char c;
-  
+
   while ((c=data_get()) == ' ' ||c == '\t')
-       if (eof()) 
-           break;
+    if (eof())
+      break;
 
   data_unget (c);
 }
 
 String
-Data_file::get_word() 
+Data_file::get_word()
 {// should handle escape seq's
   String s;
 
-  while (1) 
+  while (1)
+    {
+      char     c  = data_get();
+
+      if (isspace (c) || eof())
        {
-       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;          
+         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 
+/**  get a char
    Only class member who uses text_file::get
    */
 char
 Data_file::data_get() {
-  char c =  get(); 
+  char c =  get();
   if (!rawmode && c == '#') // gobble comment
-       {       
-       while ((c = get()) != '\n' && !eof ()) 
-           ;
-           return '\n';
-         }
+    {
+      while ((c = get()) != '\n' && !eof ())
+       ;
+      return '\n';
+    }
 
   return c;
 }
 
-/// read line, gobble '\n'    
-String Data_file::get_line()     
+/// read line, gobble '\n'
+String Data_file::get_line()
 {
-  char c; 
+  char c;
   String s;
 
   while ((c  = data_get()) != '\n' && !eof ())
-       s += c;
-  return s;    
+    s += c;
+  return s;
 }
 
-/// gobble stuff before first entry on a line.    
+/// gobble stuff before first entry on a line.
 void
-Data_file::gobble_leading_white() 
+Data_file::gobble_leading_white()
 {
   // eat blank lines.
-  while (!eof()) 
+  while (!eof())
     {
-       char c = data_get();                
-       if (!isspace (c)) 
-         {
-           data_unget (c);
-           break;
-         }
+      char c = data_get();
+      if (!isspace (c))
+       {
+         data_unget (c);
+         break;
+       }
     }
 }
-
-