]> git.donarmstrong.com Git - lilypond.git/commitdiff
add typecheck to ly_assoc_get
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 2 Feb 2007 23:23:45 +0000 (00:23 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 2 Feb 2007 23:23:45 +0000 (00:23 +0100)
lily/function-documentation.cc
lily/general-scheme.cc
lily/include/lily-guile.hh

index d8e4ddc33b4cc08739c38256259c2c2248014146..c5b1387726bf122feafda79a1d4be95f69bf74c6 100644 (file)
@@ -95,6 +95,7 @@ init_func_doc ()
   ly_add_type_predicate ((void*) &is_direction, "direction");
   ly_add_type_predicate ((void*) &is_music_function, "Music_function");
   ly_add_type_predicate ((void*) &ly_is_port, "port");
+  ly_add_type_predicate ((void*) &ly_cheap_is_list, "list");
   ly_add_type_predicate ((void*) &unsmob_global_context, "Global_context");
   ly_add_type_predicate ((void*) &unsmob_input, "Input");
   ly_add_type_predicate ((void*) &unsmob_moment, "Moment");
index 1d97d4bf8e001f34cec98e560e1cce938819203f..7723bd477b6af67bd5f21d575bb2c6349bc9ad3f 100644 (file)
@@ -138,6 +138,8 @@ LY_DEFINE (ly_assoc_get, "ly:assoc-get",
           "Return value if KEY in ALIST, else DEFAULT-VALUE "
           "(or #f if not specified).")
 {
+  LY_ASSERT_TYPE(ly_cheap_is_list, alist, 2);
+  
   SCM handle = scm_assoc (key, alist);
   if (scm_is_pair (handle))
     return scm_cdr (handle);
@@ -150,7 +152,7 @@ LY_DEFINE (ly_assoc_get, "ly:assoc-get",
 
 LY_DEFINE (ly_string_substitute, "ly:string-substitute",
           3, 0, 0, (SCM a, SCM b, SCM s),
-          "Replace @var{a} by @var{b} in @var{s}.")
+          "Replace string @var{a} by string @var{b} in string @var{s}.")
 {
   LY_ASSERT_TYPE (scm_is_string, s, 1);
   LY_ASSERT_TYPE (scm_is_string, b, 2);
index 7349050810477bc1ae1f209906c1fd6c75b757be..efb283cfc18588262bf6f3fce32839a8baf4724f 100644 (file)
@@ -85,6 +85,7 @@ SCM ly_assoc_prepend_x (SCM alist, SCM key, SCM val);
 inline bool ly_is_fraction (SCM x) { return SCM_FRACTIONP(x) || scm_is_integer (x); }
     
 inline bool ly_is_list (SCM x) { return SCM_NFALSEP (scm_list_p (x)); }
+inline bool ly_cheap_is_list (SCM x) { return scm_is_pair (x) || x == SCM_EOL; }
 inline bool ly_is_procedure (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); }
 inline bool ly_is_port (SCM x) { return SCM_NFALSEP (scm_port_p (x)); }