OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 class Source_file : public Smob<Source_file> | 33 class Source_file : public Smob<Source_file> |
34 { | 34 { |
35 public: | 35 public: |
36 int print_smob (SCM, scm_print_state *) const; | 36 int print_smob (SCM, scm_print_state *) const; |
37 SCM mark_smob () const; | 37 SCM mark_smob () const; |
38 static const char * const type_p_name_; | 38 static const char * const type_p_name_; |
39 virtual ~Source_file (); | 39 virtual ~Source_file (); |
40 private: | 40 private: |
41 std::vector<char const *> newline_locations_; | 41 std::vector<char const *> newline_locations_; |
42 std::istream *istream_; | 42 std::istream *istream_; |
43 std::vector<char> characters_; | 43 |
| 44 std::string data_; |
44 SCM str_port_; | 45 SCM str_port_; |
45 | 46 |
46 void load_stdin (); | 47 void load_stdin (); |
47 void init_port (); | 48 void init_port (); |
48 void init (); | 49 void init (); |
| 50 void init_newlines(); |
49 | 51 |
50 public: | 52 public: |
51 Source_file (const std::string &fn); | 53 Source_file (const std::string &fn); |
52 Source_file (const std::string&, const std::string&); | 54 Source_file (const std::string&, const std::string&); |
53 | 55 |
54 char const *c_str () const; | 56 char const *c_str () const; |
55 std::string quote_input (char const *pos_str0) const; | 57 std::string quote_input (char const *pos_str0) const; |
56 std::istream *get_istream (); | 58 std::istream *get_istream (); |
57 bool contains (char const *pos_str0) const; | 59 bool contains (char const *pos_str0) const; |
58 size_t length () const; | 60 size_t length () const; |
59 ssize_t get_line (char const *pos_str0) const; | 61 ssize_t get_line (char const *pos_str0) const; |
60 void set_line (char const *pos_str0, ssize_t line); | 62 void set_line (char const *pos_str0, ssize_t line); |
61 std::string name_string () const; | 63 std::string name_string () const; |
62 std::string file_line_column_string (char const *str0) const; | 64 std::string file_line_column_string (char const *str0) const; |
63 | 65 |
64 Slice line_slice (char const *pos_str0) const; | 66 Slice line_slice (char const *pos_str0) const; |
65 std::string line_string (char const *pos_str0) const; | 67 std::string line_string (char const *pos_str0) const; |
66 void get_counts (char const *pos_str0, | 68 void get_counts (char const *pos_str0, |
67 ssize_t *, ssize_t *, ssize_t *, ssize_t *) const; | 69 ssize_t *, ssize_t *, ssize_t *, ssize_t *) const; |
68 | 70 |
69 SCM get_port () const; | 71 SCM get_port () const; |
70 std::string name_; | 72 std::string name_; |
71 | 73 |
72 protected: | 74 protected: |
73 ssize_t line_offset_; | 75 ssize_t line_offset_; |
74 }; | 76 }; |
75 | 77 |
76 std::vector<char> gulp_file (const std::string &fn, size_t desired_size); | 78 std::string gulp_file (const std::string &fn, size_t desired_size); |
77 | 79 |
78 #endif /* SOURCE_FILE_HH */ | 80 #endif /* SOURCE_FILE_HH */ |
OLD | NEW |