-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);
-}
-
-/*
- convert without too many decimals, and leave a space at the end.
- */
-
-
-LY_DEFINE(ly_number2string, "ly-number->string", 1, 0,0,
- (SCM s),
- " converts @var{num} to a string without generating many decimals. It
-leaves a space at the end.
-")
-{
- assert (gh_number_p (s));
-
- char str[400]; // ugh.
-
- if (scm_exact_p (s) == SCM_BOOL_F)
- {
- Real r (gh_scm2double (s));
-
- if (isinf (r) || isnan (r))
- {
- programming_error ("Infinity or NaN encountered while converting Real number; setting to zero.");
- r = 0.0;
- }
-
- sprintf (str, "%8.4f ", r);
- }
- else
- {
- sprintf (str, "%d ", gh_scm2int (s));
- }
-
- return ly_str02scm (str);
-}
-
-/*
- Undef this to see if GUILE GC is causing too many swaps.
- */
-
-// #define TEST_GC
-
-#ifdef TEST_GC
-#include <libguile/gc.h>
-
-static void *
-greet_sweep (void *dummy1, void *dummy2, void *dummy3)
-{
- fprintf (stderr, "entering sweep\n");
-}
-
-static void *
-wave_sweep_goodbye (void *dummy1, void *dummy2, void *dummy3)
-{
- fprintf (stderr, "leaving sweep\n");
-}
-#endif
-
-
-#include "version.hh"
-LY_DEFINE(ly_version, "ly-version", 0, 0, 0, (),
- "Return the current lilypond version as a list, e.g.
-@code{(1 3 127 uu1)}.
-")
-{
- char const* vs = "\' (" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")" ;
-
- return gh_eval_str ((char*)vs);
-}
-
-LY_DEFINE(ly_unit, "ly-unit", 0, 0, 0, (),
- "Return the unit used for lengths as a string.")
-{
- return ly_str02scm (INTERNAL_UNIT);
-}
-
-LY_DEFINE(ly_verbose, "ly-verbose", 0, 0, 0, (),
- "Return whether lilypond is being run in verbose mode.")
-{
- return gh_bool2scm (verbose_global_b);
-}
-
-static void
-init_functions ()
-{
-#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);
-