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