]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.0.3
authorfred <fred>
Mon, 28 Oct 1996 21:07:30 +0000 (21:07 +0000)
committerfred <fred>
Mon, 28 Oct 1996 21:07:30 +0000 (21:07 +0000)
flower/Sources.make
flower/TODO
flower/compare.hh
flower/pcursor.hh [new file with mode: 0644]

index 18fb18cb24dc77560a29fc1163f486759b8ef752..6521100b3bb5ba72883175fdeaa7a77bfc716bfd 100644 (file)
@@ -5,7 +5,7 @@ cc=lgetopt.cc    string.cc dataf.cc textdb.cc unionfind.cc  \
 
 templatecc=cursor.cc list.cc tsmat.cc 
 inl=findcurs.inl link.inl list.inl
-hh=cursor.hh cursor.inl lgetopt.hh link.hh list.hh dstream.hh \
+hh=cursor.hh pcursor.hh cursor.inl lgetopt.hh link.hh list.hh dstream.hh \
        string.hh stringutil.hh vray.hh textdb.hh textstr.hh  assoc.hh\
        findcurs.hh unionfind.hh compare.hh handle.hh matrix.hh\
        smat.hh vsmat.hh  vector.hh  real.hh choleski.hh\
index c8f3e5ad5297ad7119d3058aa13f3fe08871ef7e..8d6e50591d20e791b3902b725a8306b7dd2e3188 100644 (file)
@@ -9,10 +9,6 @@
 
        * Restricted cursor/list: make sublist from a list, and use rcursor as if list is as big as the sublist.
 
-       * Cursor signedcompare
-
-       * int Cursor::op-(Cursor)
-
        * move towards gnu?
 
                parsestream.h
index 05b6e89e41d8a0e9143eed417905b11fcba2691f..47c7101c87cb9b65029b8dd4874194a836e4375c 100644 (file)
@@ -2,21 +2,24 @@
 #define COMPARE_HH
 
 /// handy notations for a signed comparison
-#define instantiate_compare(type, function)                            \
-inline bool operator>(type t1, type t2) { return function(t1, t2) > 0; }       \
- inline bool operator>=(type t1, type t2) { return function(t1, t2) >= 0; }    \
- inline bool operator==(type t1, type t2) { return function(t1, t2) == 0; }    \
- inline bool operator<=(type t1, type t2) { return function(t1, t2) <= 0; }    \
- inline bool operator<(type t1, type t2) { return function(t1, t2) < 0; } \
- inline type MAX(type t1, type t2) {  return (t1 > t2 )? t1 : t2; }\
- inline type MIN(type t1, type t2) {  return (t1 < t2 )? t1 : t2; }\
+#define template_instantiate_compare(type, function, prefix)                           \
+prefix inline bool operator>(type t1, type t2) { return function(t1, t2) > 0; }        \
+prefix inline bool operator>=(type t1, type t2) { return function(t1, t2) >= 0; }      \
+prefix inline bool operator==(type t1, type t2) { return function(t1, t2) == 0; }      \
+prefix inline bool operator<=(type t1, type t2) { return function(t1, t2) <= 0; }      \
+prefix inline bool operator<(type t1, type t2) { return function(t1, t2) < 0; } \
+prefix inline type MAX(type t1, type t2) {  return (t1 > t2 )? t1 : t2; }\
+prefix inline type MIN(type t1, type t2) {  return (t1 < t2 )? t1 : t2; }\
   \
-  bool operator<(type t1, type t2) /* stupid fix to allow ; */
+prefix  bool operator<(type t1, type t2) /* stupid fix to allow ; */
      /**
     make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
     Please fill a & in the type argument if necessary.    
     */
 
+
+    
+#define instantiate_compare(type, func) template_instantiate_compare(type,func, )
      
 
      
diff --git a/flower/pcursor.hh b/flower/pcursor.hh
new file mode 100644 (file)
index 0000000..8b0b179
--- /dev/null
@@ -0,0 +1,26 @@
+
+
+/// cursor which feels like a pointer
+template<class T>
+struct PCursor : public Cursor<T> {
+
+    /// make cursor with #no# items back
+    PCursor<T> operator -( int no) const {
+       return PCursor<T> (Cursor<T>::operator-(no));
+    }
+
+    /// make cursor with #no# items further
+    PCursor<T> operator +( int no) const {
+       return PCursor<T> (Cursor<T>::operator+(no));
+    }
+    PCursor(List<T> & l) : Cursor<T> (l) {}
+
+    PCursor( const Cursor<T>& cursor ) : Cursor<T>(cursor) { }
+    T operator ->() { return  *(*this); }
+
+};
+/**
+ HWN: I'd like an operator->(), so here it is.
+
+ Cursor to go with pointer list.
+ */