2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_value_h) |
|
24 #define octave_value_h 1 |
|
25 |
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
|
32 #include <string> |
|
33 |
|
34 class ostream; |
|
35 |
|
36 #include "Range.h" |
|
37 #include "idx-vector.h" |
|
38 #include "mx-base.h" |
2477
|
39 #include "oct-alloc.h" |
2942
|
40 #include "str-vec.h" |
|
41 |
3351
|
42 class Cell; |
2376
|
43 class Octave_map; |
2903
|
44 class octave_stream; |
2974
|
45 class octave_function; |
2376
|
46 class octave_value_list; |
2979
|
47 class octave_lvalue; |
2376
|
48 |
|
49 // Constants. |
|
50 |
|
51 // This just provides a way to avoid infinite recursion when building |
|
52 // octave_value objects. |
|
53 |
|
54 class |
|
55 octave_xvalue |
|
56 { |
|
57 public: |
|
58 |
|
59 octave_xvalue (void) { } |
|
60 }; |
|
61 |
2427
|
62 class octave_value; |
|
63 |
|
64 // XXX FIXME XXX -- these should probably really be inside the scope |
|
65 // of the octave_value class, but the cygwin32 beta16 version of g++ |
3203
|
66 // can't handle that. |
|
67 |
|
68 typedef octave_value (*unary_op_fcn) |
|
69 (const octave_value&); |
|
70 |
|
71 typedef void (*non_const_unary_op_fcn) |
|
72 (octave_value&); |
2427
|
73 |
|
74 typedef octave_value (*binary_op_fcn) |
|
75 (const octave_value&, const octave_value&); |
|
76 |
|
77 typedef octave_value (*assign_op_fcn) |
|
78 (octave_value&, const octave_value_list&, const octave_value&); |
|
79 |
|
80 typedef octave_value * (*type_conv_fcn) (const octave_value&); |
|
81 |
2376
|
82 class |
2974
|
83 octave_value |
2376
|
84 { |
|
85 public: |
|
86 |
3203
|
87 enum unary_op |
|
88 { |
|
89 not, |
|
90 uminus, |
|
91 transpose, |
|
92 hermitian, |
|
93 incr, |
|
94 decr, |
|
95 num_unary_ops, |
|
96 unknown_unary_op |
|
97 }; |
|
98 |
2376
|
99 enum binary_op |
|
100 { |
|
101 add, |
|
102 sub, |
|
103 mul, |
|
104 div, |
|
105 pow, |
|
106 ldiv, |
2903
|
107 lshift, |
|
108 rshift, |
2376
|
109 lt, |
|
110 le, |
|
111 eq, |
|
112 ge, |
|
113 gt, |
|
114 ne, |
|
115 el_mul, |
|
116 el_div, |
|
117 el_pow, |
|
118 el_ldiv, |
|
119 el_and, |
|
120 el_or, |
|
121 struct_ref, |
|
122 num_binary_ops, |
|
123 unknown_binary_op |
|
124 }; |
|
125 |
2880
|
126 enum assign_op |
|
127 { |
|
128 asn_eq, |
|
129 add_eq, |
|
130 sub_eq, |
|
131 mul_eq, |
|
132 div_eq, |
3204
|
133 ldiv_eq, |
2903
|
134 lshift_eq, |
|
135 rshift_eq, |
2880
|
136 el_mul_eq, |
|
137 el_div_eq, |
3204
|
138 el_ldiv_eq, |
2880
|
139 el_and_eq, |
|
140 el_or_eq, |
|
141 num_assign_ops, |
|
142 unknown_assign_op |
|
143 }; |
|
144 |
3203
|
145 static string unary_op_as_string (unary_op); |
|
146 |
2376
|
147 static string binary_op_as_string (binary_op); |
|
148 |
2880
|
149 static string assign_op_as_string (assign_op); |
|
150 |
2376
|
151 enum magic_colon { magic_colon_t }; |
|
152 enum all_va_args { all_va_args_t }; |
|
153 |
|
154 octave_value (void); |
|
155 octave_value (double d); |
3351
|
156 octave_value (const Cell& m); |
2376
|
157 octave_value (const Matrix& m); |
|
158 octave_value (const DiagMatrix& d); |
3418
|
159 octave_value (const RowVector& v); |
|
160 octave_value (const ColumnVector& v); |
2376
|
161 octave_value (const Complex& C); |
|
162 octave_value (const ComplexMatrix& m); |
|
163 octave_value (const ComplexDiagMatrix& d); |
3418
|
164 octave_value (const ComplexRowVector& v); |
|
165 octave_value (const ComplexColumnVector& v); |
2825
|
166 octave_value (bool b); |
|
167 octave_value (const boolMatrix& bm); |
3189
|
168 octave_value (char c); |
2376
|
169 octave_value (const char *s); |
|
170 octave_value (const string& s); |
|
171 octave_value (const string_vector& s); |
|
172 octave_value (const charMatrix& chm, bool is_string = false); |
|
173 octave_value (double base, double limit, double inc); |
|
174 octave_value (const Range& r); |
|
175 octave_value (const Octave_map& m); |
3340
|
176 octave_value (const octave_stream& s, int n); |
2974
|
177 octave_value (octave_function *f); |
2880
|
178 octave_value (const octave_value_list& m); |
2376
|
179 octave_value (octave_value::magic_colon); |
|
180 octave_value (octave_value::all_va_args); |
|
181 |
|
182 octave_value (octave_value *new_rep); |
|
183 |
|
184 // Copy constructor. |
|
185 |
|
186 octave_value (const octave_value& a) |
|
187 { |
|
188 rep = a.rep; |
|
189 rep->count++; |
|
190 } |
|
191 |
|
192 // Delete the representation of this constant if the count drops to |
|
193 // zero. |
|
194 |
|
195 virtual ~octave_value (void); |
|
196 |
|
197 // This should only be called for derived types. |
|
198 |
2880
|
199 virtual octave_value *clone (void); |
2376
|
200 |
|
201 void make_unique (void) |
|
202 { |
|
203 if (rep->count > 1) |
|
204 { |
|
205 --rep->count; |
|
206 rep = rep->clone (); |
|
207 rep->count = 1; |
|
208 } |
|
209 } |
|
210 |
|
211 // Simple assignment. |
|
212 |
|
213 octave_value& operator = (const octave_value& a) |
|
214 { |
|
215 if (rep != a.rep) |
|
216 { |
|
217 if (--rep->count == 0) |
|
218 delete rep; |
|
219 |
|
220 rep = a.rep; |
|
221 rep->count++; |
|
222 } |
|
223 |
|
224 return *this; |
|
225 } |
|
226 |
3240
|
227 int get_count (void) { return rep->count; } |
3239
|
228 |
2409
|
229 virtual type_conv_fcn numeric_conversion_function (void) const |
2376
|
230 { return rep->numeric_conversion_function (); } |
|
231 |
2409
|
232 void maybe_mutate (void); |
|
233 |
2410
|
234 virtual octave_value *try_narrowing_conversion (void) |
|
235 { return rep->try_narrowing_conversion (); } |
2409
|
236 |
2974
|
237 virtual octave_value do_index_op (const octave_value_list& idx) |
2963
|
238 { return rep->do_index_op (idx); } |
2376
|
239 |
2974
|
240 virtual octave_value_list |
|
241 do_index_op (int nargout, const octave_value_list& idx); |
|
242 |
2963
|
243 void assign (assign_op, const octave_value& rhs); |
2880
|
244 |
2963
|
245 void assign (assign_op, const octave_value_list& idx, |
|
246 const octave_value& rhs); |
2376
|
247 |
2948
|
248 virtual void |
|
249 assign_struct_elt (assign_op, const string& elt_nm, |
|
250 const octave_value& rhs); |
|
251 |
|
252 virtual void |
|
253 assign_struct_elt (assign_op, const string& elt_nm, |
|
254 const octave_value_list& idx, const octave_value& rhs); |
|
255 |
2376
|
256 virtual idx_vector index_vector (void) const |
|
257 { return rep->index_vector (); } |
|
258 |
2420
|
259 virtual octave_value |
2963
|
260 do_struct_elt_index_op (const string& nm, bool silent = false) |
|
261 { return rep->do_struct_elt_index_op (nm, silent); } |
|
262 |
|
263 virtual octave_value |
|
264 do_struct_elt_index_op (const string& nm, const octave_value_list& idx, |
|
265 bool silent = false) |
|
266 { return rep->do_struct_elt_index_op (nm, idx, silent); } |
2376
|
267 |
2979
|
268 octave_lvalue struct_elt_ref (const string& nm); |
2948
|
269 |
2979
|
270 virtual octave_lvalue |
2948
|
271 struct_elt_ref (octave_value *parent, const string& nm); |
2376
|
272 |
|
273 // Size. |
|
274 |
|
275 virtual int rows (void) const |
|
276 { return rep->rows (); } |
|
277 |
|
278 virtual int columns (void) const |
|
279 { return rep->columns (); } |
|
280 |
3195
|
281 virtual int length (void) const |
|
282 { return rep->length (); } |
|
283 |
2376
|
284 // Does this constant have a type? Both of these are provided since |
|
285 // it is sometimes more natural to write is_undefined() instead of |
|
286 // ! is_defined(). |
|
287 |
|
288 virtual bool is_defined (void) const |
|
289 { return rep->is_defined (); } |
|
290 |
|
291 bool is_undefined (void) const |
|
292 { return ! is_defined (); } |
|
293 |
3351
|
294 virtual bool is_cell (void) const |
|
295 { return rep->is_cell (); } |
|
296 |
2376
|
297 virtual bool is_real_scalar (void) const |
|
298 { return rep->is_real_scalar (); } |
|
299 |
|
300 virtual bool is_real_matrix (void) const |
|
301 { return rep->is_real_matrix (); } |
|
302 |
|
303 virtual bool is_complex_scalar (void) const |
|
304 { return rep->is_complex_scalar (); } |
|
305 |
|
306 virtual bool is_complex_matrix (void) const |
|
307 { return rep->is_complex_matrix (); } |
|
308 |
|
309 virtual bool is_char_matrix (void) const |
|
310 { return rep->is_char_matrix (); } |
|
311 |
|
312 virtual bool is_string (void) const |
|
313 { return rep->is_string (); } |
|
314 |
|
315 virtual bool is_range (void) const |
|
316 { return rep->is_range (); } |
|
317 |
|
318 virtual bool is_map (void) const |
|
319 { return rep->is_map (); } |
|
320 |
3340
|
321 virtual bool is_stream (void) const |
|
322 { return rep->is_stream (); } |
|
323 |
2880
|
324 virtual bool is_list (void) const |
|
325 { return rep->is_list (); } |
|
326 |
2376
|
327 virtual bool is_magic_colon (void) const |
|
328 { return rep->is_magic_colon (); } |
|
329 |
|
330 virtual bool is_all_va_args (void) const |
|
331 { return rep->is_all_va_args (); } |
|
332 |
|
333 // Are any or all of the elements in this constant nonzero? |
|
334 |
|
335 virtual octave_value all (void) const |
|
336 { return rep->all (); } |
|
337 |
|
338 virtual octave_value any (void) const |
|
339 { return rep->any (); } |
|
340 |
|
341 // Other type stuff. |
|
342 |
3209
|
343 virtual bool is_bool_type (void) const |
|
344 { return rep->is_bool_type (); } |
|
345 |
2376
|
346 virtual bool is_real_type (void) const |
|
347 { return rep->is_real_type (); } |
|
348 |
|
349 virtual bool is_complex_type (void) const |
|
350 { return rep->is_complex_type (); } |
|
351 |
|
352 virtual bool is_scalar_type (void) const |
|
353 { return rep->is_scalar_type (); } |
|
354 |
|
355 virtual bool is_matrix_type (void) const |
|
356 { return rep->is_matrix_type (); } |
|
357 |
|
358 virtual bool is_numeric_type (void) const |
|
359 { return rep->is_numeric_type (); } |
|
360 |
|
361 virtual bool valid_as_scalar_index (void) const |
|
362 { return rep->valid_as_scalar_index (); } |
|
363 |
|
364 virtual bool valid_as_zero_index (void) const |
|
365 { return rep->valid_as_zero_index (); } |
|
366 |
|
367 // Does this constant correspond to a truth value? |
|
368 |
|
369 virtual bool is_true (void) const |
|
370 { return rep->is_true (); } |
|
371 |
|
372 // Is at least one of the dimensions of this constant zero? |
|
373 |
|
374 virtual bool is_empty (void) const |
|
375 { return rep->is_empty (); } |
|
376 |
|
377 // Are the dimensions of this constant zero by zero? |
|
378 |
|
379 virtual bool is_zero_by_zero (void) const |
|
380 { return rep->is_zero_by_zero (); } |
|
381 |
2974
|
382 virtual bool is_constant (void) const |
|
383 { return rep->is_constant (); } |
|
384 |
|
385 virtual bool is_function (void) const |
|
386 { return rep->is_function (); } |
2891
|
387 |
3325
|
388 virtual bool is_builtin_function (void) const |
|
389 { return rep->is_builtin_function (); } |
|
390 |
|
391 virtual bool is_dld_function (void) const |
|
392 { return rep->is_dld_function (); } |
|
393 |
2376
|
394 // Values. |
|
395 |
2891
|
396 octave_value eval (void) { return *this; } |
|
397 |
3202
|
398 virtual int int_value (bool req_int = false, bool frc_str_conv = false) const |
|
399 { return rep->int_value (req_int, frc_str_conv); } |
|
400 |
|
401 virtual int nint_value (bool frc_str_conv = false) const |
|
402 { return rep->nint_value (frc_str_conv); } |
|
403 |
2376
|
404 virtual double double_value (bool frc_str_conv = false) const |
|
405 { return rep->double_value (frc_str_conv); } |
|
406 |
2916
|
407 virtual double scalar_value (bool frc_str_conv = false) const |
|
408 { return rep->scalar_value (frc_str_conv); } |
|
409 |
3351
|
410 virtual Cell cell_value (void) const; |
|
411 |
2376
|
412 virtual Matrix matrix_value (bool frc_str_conv = false) const |
|
413 { return rep->matrix_value (frc_str_conv); } |
|
414 |
|
415 virtual Complex complex_value (bool frc_str_conv = false) const |
|
416 { return rep->complex_value (frc_str_conv); } |
|
417 |
|
418 virtual ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const |
|
419 { return rep->complex_matrix_value (frc_str_conv); } |
|
420 |
|
421 virtual charMatrix char_matrix_value (bool frc_str_conv = false) const |
|
422 { return rep->char_matrix_value (frc_str_conv); } |
|
423 |
2493
|
424 virtual string_vector all_strings (void) const |
2376
|
425 { return rep->all_strings (); } |
|
426 |
|
427 virtual string string_value (void) const |
|
428 { return rep->string_value (); } |
|
429 |
|
430 virtual Range range_value (void) const |
|
431 { return rep->range_value (); } |
|
432 |
|
433 virtual Octave_map map_value (void) const; |
|
434 |
3340
|
435 virtual octave_stream stream_value (void) const; |
2903
|
436 |
|
437 virtual int stream_number (void) const; |
|
438 |
2974
|
439 virtual octave_function *function_value (bool silent = false); |
|
440 |
2880
|
441 virtual octave_value_list list_value (void) const; |
|
442 |
2825
|
443 virtual bool bool_value (void) const |
|
444 { return rep->bool_value (); } |
|
445 |
|
446 virtual boolMatrix bool_matrix_value (void) const |
|
447 { return rep->bool_matrix_value (); } |
|
448 |
2376
|
449 ColumnVector vector_value (bool frc_str_conv = false, |
|
450 bool frc_vec_conv = false) const; |
|
451 |
|
452 ComplexColumnVector |
|
453 complex_vector_value (bool frc_str_conv = false, |
|
454 bool frc_vec_conv = false) const; |
|
455 |
|
456 // Conversions. These should probably be private. If a user of this |
|
457 // class wants a certain kind of constant, he should simply ask for |
|
458 // it, and we should convert it if possible. |
|
459 |
|
460 virtual octave_value convert_to_str (void) const |
|
461 { return rep->convert_to_str (); } |
|
462 |
|
463 virtual void convert_to_row_or_column_vector (void) |
|
464 { rep->convert_to_row_or_column_vector (); } |
|
465 |
2903
|
466 virtual void print (ostream& os, bool pr_as_read_syntax = false) const |
2466
|
467 { rep->print (os, pr_as_read_syntax); } |
2376
|
468 |
2903
|
469 virtual void print_raw (ostream& os, bool pr_as_read_syntax = false) const |
|
470 { rep->print_raw (os, pr_as_read_syntax); } |
|
471 |
|
472 virtual bool print_name_tag (ostream& os, const string& name) const |
|
473 { return rep->print_name_tag (os, name); } |
2376
|
474 |
|
475 void print_with_name (ostream& os, const string& name, |
2903
|
476 bool print_padding = true) const; |
2376
|
477 |
|
478 virtual int type_id (void) const { return rep->type_id (); } |
|
479 |
|
480 virtual string type_name (void) const { return rep->type_name (); } |
|
481 |
3203
|
482 // Unary and binary operations. |
|
483 |
|
484 friend octave_value do_unary_op (octave_value::unary_op, |
|
485 const octave_value&); |
|
486 |
|
487 void do_non_const_unary_op (octave_value::unary_op); |
2376
|
488 |
3205
|
489 void do_non_const_unary_op (octave_value::unary_op, |
|
490 const octave_value_list& idx); |
|
491 |
2575
|
492 friend octave_value do_binary_op (octave_value::binary_op, |
|
493 const octave_value&, |
|
494 const octave_value&); |
2376
|
495 |
3301
|
496 const octave_value& get_rep (void) const { return *rep; } |
|
497 |
2376
|
498 protected: |
|
499 |
|
500 octave_value (const octave_xvalue&) : rep (0) { } |
|
501 |
2903
|
502 void reset_indent_level (void) const |
|
503 { curr_print_indent_level = 0; } |
|
504 |
|
505 void increment_indent_level (void) const |
|
506 { curr_print_indent_level += 2; } |
|
507 |
|
508 void decrement_indent_level (void) const |
|
509 { curr_print_indent_level -= 2; } |
|
510 |
|
511 int current_print_indent_level (void) const |
|
512 { return curr_print_indent_level; } |
|
513 |
|
514 void newline (ostream& os) const; |
|
515 |
|
516 void indent (ostream& os) const; |
|
517 |
|
518 void reset (void) const; |
|
519 |
2376
|
520 private: |
|
521 |
|
522 union |
|
523 { |
|
524 octave_value *rep; // The real representation. |
|
525 int count; // A reference count. |
|
526 }; |
2413
|
527 |
2880
|
528 bool convert_and_assign (assign_op, const octave_value_list& idx, |
2413
|
529 const octave_value& rhs); |
|
530 |
2880
|
531 bool try_assignment_with_conversion (assign_op, |
|
532 const octave_value_list& idx, |
2413
|
533 const octave_value& rhs); |
|
534 |
2880
|
535 bool try_assignment (assign_op, const octave_value_list& idx, |
2413
|
536 const octave_value& rhs); |
2903
|
537 |
|
538 static int curr_print_indent_level; |
|
539 static bool beginning_of_line; |
3204
|
540 |
3205
|
541 assign_op unary_op_to_assign_op (unary_op op); |
|
542 |
3204
|
543 binary_op op_eq_to_binary_op (assign_op op); |
|
544 |
|
545 void simple_assign (assign_op orig_op, const octave_value_list& idx, |
|
546 const octave_value& rhs); |
3219
|
547 |
|
548 DECLARE_OCTAVE_ALLOCATOR |
2376
|
549 }; |
|
550 |
3203
|
551 #define OV_UNOP_FN(name) \ |
|
552 inline octave_value \ |
|
553 name (const octave_value& a) \ |
|
554 { \ |
|
555 return do_unary_op (octave_value::name, a); \ |
|
556 } |
|
557 |
|
558 #define OV_UNOP_OP(name, op) \ |
|
559 inline octave_value \ |
|
560 operator op (const octave_value& a) \ |
|
561 { \ |
|
562 return name (a); \ |
|
563 } |
|
564 |
|
565 #define OV_UNOP_FN_OP(name, op) \ |
|
566 OV_UNOP_FN (name) \ |
|
567 OV_UNOP_OP (name, op) |
|
568 |
|
569 OV_UNOP_FN_OP (not, !) |
|
570 OV_UNOP_FN_OP (uminus, -) |
|
571 |
|
572 OV_UNOP_FN (transpose) |
|
573 OV_UNOP_FN (hermitian) |
|
574 |
|
575 // No simple way to define these for prefix and suffix ops? |
|
576 // |
|
577 // incr |
|
578 // decr |
|
579 |
|
580 #define OV_BINOP_FN(name) \ |
|
581 inline octave_value \ |
|
582 name (const octave_value& a1, const octave_value& a2) \ |
|
583 { \ |
|
584 return do_binary_op (octave_value::name, a1, a2); \ |
|
585 } |
|
586 |
|
587 #define OV_BINOP_OP(name, op) \ |
|
588 inline octave_value \ |
|
589 operator op (const octave_value& a1, const octave_value& a2) \ |
|
590 { \ |
|
591 return name (a1, a2); \ |
|
592 } |
|
593 |
|
594 #define OV_BINOP_FN_OP(name, op) \ |
|
595 OV_BINOP_FN (name) \ |
|
596 OV_BINOP_OP (name, op) |
|
597 |
|
598 OV_BINOP_FN_OP (add, +) |
|
599 OV_BINOP_FN_OP (sub, -) |
|
600 OV_BINOP_FN_OP (mul, *) |
|
601 OV_BINOP_FN_OP (div, /) |
|
602 |
|
603 OV_BINOP_FN (pow) |
|
604 OV_BINOP_FN (ldiv) |
|
605 OV_BINOP_FN (lshift) |
|
606 OV_BINOP_FN (rshift) |
|
607 |
|
608 OV_BINOP_FN_OP (lt, <) |
|
609 OV_BINOP_FN_OP (le, <=) |
|
610 OV_BINOP_FN_OP (eq, ==) |
|
611 OV_BINOP_FN_OP (ge, >=) |
|
612 OV_BINOP_FN_OP (gt, >) |
|
613 OV_BINOP_FN_OP (ne, !=) |
|
614 |
|
615 OV_BINOP_FN (el_mul) |
|
616 OV_BINOP_FN (el_div) |
|
617 OV_BINOP_FN (el_pow) |
|
618 OV_BINOP_FN (el_ldiv) |
|
619 OV_BINOP_FN (el_and) |
|
620 OV_BINOP_FN (el_or) |
|
621 |
|
622 OV_BINOP_FN (struct_ref) |
|
623 |
3219
|
624 // T_ID is the type id of struct objects, set by register_type(). |
|
625 // T_NAME is the type name of struct objects. |
|
626 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \ |
|
627 public: \ |
|
628 int type_id (void) const { return t_id; } \ |
|
629 string type_name (void) const { return t_name; } \ |
3301
|
630 static volatile int static_type_id (void) { return t_id; } \ |
3219
|
631 static void register_type (void) \ |
|
632 { t_id = octave_value_typeinfo::register_type (t_name); } \ |
|
633 \ |
|
634 private: \ |
3301
|
635 static volatile int t_id; \ |
3219
|
636 static const string t_name; |
|
637 |
|
638 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n) \ |
3301
|
639 volatile int t::t_id (-1); \ |
3219
|
640 const string t::t_name (n) |
|
641 |
2376
|
642 // If TRUE, allow assignments like |
|
643 // |
|
644 // octave> A(1) = 3; A(2) = 5 |
|
645 // |
|
646 // for A already defined and a matrix type. |
|
647 extern bool Vdo_fortran_indexing; |
|
648 |
|
649 // Should we allow things like: |
|
650 // |
|
651 // octave> 'abc' + 0 |
|
652 // 97 98 99 |
|
653 // |
|
654 // to happen? A positive value means yes. A negative value means |
|
655 // yes, but print a warning message. Zero means it should be |
|
656 // considered an error. |
|
657 extern int Vimplicit_str_to_num_ok; |
|
658 |
|
659 // Should we allow silent conversion of complex to real when a real |
|
660 // type is what we're really looking for? A positive value means yes. |
|
661 // A negative value means yes, but print a warning message. Zero |
|
662 // means it should be considered an error. |
|
663 extern int Vok_to_lose_imaginary_part; |
|
664 |
|
665 // If TRUE, print the name along with the value. |
|
666 extern bool Vprint_answer_id_name; |
|
667 |
|
668 // Should operations on empty matrices return empty matrices or an |
|
669 // error? A positive value means yes. A negative value means yes, |
|
670 // but print a warning message. Zero means it should be considered an |
|
671 // error. |
|
672 extern int Vpropagate_empty_matrices; |
|
673 |
|
674 // How many levels of structure elements should we print? |
|
675 extern int Vstruct_levels_to_print; |
|
676 |
|
677 // Allow divide by zero errors to be suppressed. |
|
678 extern bool Vwarn_divide_by_zero; |
|
679 |
3195
|
680 // If TRUE, resize matrices when performing and indexed assignment and |
|
681 // the indices are outside the current bounds. |
|
682 extern bool Vresize_on_range_error; |
|
683 |
2376
|
684 // Indentation level for structures. |
|
685 extern int struct_indent; |
|
686 |
|
687 extern void increment_struct_indent (void); |
|
688 extern void decrement_struct_indent (void); |
|
689 |
2880
|
690 // Indentation level for lists. |
|
691 extern int list_indent; |
|
692 |
|
693 extern void increment_list_indent (void); |
|
694 extern void decrement_list_indent (void); |
|
695 |
2376
|
696 extern void install_types (void); |
|
697 |
|
698 #endif |
|
699 |
|
700 /* |
|
701 ;; Local Variables: *** |
|
702 ;; mode: C++ *** |
|
703 ;; End: *** |
|
704 */ |