]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/input.hh
Run grand replace for 2015.
[lilypond.git] / lily / include / input.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2015 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 #include "smobs.hh"
25
26 /**
27    Base class for anything that records its poisition in the parse file.
28 */
29 class Input : public Simple_smob<Input>
30 {
31   char const *start_;
32   char const *end_;
33   Source_file *source_file_;
34 public:
35   static const char type_p_name_[];
36   int print_smob (SCM, scm_print_state *);
37   static SCM equal_p (SCM, SCM);
38   SCM mark_smob ();
39   Source_file *get_source_file () const;
40   char const *start () const;
41   char const *end () const;
42
43   void set (Source_file *, char const *, char const *);
44   void error (const string&) const;
45   void programming_error (const string&) const;
46   void non_fatal_error (const string&) const;
47   void warning (const string&) const;
48   void message (const string&) const;
49   void debug_output (const string&) const;
50   void set_spot (Input const &);
51   void step_forward ();
52   void set_location (Input const &, Input const &);
53
54   Input spot () const;
55
56   string location_string () const;
57   string line_number_string () const;
58   string file_string ()const;
59
60   int line_number ()const;
61   int column_number ()const;
62   int end_line_number ()const;
63   int end_column_number ()const;
64
65   void get_counts (int *, int *, int *, int *) const;
66
67   Input (Input const &i);
68   Input ();
69 protected:
70   string message_location () const;
71   string message_string (const string &msg) const;
72 };
73
74 extern Input dummy_input_global;
75
76 #endif // INPUT_HH