comparison libinterp/corefcn/comment-list.h @ 17693:efbe746f8fa8

eliminate octave_comment_buffer singleton * lex.h (octave_base_lexer::comment_buffer): New class adapted from octave_comment_buffer class. No longer a singleton class. (octave_base_lexer::comment_buffer::reset): New function. (octave_base_lexer::reset): Call comment_buf.reset. (octave_base_lexer::comment_buf): New data member. (octave_base_lexer::get_comment): New function. * comment-list.h, comment-list.cc (octave_comment_buffer): Delete. Change all uses of octave_comment_buffer to use local comment_buf object instead. * parse.h (octave_base_parser::make_statement): New member function. * oct-parse.in.yy (make_statement): Delete. Change all uses of make_statement to use the member function instead. (safe_fclose): Don't extract and delete comment list here.
author John W. Eaton <jwe@octave.org>
date Fri, 18 Oct 2013 21:00:33 -0400
parents 68fc671a9339
children d63878346099
comparison
equal deleted inserted replaced
17692:38cf56b77274 17693:efbe746f8fa8
96 { append (octave_comment_elt (s, t)); } 96 { append (octave_comment_elt (s, t)); }
97 97
98 octave_comment_list *dup (void) const; 98 octave_comment_list *dup (void) const;
99 }; 99 };
100 100
101 class
102 octave_comment_buffer
103 {
104 public:
105
106 octave_comment_buffer (void)
107 : comment_list (new octave_comment_list ()) { }
108
109 ~octave_comment_buffer (void) { delete comment_list; }
110
111 static bool instance_ok (void);
112
113 static void append
114 (const std::string& s,
115 octave_comment_elt::comment_type t = octave_comment_elt::unknown);
116
117 static octave_comment_list *get_comment (void);
118
119 private:
120
121 void do_append (const std::string& s, octave_comment_elt::comment_type t);
122
123 octave_comment_list *do_get_comment (void);
124
125 octave_comment_list *comment_list;
126
127 static octave_comment_buffer *instance;
128
129 static void cleanup_instance (void) { delete instance; instance = 0; }
130 };
131
132 #endif 101 #endif