Mercurial > hg > octave-lyh
comparison src/pt-const.h @ 922:708827b941b4
[project @ 1994-11-14 22:14:13 by jwe]
author | jwe |
---|---|
date | Mon, 14 Nov 1994 22:14:13 +0000 |
parents | e8a677c3f042 |
children | df3c4da3adb0 |
comparison
equal
deleted
inserted
replaced
921:58f0c171bbbd | 922:708827b941b4 |
---|---|
54 tree_constant_rep *rep; | 54 tree_constant_rep *rep; |
55 | 55 |
56 public: | 56 public: |
57 | 57 |
58 enum magic_colon { magic_colon_t }; | 58 enum magic_colon { magic_colon_t }; |
59 enum all_va_args { all_va_args_t }; | |
59 | 60 |
60 // Constructors. It is possible to create the following types of | 61 // Constructors. It is possible to create the following types of |
61 // constants: | 62 // constants: |
62 // | 63 // |
63 // constant type constructor arguments | 64 // constant type constructor arguments |
75 // ComplexColumnVector | 76 // ComplexColumnVector |
76 // string char* (null terminated) | 77 // string char* (null terminated) |
77 // range double, double, dobule | 78 // range double, double, dobule |
78 // Range | 79 // Range |
79 // magic colon tree_constant::magic_colon | 80 // magic colon tree_constant::magic_colon |
81 // all_va_args tree_constant::all_va_args | |
80 | 82 |
81 tree_constant (void) : tree_fvc () | 83 tree_constant (void) : tree_fvc () |
82 { rep = new tree_constant_rep (); rep->count = 1; } | 84 { rep = new tree_constant_rep (); rep->count = 1; } |
83 | 85 |
84 tree_constant (double d) : tree_fvc () | 86 tree_constant (double d) : tree_fvc () |
125 | 127 |
126 tree_constant (tree_constant::magic_colon t) : tree_fvc () | 128 tree_constant (tree_constant::magic_colon t) : tree_fvc () |
127 { | 129 { |
128 tree_constant_rep::constant_type tmp; | 130 tree_constant_rep::constant_type tmp; |
129 tmp = tree_constant_rep::magic_colon; | 131 tmp = tree_constant_rep::magic_colon; |
132 rep = new tree_constant_rep (tmp); | |
133 rep->count = 1; | |
134 } | |
135 | |
136 tree_constant (tree_constant::all_va_args t) : tree_fvc () | |
137 { | |
138 tree_constant_rep::constant_type tmp; | |
139 tmp = tree_constant_rep::all_va_args; | |
130 rep = new tree_constant_rep (tmp); | 140 rep = new tree_constant_rep (tmp); |
131 rep->count = 1; | 141 rep->count = 1; |
132 } | 142 } |
133 | 143 |
134 // Copy constructor. | 144 // Copy constructor. |
200 int is_complex_matrix (void) const { return rep->is_complex_matrix (); } | 210 int is_complex_matrix (void) const { return rep->is_complex_matrix (); } |
201 int is_string (void) const { return rep->is_string (); } | 211 int is_string (void) const { return rep->is_string (); } |
202 int is_range (void) const { return rep->is_range (); } | 212 int is_range (void) const { return rep->is_range (); } |
203 int is_map (void) const { return rep->is_map (); } | 213 int is_map (void) const { return rep->is_map (); } |
204 int is_magic_colon (void) const { return rep->is_magic_colon (); } | 214 int is_magic_colon (void) const { return rep->is_magic_colon (); } |
215 int is_all_va_args (void) const { return rep->is_all_va_args (); } | |
205 | 216 |
206 // Are any or all of the elements in this constant nonzero? | 217 // Are any or all of the elements in this constant nonzero? |
207 | 218 |
208 tree_constant all (void) const { return rep->all (); } | 219 tree_constant all (void) const { return rep->all (); } |
209 tree_constant any (void) const { return rep->any (); } | 220 tree_constant any (void) const { return rep->any (); } |
234 | 245 |
235 // Is at least one of the dimensions of this constant zero? | 246 // Is at least one of the dimensions of this constant zero? |
236 | 247 |
237 int is_empty (void) const | 248 int is_empty (void) const |
238 { | 249 { |
239 return ((! (is_magic_colon () || is_unknown ())) | 250 return ((! (is_magic_colon () || is_all_va_args () || is_unknown ())) |
240 && (rows () == 0 || columns () == 0)); | 251 && (rows () == 0 || columns () == 0)); |
241 } | 252 } |
242 | 253 |
243 // Are the dimensions of this constant zero by zero? | 254 // Are the dimensions of this constant zero by zero? |
244 | 255 |
245 int is_zero_by_zero (void) const | 256 int is_zero_by_zero (void) const |
246 { | 257 { |
247 return ((! (is_magic_colon () || is_unknown ())) | 258 return ((! (is_magic_colon () || is_all_va_args () || is_unknown ())) |
248 && rows () == 0 && columns () == 0); | 259 && rows () == 0 && columns () == 0); |
249 } | 260 } |
250 | 261 |
251 // Values. | 262 // Values. |
252 | 263 |
387 } | 398 } |
388 #endif | 399 #endif |
389 | 400 |
390 tree_constant make_numeric_or_magic (void) const | 401 tree_constant make_numeric_or_magic (void) const |
391 { | 402 { |
392 if (is_numeric_type () || is_magic_colon ()) | 403 if (is_numeric_type () || is_all_va_args () || is_magic_colon ()) |
393 return *this; | 404 return *this; |
394 else | 405 else |
395 return rep->make_numeric (); | 406 return rep->make_numeric (); |
396 } | 407 } |
397 | 408 |
398 tree_constant make_numeric_or_range_or_magic (void) const | 409 tree_constant make_numeric_or_range_or_magic (void) const |
399 { | 410 { |
400 if (is_numeric_type () || is_range () || is_magic_colon ()) | 411 if (is_numeric_type () || is_range () || is_all_va_args () |
412 || is_magic_colon ()) | |
401 return *this; | 413 return *this; |
402 else | 414 else |
403 return rep->make_numeric (); | 415 return rep->make_numeric (); |
404 } | 416 } |
405 }; | 417 }; |