]> git.donarmstrong.com Git - lilypond.git/commitdiff
T1265 - Remove deprecation warnings when running with Guile V2 Replace scm_str2symbol...
authorIan Hulin <ian@hulin.org.uk>
Mon, 18 Oct 2010 19:20:07 +0000 (20:20 +0100)
committerPatrick McCarty <pnorcks@gmail.com>
Tue, 19 Oct 2010 18:42:43 +0000 (11:42 -0700)
12 files changed:
flower/include/guile-compatibility.hh
lily/dispatcher.cc
lily/grob-array-scheme.cc
lily/include/lily-guile-macros.hh
lily/open-type-font.cc
lily/paper-book.cc
lily/paper-def.cc
lily/parse-scm.cc
lily/parser.yy
lily/percent-repeat-iterator.cc
lily/piano-pedal-engraver.cc
lily/translator.cc

index f18c1824e7ca81c00ebafe1c0a35e9331a209f3c..bab8325efd915c9a0bd70386e8f77b8519c740a7 100644 (file)
 #ifndef GUILE_COMPATIBILITY_HH
 #define GUILE_COMPATIBILITY_HH
 
-#if SCM_MINOR_VERSION < 7
-/* guile-1.6.x compatibility */
-
-inline SCM scm_cdr (SCM x)
-{
-  if (SCM_NCONSP (x))
-    abort ();
-  return SCM_CDR (x);
-}
-inline SCM scm_car (SCM x)
-{
-  if (SCM_NCONSP (x))
-    abort ();
-  return SCM_CAR (x);
-}
-#define SCM_I_CONSP(x) SCM_CONSP (x)
-inline SCM scm_caar (SCM x) { return SCM_CAAR (x); }
-inline SCM scm_cdar (SCM x) { return SCM_CDAR (x); }
-inline SCM scm_cadr (SCM x) { return SCM_CADR (x); }
-inline SCM scm_cddr (SCM x) { return SCM_CDDR (x); }
-inline SCM scm_caddr (SCM x) { return SCM_CADDR (x); }
-inline SCM scm_cdadr (SCM x) { return SCM_CDADR (x); }
-inline SCM scm_caadr (SCM x) { return SCM_CAADR (x); }
-inline SCM scm_cadar (SCM x) { return SCM_CADAR (x); }
-#define scm_gc_unregister_collectable_memory(a, b, c) scm_done_free (b)
-#define scm_gc_register_collectable_memory(a, b, c) scm_done_malloc (b)
-#define scm_is_vector(x) (SCM_VECTORP ((SCM) x))
-#define SCM_HASHTABLE_P(x) (SCM_VECTORP ((SCM) x))
-#define SCM_VECTOR_REF(v, i) (SCM_VELTS ((v))[ (i)])
-#define scm_from_bool(x) (x ? SCM_BOOL_T : SCM_BOOL_F)
-#define scm_from_int(x) SCM_MAKINUM (x)
-#define scm_from_unsigned_integer(x) scm_uint2num (x)
-#define scm_from_unsigned(x) scm_uint2num (x)
-#define scm_from_uint32(x) scm_uint2num (x)
-#define scm_is_integer(x) SCM_INUMP (x)
-#define scm_is_string(x) SCM_STRINGP (x)
-#define scm_hash_table_p scm_vector_p
-#define scm_from_locale_stringn(s, n) scm_mem2string (s, n)
-#define scm_from_locale_string(x) scm_makfrom0str (x)
-#define scm_i_string_chars(x) SCM_STRING_CHARS (x)
-#define scm_i_string_length(x) SCM_STRING_LENGTH (x)
-inline int ly_c_number_p (SCM x) { return SCM_NUMBERP (x); }
-#define scm_is_number(x) (scm_number_p (x) == SCM_BOOL_T)
-inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); }
-#define scm_to_int(x) (ly_scm2int (x))
-inline int ly_scm2unsigned (SCM x) { return scm_num2uint (x, 0, "ly_scm2unsigned"); }
-#define scm_to_unsigned(x) (ly_scm2unsigned (x))
-inline int ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
-#define scm_is_symbol(x) ly_c_symbol_p (x)
-inline int ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
-#define scm_is_bool(x) ly_c_boolean_p (x)
-inline int ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); }
-#define scm_is_eq(x, y) (SCM_EQ_P ((x), (y)))
-
-#define scm_c_string_length(x) SCM_STRING_LENGTH (x)
-#define scm_is_pair(x) (SCM_CONSP (x))
-
-#define scm_c_vector_length(x) SCM_VECTOR_LENGTH (x)
-#define scm_c_vector_ref(x, y) SCM_VECTOR_REF (x, y)
-
-inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); }
-#define scm_to_double(x) (ly_scm2double (x))
-#define scm_from_double(x) (scm_make_real (x))
-
-#else /* !SCM_MINOR_VERSION < 7 */
-
-#define scm_to_unsigned(x) scm_to_uint32 (x)
+#if SCM_MAJOR_VERSION == 1
+#if SCM_MINOR_VERSION > 6 && SCM_MINOR_VERSION < 9
+/*
+  GUILE V1.7.0 - V1.8.n
+*/
 #define scm_from_unsigned(x) scm_from_unsigned_integer (x)
-
-#endif /* !SCM_MINOR_VERSION < 7 */
-
+#else  // SCM_MINOR_VERSION >= 9
+/*
+  GUILE V1.9.n
+*/
+#endif // SCM_MINOR_VERSION > 6 && SCM_MINOR_VERSION < 9
+#else  // SCM_MAJOR_VERSION != 1
+/*
+   Add any compatibility definitions here for Guile V2.n
+*/
+#endif // SCM_MAJOR_VERSION == 1
 #endif /* GUILE_COMPATIBILITY_HH */
index b91b4fa5e935f15120e070b4cbf6111cd41d7816..750750149226203876006c51d51d66603e358535 100644 (file)
@@ -185,7 +185,7 @@ Dispatcher::internal_add_listener (Listener l, SCM ev_class, int priority)
   SCM list = scm_hashq_ref (listeners_, ev_class, SCM_EOL);
   if (!scm_is_pair (list))
     {
-      /* Tell all dispatchers that we listen to, that we want to hear ev_class 
+      /* Tell all dispatchers that we listen to, that we want to hear ev_class
          events */
       for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp))
        {
@@ -195,7 +195,7 @@ Dispatcher::internal_add_listener (Listener l, SCM ev_class, int priority)
        }
       listen_classes_ = scm_cons (ev_class, listen_classes_);
     }
-  SCM entry = scm_cons (scm_int2num (priority), l.smobbed_copy ());
+  SCM entry = scm_cons (scm_from_int (priority), l.smobbed_copy ());
   list = scm_merge (list, scm_list_1 (entry), ly_lily_module_constant ("car<"));
   scm_hashq_set_x (listeners_, ev_class, list);
 }
@@ -255,7 +255,7 @@ Dispatcher::register_as_listener (Dispatcher *disp)
       return;
     }
 
-  dispatchers_ = scm_acons (disp->self_scm (), scm_int2num (priority), dispatchers_);
+  dispatchers_ = scm_acons (disp->self_scm (), scm_from_int (priority), dispatchers_);
 
   Listener list = GET_LISTENER (dispatch);
   for (SCM cl = listen_classes_; scm_is_pair (cl); cl = scm_cdr (cl))
index 1c10f6488a9b9c74250b64fcdcd0192d5cfa26d5..d99cb58a900b1e9fb1cb513530ffe32fef45a135 100644 (file)
@@ -42,9 +42,9 @@ LY_DEFINE (ly_grob_array_ref, "ly:grob-array-ref",
   LY_ASSERT_SMOB (Grob_array, grob_arr, 1);
   LY_ASSERT_TYPE (scm_is_integer, index, 2);
 
-  vsize i = scm_to_unsigned (index);
+  vsize i = scm_to_uint (index);
   if (i == VPOS || i >= me->size ())
-    scm_out_of_range (NULL, scm_from_unsigned (i)); 
+    scm_out_of_range (NULL, scm_from_unsigned_integer (i)); 
   
   return me->grob (i)->self_scm ();
 }
index b86c31715da0c88824b8801dbe431a08c0d3a10f..f4cd79c5e882cad733847cce97f849ff95cb424a 100644 (file)
@@ -41,7 +41,7 @@
 /* this lets us "overload" macros such as get_property to take
    symbols as well as strings */
 inline SCM
-scm_or_str2symbol (char const *c) { return scm_str2symbol (c); }
+scm_or_str2symbol (char const *c) { return scm_from_locale_symbol (c); }
 
 inline SCM
 scm_or_str2symbol (SCM s) {
@@ -49,7 +49,7 @@ scm_or_str2symbol (SCM s) {
   return s;
 }
 
-/* Using this trick we cache the value of scm_str2symbol ("fooo") where
+/* Using this trick we cache the value of scm_from_locale_symbol ("fooo") where
    "fooo" is a constant string. This is done at the cost of one static
    variable per ly_symbol2scm() use, and one boolean evaluation for
    every call.
@@ -69,7 +69,7 @@ scm_or_str2symbol (SCM s) {
     value;                                                             \
   })
 #else
-inline SCM ly_symbol2scm (char const *x) { return scm_str2symbol ((x)); }
+inline SCM ly_symbol2scm (char const *x) { return scm_from_locale_symbol ((x)); }
 #endif
 
 /*
@@ -87,11 +87,11 @@ inline SCM ly_symbol2scm (char const *x) { return scm_str2symbol ((x)); }
     if (__builtin_constant_p ((x)))                                    \
       {                                                                        \
        if (!cached)                                                    \
-         value = cached = scm_eval (scm_str2symbol (x),                \
-                                    global_lily_module);               \
+         value = cached = scm_eval (scm_from_locale_symbol (x),                \
+                                   global_lily_module);                \
       }                                                                        \
     else                                                               \
-      value = scm_eval (scm_str2symbol (x), global_lily_module);       \
+      value = scm_eval (scm_from_locale_symbol (x), global_lily_module);       \
     value;                                                             \
   })
 
index 6be9dc41f83a29a2b2dfc0d951404bbded164444..e7081b69b1f835bb9b0ff4040331dba24af10291 100644 (file)
@@ -172,7 +172,7 @@ Open_type_font::get_indexed_char_dimensions (size_t signed_idx) const
   if (SCM_HASHTABLE_P (lily_index_to_bbox_table_))
     {
       SCM box = scm_hashq_ref (lily_index_to_bbox_table_,
-                              scm_from_unsigned (signed_idx), SCM_BOOL_F);
+                              scm_from_unsigned_integer (signed_idx), SCM_BOOL_F);
       Box *box_ptr = Box::unsmob (box);
       if (box_ptr)
        return *box_ptr;
@@ -208,7 +208,7 @@ Open_type_font::get_indexed_char_dimensions (size_t signed_idx) const
          b.scale (point_constant);
 
          scm_hashq_set_x (lily_index_to_bbox_table_,
-                          scm_from_unsigned (signed_idx),
+                          scm_from_unsigned_integer (signed_idx),
                           b.smobbed_copy ());
          return b;
        }
@@ -270,7 +270,7 @@ Open_type_font::design_size () const
                               which will trip errors more
                               quickly. --hwn.
                             */
-                            scm_from_unsigned (1));
+                            scm_from_unsigned_integer (1));
   return scm_to_double (entry) * Real (point_constant);
 }
 
index 33998a190b84183e566342b8dc861f2b5fdf5180..94eb705aedfbf435580aff3022d36850170b09bf 100644 (file)
@@ -134,7 +134,7 @@ Paper_book::output_aux (SCM output_channel,
       scm_call_3 (proc,
                  performances (),
                  output_channel,
-                 scm_long2num (*first_performance_number));
+                 scm_from_long (*first_performance_number));
       *first_performance_number += scm_ilength (performances_);
     }
 
@@ -155,7 +155,7 @@ Paper_book::output_aux (SCM output_channel,
       if (scores_ == SCM_EOL)
        return 0;
       paper_->set_variable (ly_symbol2scm ("first-page-number"),
-                           scm_long2num (*first_page_number));
+                           scm_from_long (*first_page_number));
       paper_->set_variable (ly_symbol2scm ("is-last-bookpart"),
                            ly_bool2scm (is_last));
       /* Generate all stencils to trigger font loads.  */
@@ -245,7 +245,7 @@ Paper_book::classic_output_aux (SCM output,
       scm_call_3 (proc,
                  performances (),
                  output,
-                 scm_long2num (*first_performance_number));
+                 scm_from_long (*first_performance_number));
       *first_performance_number += scm_ilength (performances_);
     }
   
index 5034376ed5f71581fbabd89a73e96f54e39fba76..dd8f97ac30256207a905716d4112a5b4371f317a 100644 (file)
@@ -115,7 +115,7 @@ Output_def *
 scale_output_def (Output_def *o, Real amount)
 {
   SCM proc = ly_lily_module_constant ("scale-layout");
-  SCM new_pap = scm_call_2 (proc, o->self_scm (), scm_double2num (amount));
+  SCM new_pap = scm_call_2 (proc, o->self_scm (), scm_from_double (amount));
 
   o = unsmob_output_def (new_pap);
   o->protect ();
index a8c6f6586a728db2021c109e90a90557be6edb66..9f6ff8b5d785762ba255c07817745fd89fcb2057 100644 (file)
@@ -40,7 +40,7 @@ internal_ly_parse_scm (Parse_start *ps)
 
   int off = ps->start_location_.start () - sf->c_str ();
 
-  scm_seek (port, scm_long2num (off), scm_long2num (SEEK_SET));
+  scm_seek (port, scm_from_long (off), scm_from_long (SEEK_SET));
   SCM from = scm_ftell (port);
 
   scm_set_port_line_x (port,  scm_from_int (ps->start_location_.line_number () -1));
index fcde80ea58e6e9c1d08a280fd77d77a14adf0a37..abcf101386d6da55e5c7f6a511afeeadb77d3eeb 100644 (file)
@@ -907,13 +907,13 @@ output_def_body:
 
 tempo_event:
        TEMPO steno_duration '=' bare_unsigned  {
-               $$ = MAKE_SYNTAX ("tempo", @$, SCM_BOOL_F, $2, scm_int2num ($4));
+               $$ = MAKE_SYNTAX ("tempo", @$, SCM_BOOL_F, $2, scm_from_int ($4));
        }
        | TEMPO string steno_duration '=' bare_unsigned {
-               $$ = MAKE_SYNTAX ("tempo", @$, make_simple_markup($2), $3, scm_int2num ($5));
+               $$ = MAKE_SYNTAX ("tempo", @$, make_simple_markup($2), $3, scm_from_int ($5));
        }
        | TEMPO full_markup steno_duration '=' bare_unsigned    {
-               $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, scm_int2num ($5));
+               $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, scm_from_int ($5));
        }
        | TEMPO string {
                $$ = MAKE_SYNTAX ("tempoText", @$, make_simple_markup($2) );
index 666e2425b0125c305c3b623c445d80fa31c85016..c41bbed172044f750651ce3ea189cf043745a4f3 100644 (file)
@@ -54,11 +54,11 @@ Percent_repeat_iterator::get_music_list () const
     percent->set_spot (*mus->origin ());
     percent->set_property ("length", length);
     if (repeats > 1)
-      percent->set_property ("repeat-count", scm_int2num (i));
-    
+      percent->set_property ("repeat-count", scm_from_int (i));
+
     child_list = scm_cons (percent->unprotect (), child_list);
   }
-  
+
   child_list = scm_cons (child->self_scm (), child_list);
 
   return child_list;
index d708ddfcc644de4e1b2193455c37ffb983e0ed8b..55e0d4e4b450709910b175029a6929261eb56833 100644 (file)
@@ -168,9 +168,9 @@ init_pedal_types ()
        be careful, as we don't want to loose references to the _sym_ members.
        */
       Pedal_type_info info;
-      info.event_class_sym_ = scm_str2symbol ((base_ident + "-event").c_str ());
-      info.style_sym_ = scm_str2symbol (("pedal" + base_name + "Style").c_str ());
-      info.strings_sym_ = scm_str2symbol (("pedal" + base_name + "Strings").c_str ());
+      info.event_class_sym_ = scm_from_locale_symbol ((base_ident + "-event").c_str ());
+      info.style_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Style").c_str ());
+      info.strings_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Strings").c_str ());
       
       info.base_name_ = name;
       info.pedal_c_str_ = strdup ((base_name + "Pedal").c_str ());
index 64cff836e6aa098813ec802b8523cd0e41ea2b9c..d7931788c6b2e789d72f58da3920eae3fbec75b9 100644 (file)
@@ -186,7 +186,7 @@ Translator::add_translator_listener (translator_listener_record **listener_list,
   name = replace_all (&name, '_', '-');
   name += "-event";
   
-  SCM class_sym = scm_str2symbol (name.c_str ());
+  SCM class_sym = scm_from_locale_symbol (name.c_str ());
   
   add_listened_event_class (class_sym);