X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Flily-guile.hh;h=6aa25f828a90ec8a3d980b3a7e89fa7b975c01c6;hb=af770f3440264c18ce01525dce1aa76b86ace0d5;hp=23b3c64785edef95c978f2553d734da4a394f8a3;hpb=8d540cf685bfda800b1ea99bef1ae236dba6280d;p=lilypond.git diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 23b3c64785..6aa25f828a 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -45,6 +45,8 @@ string gulp_file_to_string (string fn, bool must_exist, int size); string ly_scm2string (SCM s); string ly_symbol2string (SCM); +Rational ly_scm2rational (SCM); +SCM ly_rational2scm (Rational); SCM ly_offset2scm (Offset); Offset ly_scm2offset (SCM); SCM ly_chain_assoc (SCM key, SCM achain); @@ -64,7 +66,9 @@ Drul_array robust_scm2drul (SCM, Drul_array); Drul_array robust_scm2booldrul (SCM, Drul_array); Interval robust_scm2interval (SCM, Drul_array); Offset robust_scm2offset (SCM, Offset); +string robust_scm2string (SCM, string); + SCM ly_quote_scm (SCM s); bool type_check_assignment (SCM val, SCM sym, SCM type_symbol); string print_scm_val (SCM val); @@ -95,10 +99,6 @@ inline bool ly_is_equal (SCM x, SCM y) inline bool ly_scm2bool (SCM x) { return SCM_NFALSEP (x); } inline char ly_scm2char (SCM x) { return SCM_CHAR (x); } -inline unsigned long ly_length (SCM x) -{ - return scm_num2ulong (scm_length (x), 0, "ly_length"); -} inline SCM ly_bool2scm (bool x) { return SCM_BOOL (x); } inline SCM ly_append2 (SCM x1, SCM x2) @@ -171,6 +171,10 @@ typedef SCM (*Scheme_function_2) (GUILE_ELLIPSIS); typedef SCM (*Scheme_function_3) (GUILE_ELLIPSIS); #endif + +/* + Inline these for performance reasons. + */ #define scm_cdr ly_cdr #define scm_car ly_car @@ -183,4 +187,22 @@ inline SCM ly_cdr (SCM x) { return SCM_CDR (x); } inline bool ly_is_pair (SCM x) { return SCM_I_CONSP (x); } + +#include "std-vector.hh" + +template +SCM +ly_cxx_vector_to_list (vector const &src) +{ + SCM l = SCM_EOL; + for (vsize i = src.size (); i --; ) + l = scm_cons (src[i]->self_scm (), l); + + return l; +} + + +SCM ly_offsets2scm (vector os); +vector ly_scm2offsets (SCM s); + #endif /* LILY_GUILE_HH */