]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/input.hh
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond into...
[lilypond.git] / lily / include / input.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef INPUT_HH
21 #define INPUT_HH
22
23 #include "lily-proto.hh"
24
25 /**
26    Base class for anything that records its poisition in the parse file.
27 */
28 class Input
29 {
30   char const *start_;
31   char const *end_;
32   Source_file *source_file_;
33 public:
34   Source_file *get_source_file () const;
35   char const *start () const;
36   char const *end () const;
37
38   void set (Source_file *, char const *, char const *);
39   void warning (string) const;
40   void programming_error (string) const;
41   void non_fatal_error (string) const;
42   void error (string) const;
43   void message (string) const;
44   void set_spot (Input const &);
45   void step_forward ();
46   void set_location (Input const &, Input const &);
47
48   Input spot () const;
49
50   string location_string () const;
51   string line_number_string () const;
52   string file_string ()const;
53
54   int line_number ()const;
55   int column_number ()const;
56   int end_line_number ()const;
57   int end_column_number ()const;
58
59   void get_counts (int *, int *, int *, int *) const;
60
61   Input (Input const &i);
62   Input ();
63 };
64
65
66 #include "smobs.hh"
67
68 SCM make_input (Input spot);
69 Input *unsmob_input (SCM);
70
71 extern Input dummy_input_global;
72
73 #endif // INPUT_HH