]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/lily-guile.icc
patch::: 1.3.15.jcn2
[lilypond.git] / lily / include / lily-guile.icc
1 /*
2   lily-guile.icc -- implement guile templates
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1999 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #ifndef LILY_GUILE_ICC
10 #define LILY_GUILE_ICC
11
12 #include "lily-guile.hh"
13
14 template<class T>SCM
15 array_to_scm (Array<T> arr)
16 {
17   SCM list = SCM_EOL;
18   for (int i = arr.size (); i--;)
19     list =  gh_cons (to_scm (arr[i]), list);
20   return list;
21 }
22
23 /*
24   Silly templates
25   Array<T> scm_to_array (SCM s)
26
27   check scm?
28  */
29 template<class T>void
30 scm_to_array (SCM s, Array<T>* arr)
31 {
32   for (; gh_pair_p (s); s= gh_cdr (s))
33     {
34       T t;
35       scm_to (gh_car (s), &t);
36       arr->push (t);
37     }
38 }
39
40 #endif /* LILY_GUILE_ICC */