]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.1.5
authorfred <fred>
Tue, 4 Mar 1997 22:55:11 +0000 (22:55 +0000)
committerfred <fred>
Tue, 4 Mar 1997 22:55:11 +0000 (22:55 +0000)
flower/Makefile
flower/NEWS
flower/fproto.hh
flower/libc-extension.hh
flower/string.cc

index 779f1e5b82f04d8cd6b13e07411df3e2f6662f5d..f4ab0e668f304d9016c4a6f89419845afaf6d4e5 100644 (file)
@@ -5,6 +5,9 @@ $(staticlib): $(obs) fversion.hh
 
 include deps/*.dep
 
+flower-config.hh:
+       touch flower-config.hh
+
 deps/*.dep:
        touch deps/dummy.dep
 
index 36c03ddcd46c0f66f4eb975df29a5f4e5c5b24a4..faa08528d73cdced2145437b9e24c32ebd163ff0 100644 (file)
@@ -1,3 +1,6 @@
+pl 1.1.5
+       - memmem interface, conditional compilation
+       - snprintf
 
 pl 1.1.4
        - great file-renaming.
index 57469fead57711b5ced16bda6f84a835cbedb08b..8c6fda680ef111acb3db33771fb9e546fcb70f76 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef FPROTO_HH
 #define FPROTO_HH
 
+#include "flower-config.hh"
+
 template<class T> struct Array;
 template<class T> struct sstack;
 template<class T,class K> struct Assoc;
index e06feb5af447bd7190eea59bfcd85e11b9e80844..e71037c41ee817c95f2f108bb143284a2947f58a 100644 (file)
 
 char* strnlwr( char* start_l ,int n);
 char* strnupr( char* start_l, int n);
-/*
-  should use void* like in libc
- */
-char *memmem(const Byte * haystack, const Byte *needle,
-              int haystack_len, int needle_len);
+
+#ifndef HAVE_MEMMEM            // GNU extension.
+char *memmem(const Byte * haystack, int haystack_len,
+            const Byte *needle, int needle_len);
+#endif HAVE_MEMMEM
+
+#ifndef HAVE_SNPRINTF          // GNU extension.
+int snprintf (char *str, size_t n,
+             const char *format, ... );
+#endif
+
+
 Byte *memrchr(const Byte * p, int n, char c);
-Byte*strrev( Byte* byte_l, int length_i );
+Byte *strrev( Byte* byte_l, int length_i );
 
 
 #endif // LIBC_EXTENSION_HH
index b4687c0b7f8bf3cb113fdd8326e65814b24a3883..60038f6a557b04683e7f24846b44e02cafdff91d 100644 (file)
@@ -152,9 +152,8 @@ String::compare_i(String const& s1, String const& s2 )
 
     int i1 = s1.length_i();
     int i2 = s2.length_i();
-    int i = i1 <? i2;
 
-    int result=  memcmp( p1, p2, i );
+    int result=  memcmp( p1, p2, i1 <? i2 );
     return result ? result : i1-i2;
 }
 
@@ -220,8 +219,8 @@ int
 String::index_i( String searchfor ) const
 {
     char const* me = strh_.ch_c_l();
-    char const* p = (char const *) memmem(me, length_i(), searchfor.ch_c_l(), 
-                                         searchfor.length_i());
+    char const* p = (char const *) memmem(
+       me, length_i(), searchfor.ch_c_l(), searchfor.length_i());
     
     if ( p )
        return p - me;
@@ -300,6 +299,11 @@ String::nomid_str( int index_i, int n ) const
 String
 String::mid_str( int index_i, int n ) const
 {
+    if (index_i <0) {
+       n += index_i;
+       index_i=0;
+    }
+    
     if ( !length_i() || ( index_i < 0 ) || ( index_i >= length_i() ) || ( n < 1 ) )
        return String();