Mercurial > hg > octave-nkf
comparison src/ov.h @ 2880:0a076230ca87
[project @ 1997-04-24 09:47:41 by jwe]
author | jwe |
---|---|
date | Thu, 24 Apr 1997 09:47:41 +0000 |
parents | 8b262e771614 |
children | 1a30f46e1870 |
comparison
equal
deleted
inserted
replaced
2879:4309724baab6 | 2880:0a076230ca87 |
---|---|
35 | 35 |
36 #include "Range.h" | 36 #include "Range.h" |
37 #include "idx-vector.h" | 37 #include "idx-vector.h" |
38 #include "mx-base.h" | 38 #include "mx-base.h" |
39 #include "oct-alloc.h" | 39 #include "oct-alloc.h" |
40 #include "oct-sym.h" | |
40 #include "str-vec.h" | 41 #include "str-vec.h" |
41 | |
42 #include "error.h" | |
43 #include "pt-exp.h" | |
44 | 42 |
45 class Octave_map; | 43 class Octave_map; |
46 class octave_value_list; | 44 class octave_value_list; |
47 | 45 |
48 // Constants. | 46 // Constants. |
71 (octave_value&, const octave_value_list&, const octave_value&); | 69 (octave_value&, const octave_value_list&, const octave_value&); |
72 | 70 |
73 typedef octave_value * (*type_conv_fcn) (const octave_value&); | 71 typedef octave_value * (*type_conv_fcn) (const octave_value&); |
74 | 72 |
75 class | 73 class |
76 octave_value | 74 octave_value : public octave_symbol |
77 { | 75 { |
78 public: | 76 public: |
79 | 77 |
80 enum binary_op | 78 enum binary_op |
81 { | 79 { |
100 struct_ref, | 98 struct_ref, |
101 num_binary_ops, | 99 num_binary_ops, |
102 unknown_binary_op | 100 unknown_binary_op |
103 }; | 101 }; |
104 | 102 |
103 enum assign_op | |
104 { | |
105 asn_eq, | |
106 add_eq, | |
107 sub_eq, | |
108 mul_eq, | |
109 div_eq, | |
110 el_mul_eq, | |
111 el_div_eq, | |
112 el_and_eq, | |
113 el_or_eq, | |
114 num_assign_ops, | |
115 unknown_assign_op | |
116 }; | |
117 | |
105 static string binary_op_as_string (binary_op); | 118 static string binary_op_as_string (binary_op); |
119 | |
120 static string assign_op_as_string (assign_op); | |
106 | 121 |
107 enum magic_colon { magic_colon_t }; | 122 enum magic_colon { magic_colon_t }; |
108 enum all_va_args { all_va_args_t }; | 123 enum all_va_args { all_va_args_t }; |
109 | 124 |
110 octave_value (void); | 125 octave_value (void); |
125 octave_value (const string_vector& s); | 140 octave_value (const string_vector& s); |
126 octave_value (const charMatrix& chm, bool is_string = false); | 141 octave_value (const charMatrix& chm, bool is_string = false); |
127 octave_value (double base, double limit, double inc); | 142 octave_value (double base, double limit, double inc); |
128 octave_value (const Range& r); | 143 octave_value (const Range& r); |
129 octave_value (const Octave_map& m); | 144 octave_value (const Octave_map& m); |
145 octave_value (const octave_value_list& m); | |
130 octave_value (octave_value::magic_colon); | 146 octave_value (octave_value::magic_colon); |
131 octave_value (octave_value::all_va_args); | 147 octave_value (octave_value::all_va_args); |
132 | 148 |
133 octave_value (octave_value *new_rep); | 149 octave_value (octave_value *new_rep); |
134 | 150 |
145 | 161 |
146 virtual ~octave_value (void); | 162 virtual ~octave_value (void); |
147 | 163 |
148 // This should only be called for derived types. | 164 // This should only be called for derived types. |
149 | 165 |
150 virtual octave_value *clone (void) { panic_impossible (); } | 166 virtual octave_value *clone (void); |
151 | 167 |
152 void make_unique (void) | 168 void make_unique (void) |
153 { | 169 { |
154 if (rep->count > 1) | 170 if (rep->count > 1) |
155 { | 171 { |
190 { return rep->try_narrowing_conversion (); } | 206 { return rep->try_narrowing_conversion (); } |
191 | 207 |
192 virtual octave_value index (const octave_value_list& idx) const | 208 virtual octave_value index (const octave_value_list& idx) const |
193 { return rep->index (idx); } | 209 { return rep->index (idx); } |
194 | 210 |
195 octave_value& assign (const octave_value_list& idx, const octave_value& rhs); | 211 octave_value& assign (assign_op, const octave_value& rhs); |
212 | |
213 octave_value& assign (assign_op, const octave_value_list& idx, | |
214 const octave_value& rhs); | |
196 | 215 |
197 virtual idx_vector index_vector (void) const | 216 virtual idx_vector index_vector (void) const |
198 { return rep->index_vector (); } | 217 { return rep->index_vector (); } |
199 | 218 |
200 virtual octave_value | 219 virtual octave_value |
244 { return rep->is_range (); } | 263 { return rep->is_range (); } |
245 | 264 |
246 virtual bool is_map (void) const | 265 virtual bool is_map (void) const |
247 { return rep->is_map (); } | 266 { return rep->is_map (); } |
248 | 267 |
268 virtual bool is_list (void) const | |
269 { return rep->is_list (); } | |
270 | |
249 virtual bool is_magic_colon (void) const | 271 virtual bool is_magic_colon (void) const |
250 { return rep->is_magic_colon (); } | 272 { return rep->is_magic_colon (); } |
251 | 273 |
252 virtual bool is_all_va_args (void) const | 274 virtual bool is_all_va_args (void) const |
253 { return rep->is_all_va_args (); } | 275 { return rep->is_all_va_args (); } |
323 | 345 |
324 virtual Range range_value (void) const | 346 virtual Range range_value (void) const |
325 { return rep->range_value (); } | 347 { return rep->range_value (); } |
326 | 348 |
327 virtual Octave_map map_value (void) const; | 349 virtual Octave_map map_value (void) const; |
350 | |
351 virtual octave_value_list list_value (void) const; | |
328 | 352 |
329 virtual bool bool_value (void) const | 353 virtual bool bool_value (void) const |
330 { return rep->bool_value (); } | 354 { return rep->bool_value (); } |
331 | 355 |
332 virtual boolMatrix bool_matrix_value (void) const | 356 virtual boolMatrix bool_matrix_value (void) const |
407 { | 431 { |
408 octave_value *rep; // The real representation. | 432 octave_value *rep; // The real representation. |
409 int count; // A reference count. | 433 int count; // A reference count. |
410 }; | 434 }; |
411 | 435 |
412 bool convert_and_assign (const octave_value_list& idx, | 436 bool convert_and_assign (assign_op, const octave_value_list& idx, |
413 const octave_value& rhs); | 437 const octave_value& rhs); |
414 | 438 |
415 bool try_assignment_with_conversion (const octave_value_list& idx, | 439 bool try_assignment_with_conversion (assign_op, |
440 const octave_value_list& idx, | |
416 const octave_value& rhs); | 441 const octave_value& rhs); |
417 | 442 |
418 bool try_assignment (const octave_value_list& idx, | 443 bool try_assignment (assign_op, const octave_value_list& idx, |
419 const octave_value& rhs); | 444 const octave_value& rhs); |
420 }; | 445 }; |
421 | 446 |
422 // If TRUE, allow assignments like | 447 // If TRUE, allow assignments like |
423 // | 448 // |
470 extern bool Vwarn_divide_by_zero; | 495 extern bool Vwarn_divide_by_zero; |
471 | 496 |
472 // Indentation level for structures. | 497 // Indentation level for structures. |
473 extern int struct_indent; | 498 extern int struct_indent; |
474 | 499 |
475 extern void symbols_of_value (void); | |
476 | |
477 extern void increment_struct_indent (void); | 500 extern void increment_struct_indent (void); |
478 extern void decrement_struct_indent (void); | 501 extern void decrement_struct_indent (void); |
502 | |
503 // Indentation level for lists. | |
504 extern int list_indent; | |
505 | |
506 extern void increment_list_indent (void); | |
507 extern void decrement_list_indent (void); | |
508 | |
509 extern void symbols_of_value (void); | |
479 | 510 |
480 extern void install_types (void); | 511 extern void install_types (void); |
481 | 512 |
482 #endif | 513 #endif |
483 | 514 |