summaryrefslogtreecommitdiff
path: root/lily/guile-init.cc
blob: 8f7cbd873778111ee29c087a61f8683db5dbb546 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* 
  guile-init.cc -- implement GUILE init routines.
  
  source file of the GNU LilyPond music typesetter
  
  (c) 2006--2007 Han-Wen Nienhuys <hanwen@lilypond.org>
  
*/

#include  "lily-guile.hh"
#include  "main.hh"
#include  "warn.hh"

/*
  INIT
*/


typedef void (*Void_fptr) ();
vector<Void_fptr> *scm_init_funcs_;

void add_scm_init_func (void (*f) ())
{
  if (!scm_init_funcs_)
    scm_init_funcs_ = new vector<Void_fptr>;

  scm_init_funcs_->push_back (f);
}

void
ly_init_ly_module (void *)
{
  for (vsize i = scm_init_funcs_->size (); i--;)
    (scm_init_funcs_->at (i)) ();

  if (be_verbose_global)
    {
      progress_indication ("[");
      scm_display (scm_c_eval_string ("(%search-load-path \"lily.scm\")"),
		   scm_current_error_port ());
      progress_indication ("]\n");
    }

  scm_primitive_load_path (scm_from_locale_string ("lily.scm"));
}

SCM global_lily_module;

void
ly_c_init_guile ()
{
  global_lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0);
  scm_c_use_module ("lily");
}