X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fguile-init.cc;h=b812402e0e3d85f0ee4c975a246882d6294c7906;hb=23838d1d1ae8a457ad59adc81bf2f9fcbb531b44;hp=6c2422e76b9cbc7bf61d5ed16d70f95a2eef3cb5;hpb=8cab78caa0db1ba14f2e52e4c1ddbb541ea0e5cb;p=lilypond.git diff --git a/lily/guile-init.cc b/lily/guile-init.cc index 6c2422e76b..b812402e0e 100644 --- a/lily/guile-init.cc +++ b/lily/guile-init.cc @@ -1,20 +1,41 @@ -/* - guile-init.cc -- implement GUILE init routines. - - source file of the GNU LilyPond music typesetter - - (c) 2006--2009 Han-Wen Nienhuys - +/* + This file is part of LilyPond, the GNU music typesetter. + + Copyright (C) 2006--2015 Han-Wen Nienhuys + + + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ -#include "lily-guile.hh" -#include "main.hh" -#include "warn.hh" +#include "lily-guile.hh" +#include "main.hh" +#include "warn.hh" +#include "smobs.hh" +#include "lily-imports.hh" /* INIT */ +// Why a pointer here? Because it has zero initialization at load +// time which is guaranteed to come before the static initializations +// of all constructors for static expressions of the classes created +// by ADD_SCM_INIT_FUNC. The vector data type does not have load-time +// initialization and might clear out already set callbacks at the +// time it is initialized since there is no implied order among +// non-trivial constructors for static data in separate compilation +// units. So we need a trivial type like a pointer instead. typedef void (*Void_fptr) (); vector *scm_init_funcs_; @@ -27,28 +48,33 @@ void add_scm_init_func (void (*f) ()) scm_init_funcs_->push_back (f); } -void +SCM ly_init_ly_module (void *) { + // Start up type system first. + Scm_init::init (); for (vsize i = scm_init_funcs_->size (); i--;) (scm_init_funcs_->at (i)) (); - if (be_verbose_global) + if (is_loglevel (LOG_DEBUG)) { - progress_indication ("["); + debug_output ("[", true); scm_display (scm_c_eval_string ("(%search-load-path \"lily.scm\")"), - scm_current_error_port ()); - progress_indication ("]\n"); + scm_current_error_port ()); + debug_output ("]\n", false); } - scm_primitive_load_path (scm_from_locale_string ("lily.scm")); + scm_primitive_load_path (scm_from_ascii_string ("lily.scm")); + return SCM_UNDEFINED; } -SCM global_lily_module; - void ly_c_init_guile () { - global_lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0); + Guile_user::module.import (); + Lily::module.boot (); + scm_c_call_with_current_module (Lily::module, ly_init_ly_module, 0); + Syntax::module.import (); + Display::module.import (); scm_c_use_module ("lily"); }