2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2000--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 #include "source-file.hh"
22 #include "std-string.hh"
25 /* Dummy input location for use if real one is missing. */
26 Input dummy_input_global;
28 static long input_tag;
33 Input *sc = (Input *) SCM_CELL_WORD_1 (s);
35 if (Source_file *sf = sc->get_source_file ())
36 return sf->self_scm ();
42 print_smob (SCM s, SCM port, scm_print_state *)
44 string str = "#<location " + Input::unsmob (s)->location_string () + ">";
45 scm_puts (str.c_str (), port);
52 delete Input::unsmob (s);
57 equal_smob (SCM sa, SCM sb)
59 Input *a = (Input *) SCM_CELL_WORD_1 (sa);
60 Input *b = (Input *) SCM_CELL_WORD_1 (sb);
61 if (a->get_source_file () == b->get_source_file ()
62 && a->start () == b->start ()
63 && a->end () == b->end ())
72 input_tag = scm_make_smob_type ("input", 0);
73 scm_set_smob_mark (input_tag, mark_smob);
74 scm_set_smob_free (input_tag, free_smob);
75 scm_set_smob_print (input_tag, print_smob);
76 scm_set_smob_equalp (input_tag, equal_smob);
82 Input *nip = new Input (ip);
85 SCM_NEWSMOB (z, input_tag, nip);
94 if (SCM_CAR (s) == (SCM)input_tag) // ugh.
95 return (Input *) SCM_CDR (s);
100 ADD_SCM_INIT_FUNC (input, start_input_smobs);