]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lily-guile.cc
release: 1.3.106
[lilypond.git] / lily / lily-guile.cc
index 6f6b93e280e6a4528bb8cd38197a473b40545c41..91096bce8efe606d8f758e9ba17a6e281548a658 100644 (file)
@@ -53,7 +53,7 @@ ly_parse_scm (char const* s, int* n)
 
   /* Read expression from port */
   if (!SCM_EOF_OBJECT_P (form = scm_read (port)))
-    answer = scm_eval_3 (form, 1, SCM_EOL);
+    answer = scm_eval_3 (form, 1, SCM_EOL); // guh?
 
   /*
    After parsing
@@ -100,6 +100,7 @@ ly_symbol2scm(const char *s)
   return gh_symbol2scm ((char *)s);
 }
 
+
 String
 ly_symbol2string (SCM s)
 {
@@ -345,7 +346,7 @@ ly_number2string (SCM s)
 {
   assert (gh_number_p (s));
 
-  char str[100];                       // ugh.
+  char str[400];                       // ugh.
 
   if (scm_integer_p (s) == SCM_BOOL_F)
     {
@@ -389,27 +390,32 @@ wave_sweep_goodbye (void *dummy1, void *dummy2, void *dummy3)
 }
 #endif
 
+
+#include "version.hh"
 SCM
-undefd ()
+ly_version ()
 {
-  return SCM_UNDEFINED;
+  char const* vs =  "\'(" MAJOR_VERSION " " MINOR_VERSION " "  PATCH_LEVEL " " MY_PATCH_LEVEL ")" ;
+
+  
+  return gh_eval_str ((char*)vs);
 }
 
 static void
 init_functions ()
 {
-  scm_make_gsubr ("ly-warn", 1, 0, 0, (SCM(*)(...))ly_warning);
-  scm_make_gsubr ("ly-gulp-file", 1,0, 0, (SCM(*)(...))ly_gulp_file);
-  scm_make_gsubr ("dir?", 1,0, 0, (SCM(*)(...))ly_isdir_p);
-  scm_make_gsubr ("undefd", 0,0, 0, (SCM(*)(...))undefd);  
-  scm_make_gsubr ("ly-number->string", 1, 0,0, (SCM(*)(...)) ly_number2string);
+  scm_make_gsubr ("ly-warn", 1, 0, 0, (Scheme_function_unknown)ly_warning);
+  scm_make_gsubr ("ly-version", 0, 0, 0, (Scheme_function_unknown)ly_warning);  
+  scm_make_gsubr ("ly-gulp-file", 1,0, 0, (Scheme_function_unknown)ly_gulp_file);
+  scm_make_gsubr ("dir?", 1,0, 0, (Scheme_function_unknown)ly_isdir_p);
+
+  scm_make_gsubr ("ly-number->string", 1, 0,0, (Scheme_function_unknown) ly_number2string);
 
 
 #ifdef TEST_GC 
   scm_c_hook_add (&scm_before_mark_c_hook, greet_sweep, 0, 0);
   scm_c_hook_add (&scm_before_sweep_c_hook, wave_sweep_goodbye, 0, 0);
 #endif
-  
 }
 
 ADD_SCM_INIT_FUNC(funcs, init_functions);
@@ -426,3 +432,19 @@ ly_deep_copy (SCM l)
 }
 
 
+
+
+SCM
+ly_assoc_chain (SCM key, SCM achain)
+{
+  if (gh_pair_p (achain))
+    {
+      SCM handle = scm_assoc (key, gh_car (achain));
+      if (gh_pair_p (handle))
+       return handle;
+      else
+       return ly_assoc_chain (key, gh_cdr (achain));
+    }
+  else
+    return SCM_BOOL_F;
+}