+++ /dev/null
-/*
- acursor.hh -- declare ACursor, PACursor
-
- source file of the Flower Library
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef ACURSOR_HH
-#define ACURSOR_HH
-
-template<class T>
-class ACursor
-{
-protected:
- int idx_;
- Array<T> &arr_;
-public:
- ACursor (ACursor const& s)
- :arr_(s.arr_)
- {
- idx_ = s.idx_;
- }
- ACursor (Array<T> const &arr)
- arr_((Array<T>&)arr)
- {
- idx_ =0;
- }
- T thing() const {
- return arr_[idx_];
- }
- T& thing() { return arr_[idx_]; }
- T& operator++(int) {
- T&t = thing();
- idx_ ++;
- return t;
- }
- bool ok() { return idx_ >=0 && idx_ < arr_.size (); }
-};
-
-
-template<class T>
-class PACursor : public ACursor<T*>
-{
-public:
- PACursor (Link_array<T> l)
- : ACursor (l)
- {
- }
- T* ptr() { return arr_[idx_]; }
- T *operator->() {
- return ptr();
- }
-
-};
-
-#endif // ACURSOR_HH
+++ /dev/null
-/*
- full-storage.icc -- implement Full_storage inline functions
-
- source file of the Flower Library
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef FULL_STORAGE_ICC
-#define FULL_STORAGE_ICC
-
-
-INLINE void
-Full_storage::init()
-{
- els_p_p_=0;
- band_i_ = 0;
- height_i_=width_i_=max_height_i_=max_width_i_=0;
-}
-
-INLINE bool
-Full_storage::valid (int i, int j) const
-{
- return (i>=0 && i < height_i_)
- && (j < width_i_ && j >=0);
-}
-
-
-INLINE
-Full_storage::Full_storage (Full_storage const&s)
-{
- init();
- (*this) = s;
-}
-
-INLINE Real&
-Full_storage::elem (int i,int j)
-{
- assert (valid (i,j));
- return els_p_p_[i][j];
-}
-
-INLINE Real
-Full_storage::elem (int i, int j) const {
- assert (valid (i,j));
- return els_p_p_[i][j];
-}
-
-INLINE
-Full_storage::Full_storage() {
- init();
-}
-
-
-INLINE int
-Full_storage::rows() const
-{
- return height_i_;
-}
-
-INLINE int
-Full_storage::cols() const
-{
- return width_i_;
-}
-
-INLINE int
-Full_storage::dim() const
-{
- assert (rows()==cols ());
- return rows();
-}
-
-INLINE void
-Full_storage::resize (int i)
-{
- resize (i,i);
-}
-
-INLINE
-Full_storage::Full_storage (int i,int j)
-{
- init();
- set_size (i,j);
-}
-
-INLINE
-Full_storage::Full_storage (int i)
-{
- init();
- set_size (i);
-}
-
-
-INLINE
-bool
-Full_storage::mult_ok (int i, int ) const
-{
- return i < height_i_;
-}
-
-INLINE
-bool
-Full_storage::trans_ok (int , int j) const
-{
- return j < width_i_;
-}
-
-
-INLINE
-void
-Full_storage::trans_next (int &i, int &j) const
-{
- assert (trans_ok (i,j));
- i++;
- if (i >= height_i_)
- {
- i= (0 >? j - band_i_);
- j ++;
- }
-}
-
-INLINE
-void
-Full_storage::mult_next (int &i, int &j) const
-{
- assert (mult_ok (i,j));
- j++;
- if (j >= width_i_)
- {
- j= 0 >? (i - band_i_);
- i++;
- }
-}
-#endif // FULL_STORAGE_ICC
+++ /dev/null
-#ifndef HANDLE_HH
-#define HANDLE_HH
-
-/// reference counting handle
-template<class T>
-class Handle {
- T *obj;
- int *refs;
-
- /// let go of ref. Delete if necessary
- void down() {
- if (!(*refs--)) {
- delete obj;
- delete refs;
- }
- obj = 0;
- refs = 0;
- }
- /// point to new object.
- void up (T *t, int *r) {
- if (!r) {
- refs = new int;
- *refs = 1;
- } else {
- refs =r;
- *refs++;
- }
- obj = t;
- }
- /// POST: *refs == 1
- void copy() {
- if (*refs != 1){
- T * newobj = new T(*obj);
- down();
- up (newobj);
- }
- }
- Handle (Handle const &src) {
- up (src.obj, src.refs);
- }
- Handle (T & o) {
- up (&o);
- }
- void operator=(Handle const& src) {
- if (this == &src)
- return;
- down();
- up (src.o, src.refs);
- }
- operator T const &() {
- return *obj;
- }
- operator T&() {
- copy();
- return *obj;
- }
-}
-#endif
+++ /dev/null
-/*
- iterate.hh -- define some list macros
-
- source file of the flowerlib
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef ITERATE_HH
-#define ITERATE_HH
-
-/*
- ugh.
- jcn: kjoet.
- if we wouldn't have had this, things might have been
- just a little bit easier to read, imho.
- (it does save quite some disk space, though)
- */
-
-#define iterator(set) typeof ((set).top())
-#define iterator_bot(set) typeof ((set).bottom())
-
-#define iter(init, var) typeof (init) var (init)
-
-// should use top()
-#define iter_top(set,var) iterator (set) var (set)
-#define iter_bot(set,var) iterator (set) var (set.bottom())
-
-#endif // ITERATE_HH
+++ /dev/null
-/*
- scalar.hh -- declare
-
- source file of the Flower Library
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef SCALAR_HH
-#define SCALAR_HH
-
-struct Scalar {
- String str_;
- // Real real_;
- int int_;
- // Rational rational_;
-
-
- struct typebits {
- string_bit: 1;
- int_bit:1;
- };
-private:
-
-
- // operator Real();
- operator int();
-
- /** perl -like string to bool conversion.
- */
- // operator bool() const;
-
- //Scalar (Real r) : String (r) {}
- Scalar (int i) : String (i) {}
- // Scalar (char c) : String (c) {}
- Scalar (char const *c) : String (c) {}
- Scalar (String s):String (s) {}
- //Scalar (Rational);
- static Scalar undefined ();
-};
-
-#endif // SCALAR_HH
+++ /dev/null
-/*
- priorities.hh -- declare Priorities
-
- source file of the Flower Library
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef PRIORITIES_HH
-#define PRIORITIES_HH
-
-#include "array.hh"
-
-/**
- A sorted (uni)set. Should connect with PQueue
- */
-template<class K>
-struct Priorities : Array<K>
-{
- void insert (K k)
- {
- int i=0;
- for (; i < size(); i++) {
- if (elem (i) == k)
- return;
- if (elem (i) > k)
- break;
- }
- Array<K>::insert (k, i);
- }
-};
-#endif // PRIORITIES_HH
-
-
+++ /dev/null
-#error
-/*
- (c) Han-Wen Nienhuys 1995,96,97,98
-
- Distributed under GNU GPL
-*/
-
-
-#if 0
-#include "array.hh"
-#ifdef INLINE
-#undef INLINE
-#endif
-
-#define INLINE
-#endif
-
-/*
- functions with loops don't inline
- */
-
-template<class T> INLINE void
-arrcpy (T*dest, T*src, int count)
-{
- for (int i_shadows_local=0; i_shadows_local < count ; i_shadows_local++)
- *dest++ = *src++;
-}
-
-template<class T> INLINE void
-Array<T>::insert (T k, int j)
-{
- assert (j >=0 && j<= size_);
- set_size (size_+1);
- for (int i=size_-1; i > j; i--)
- array_p_[i] = array_p_[i-1];
- array_p_[j] = k;
-}
-
-template<class T> INLINE void
-Array<T>::sort (int (*compare)(T const&,T const&),
- int lower = -1, int upper = -1)
-{
- if (lower < 0)
- {
- lower = 0 ;
- upper = size () - 1;
- }
- if (lower >= upper)
- return;
- swap (lower, (lower+upper)/2);
- int last = lower;
- for (int i= lower +1; i <= upper; i++)
- if (compare (array_p_[i], array_p_[lower]) < 0)
- swap (++last,i);
- swap (lower, last);
- sort (compare, lower, last-1);
- sort (compare, last+1, upper);
-}
-
-template<class T> INLINE void
-Array<T>::reverse ()
-{
- int h = size_/2;
- for (int i =0,j = size_-1; i < h; i++,j--)
- swap (i,j);
-}
-
+++ /dev/null
-/*
- scalar.cc -- implement
-
- source file of the Flower Library
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
+++ /dev/null
-/*
- duration-convert.cc -- implement Duration_convert
-
- source file of the LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-#include <assert.h>
-#include "duration-convert.hh"
-#include "duration-iter.hh"
-#include "warn.hh"
-
-// statics Duration_convert
-bool const Duration_convert::midi_as_plet_b_s = true;
-bool Duration_convert::no_quantify_b_s = false;
-bool Duration_convert::no_double_dots_b_s = false;
-bool Duration_convert::no_triplets_b_s = false;
-int Duration_convert::no_smaller_than_i_s = 0;
-Array<Duration> Duration_convert::dur_array_s;
-
-String
-Duration_convert::dur2_str (Duration dur)
-{
- if (dur.ticks_i_)
- return String ("[") + to_str (dur.ticks_i_) + "]";
-
- String str;
- if (dur.durlog_i_ >= 0)
- str = to_str ( type2_i (dur.durlog_i_) );
- else if (dur.durlog_i_ == -1)
- str = "\\breve";
- else if (dur.durlog_i_ == -2)
- str = "\\longa";
- str += to_str ('.', dur.dots_i_);
- if (dur.plet_b ())
- str += String ("*") + to_str (dur.plet_.iso_i_)
- + String ("/") + to_str (dur.plet_.type_i_);
- return str;
-}
-
-int
-Duration_convert::dur2ticks_i (Duration dur)
-{
- if (dur.ticks_i_)
- return dur.ticks_i_;
- return dur2_mom (dur) * Rational (Duration::division_1_i_s);
-}
-
-int
-Duration_convert::i2_type (int i)
-{
- int t=0;
- while (i && !(i & 1)) {
- i >>= 1;
- t++;
- }
- return t;
-}
-
-int
-Duration_convert::type2_i (int type)
-{
- if (type<0)
- return 0;
- else
- return 1 << type;
-}
-
-Rational
-Duration_convert::dur2_mom (Duration dur)
-{
- if (dur.ticks_i_)
- return Rational (dur.ticks_i_, Duration::division_1_i_s);
-
- // or simply assert?
- if (dur.durlog_i_<-10)
- return Rational (0);
- Rational mom;
- if (dur.durlog_i_<0)
- mom = Rational (type2_i (-dur.durlog_i_), 1);
- else
- mom = Rational (1 , type2_i (dur.durlog_i_));
-
- Rational delta = mom;
- while (dur.dots_i_--)
- {
- delta /= 2.0;
- mom += delta;
- }
-
- return mom * plet_factor_mom (dur);
-}
-
-Duration
-Duration_convert::mom2_dur (Rational mom)
-{
- if (!mom)
- {
- Duration dur;
- dur.set_plet (0,1);
- return dur;
- }
-
-
- Duration dur = mom2standardised_dur (mom);
- // if (!dur.mom () || (dur.mom () == mom))
- if (!dur.length_mom () || (dur.length_mom () == mom))
- return dur;
- assert (midi_as_plet_b_s);
-
- // dur.set_plet (type_mom, Duration::division_1_i_s / 4);
-
- // Rational as_plet_mom = mom / dur.mom ();
- Rational as_plet_mom = mom / dur.length_mom ();
- as_plet_mom *= dur.plet_.mom ();
- long num = as_plet_mom.num ();
- long den = as_plet_mom.den ();
- dur.set_plet (num, den);
- return dur;
-}
-
-Duration
-Duration_convert::mom2standardised_dur (Rational mom)
-{
- // if (!dur_array_s.length_i ())
- if (!dur_array_s.size ())
- set_array ();
- assert (dur_array_s.size ());
- for (int i = 0; i < dur_array_s.size () - 1; i++)
- {
- Rational lower_mom = dur2_mom (dur_array_s[ i ]);
- if (mom <= lower_mom)
- {
- // all arbitrary, but 3/4 will get rid of the noise...
- // kinda ok
- if (i || (mom / lower_mom > Rational (3, 4)))
- return dur_array_s[ i ];
- else
- {
- Duration d;
- d.durlog_i_ = -100;
- return d;
- }
- }
- Rational upper_mom = dur2_mom (dur_array_s[ i + 1 ]);
- if ((mom < upper_mom)
- && ((mom - lower_mom) / lower_mom
- < (upper_mom - mom) / upper_mom))
- return dur_array_s[ i ];
- }
- return dur_array_s[ dur_array_s.size () - 1 ];
-}
-
-void
-Duration_convert::set_array ()
-{
- dur_array_s.clear ();
-
- Duration_iterator iter_dur;
- assert (iter_dur);
- while (iter_dur)
- dur_array_s.push (iter_dur++);
-}
-
-
-Rational
-Duration_convert::plet_factor_mom (Duration dur)
-{
- return dur.plet_.mom ();
-}
-
-Real
-Duration_convert::sync_f (Duration dur, Rational mom)
-{
- return mom / dur2_mom (dur);
-}
-
-Duration
-Duration_convert::ticks2_dur (int ticks_i)
-{
- Rational mom (ticks_i, Duration::division_1_i_s);
- if (midi_as_plet_b_s)
- return mom2_dur (mom);
-
- Duration dur = mom2standardised_dur (mom);
-
- if (dur.length_mom () == mom)
- return dur;
-
- return mom2_dur (mom);
-}
-
-Duration
-Duration_convert::ticks2standardised_dur (int ticks_i)
-{
- Rational mom (ticks_i, Duration::division_1_i_s);
- Duration dur = mom2standardised_dur (mom);
- return dur;
-}
+++ /dev/null
-/*
- duration-convert.cc -- implement Duration_convert
-
- source file of the LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-#include <assert.h>
-#include "duration-convert.hh"
-#include "warn.hh"
-#include "duration-iter.hh"
-
-Duration_iterator::Duration_iterator ()
-{
- cursor_dur_.durlog_i_ = 7;
- if (Duration_convert::no_smaller_than_i_s)
- cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
-}
-
-Duration
-Duration_iterator::operator ++(int)
-{
- return forward_dur ();
-}
-
-Duration
-Duration_iterator::operator ()()
-{
- return dur ();
-}
-
-Duration_iterator::operator bool ()
-{
- return ok ();
-}
-
-Duration
-Duration_iterator::dur ()
-{
- return cursor_dur_;
-}
-
-Duration
-Duration_iterator::forward_dur ()
-{
- /* should do smart table? guessing:
- duration wholes
- 16 0.0625
- 32.. 0.0703
- 8:2/3 0.0833
- 16. 0.0938
- 8 0.1250
- 16.. 0.1406
- 4:2/3 0.1667
- 8. 0.1875
-
- */
- assert (ok ());
-
- Duration dur = cursor_dur_;
-
- if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b ())
- {
- cursor_dur_.durlog_i_ += 1;
- cursor_dur_.dots_i_ = 2;
- }
- else if (cursor_dur_.dots_i_ == 2)
- {
- assert (!cursor_dur_.plet_b ());
- cursor_dur_.dots_i_ = 0;
- cursor_dur_.durlog_i_ -=2;
- cursor_dur_.set_plet (2, 3);
- }
- else if (cursor_dur_.plet_b ()
- && (cursor_dur_.plet_.iso_i_ == 2)
- && (cursor_dur_.plet_.type_i_ == 3))
- {
- assert (!cursor_dur_.dots_i_);
- cursor_dur_.set_plet (1, 1);
- cursor_dur_.durlog_i_ += 1;
- cursor_dur_.dots_i_ = 1;
- }
- else if (cursor_dur_.dots_i_ == 1)
- {
- assert (!cursor_dur_.plet_b ());
- cursor_dur_.dots_i_ = 0;
- cursor_dur_.durlog_i_ -= 1;
- }
-
- if (Duration_convert::no_triplets_b_s
- && cursor_dur_.plet_b () && ok ())
- forward_dur ();
- if (Duration_convert::no_double_dots_b_s
- && (cursor_dur_.dots_i_ == 2) && ok ())
- forward_dur ();
- if (Duration_convert::no_smaller_than_i_s
- && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok ())
- forward_dur ();
- if (Duration_convert::no_smaller_than_i_s
- && cursor_dur_.dots_i_
- && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s)
- && ok ())
- forward_dur ();
- if (Duration_convert::no_smaller_than_i_s
- && (cursor_dur_.dots_i_ == 2)
- && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2)
- && ok ())
- forward_dur ();
-
- return dur;
-}
-
-bool
-Duration_iterator::ok ()
-{
- return cursor_dur_.length_mom () <= Rational (4);
-}
+++ /dev/null
-/*
- duration.cc -- implement Duration, Plet,
-
- source file of the LilyPond music typesetter
-
- (c) 1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
- Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
-
- UGH. Duration is broken.
-*/
-
-#include <assert.h>
-
-#include "proto.hh"
-#include "string.hh"
-#include "source-file.hh"
-#include "source.hh"
-#include "rational.hh"
-#include "duration.hh"
-#include "duration-convert.hh"
-#include "duration-iter.hh"
-
-// statics Duration
-int Duration::division_1_i_s = 384 * 4;
-
-
-Duration::Duration ()
-{
- durlog_i_ = 0;
- dots_i_ = 0;
- ticks_i_ = 0;
-}
-
-bool
-Duration::duration_type_b (int t)
-{
- /*
- ugh. Assuming behavior of conversion funcs on broken input.
- */
- return t == Duration_convert::type2_i (Duration_convert::i2_type (t));
-}
-
-void
-Duration::compress (Rational m)
-{
- plet_.iso_i_ *= m.num_i ();
- plet_.type_i_ *= m.den_i ();
-}
-
-Rational
-Duration::length_mom () const
-{
- return Duration_convert::dur2_mom (*this);
-}
-
-void
-Duration::set_plet (int i, int t)
-{
- plet_.iso_i_ = i;
- plet_.type_i_ = t;
-}
-
-/*
-void
-Duration::set_plet (Duration d)
-{
- plet_.iso_i_ = d.plet_.iso_i_;
- plet_.type_i_ = d.plet_.type_i_;
-}
-*/
-
-void
-Duration::set_ticks (int ticks_i)
-{
- assert (durlog_i_ <10);
- assert (!dots_i_);
- ticks_i_ = ticks_i;
-}
-
-String
-Duration::str () const
-{
- return Duration_convert::dur2_str (*this);
-}
-
-
-bool
-Duration::plet_b ()
-{
- return !plet_.unit_b ();
-}
-
+++ /dev/null
-/*
- duration-convert.hh -- declare Duration_convert
-
- source file of the LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef DURATION_CONVERT_HH
-#define DURATION_CONVERT_HH
-#include "duration.hh"
-#include "string.hh"
-#include "array.hh"
-
-/**
- Duration_convert handles all conversions to -n fro Duration (dur).
- That is including (integer + division) representation for MIDI,
- and conversion from unexact time representation (best guess :-).
-
- A Rational (mom) is a Rational that holds the time fraction
- compared to a whole note (before also called wholes).
-
- [todo]
- move all statics to real members, instantiate Duration_convert
- object (s).
-*/
-struct Duration_convert {
-
- /* Urgh. statics.
- */
- static bool const midi_as_plet_b_s;
- static bool no_quantify_b_s;
- static bool no_double_dots_b_s;
- static bool no_triplets_b_s;
- static int no_smaller_than_i_s;
- static Array<Duration> dur_array_s;
-
- /// Return number of ticks in (ticks, division_1) representation
- static int dur2ticks_i (Duration dur );
-
- /// Return the type_i representation of note length i
- static int i2_type (int i);
-
- /// Return the note length corresponding to the type_i representation
- /// Return 0 if longer than whole note.
- static int type2_i (int type);
-
- /// Return Rational representation (fraction of whole note).
- static Rational dur2_mom (Duration dur );
-
- /// Return Mudela string representation.
- static String dur2_str (Duration dur );
-
- /// Return duration from Rational (fraction of whole) representation.
- static Duration mom2_dur (Rational mom );
-
- /// Return standardised duration, best guess if not exact.
- static Duration mom2standardised_dur (Rational mom );
-
- /// Return plet factor (not a Rational: should use Rational?).
- static Rational plet_factor_mom (Duration dur );
-
- static void set_array ();
-
- /** Return synchronisation factor for mom, so that
- mom2_dur (mom / sync_f ) will return the duration dur.
- */
- static Real sync_f (Duration dur, Rational mom );
-
- /// Return exact duration, in midi-ticks if not-exact.
- static Duration ticks2_dur (int ticks_i );
-
- /// Return standardised duration, best guess if not exact.
- static Duration ticks2standardised_dur (int ticks_i );
-};
-
-
-#endif // DURATION_CONVERT_HH
+++ /dev/null
-/*
- duration-iter.hh -- declare Duration_iterator
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
-
- */
-
-#ifndef DURATION_ITER_HH
-#define DURATION_ITER_HH
-
-/// (iter_dur)
-struct Duration_iterator {
-
- /// start at shortest: 128:2/3
- Duration_iterator ();
-
- // **** what about these three here ?
- /// return forward_dur ();
- Duration operator ++(int);
-
- /// return ok ()
- operator bool ();
-
- /// return dur ()
- Duration operator ()();
-
-
- /// return current dur
- Duration dur ();
-
- /// return dur (), step to next
- Duration forward_dur ();
-
- /// durations left?
- bool ok ();
-
-private:
-
- Duration cursor_dur_;
-};
-
-
-
-#endif /* DURATION_ITER_HH */
-
+++ /dev/null
-/*
- duration.hh -- declare Duration
-
- source file of the LilyPond music typesetter
-
- (c) 1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
-
-*/
-
-// split into 4?
-
-#ifndef DURATION_HH
-#define DURATION_HH
-
-#include "fproto.hh"
-#include "rational.hh"
-#include "plet.hh"
-
-/**
- Handle "musical" durations. This means: balltype 1,2,4,etc. and dots.
-
- (dur)
- */
-struct Duration {
- Duration ();
- /// is the "plet factor" of this note != 1 ?
- bool plet_b ();
- String str () const;
- void set_plet (int,int );
- void compress (Rational);
-
- static bool duration_type_b (int t);
- void set_ticks (int ticks_i );
- Rational length_mom () const ;
- static int division_1_i_s;
-
- /// Logarithm of the base duration.
- int durlog_i_;
- int dots_i_;
- Plet plet_;
- int ticks_i_;
-};
-#endif // DURATION_HH
-
+++ /dev/null
-/*
- plet.hh -- declare Plet
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef PLET_HH
-#define PLET_HH
-#include "rational.hh"
-
-/**
- The type and replacement value of a plet (triplet, quintuplet.) Conceptually the same as a rational, but 4/6 != 2/3.
-
- (plet)
- */
-struct Plet {
- Plet ();
- Rational mom () const;
- bool unit_b () const;
- int iso_i_; // 2/3; 2 is not duration, maar of count!
- int type_i_;
-};
-
-#endif // PLET_HH
+++ /dev/null
-//
-// windhoos-suck-suck-suck-thank-you-cygnus.hh
-//
-// mmap () should work now (cygnus beta 18), but let's keep it here
-// for people using old cygnus releases
-#if 0 //def _WINDOWS32
-#ifndef WINDHOOS_SUCK_SUCK_SUCK_HH
-#define WINDHOOS_SUCK_SUCK_SUCK_HH
-
-caddr_t mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset);
-
-int munmap (caddr_t addr, size_t len);
-
-#endif // WINDHOOS_SUCK_SUCK_SUCK_HH
-#endif // _WINDOWS32 //
+++ /dev/null
-/*
- plet.cc -- implement Plet
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "plet.hh"
-
-
-Plet::Plet ()
-{
- type_i_ = 1;
- iso_i_ = 1;
-}
-
-Rational
-Plet::mom () const
-{
- return Rational (iso_i_, type_i_);
-}
-
-bool
-Plet::unit_b () const
-{
- return type_i_ == 1 && iso_i_ == 1;
-}
-
+++ /dev/null
-//
-// windhoos.cc
-//
-// mmap () should work now (cygnus beta 18), but let's keep it here
-// for people using old cygnus releases
-#if 0 // def _WINDOWS32
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <winbase.h>
-#include "thank-you-cygnus.hh"
-
-/*
-HANDLE CreateFileMapping (
- HANDLE hFile, // handle to file to map
- LPSECURITY_ATTRIBUTES lpFileMappingAttributes, // optional security attributes
- DWORD flProtect, // protection for mapping object
- DWORD dwMaximumSizeHigh, // high-order 32 bits of object size
- DWORD dwMaximumSizeLow, // low-order 32 bits of object size
- LPCTSTR lpName // name of file-mapping object
-);
-
-
-LPVOID MapViewOfFile (
- HANDLE hFileMappingObject, // file-mapping object to map into address space
- DWORD dwDesiredAccess, // access mode
- DWORD dwFileOffsetHigh, // high-order 32 bits of file offset
- DWORD dwFileOffsetLow, // low-order 32 bits of file offset
- DWORD dwNumberOfBytesToMap // number of bytes to map
-);
-
-
-io.h:
-long _get_osfhandle (int filehandle);
-*/
-
-// cygnus's gnu-win32-b17.1 does not have _get_osfhandle
-// however, after some hacking, it turns out that:
-
-static const int OSF_OFFSET_i = 72;
-static const int OSF_BASE_i = -3;
-static const int OSF_FACTOR_i = 8;
-// let-s hope bill doesn-t change his mind any time soon :-)
-
-// so that, while waiting for cygnus's mmap, we can write:
-
-// #define HAVE_GET_OSFHANDLE // no we still cannot; works only with cl.exe
-long
-_get_osfhandle (int filedes_i)
-{
- return (long)(OSF_OFFSET_i + (filedes_i + OSF_BASE_i) * OSF_FACTOR_i);
-}
-
-#ifdef HAVE_GET_OSFHANDLE
-
-#include <iostream.h>
-
-caddr_t
-mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
- (void)flags;
- (void)prot;
- (void)addr;
- HANDLE osf = (HANDLE)_get_osfhandle (fd);
- HANDLE file_handle = CreateFileMapping (osf, (void*)0, PAGE_READONLY,
- 0, len, 0);
- return (caddr_t)MapViewOfFile (file_handle, FILE_MAP_READ, 0, offset, len);
-}
-
-
-int
-munmap (caddr_t addr, size_t len)
-{
- (void)len;
- return UnmapViewOfFile (addr);
-}
-
-#else // ! HAVE_GET_OSFHANDLE //
-
-caddr_t
-mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
- (void)flags;
- (void)prot;
- (void)addr;
- (void)offset;
- char* ch_p = new char[ len ];
- if (ch_p)
- read (fd, (void*)ch_p, len);
- return ch_p;
-}
-
-
-int
-munmap (caddr_t addr, size_t len)
-{
- (void)len;
- delete (char*)addr;
- return 0;
-}
-
-#endif // !HAVE_GET_OSFHANDLE //
-
-
-#endif // _WINDOWS32 //