#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 */
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))
{
}
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);
}
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))
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 ();
}
/* 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) {
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.
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
/*
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; \
})
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;
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;
}
which will trip errors more
quickly. --hwn.
*/
- scm_from_unsigned (1));
+ scm_from_unsigned_integer (1));
return scm_to_double (entry) * Real (point_constant);
}
scm_call_3 (proc,
performances (),
output_channel,
- scm_long2num (*first_performance_number));
+ scm_from_long (*first_performance_number));
*first_performance_number += scm_ilength (performances_);
}
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. */
scm_call_3 (proc,
performances (),
output,
- scm_long2num (*first_performance_number));
+ scm_from_long (*first_performance_number));
*first_performance_number += scm_ilength (performances_);
}
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 ();
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));
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) );
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;
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 ());
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);