2117
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2117
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2117
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_octave_stream_h) |
|
25 #define octave_octave_stream_h 1 |
|
26 |
2877
|
27 class Matrix; |
|
28 class string_vector; |
|
29 class octave_value; |
|
30 class octave_value_list; |
2117
|
31 |
3503
|
32 #include <iostream> |
2877
|
33 #include <string> |
2117
|
34 |
|
35 #include "Array.h" |
2317
|
36 #include "data-conv.h" |
4051
|
37 #include "lo-sstream.h" |
3640
|
38 #include "lo-utils.h" |
2317
|
39 #include "mach-info.h" |
2117
|
40 |
3640
|
41 class |
2117
|
42 scanf_format_elt |
|
43 { |
3640
|
44 public: |
|
45 |
3483
|
46 enum special_conversion |
|
47 { |
|
48 whitespace_conversion = 1, |
|
49 literal_conversion = 2 |
|
50 }; |
|
51 |
2215
|
52 scanf_format_elt (const char *txt = 0, int w = 0, bool d = false, |
3483
|
53 char typ = '\0', char mod = '\0', |
3523
|
54 const std::string& ch_class = std::string ()) |
3640
|
55 : text (strsave (txt)), width (w), discard (d), type (typ), |
|
56 modifier (mod), char_class (ch_class) { } |
|
57 |
|
58 scanf_format_elt (const scanf_format_elt& e) |
|
59 : text (strsave (e.text)), width (e.width), discard (e.discard), |
|
60 type (e.type), modifier (e.modifier), char_class (e.char_class) { } |
2117
|
61 |
3640
|
62 scanf_format_elt& operator = (const scanf_format_elt& e) |
|
63 { |
|
64 if (this != &e) |
|
65 { |
|
66 text = strsave (e.text); |
|
67 width = e.width; |
|
68 discard = e.discard; |
|
69 type = e.type; |
|
70 modifier = e.modifier; |
|
71 char_class = e.char_class; |
|
72 } |
2117
|
73 |
3640
|
74 return *this; |
|
75 } |
|
76 |
|
77 ~scanf_format_elt (void) { delete [] text; } |
|
78 |
|
79 // The C-style format string. |
2117
|
80 const char *text; |
3640
|
81 |
|
82 // The maximum field width. |
2215
|
83 int width; |
3640
|
84 |
|
85 // TRUE if we are not storing the result of this conversion. |
2117
|
86 bool discard; |
3640
|
87 |
|
88 // Type of conversion -- `d', `i', `o', `u', `x', `e', `f', `g', |
|
89 // `c', `s', `p', `%', or `['. |
2117
|
90 char type; |
3640
|
91 |
|
92 // A length modifier -- `h', `l', or `L'. |
2117
|
93 char modifier; |
3640
|
94 |
|
95 // The class of characters in a `[' format. |
3523
|
96 std::string char_class; |
2117
|
97 }; |
|
98 |
|
99 class |
|
100 scanf_format_list |
|
101 { |
|
102 public: |
|
103 |
3523
|
104 scanf_format_list (const std::string& fmt = std::string ()); |
2117
|
105 |
|
106 ~scanf_format_list (void); |
|
107 |
|
108 int num_conversions (void) { return nconv; } |
|
109 |
2215
|
110 // The length can be different than the number of conversions. |
|
111 // For example, "x %d y %d z" has 2 conversions but the length of |
|
112 // the list is 3 because of the characters that appear after the |
|
113 // last conversion. |
|
114 |
|
115 int length (void) { return list.length (); } |
|
116 |
2117
|
117 const scanf_format_elt *first (void) |
|
118 { |
|
119 curr_idx = 0; |
|
120 return current (); |
|
121 } |
|
122 |
|
123 const scanf_format_elt *current (void) const |
|
124 { return list.length () > 0 ? list.elem (curr_idx) : 0; } |
|
125 |
3640
|
126 const scanf_format_elt *next (bool cycle = true) |
2117
|
127 { |
|
128 curr_idx++; |
3640
|
129 |
2117
|
130 if (curr_idx >= list.length ()) |
3640
|
131 { |
|
132 if (cycle) |
|
133 curr_idx = 0; |
|
134 else |
|
135 return 0; |
|
136 } |
2117
|
137 return current (); |
|
138 } |
|
139 |
|
140 void printme (void) const; |
|
141 |
|
142 bool ok (void) const { return (nconv >= 0); } |
|
143 |
3145
|
144 operator bool () const { return ok (); } |
2117
|
145 |
|
146 bool all_character_conversions (void); |
|
147 |
|
148 bool all_numeric_conversions (void); |
|
149 |
|
150 private: |
|
151 |
3642
|
152 // Number of conversions specified by this format string, or -1 if |
2117
|
153 // invalid conversions have been found. |
|
154 int nconv; |
|
155 |
|
156 // Index to current element; |
|
157 int curr_idx; |
|
158 |
|
159 // List of format elements. |
|
160 Array<scanf_format_elt*> list; |
|
161 |
|
162 // Temporary buffer. |
4051
|
163 OSSTREAM *buf; |
2117
|
164 |
2215
|
165 void add_elt_to_list (int width, bool discard, char type, char modifier, |
3640
|
166 int& num_elts, |
|
167 const std::string& char_class = std::string ()); |
2117
|
168 |
3523
|
169 void process_conversion (const std::string& s, int& i, int n, int& width, |
2215
|
170 bool& discard, char& type, char& modifier, |
|
171 int& num_elts); |
2117
|
172 |
3523
|
173 int finish_conversion (const std::string& s, int& i, int n, int& width, |
2215
|
174 bool discard, char& type, char modifier, |
|
175 int& num_elts); |
2117
|
176 // No copying! |
|
177 |
|
178 scanf_format_list (const scanf_format_list&); |
|
179 |
|
180 scanf_format_list& operator = (const scanf_format_list&); |
|
181 }; |
|
182 |
3640
|
183 class |
2117
|
184 printf_format_elt |
|
185 { |
3640
|
186 public: |
|
187 |
|
188 printf_format_elt (const char *txt = 0, int n = 0, int w = 0, |
|
189 int p = 0, const std::string& f = std::string (), |
|
190 char typ = '\0', char mod = '\0') |
|
191 : text (strsave (txt)), args (n), fw (w), prec (p), flags (f), |
|
192 type (typ), modifier (mod) { } |
|
193 |
|
194 printf_format_elt (const printf_format_elt& e) |
|
195 : text (strsave (e.text)), args (e.args), fw (e.fw), prec (e.prec), |
|
196 flags (e.flags), type (e.type), modifier (e.modifier) { } |
|
197 |
|
198 printf_format_elt& operator = (const printf_format_elt& e) |
|
199 { |
|
200 if (this != &e) |
|
201 { |
|
202 text = strsave (e.text); |
|
203 args = e.args; |
|
204 fw = e.fw; |
|
205 prec = e.prec; |
|
206 flags = e.flags; |
|
207 type = e.type; |
|
208 modifier = e.modifier; |
|
209 } |
2117
|
210 |
3640
|
211 return *this; |
|
212 } |
2117
|
213 |
3640
|
214 ~printf_format_elt (void) { delete [] text; } |
|
215 |
|
216 // The C-style format string. |
2117
|
217 const char *text; |
3640
|
218 |
|
219 // How many args do we expect to consume? |
2117
|
220 int args; |
3640
|
221 |
|
222 // Field width. |
|
223 int fw; |
|
224 |
|
225 // Precision. |
|
226 int prec; |
|
227 |
|
228 // Flags -- `-', `+', ` ', `0', or `#'. |
3642
|
229 std::string flags; |
3640
|
230 |
|
231 // Type of conversion -- `d', `i', `o', `x', `X', `u', `c', `s', |
|
232 // `f', `e', `E', `g', `G', `p', or `%' |
2117
|
233 char type; |
3640
|
234 |
|
235 // A length modifier -- `h', `l', or `L'. |
2117
|
236 char modifier; |
|
237 }; |
|
238 |
|
239 class |
|
240 printf_format_list |
|
241 { |
|
242 public: |
|
243 |
3523
|
244 printf_format_list (const std::string& fmt = std::string ()); |
2117
|
245 |
|
246 ~printf_format_list (void); |
|
247 |
|
248 int num_conversions (void) { return nconv; } |
|
249 |
|
250 const printf_format_elt *first (void) |
|
251 { |
|
252 curr_idx = 0; |
|
253 return current (); |
|
254 } |
|
255 |
|
256 const printf_format_elt *current (void) const |
|
257 { return list.length () > 0 ? list.elem (curr_idx) : 0; } |
|
258 |
3640
|
259 const printf_format_elt *next (bool cycle = true) |
2117
|
260 { |
|
261 curr_idx++; |
3640
|
262 |
2117
|
263 if (curr_idx >= list.length ()) |
3640
|
264 { |
|
265 if (cycle) |
|
266 curr_idx = 0; |
|
267 else |
|
268 return 0; |
|
269 } |
|
270 |
2117
|
271 return current (); |
|
272 } |
|
273 |
3640
|
274 bool last_elt_p (void) { return (curr_idx + 1 == list.length ()); } |
|
275 |
2117
|
276 void printme (void) const; |
|
277 |
|
278 bool ok (void) const { return (nconv >= 0); } |
|
279 |
3145
|
280 operator bool () const { return ok (); } |
2117
|
281 |
|
282 private: |
|
283 |
3642
|
284 // Number of conversions specified by this format string, or -1 if |
2117
|
285 // invalid conversions have been found. |
|
286 int nconv; |
|
287 |
|
288 // Index to current element; |
|
289 int curr_idx; |
|
290 |
|
291 // List of format elements. |
|
292 Array<printf_format_elt*> list; |
|
293 |
|
294 // Temporary buffer. |
4051
|
295 OSSTREAM *buf; |
2117
|
296 |
3640
|
297 void add_elt_to_list (int args, const std::string& flags, int fw, |
|
298 int prec, char type, char modifier, |
|
299 int& num_elts); |
|
300 |
|
301 void process_conversion (const std::string& s, int& i, int n, |
|
302 int& args, std::string& flags, int& fw, |
|
303 int& prec, char& modifier, char& type, |
|
304 int& num_elts); |
|
305 |
3523
|
306 void finish_conversion (const std::string& s, int& i, int args, |
3640
|
307 const std::string& flags, int fw, int prec, |
2117
|
308 char modifier, char& type, int& num_elts); |
|
309 |
|
310 // No copying! |
|
311 |
|
312 printf_format_list (const printf_format_list&); |
|
313 |
|
314 printf_format_list& operator = (const printf_format_list&); |
|
315 }; |
|
316 |
|
317 // Provide an interface for Octave streams. |
|
318 |
|
319 class |
|
320 octave_base_stream |
|
321 { |
|
322 friend class octave_stream; |
|
323 |
|
324 public: |
|
325 |
3544
|
326 octave_base_stream (std::ios::openmode arg_md = std::ios::in|std::ios::out, |
5015
|
327 oct_mach_info::float_format ff |
|
328 = oct_mach_info::native_float_format ()) |
3340
|
329 : count (0), md (arg_md), flt_fmt (ff), fail (false), open_state (true) |
|
330 { } |
2117
|
331 |
|
332 virtual ~octave_base_stream (void) { } |
|
333 |
|
334 // The remaining functions are not specific to input or output only, |
|
335 // and must be provided by the derived classes. |
|
336 |
|
337 // Position a stream at OFFSET relative to ORIGIN. |
|
338 |
4797
|
339 virtual int seek (long offset, int origin) = 0; |
2117
|
340 |
|
341 // Return current stream position. |
|
342 |
4797
|
343 virtual long tell (void) = 0; |
2117
|
344 |
3340
|
345 // Return TRUE if EOF has been reached on this stream. |
2117
|
346 |
|
347 virtual bool eof (void) const = 0; |
|
348 |
|
349 // The name of the file. |
|
350 |
3523
|
351 virtual std::string name (void) const = 0; |
2117
|
352 |
|
353 // If the derived class provides this function and it returns a |
|
354 // pointer to a valid istream, scanf(), read(), getl(), and gets() |
|
355 // will automatically work for this stream. |
|
356 |
3523
|
357 virtual std::istream *input_stream (void) { return 0; } |
2117
|
358 |
|
359 // If the derived class provides this function and it returns a |
|
360 // pointer to a valid ostream, flush(), write(), and printf() will |
|
361 // automatically work for this stream. |
|
362 |
3523
|
363 virtual std::ostream *output_stream (void) { return 0; } |
2117
|
364 |
3340
|
365 // Return TRUE if this stream is open. |
|
366 |
|
367 bool is_open (void) const { return open_state; } |
|
368 |
3652
|
369 virtual void do_close (void) { } |
|
370 |
|
371 void close (void) |
|
372 { |
|
373 if (is_open ()) |
|
374 { |
|
375 open_state = false; |
|
376 do_close (); |
|
377 } |
|
378 } |
3340
|
379 |
3148
|
380 int file_number (void); |
3145
|
381 |
2117
|
382 bool ok (void) const { return ! fail; } |
|
383 |
|
384 // Return current error message for this stream. |
|
385 |
3523
|
386 std::string error (bool clear, int& err_num); |
2117
|
387 |
|
388 protected: |
|
389 |
3340
|
390 int mode (void) const { return md; } |
2117
|
391 |
3340
|
392 oct_mach_info::float_format float_format (void) const { return flt_fmt; } |
2117
|
393 |
|
394 // Set current error state and set fail to TRUE. |
|
395 |
3523
|
396 void error (const std::string& msg); |
4468
|
397 void error (const std::string& who, const std::string& msg); |
2117
|
398 |
|
399 // Clear any error message and set fail to FALSE. |
|
400 |
|
401 void clear (void); |
|
402 |
4889
|
403 // Clear stream state. |
|
404 |
|
405 void clearerr (void); |
|
406 |
2117
|
407 private: |
|
408 |
3340
|
409 // A reference count. |
5275
|
410 octave_idx_type count; |
3340
|
411 |
2117
|
412 // The permission bits for the file. Should be some combination of |
3544
|
413 // std::ios::open_mode bits. |
2117
|
414 int md; |
|
415 |
|
416 // Data format. |
2317
|
417 oct_mach_info::float_format flt_fmt; |
2117
|
418 |
|
419 // TRUE if an error has occurred. |
|
420 bool fail; |
|
421 |
3340
|
422 // TRUE if this stream is open. |
|
423 bool open_state; |
|
424 |
2117
|
425 // Should contain error message if fail is TRUE. |
3523
|
426 std::string errmsg; |
2117
|
427 |
|
428 // Functions that are defined for all input streams (input streams |
|
429 // are those that define is). |
|
430 |
5275
|
431 std::string do_gets (octave_idx_type max_len, bool& err, bool strip_newline, |
4468
|
432 const std::string& who /* = "gets" */); |
2117
|
433 |
5275
|
434 std::string getl (octave_idx_type max_len, bool& err, const std::string& who /* = "getl" */); |
|
435 std::string gets (octave_idx_type max_len, bool& err, const std::string& who /* = "gets" */); |
2117
|
436 |
5275
|
437 octave_value do_scanf (scanf_format_list& fmt_list, octave_idx_type nr, octave_idx_type nc, |
|
438 bool one_elt_size_spec, octave_idx_type& count, |
4468
|
439 const std::string& who /* = "scanf" */); |
2117
|
440 |
4468
|
441 octave_value scanf (const std::string& fmt, const Array<double>& size, |
5275
|
442 octave_idx_type& count, const std::string& who /* = "scanf" */); |
2117
|
443 |
4468
|
444 bool do_oscanf (const scanf_format_elt *elt, octave_value&, |
|
445 const std::string& who /* = "scanf" */); |
2117
|
446 |
4468
|
447 octave_value_list oscanf (const std::string& fmt, |
|
448 const std::string& who /* = "scanf" */); |
2215
|
449 |
2117
|
450 // Functions that are defined for all output streams (output streams |
|
451 // are those that define os). |
|
452 |
|
453 int flush (void); |
|
454 |
4468
|
455 int do_printf (printf_format_list& fmt_list, const octave_value_list& args, |
|
456 const std::string& who /* = "printf" */); |
2117
|
457 |
4468
|
458 int printf (const std::string& fmt, const octave_value_list& args, |
|
459 const std::string& who /* = "printf" */); |
2117
|
460 |
4468
|
461 int puts (const std::string& s, const std::string& who /* = "puts" */); |
2117
|
462 |
|
463 // We can always do this in terms of seek(), so the derived class |
|
464 // only has to provide that. |
|
465 |
|
466 int rewind (void); |
|
467 |
4468
|
468 void invalid_operation (const std::string& who, const char *rw); |
2117
|
469 |
|
470 // No copying! |
|
471 |
|
472 octave_base_stream (const octave_base_stream&); |
|
473 |
|
474 octave_base_stream& operator = (const octave_base_stream&); |
|
475 }; |
|
476 |
|
477 class |
|
478 octave_stream |
|
479 { |
|
480 public: |
|
481 |
3340
|
482 octave_stream (octave_base_stream *bs = 0); |
|
483 |
|
484 ~octave_stream (void); |
2117
|
485 |
3340
|
486 octave_stream (const octave_stream&); |
|
487 |
|
488 octave_stream& operator = (const octave_stream&); |
2117
|
489 |
|
490 int flush (void); |
|
491 |
5275
|
492 std::string getl (octave_idx_type max_len, bool& err, const std::string& who /* = "getl" */); |
4468
|
493 std::string getl (const octave_value& max_len, bool& err, |
|
494 const std::string& who /* = "getl" */); |
2117
|
495 |
5275
|
496 std::string gets (octave_idx_type max_len, bool& err, const std::string& who /* = "gets" */); |
4468
|
497 std::string gets (const octave_value& max_len, bool& err, |
|
498 const std::string& who /* = "gets" */); |
2117
|
499 |
4797
|
500 int seek (long offset, int origin); |
2117
|
501 int seek (const octave_value& offset, const octave_value& origin); |
|
502 |
4797
|
503 long tell (void); |
2117
|
504 |
|
505 int rewind (void); |
|
506 |
3340
|
507 bool is_open (void) const; |
|
508 |
|
509 void close (void); |
|
510 |
5275
|
511 octave_value read (const Array<double>& size, octave_idx_type block_size, |
4944
|
512 oct_data_conv::data_type input_type, |
|
513 oct_data_conv::data_type output_type, |
5275
|
514 octave_idx_type skip, oct_mach_info::float_format flt_fmt, |
|
515 octave_idx_type& count); |
2117
|
516 |
5275
|
517 octave_idx_type write (const octave_value& data, octave_idx_type block_size, |
4944
|
518 oct_data_conv::data_type output_type, |
5275
|
519 octave_idx_type skip, oct_mach_info::float_format flt_fmt); |
4944
|
520 |
|
521 template <class T> |
5275
|
522 octave_idx_type write (const Array<T>&, octave_idx_type block_size, |
4944
|
523 oct_data_conv::data_type output_type, |
5275
|
524 octave_idx_type skip, oct_mach_info::float_format flt_fmt); |
2117
|
525 |
4468
|
526 octave_value scanf (const std::string& fmt, const Array<double>& size, |
5275
|
527 octave_idx_type& count, const std::string& who /* = "scanf" */); |
2117
|
528 |
5279
|
529 octave_value scanf (const octave_value& fmt, const Array<double>& size, |
5299
|
530 octave_idx_type& count, const std::string& who /* = "scanf" */); |
5279
|
531 |
4468
|
532 octave_value_list oscanf (const std::string& fmt, |
|
533 const std::string& who /* = "scanf" */); |
2215
|
534 |
5279
|
535 octave_value_list oscanf (const octave_value& fmt, |
|
536 const std::string& who /* = "scanf" */); |
|
537 |
4468
|
538 int printf (const std::string& fmt, const octave_value_list& args, |
|
539 const std::string& who /* = "printf" */); |
2117
|
540 |
5279
|
541 int printf (const octave_value& fmt, const octave_value_list& args, |
|
542 const std::string& who /* = "printf" */); |
|
543 |
4468
|
544 int puts (const std::string& s, const std::string& who /* = "puts" */); |
|
545 int puts (const octave_value& s, const std::string& who /* = "puts" */); |
2117
|
546 |
|
547 bool eof (void) const; |
|
548 |
3523
|
549 std::string error (bool clear, int& err_num); |
2117
|
550 |
3523
|
551 std::string error (bool clear = false) |
2117
|
552 { |
2435
|
553 int err_num; |
|
554 return error (clear, err_num); |
2117
|
555 } |
|
556 |
4799
|
557 // Set the error message and state. |
|
558 |
|
559 void error (const std::string& msg) |
|
560 { |
|
561 if (rep) |
|
562 rep->error (msg); |
|
563 } |
|
564 |
|
565 void error (const char *msg) { error (std::string (msg)); } |
|
566 |
3148
|
567 int file_number (void) { return rep ? rep->file_number () : -1; } |
3145
|
568 |
3340
|
569 bool is_valid (void) const { return (rep != 0); } |
|
570 |
2117
|
571 bool ok (void) const { return rep && rep->ok (); } |
|
572 |
3145
|
573 operator bool () const { return ok (); } |
2117
|
574 |
3523
|
575 std::string name (void) const; |
2117
|
576 |
3340
|
577 int mode (void) const; |
2117
|
578 |
3340
|
579 oct_mach_info::float_format float_format (void) const; |
2117
|
580 |
3523
|
581 static std::string mode_as_string (int mode); |
2117
|
582 |
3523
|
583 std::istream *input_stream (void) { return rep ? rep->input_stream () : 0; } |
2902
|
584 |
3523
|
585 std::ostream *output_stream (void) { return rep ? rep->output_stream () : 0; } |
2902
|
586 |
4889
|
587 void clearerr (void) { if (rep) rep->clearerr (); } |
|
588 |
2117
|
589 private: |
|
590 |
|
591 // The actual representation of this stream. |
|
592 octave_base_stream *rep; |
|
593 |
4468
|
594 void invalid_stream_error (const std::string& who) const; |
2117
|
595 |
4468
|
596 bool stream_ok (const std::string& who, bool clear = true) const |
2117
|
597 { |
|
598 bool retval = true; |
|
599 |
|
600 if (rep) |
|
601 { |
|
602 if (clear) |
|
603 rep->clear (); |
|
604 } |
|
605 else |
|
606 { |
|
607 retval = false; |
4468
|
608 invalid_stream_error (who); |
2117
|
609 } |
|
610 |
|
611 return retval; |
|
612 } |
4944
|
613 |
|
614 void invalid_operation (const std::string& who, const char *rw) |
|
615 { |
|
616 if (rep) |
|
617 rep->invalid_operation (who, rw); |
|
618 } |
2117
|
619 }; |
|
620 |
|
621 class |
|
622 octave_stream_list |
|
623 { |
|
624 protected: |
|
625 |
|
626 octave_stream_list (void) : list (32), curr_len (0) { } |
|
627 |
|
628 public: |
|
629 |
|
630 ~octave_stream_list (void) { } |
|
631 |
2926
|
632 static bool instance_ok (void); |
|
633 |
5353
|
634 static int insert (const octave_stream& os); |
2117
|
635 |
4468
|
636 static octave_stream |
|
637 lookup (int fid, const std::string& who = std::string ()); |
|
638 |
|
639 static octave_stream |
|
640 lookup (const octave_value& fid, const std::string& who = std::string ()); |
2117
|
641 |
3523
|
642 static int remove (int fid, const std::string& who = std::string ()); |
3341
|
643 static int remove (const octave_value& fid, |
3523
|
644 const std::string& who = std::string ()); |
2117
|
645 |
|
646 static void clear (void); |
|
647 |
|
648 static string_vector get_info (int fid); |
|
649 static string_vector get_info (const octave_value& fid); |
|
650 |
3523
|
651 static std::string list_open_files (void); |
2117
|
652 |
|
653 static octave_value open_file_numbers (void); |
|
654 |
2609
|
655 static int get_file_number (const octave_value& fid); |
|
656 |
2117
|
657 private: |
|
658 |
3340
|
659 Array<octave_stream> list; |
2117
|
660 |
|
661 int curr_len; |
|
662 |
|
663 static octave_stream_list *instance; |
|
664 |
5353
|
665 int do_insert (const octave_stream& os); |
2117
|
666 |
3523
|
667 octave_stream do_lookup (int fid, const std::string& who = std::string ()) const; |
3341
|
668 octave_stream do_lookup (const octave_value& fid, |
3523
|
669 const std::string& who = std::string ()) const; |
2117
|
670 |
3523
|
671 int do_remove (int fid, const std::string& who = std::string ()); |
|
672 int do_remove (const octave_value& fid, const std::string& who = std::string ()); |
2117
|
673 |
|
674 void do_clear (void); |
|
675 |
|
676 string_vector do_get_info (int fid) const; |
|
677 string_vector do_get_info (const octave_value& fid) const; |
|
678 |
3523
|
679 std::string do_list_open_files (void) const; |
2117
|
680 |
|
681 octave_value do_open_file_numbers (void) const; |
|
682 |
2609
|
683 int do_get_file_number (const octave_value& fid) const; |
2117
|
684 }; |
|
685 |
|
686 #endif |
|
687 |
|
688 /* |
|
689 ;;; Local Variables: *** |
|
690 ;;; mode: C++ *** |
|
691 ;;; End: *** |
|
692 */ |