CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/05/19 22:57:50
Modified files:
. : ChangeLog
flower : file-name.cc file-path.cc
flower/include : file-name.hh file-path.hh
lily : hara-kiri-engraver.cc
Log message:
* flower/file-path.cc (find): don't throw away file_name.dir, but
append to it. Fixes \include with directories.
* flower/include/file-path.hh (class File_path): don't derive from
Array<String>.
* flower/include/file-name.hh (class File_name): remove to_str0()
* lily/hara-kiri-engraver.cc (acknowledge_grob): split
Hara_kiri_engraver in separate file.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3639&tr2=1.3640&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/file-name.cc.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/file-path.cc.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/include/file-name.hh.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/include/file-path.hh.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/hara-kiri-engraver.cc.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3639 lilypond/ChangeLog:1.3640
--- lilypond/ChangeLog:1.3639 Thu May 19 22:24:08 2005
+++ lilypond/ChangeLog Thu May 19 22:57:50 2005
@@ -1,5 +1,13 @@
2005-05-20 Han-Wen Nienhuys <[EMAIL PROTECTED]>
+ * flower/file-path.cc (find): don't throw away file_name.dir, but
+ append to it. Fixes \include with directories.
+
+ * flower/include/file-path.hh (class File_path): don't derive from
+ Array<String>.
+
+ * flower/include/file-name.hh (class File_name): remove to_str0()
+
* lily/hara-kiri-engraver.cc (acknowledge_grob): split
Hara_kiri_engraver in separate file.
Index: lilypond/flower/file-name.cc
diff -u lilypond/flower/file-name.cc:1.10 lilypond/flower/file-name.cc:1.11
--- lilypond/flower/file-name.cc:1.10 Sun May 15 23:44:06 2005
+++ lilypond/flower/file-name.cc Thu May 19 22:57:50 2005
@@ -75,11 +75,6 @@
return s;
}
-char const *
-File_name::to_str0 () const
-{
- return to_string ().to_str0 ();
-}
File_name::File_name (String file_name)
{
Index: lilypond/flower/file-path.cc
diff -u lilypond/flower/file-path.cc:1.34 lilypond/flower/file-path.cc:1.35
--- lilypond/flower/file-path.cc:1.34 Mon May 16 23:25:37 2005
+++ lilypond/flower/file-path.cc Thu May 19 22:57:50 2005
@@ -31,7 +31,7 @@
Array<String>
File_path::directories () const
{
- return *this;
+ return dirs_;
}
void
@@ -41,7 +41,7 @@
while ((len = p.length ()) )
{
int i = p.index (PATHSEP);
- if (i <0)
+ if (i < 0)
i = len;
append (p.left_string (i));
p = p.right_string (len - i - 1);
@@ -59,6 +59,7 @@
if (!(sbuf.st_mode & __S_IFREG))
return false;
#endif
+
#if !STAT_MACROS_BROKEN
struct stat sbuf;
if (stat (file_name.to_str0 (), &sbuf) != 0)
@@ -67,12 +68,14 @@
return !S_ISDIR (sbuf.st_mode);
#endif
+
if (FILE *f = fopen (file_name.to_str0 (), "r"))
{
fclose (f);
return true;
}
+
return false;
}
@@ -120,29 +123,31 @@
File_name file_name (name);
if (file_name.dir_[0] == DIRSEP && is_file (file_name.to_string ()))
return file_name.to_string ();
-
- for (int i = 0, n = size (); i < n; i++)
+
+ for (int i = 0; i < dirs_.size (); i++)
{
- File_name dir = elem (i);
+ File_name file_name (name);
+ File_name dir = dirs_[i];
file_name.root_ = dir.root_;
dir.root_ = "";
- file_name.dir_ = dir.to_string ();
+ if (file_name.dir_.is_empty ())
+ file_name.dir_ = dir.to_string ();
+ else if (!dir.to_string ().is_empty())
+ file_name.dir_ += ::to_string (DIRSEP) + dir.to_string ();
+
if (is_file (file_name.to_string ()))
return file_name.to_string ();
}
return "";
}
-/** Find a file.
-
-Seach in the current dir (DUH! FIXME?), in the construction-arg
-(what's that?, and in any other appended directory, in this order.
+/*
+ Try to find
-Search for NAME, or name without extension, or name with any of
-EXTENSIONS, in that order.
+ file.EXT,
[EMAIL PROTECTED]
-The file name if found, or empty string if not found. */
+ where EXT is from EXTENSIONS.
+*/
String
File_path::find (String name, char const *extensions[])
{
@@ -161,6 +166,7 @@
if (!find (file_name.to_string ()).is_empty ())
break;
}
+
/* Reshuffle extension */
file_name = File_name (file_name.to_string ());
}
@@ -185,11 +191,23 @@
File_path::to_string () const
{
String s;
- for (int i = 0, n = size (); i < n; i++)
+ for (int i = 0; i < dirs_.size (); i++)
{
- s = s + elem (i);
- if (i < n - 1)
+ s = s + dirs_[i];
+ if (i < dirs_.size() - 1)
s += ::to_string (PATHSEP);
}
return s;
}
+
+void
+File_path::append (String str)
+{
+ dirs_.push (str);
+}
+
+void
+File_path::prepend (String str)
+{
+ dirs_.insert (str, 0);
+}
Index: lilypond/flower/include/file-name.hh
diff -u lilypond/flower/include/file-name.hh:1.3
lilypond/flower/include/file-name.hh:1.4
--- lilypond/flower/include/file-name.hh:1.3 Thu Mar 10 14:36:16 2005
+++ lilypond/flower/include/file-name.hh Thu May 19 22:57:50 2005
@@ -23,7 +23,6 @@
File_name (String);
String to_string () const;
- char const *to_str0 () const;
};
#endif /* FILE_NAME */
Index: lilypond/flower/include/file-path.hh
diff -u lilypond/flower/include/file-path.hh:1.19
lilypond/flower/include/file-path.hh:1.20
--- lilypond/flower/include/file-path.hh:1.19 Sat May 14 21:43:04 2005
+++ lilypond/flower/include/file-path.hh Thu May 19 22:57:50 2005
@@ -21,17 +21,18 @@
TODO: add a unix style PATH interface
*/
-class File_path : private Array<String>
+class File_path
{
+ Array<String> dirs_;
public:
Array<String> directories () const;
String find (String name) const;
String find (String name, char const *extensions[]);
String to_string () const;
bool try_append (String str);
- void append (String str) { Array<String>::push (str); }
+ void append (String str);
void parse_path (String);
- void prepend (String str) { Array<String>::insert (str, 0); }
+ void prepend (String str);
};
#endif /* FILE_PATH */
Index: lilypond/lily/hara-kiri-engraver.cc
diff -u lilypond/lily/hara-kiri-engraver.cc:1.10
lilypond/lily/hara-kiri-engraver.cc:1.11
--- lilypond/lily/hara-kiri-engraver.cc:1.10 Thu May 19 22:24:08 2005
+++ lilypond/lily/hara-kiri-engraver.cc Thu May 19 22:57:50 2005
@@ -10,6 +10,7 @@
#include "axis-group-engraver.hh"
#include "hara-kiri-group-spanner.hh"
#include "rhythmic-head.hh"
+#include "spanner.hh"
class Hara_kiri_engraver : public Axis_group_engraver
{
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs