]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.52
authorfred <fred>
Sun, 24 Mar 2002 19:39:30 +0000 (19:39 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:39:30 +0000 (19:39 +0000)
13 files changed:
flower/include/interval.hh
flower/include/interval.tcc
flower/interval.cc [new file with mode: 0644]
lily/include/dynamic-reg.hh
lily/include/lily-proto.hh
lily/include/register-group.hh
lily/include/register.hh
lily/include/stem-beam-reg.hh
lily/include/text-reg.hh
lily/register-group.cc
lily/script-reg.cc
lily/staff-elem-info.cc
lily/template5.cc

index 57f6a5607a8cd87f5cc8cc242f6d7876e4c7b29c..1c3c6588c08b81d9efa1c1c79d1d0445737d12e1 100644 (file)
 #include "real.hh"
 
 
-/**  a T interval. 
-  this represents the closed interval [left,right].
-  No invariants. T must be a totally ordered ring
+/** a T interval.  this represents the closed interval [left,right].
+  No invariants. T must be a totally ordered ring (with division, anyway ..)
+  At instantiation, the function infinity() has to be defined explicitely.
+  
   */
 template<class T>
 struct Interval_t {
@@ -22,6 +23,8 @@ struct Interval_t {
 
     /* ************** */
     
+    static T infinity() ;
+    
     T center() { return (left + right) / T(2);}
     void translate(T t) {
        left += t;
@@ -56,6 +59,7 @@ struct Interval_t {
     T length() const;
     void set_empty() ;
     bool empty_b() const { return left > right; }
+    bool contains_b(Interval_t<T> const&) const;
     Interval_t() {
        set_empty();
     }
index 32eec44580228b76f322b47d79a026c031a548d3..49be7046085ba6bf555a1e184d19f8cf140c665a 100644 (file)
@@ -20,6 +20,15 @@ _Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
     return -2;
 }
 
+template<class T>
+bool 
+Interval_t<T>::contains_b(Interval_t<T> const& a)const
+{
+    int c_i= _Interval__compare( *this, a);
+    if (c_i == -2)
+       return false;
+    return c_i >= 0;
+}
 
 template<class T>
 int
@@ -31,18 +40,12 @@ Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
     return i;
 }
 
-#ifdef AIX
-const Real INFTY = 1e8;        // ARGh. AIX sucks
-#else
-const Real INFTY = HUGE_VAL;
-#endif
-
 template<class T>
 void
 Interval_t<T>::set_empty()
 {
-    left = INFTY;
-    right = -INFTY;
+    left = (T) infinity();
+    right = (T) -infinity();
 }
 
 template<class T>
diff --git a/flower/interval.cc b/flower/interval.cc
new file mode 100644 (file)
index 0000000..1db78d8
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+  interval.cc -- instantiate Interval_t<Real>
+
+  source file of the Flower Library
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "interval.hh"
+#include "real.hh"
+#include "interval.tcc"
+
+Interval__instantiate(Real);
+
+Real
+Interval_t<Real>::infinity() 
+{
+    return HUGE;
+}
index b0f8b1a4379d647fae73c0c353036d7154a97607..c56805d07d849214d72b0517bd4a5ee439e2307d 100644 (file)
@@ -31,7 +31,7 @@ protected:
     virtual void pre_move_processing();
     virtual void post_move_processing();
     virtual bool acceptable_request_b(Request*) const;
-    virtual void set_feature(Features);
+    virtual void set_feature(Feature);
 };
 
 #endif // DYNAMIC_REG_HH
index abe556db86a6aba7d9303558b7b4cbc759050fe2..3864ace14675f07db7c3bed0f3bb5a1259286b23 100644 (file)
@@ -27,6 +27,7 @@ struct Decresc_req;
 struct Durational_req;
 struct Dynamic_req;
 struct Group_change_req;
+struct Feature;
 struct Group_feature_req;
 struct Key_change_req;
 struct Lyric_req;
@@ -35,6 +36,8 @@ struct Measure_grouping_req;
 struct Meter_change_req;
 struct Musical_req;
 struct Command_req;
+struct Collision_register;
+struct Collision;
 struct Note_req;
 struct Plet_req;
 struct Partial_measure_req;
index 7af00f6505f8e14b3153238e3e6d3a0d7f62a1d9..cccafc4804ba23d38b219001f239e051ffa86f1b 100644 (file)
@@ -39,7 +39,7 @@ public:
       Remove #reg_l# from the list, and return it.
      */
     Request_register * get_register_p(Request_register*reg_l);
-    virtual void set_feature(Features i);
+    virtual void set_feature(Feature i);
     virtual bool acceptable_request_b(Request*)const;
     virtual void pre_move_processing();
     virtual void post_move_processing();
index 3978c797272d36ccc32ff63201bd506e5987b3f0..6d62b74c6154bbc78a1e08a241859809147f8184 100644 (file)
@@ -80,9 +80,9 @@ protected:
       */
     virtual void announce_element(Staff_elem_info);
     /**
-      Set features of the register(s). Default: ignore features.
+      Set Feature of the register(s). Default: ignore Feature.
      */
-    virtual void set_feature(Features){}
+    virtual void set_feature(Feature){}
     /**
       Does this equal or contain a certain register?
      */
index dddba269a4f56073220e1321d210fcb3068b0d54..9c64765807666ea653ed527b5a92681b1b5cec47 100644 (file)
@@ -22,7 +22,7 @@ struct Stem_beam_register : Request_register {
     /* *************** */
     Stem_beam_register();
     ~Stem_beam_register();
-    virtual void set_feature(Features dir_i_);
+    virtual void set_feature(Feature dir_i_);
     virtual bool try_request(Request*);
     virtual void process_requests();
     virtual void acknowledge_element(Staff_elem_info);
index db668dd44f7ebb67f9e67f54ff3eb7b50bfb8a6d..f3544b3ec77ba58221b686ccc0ea248abeac7981 100644 (file)
@@ -15,7 +15,7 @@ class Text_register : public Request_register{
     int dir_i_;
     /* *************** */
 protected:
-    virtual void set_feature(Features );
+    virtual void set_feature(Feature );
     virtual bool try_request(Request*);
     virtual void process_requests();
     virtual void pre_move_processing();
index 9400bbc87a66bf4aa1b173f1903c9688fa69a911..611ac59b75f40f998cec985f308faefc5aa7b1fa 100644 (file)
@@ -22,7 +22,7 @@ Register_group_register::acceptable_request_b(Request* r)const
 }
 
 void
-Register_group_register::set_feature(Features d)
+Register_group_register::set_feature(Feature d)
 {
     for (iter_top(reg_list_, i); i.ok(); i++) {
        i->set_feature(d);
index 5fd12bc9f6605303193c2d00542313e59a1697af..67ab628183c2b95ae1c0af8e80022e65f5ffc660 100644 (file)
@@ -81,11 +81,5 @@ Script_register::post_move_processing()
     script_req_l_arr_.set_size(0);
 }
 
-void
-Script_register::set_feature(Features )
-{
-//    if (i.direction_i_|| i.initialiser_b_)
-    //dir_i_ = i.direction_i_;
-}
 IMPLEMENT_STATIC_NAME(Script_register);
 ADD_THIS_REGISTER(Script_register);
index c0465584928437002d577e9ee2f01a4c6a1b682c..0bef384db6eb0cf2c45aab4d64eb6eb1e54ec469 100644 (file)
@@ -24,17 +24,5 @@ Staff_elem_info::Staff_elem_info()
     req_l_ = 0;
 }
 
-Features::Features()
-{
-    direction_i_ = 0;
-    initialiser_b_ = false;
-}
-
-Features
-Features::dir(int d) return f;
-{
-    f.initialiser_b_ = true;
-    f.direction_i_ = d;
-}
 
 
index a1ab7e8df321ba6190227a118e4b9ebf8b4736c1..05b842473dd92c9d7007424ba4f7048e09be5193 100644 (file)
@@ -1,3 +1,4 @@
+#include <limits.h>
 #include "proto.hh"
 #include "string.hh"
 #include "moment.hh"
@@ -5,5 +6,23 @@
 
 #include "interval.tcc"
 
-Interval__instantiate(Real);
 Interval__instantiate(Rational);
+Interval__instantiate(int);
+
+#ifdef AIX
+const Real INFTY = 1e8;        // ARGh. AIX sucks
+#else
+const Real INFTY = HUGE_VAL;
+#endif
+
+Rational
+Interval_t<Rational>::infinity()
+{
+    return INFTY;
+}
+
+int
+Interval_t<int>::infinity()
+{
+    return INT_MAX;
+}