[SCM] rumor/master: Update rumor to support guile 2.0, 02_guile2.diff (Closes: #746010)

rak at users.alioth.debian.org rak at users.alioth.debian.org
Sun Jun 15 12:35:54 UTC 2014


The following commit has been merged in the master branch:
commit a7530e283fc98d243c450fa9323a592f382bf429
Author: Ryan Kavanagh <rak at debian.org>
Date:   Sat Jun 14 12:14:16 2014 +0200

    Update rumor to support guile 2.0, 02_guile2.diff (Closes: #746010)
    
    Thanks: Orcan Ogetbil

diff --git a/debian/patches/02_guile2.diff b/debian/patches/02_guile2.diff
new file mode 100644
index 0000000..efa9b56
--- /dev/null
+++ b/debian/patches/02_guile2.diff
@@ -0,0 +1,263 @@
+Description: Update rumor to support guile 2.0
+Author: Orcan Ogetbil <oget.fedora at gmail.com>
+Origin: https://launchpadlibrarian.net/71717965/rumor-guile2.patch
+Bug: https://bugs.launchpad.net/rumor/+bug/782750
+Bug-Debian: https://bugs.debian.org/746010
+Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=704535
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+diff -rupN rumor-1.0.5.old/configure.ac rumor-1.0.5/configure.ac
+--- rumor-1.0.5.old/configure.ac	2010-11-15 12:40:44.000000000 -0500
++++ rumor-1.0.5/configure.ac	2011-05-14 14:06:32.000000000 -0400
+@@ -51,16 +51,13 @@ if test "$ac_cv_header_linux_soundcard_h
+   rumor_oss=yes
+ fi
+ 
+-rumor_guile=no
+ ## GUILE
+ ##############################
+-AC_CHECK_HEADER([guile/gh.h])
+-AC_CHECK_LIB([guile],[gh_enter])
+-if test "$ac_cv_header_guile_gh_h" = "yes" \
+-      -a "$ac_cv_lib_guile_gh_enter" = "yes"; then
++PKG_CHECK_MODULES(guile, guile-2.0 >= 2.0, [rumor_guile=yes], [rumor_guile=no])
++if test "x$rumor_guile" = xyes ; then
++  CXXFLAGS="$CXXFLAGS $guile_CFLAGS"
++  LIBS="$LIBS $guile_LIBS"
+   AC_DEFINE(HAVE_GUILE,,[guile is usable (for scripting)])
+-  LIBS="-lguile $LIBS"
+-  rumor_guile=yes
+ fi
+ 
+ 
+diff -rupN rumor-1.0.5.old/src/guile2cc.cc rumor-1.0.5/src/guile2cc.cc
+--- rumor-1.0.5.old/src/guile2cc.cc	2010-11-15 12:40:22.000000000 -0500
++++ rumor-1.0.5/src/guile2cc.cc	2011-05-14 14:07:57.000000000 -0400
+@@ -14,18 +14,21 @@
+ template<> const c_type SCM_to<c_type>(SCM s){ \
+   if (!scm_pred(s)) throw script_error("SCM_to: predicate " #scm_pred " false."); \
+   return scm_conv(s);}
+-SPECIALIZATION_OF_SCM_TO(unsigned long,gh_scm2ulong,gh_number_p)
+-SPECIALIZATION_OF_SCM_TO(unsigned,gh_scm2ulong,gh_number_p)
+-SPECIALIZATION_OF_SCM_TO(long,gh_scm2long,gh_number_p)
+-SPECIALIZATION_OF_SCM_TO(int,gh_scm2int,gh_number_p)
+-SPECIALIZATION_OF_SCM_TO(double,gh_scm2double,gh_number_p)
+-SPECIALIZATION_OF_SCM_TO(bool,gh_scm2bool,gh_boolean_p)
+-SPECIALIZATION_OF_SCM_TO(char,gh_scm2char,gh_char_p)
++SPECIALIZATION_OF_SCM_TO(unsigned long,scm_to_long,scm_is_number)
++SPECIALIZATION_OF_SCM_TO(unsigned,scm_to_long,scm_is_number)
++SPECIALIZATION_OF_SCM_TO(long,scm_to_long,scm_is_number)
++SPECIALIZATION_OF_SCM_TO(int,scm_to_int,scm_is_number)
++SPECIALIZATION_OF_SCM_TO(double,scm_to_double,scm_is_number)
++SPECIALIZATION_OF_SCM_TO(bool,scm_to_bool,scm_is_bool)
+ #undef SPECIALIZATION_OF_SCM_TO
+ 
++template<> const char SCM_to<char>(SCM s){
++  if (!scm_is_true (scm_char_p (s))) throw script_error("SCM_to: predicate " " scm_is_true " " false.");
++  return scm_to_char(s);} //FIXME: oget: recheck
++
+ template<> const std::string SCM_to<std::string>(SCM s){
+-  if (!gh_string_p(s)) throw script_error("SCM_to: predicate " "gh_string_p" " false.");
+-  char* pstr=gh_scm2newstr(s,NULL);
++  if (!scm_is_string(s)) throw script_error("SCM_to: predicate " "scm_is_string" " false.");
++  char* pstr=scm_to_locale_string(s);
+   std::string ret(pstr);
+   delete[] pstr; //FIXME: is this correct?
+   return ret;
+@@ -33,17 +36,17 @@ template<> const std::string SCM_to<std:
+ #define SPECIALIZATION_OF_TO_SCM(c_type,scm_conv) \
+ template<> SCM to_SCM(const c_type& arg){ \
+   return scm_conv(arg); }
+-SPECIALIZATION_OF_TO_SCM(unsigned long,gh_ulong2scm)
+-SPECIALIZATION_OF_TO_SCM(unsigned,gh_ulong2scm)
+-SPECIALIZATION_OF_TO_SCM(long,gh_long2scm)
+-SPECIALIZATION_OF_TO_SCM(int,gh_int2scm)
+-SPECIALIZATION_OF_TO_SCM(bool,gh_bool2scm)
+-SPECIALIZATION_OF_TO_SCM(double,gh_double2scm)
+-SPECIALIZATION_OF_TO_SCM(char,gh_char2scm)
++SPECIALIZATION_OF_TO_SCM(unsigned long,scm_from_ulong)
++SPECIALIZATION_OF_TO_SCM(unsigned,scm_from_ulong)
++SPECIALIZATION_OF_TO_SCM(long,scm_from_ulong)
++SPECIALIZATION_OF_TO_SCM(int,scm_from_int)
++SPECIALIZATION_OF_TO_SCM(bool,scm_from_bool)
++SPECIALIZATION_OF_TO_SCM(double,scm_make_real)
++SPECIALIZATION_OF_TO_SCM(char,SCM_MAKE_CHAR)
+ #undef SPECIALIZATION_OF_TO_SCM
+ 
+ template<> SCM to_SCM(const std::string& arg){
+-  return gh_str02scm(arg.c_str()); }
++  return scm_from_locale_string(arg.c_str()); }
+ 
+ 
+ #endif /*HAVE_GUILE*/
+diff -rupN rumor-1.0.5.old/src/guile2cc.hh rumor-1.0.5/src/guile2cc.hh
+--- rumor-1.0.5.old/src/guile2cc.hh	2010-11-15 12:40:22.000000000 -0500
++++ rumor-1.0.5/src/guile2cc.hh	2011-05-14 14:06:03.000000000 -0400
+@@ -1,5 +1,5 @@
+ #ifdef HAVE_GUILE
+-#include<guile/gh.h>
++#include<libguile.h>
+   
+ // definitions in guile2cc.cc
+ template<typename T> const T SCM_to(SCM);
+diff -rupN rumor-1.0.5.old/src/kbdclient.cc rumor-1.0.5/src/kbdclient.cc
+--- rumor-1.0.5.old/src/kbdclient.cc	2010-11-15 12:40:22.000000000 -0500
++++ rumor-1.0.5/src/kbdclient.cc	2011-05-14 13:17:56.000000000 -0400
+@@ -79,12 +79,12 @@ SCM KbdMidiClient::gh_rumor_kbd(SCM repl
+     LOG(2,"Emptying all ("<<Keys.size()<<") key bindings\n");
+     Keys.clear();
+   }
+-  for(unsigned i=0; i<gh_length(rest); i++){
+-    assert(gh_pair_p(gh_list_ref(rest,to_SCM(i))));
+-    assert(gh_char_p(gh_car(gh_list_ref(rest,to_SCM(i)))));
+-    assert(gh_number_p(gh_cdr(gh_list_ref(rest,to_SCM(i)))));    
+-    char key=       SCM_to<char>(gh_car(gh_list_ref(rest,to_SCM(i))));
+-    unsigned pitch=trsp+SCM_to<unsigned>(gh_cdr(gh_list_ref(rest,to_SCM(i))));
++  for(unsigned i=0; i<scm_to_size_t (scm_length (rest)); i++){
++    assert(scm_is_true (scm_pair_p (scm_list_ref(rest,to_SCM(i)))));
++    assert(scm_is_true (scm_char_p (scm_car(scm_list_ref(rest,to_SCM(i))))));
++    assert(scm_is_number(scm_cdr(scm_list_ref(rest,to_SCM(i)))));    
++    char key=       SCM_to<char>(scm_car(scm_list_ref(rest,to_SCM(i))));
++    unsigned pitch=trsp+SCM_to<unsigned>(scm_cdr(scm_list_ref(rest,to_SCM(i))));
+     Keys[key]=pitch;
+     DBGLOG(3,"key: "<<key<<"->"<<pitch<<"\n");
+     keysOK++;
+diff -rupN rumor-1.0.5.old/src/metronome.cc rumor-1.0.5/src/metronome.cc
+--- rumor-1.0.5.old/src/metronome.cc	2010-11-15 12:40:22.000000000 -0500
++++ rumor-1.0.5/src/metronome.cc	2011-05-14 13:19:27.000000000 -0400
+@@ -91,20 +91,20 @@ void Metronome::Nanosleep(long nsec){
+ 
+ #ifdef HAVE_GUILE
+ SCM Metronome::gh_rumor_beats(SCM channel, SCM beat1st, SCM beats){
+-  if(gh_length(beat1st)!=4) throw script_error("Invalid number of beat specifications (must be 4: patch, pitch, volume, length)");
++  if(scm_to_size_t (scm_length(beat1st))!=4) throw script_error("Invalid number of beat specifications (must be 4: patch, pitch, volume, length)");
+   //channels numbered 1--16
+   BeatChannel=SCM_to<unsigned>(channel)-1;
+ 
+   //patches numbered 1--128
+-  BeatPatches[0]=SCM_to<unsigned>(gh_list_ref(beat1st,to_SCM(0)))-1;
+-  BeatPitches[0]=SCM_to<unsigned>(gh_list_ref(beat1st,to_SCM(1)));
+-  BeatVolumes[0]=SCM_to<unsigned>(gh_list_ref(beat1st,to_SCM(2)));
+-  BeatLengths[0]=SCM_to<double>  (gh_list_ref(beat1st,to_SCM(3)));
+-
+-  BeatPatches[1]=SCM_to<unsigned>(gh_list_ref(beats,to_SCM(0)))-1;
+-  BeatPitches[1]=SCM_to<unsigned>(gh_list_ref(beats,to_SCM(1)));
+-  BeatVolumes[1]=SCM_to<unsigned>(gh_list_ref(beats,to_SCM(2)));
+-  BeatLengths[1]=SCM_to<double>  (gh_list_ref(beats,to_SCM(3)));
++  BeatPatches[0]=SCM_to<unsigned>(scm_list_ref(beat1st,to_SCM(0)))-1;
++  BeatPitches[0]=SCM_to<unsigned>(scm_list_ref(beat1st,to_SCM(1)));
++  BeatVolumes[0]=SCM_to<unsigned>(scm_list_ref(beat1st,to_SCM(2)));
++  BeatLengths[0]=SCM_to<double>  (scm_list_ref(beat1st,to_SCM(3)));
++
++  BeatPatches[1]=SCM_to<unsigned>(scm_list_ref(beats,to_SCM(0)))-1;
++  BeatPitches[1]=SCM_to<unsigned>(scm_list_ref(beats,to_SCM(1)));
++  BeatVolumes[1]=SCM_to<unsigned>(scm_list_ref(beats,to_SCM(2)));
++  BeatLengths[1]=SCM_to<double>  (scm_list_ref(beats,to_SCM(3)));
+   LOG(1,"Beat parameters assigned\n");
+   return to_SCM(0);
+ }
+diff -rupN rumor-1.0.5.old/src/notator.cc rumor-1.0.5/src/notator.cc
+--- rumor-1.0.5.old/src/notator.cc	2010-11-15 12:40:22.000000000 -0500
++++ rumor-1.0.5/src/notator.cc	2011-05-14 13:23:21.000000000 -0400
+@@ -348,13 +348,13 @@ std::string Notator::PitchName(int Pitch
+ SCM Notator::gh_rumor_pitches(SCM plist){
+   int total=0;
+   //TREXP(gh_length(plist));
+-  for(unsigned i=0; i<gh_length(plist); i++){
+-    SCM pdesc=gh_list_ref(plist,to_SCM(i));
+-    if (gh_length(pdesc)!=6) throw script_error("invalid pitch description length");
+-    unsigned wt=SCM_to<unsigned>(gh_list_ref(pdesc,to_SCM(0)));
++  for(unsigned i=0; i<scm_to_size_t (scm_length(plist)); i++){
++    SCM pdesc=scm_list_ref(plist,to_SCM(i));
++    if (scm_to_size_t (scm_length(pdesc))!=6) throw script_error("invalid pitch description length");
++    unsigned wt=SCM_to<unsigned>(scm_list_ref(pdesc,to_SCM(0)));
+     if ((wt<0)||(wt>6)) throw script_error("invalid base tone number (must be 0..6)");
+     for(int j=1;j<6;j++){
+-      note_names[std::make_pair(wt,j-3)]=SCM_to<std::string>(gh_list_ref(pdesc,to_SCM(j)));
++      note_names[std::make_pair(wt,j-3)]=SCM_to<std::string>(scm_list_ref(pdesc,to_SCM(j)));
+       total++;
+     }
+   }
+@@ -397,19 +397,19 @@ SCM Notator::gh_rumor_rhythms(SCM G, SCM
+ 
+   unsigned rhyOK=0;
+ 
+-  for(unsigned i=0; i<gh_length(rhys); i++){
+-    SCM onsets=gh_list_ref(rhys,to_SCM(i));
+-    SCM rhy=gh_list_ref(onsets,to_SCM(0));
++  for(unsigned i=0; i<scm_to_size_t (scm_length(rhys)); i++){
++    SCM onsets=scm_list_ref(rhys,to_SCM(i));
++    SCM rhy=scm_list_ref(onsets,to_SCM(0));
+     //first get rhythm description
+     LyNote* lyn=NULL;
+-    for(unsigned j=0; j<gh_vector_length(rhy); j++){
++    for(unsigned j=0; j<scm_c_vector_length(rhy); j++){
+       // primitive rhythm
+-      SCM rhy0=gh_vector_ref(rhy,to_SCM(j));
++      SCM rhy0=scm_vector_ref(rhy,to_SCM(j));
+       unsigned len,dot;
+-      if (gh_pair_p(rhy0)){
+-        len=SCM_to<unsigned>(gh_car(rhy0)); dot=SCM_to<unsigned>(gh_cdr(rhy0));
++      if (scm_is_true (scm_pair_p(rhy0))){
++        len=SCM_to<unsigned>(scm_car(rhy0)); dot=SCM_to<unsigned>(scm_cdr(rhy0));
+       } else {
+-        assert(gh_number_p(rhy0));
++        assert(scm_number_p(rhy0));
+         len=SCM_to<unsigned>(rhy0); dot=0;
+       }
+       unsigned ex=0;
+@@ -429,8 +429,8 @@ SCM Notator::gh_rumor_rhythms(SCM G, SCM
+     }
+     if (!lyn) continue;
+     LOG(2,"rhythm "<<lyn->DbgPrint()<<": ");
+-    for(unsigned j=1; j<gh_length(onsets); j++){
+-      unsigned TU_on=SCM_to<unsigned>(gh_list_ref(onsets,to_SCM(j)));
++    for(unsigned j=1; j<scm_to_size_t (scm_length (onsets)); j++){
++      unsigned TU_on=SCM_to<unsigned>(scm_list_ref(onsets,to_SCM(j)));
+       // invalid TU_on; rhythm is too refined
+       if((TU_on*TUmul)%TUdiv!=0){
+         LOG(2,"[rhythm onset "<<TU_on<<"(*"<<TUmul<<"/"<<TUdiv<<") skipped]\n");
+diff -rupN rumor-1.0.5.old/src/rumor.cc rumor-1.0.5/src/rumor.cc
+--- rumor-1.0.5.old/src/rumor.cc	2010-11-15 12:40:22.000000000 -0500
++++ rumor-1.0.5/src/rumor.cc	2011-05-14 13:39:19.000000000 -0400
+@@ -73,11 +73,11 @@ SCM gh_rumor_beats_wrap(SCM channel, SCM
+ #endif
+ 
+ 
+-void main2(int,char**);
++void main2(void*,int,char**);
+ 
+ int main(int argc,char**argv){
+ #ifdef HAVE_GUILE
+-  gh_enter(argc,argv,main2);
++  scm_boot_guile(argc,argv,main2,0);
+ #else
+   main2(argc,argv);
+ #endif  
+@@ -86,7 +86,7 @@ int main(int argc,char**argv){
+ 
+ 
+ //this is the REAL main
+-void main2(int argc, char **argv) try{
++void main2(void* closure, int argc, char **argv) try{
+ 
+ 
+   //FIXME: detect locale and choose appropriate notation style here
+@@ -120,12 +120,12 @@ void main2(int argc, char **argv) try{
+   }
+ 
+ # ifdef HAVE_GUILE
+-  gh_new_procedure("rumor-rhythms",(SCM (*)())gh_rumor_rhythms_wrap,3,0,1);
+-  gh_new_procedure("rumor-kbd",    (SCM (*)())gh_rumor_kbd_wrap,2,0,1);
+-  gh_new_procedure("rumor-pitches",(SCM (*)())gh_rumor_pitches_wrap,0,0,1);
+-  gh_new_procedure("rumor-beats",  (SCM (*)())gh_rumor_beats_wrap,3,0,0);
++  scm_c_define_gsubr("rumor-rhythms",3,0,1,(SCM*) gh_rumor_rhythms_wrap);
++  scm_c_define_gsubr("rumor-kbd",2,0,1,    (SCM*) gh_rumor_kbd_wrap);
++  scm_c_define_gsubr("rumor-pitches",0,0,1,(SCM*) gh_rumor_pitches_wrap);
++  scm_c_define_gsubr("rumor-beats",3,0,0,  (SCM*) gh_rumor_beats_wrap);
+   for(std::list<std::string>::iterator I=pOpts->GuileScripts.begin(); I!=pOpts->GuileScripts.end(); I++){
+-    gh_load(I->c_str());
++    scm_c_primitive_load(I->c_str());
+   }  
+ # endif      
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 4165c32..1d704b1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 01_correct_version.diff
+02_guile2.diff

-- 
rumor packaging



More information about the pkg-multimedia-commits mailing list