LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2019 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1997--2019 Jan Nieuwenhuizen <janneke@gnu.org> |
5 Han-Wen Nienhuys <hanwen@xs4all.nl> | 5 Han-Wen Nienhuys <hanwen@xs4all.nl> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 string | 173 string |
174 Source_file::file_line_column_string (char const *context_str0) const | 174 Source_file::file_line_column_string (char const *context_str0) const |
175 { | 175 { |
176 if (!c_str ()) | 176 if (!c_str ()) |
177 return " (" + _ ("position unknown") + ")"; | 177 return " (" + _ ("position unknown") + ")"; |
178 else | 178 else |
179 { | 179 { |
180 int l, ch, col, offset; | 180 int l, ch, col, offset; |
181 get_counts (context_str0, &l, &ch, &col, &offset); | 181 get_counts (context_str0, &l, &ch, &col, &offset); |
182 | 182 |
183 return name_string () + ":" + ::to_string (l) | 183 return name_string () + ":" + std::to_string (l) |
184 + ":" + ::to_string (col + 1); | 184 + ":" + std::to_string (col + 1); |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 string | 188 string |
189 Source_file::quote_input (char const *pos_str0) const | 189 Source_file::quote_input (char const *pos_str0) const |
190 { | 190 { |
191 if (!contains (pos_str0)) | 191 if (!contains (pos_str0)) |
192 return " (" + _ ("position unknown") + ")"; | 192 return " (" + _ ("position unknown") + ")"; |
193 | 193 |
194 int l, ch, col, offset; | 194 int l, ch, col, offset; |
195 get_counts (pos_str0, &l, &ch, &col, &offset); | 195 get_counts (pos_str0, &l, &ch, &col, &offset); |
196 string line = line_string (pos_str0); | 196 string line = line_string (pos_str0); |
197 string context = line.substr (0, offset) | 197 string context = line.substr (0, offset); |
198 + ::to_string ('\n') | 198 context += '\n'; |
199 + ::to_string (' ', col) | 199 if (col > 0) |
200 + line.substr (offset, line.length () - offset); | 200 context += string (col, ' '); |
| 201 context += line.substr (offset, line.length () - offset); |
201 return context; | 202 return context; |
202 } | 203 } |
203 | 204 |
204 string | 205 string |
205 Source_file::name_string () const | 206 Source_file::name_string () const |
206 { | 207 { |
207 return map_file_name (name_); | 208 return map_file_name (name_); |
208 } | 209 } |
209 | 210 |
210 Source_file::~Source_file () | 211 Source_file::~Source_file () |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 int | 371 int |
371 Source_file::print_smob (SCM port, scm_print_state *) const | 372 Source_file::print_smob (SCM port, scm_print_state *) const |
372 { | 373 { |
373 scm_puts ("#<Source_file ", port); | 374 scm_puts ("#<Source_file ", port); |
374 scm_puts (name_.c_str (), port); | 375 scm_puts (name_.c_str (), port); |
375 | 376 |
376 /* Do not print properties, that is too much hassle. */ | 377 /* Do not print properties, that is too much hassle. */ |
377 scm_puts (" >", port); | 378 scm_puts (" >", port); |
378 return 1; | 379 return 1; |
379 } | 380 } |
LEFT | RIGHT |