LEFT | RIGHT |
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) 1999--2020 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1999--2020 Jan Nieuwenhuizen <janneke@gnu.org> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // directly point into the data kept here. | 30 // directly point into the data kept here. |
31 class Source_file : public Smob<Source_file> | 31 class Source_file : public Smob<Source_file> |
32 { | 32 { |
33 public: | 33 public: |
34 int print_smob (SCM, scm_print_state *) const; | 34 int print_smob (SCM, scm_print_state *) const; |
35 static const char * const type_p_name_; | 35 static const char * const type_p_name_; |
36 virtual ~Source_file (); | 36 virtual ~Source_file (); |
37 private: | 37 private: |
38 std::vector<char const *> newline_locations_; | 38 std::vector<char const *> newline_locations_; |
39 std::istream *istream_; | 39 std::istream *istream_; |
40 std::vector<char> characters_; | 40 |
| 41 std::string data_; |
41 | 42 |
42 void load_stdin (); | 43 void load_stdin (); |
43 void init (); | 44 void init (); |
| 45 void init_newlines(); |
44 | 46 |
45 public: | 47 public: |
46 Source_file (const std::string &fn); | 48 Source_file (const std::string &fn); |
47 Source_file (const std::string&, const std::string&); | 49 Source_file (const std::string&, const std::string&); |
48 | 50 |
49 char const *c_str () const; | 51 char const *c_str () const; |
50 std::string quote_input (char const *pos_str0) const; | 52 std::string quote_input (char const *pos_str0) const; |
51 std::istream *get_istream (); | 53 std::istream *get_istream (); |
52 bool contains (char const *pos_str0) const; | 54 bool contains (char const *pos_str0) const; |
53 size_t length () const; | 55 size_t length () const; |
54 ssize_t get_line (char const *pos_str0) const; | 56 ssize_t get_line (char const *pos_str0) const; |
55 void set_line (char const *pos_str0, ssize_t line); | 57 void set_line (char const *pos_str0, ssize_t line); |
56 std::string name_string () const; | 58 std::string name_string () const; |
57 std::string file_line_column_string (char const *str0) const; | 59 std::string file_line_column_string (char const *str0) const; |
58 | 60 |
59 Slice line_slice (char const *pos_str0) const; | 61 Slice line_slice (char const *pos_str0) const; |
60 std::string line_string (char const *pos_str0) const; | 62 std::string line_string (char const *pos_str0) const; |
61 void get_counts (char const *pos_str0, | 63 void get_counts (char const *pos_str0, |
62 ssize_t *, ssize_t *, ssize_t *, ssize_t *) const; | 64 ssize_t *, ssize_t *, ssize_t *, ssize_t *) const; |
63 | 65 |
64 std::string name_; | 66 std::string name_; |
65 | 67 |
66 protected: | 68 protected: |
67 ssize_t line_offset_; | 69 ssize_t line_offset_; |
68 }; | 70 }; |
69 | 71 |
70 std::vector<char> gulp_file (const std::string &fn, size_t desired_size); | 72 std::string gulp_file (const std::string &fn, size_t desired_size); |
71 | 73 |
72 #endif /* SOURCE_FILE_HH */ | 74 #endif /* SOURCE_FILE_HH */ |
LEFT | RIGHT |