-/*
- atom.cc -- implement Atom
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include <math.h>
-
-#include "atom.hh"
-#include "lookup.hh"
-#include "global-ctor.hh"
-#include "font-metric.hh"
-
-
-#if 0
-SCM translate_sym;
-
-static void init()
-{
- translate_sym = sly_symbol2scm ("translate-atom");
-}
-
-ADD_SCM_INIT_FUNC(atom, init);
-#endif
-
-SCM
-translate_atom (Offset o, SCM func)
-{
- return gh_list (ly_symbol2scm ("translate-atom"),
- ly_quote_scm (to_scm (o)),
- func,
- SCM_UNDEFINED);
-}
-
-SCM
-translate_atom_axis (Real r, Axis a, SCM func)
-{
- // off_[a] += r;
- Offset o ;
- o[a] = r;
- return gh_list (ly_symbol2scm ("translate-atom"),
- ly_quote_scm (to_scm (o)),
- func,
- SCM_UNDEFINED);
-}
-
-
-SCM
-fontify_atom(Font_metric * met, SCM f)
-{
- return gh_list (ly_symbol2scm ("fontify"),
- ly_quote_scm (met->description ()), f, SCM_UNDEFINED);
-}
SCM ly_eval_str (String s);
SCM ly_symbol2scm (char const *);
String ly_symbol2string (SCM);
+SCM ly_type (SCM);
SCM ly_eval (SCM a);
SCM ly_parse_scm (char const* s, int* n);
return Offset (gh_scm2double (gh_car (s)),
gh_scm2double (gh_cdr (s)));
}
+
+SCM
+ly_type (SCM exp)
+{
+ char const * cp = "unknown";
+ if (gh_number_p (exp))
+ {
+ cp = "number";
+ }
+ else if (gh_string_p (exp))
+ {
+ cp = "string";
+ }
+ else if (gh_procedure_p (exp))
+ {
+ cp = "procedure";
+ }
+ else if (gh_boolean_p (exp))
+ {
+ cp = "boolean";
+ }
+ else if (gh_pair_p (exp))
+ {
+ cp = "list";
+ }
+
+ return ly_str02scm (cp);
+}