]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator-scheme.cc
* scm/music-functions.scm (descend-to-context): new
[lilypond.git] / lily / translator-scheme.cc
1 /*
2   translator-scheme.cc --  implement Scheme context functions
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7
8  */
9
10 #include "translator.hh"
11 #include "context-def.hh"
12 #include "translator-group.hh"
13 #include "lily-guile.hh"
14
15
16 LY_DEFINE (ly_translator_name, "ly:translator-name",
17            1, 0, 0, (SCM trans),
18           "Return the type name of the translator object @var{trans}. "
19            "The name is a symbol.")
20 {
21   Translator *tr = unsmob_translator (trans);
22   SCM_ASSERT_TYPE (tr, trans, SCM_ARG1, __FUNCTION__, "Translator");
23   char const *nm = classname (tr);
24   return ly_symbol2scm (nm);
25 }
26
27 LY_DEFINE (ly_translator_description, "ly:translator-description",
28           1,0,0, (SCM me),
29           "Return an alist of properties of  translator @var{me}.")
30 {
31   Translator *tr = unsmob_translator (me);
32   SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Translator");
33   return tr->translator_description ();
34 }
35
36 int
37 Translator::print_smob (SCM s, SCM port, scm_print_state *)
38 {
39   Translator *me = (Translator*) ly_cdr (s);
40   scm_puts ("#<Translator ", port);
41   scm_puts (classname (me), port);
42   scm_display (me->simple_trans_list_, port);
43   
44   scm_puts (" >", port);
45   return 1;
46 }
47