1741
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1741
|
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 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
1741
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
3503
|
31 #include <iostream> |
1741
|
32 |
2172
|
33 #include "defun.h" |
1741
|
34 #include "error.h" |
|
35 #include "oct-obj.h" |
2982
|
36 #include "pt-arg-list.h" |
3770
|
37 #include "pt-bp.h" |
1741
|
38 #include "pt-exp.h" |
|
39 #include "pt-mat.h" |
2124
|
40 #include "pt-walk.h" |
2201
|
41 #include "utils.h" |
2371
|
42 #include "ov.h" |
|
43 #include "variables.h" |
1741
|
44 |
4460
|
45 // If TRUE, print a warning message for empty elements in a matrix list. |
|
46 static bool Vwarn_empty_list_elements; |
2172
|
47 |
2254
|
48 // The character to fill with when creating string arrays. |
3836
|
49 char Vstring_fill_char = ' '; |
2254
|
50 |
1741
|
51 // General matrices. This list type is much more work to handle than |
|
52 // constant matrices, but it allows us to construct matrices from |
|
53 // other matrices, variables, and functions. |
|
54 |
1827
|
55 // But first, some internal classes that make our job much easier. |
1741
|
56 |
1827
|
57 class |
|
58 tm_row_const |
1741
|
59 { |
1827
|
60 private: |
|
61 |
|
62 class |
4219
|
63 tm_row_const_rep : public octave_base_list<octave_value> |
1827
|
64 { |
|
65 public: |
|
66 |
|
67 tm_row_const_rep (void) |
4765
|
68 : count (1), dv (), |
3110
|
69 all_str (false), some_str (false), is_cmplx (false), |
|
70 all_mt (true), ok (false) { } |
1827
|
71 |
2971
|
72 tm_row_const_rep (const tree_argument_list& row) |
4765
|
73 : count (1), dv (), |
3110
|
74 all_str (false), some_str (false), is_cmplx (false), |
|
75 all_mt (true), ok (false) |
|
76 { init (row); } |
1827
|
77 |
|
78 ~tm_row_const_rep (void) { } |
|
79 |
|
80 int count; |
|
81 |
4765
|
82 dim_vector dv; |
1741
|
83 |
1827
|
84 bool all_str; |
3110
|
85 bool some_str; |
1827
|
86 bool is_cmplx; |
2602
|
87 bool all_mt; |
1827
|
88 |
|
89 bool ok; |
|
90 |
4501
|
91 bool do_init_element (tree_expression *, const octave_value&, bool&); |
|
92 |
2971
|
93 void init (const tree_argument_list&); |
1827
|
94 |
|
95 private: |
|
96 |
|
97 tm_row_const_rep (const tm_row_const_rep&); |
|
98 |
2971
|
99 tm_row_const_rep& operator = (const tm_row_const_rep&); |
2419
|
100 |
3661
|
101 void eval_error (const char *msg, int l, int c, |
|
102 int x = -1, int y = -1) const; |
2419
|
103 |
|
104 void eval_warning (const char *msg, int l, int c) const; |
1827
|
105 }; |
|
106 |
|
107 public: |
|
108 |
4219
|
109 typedef tm_row_const_rep::iterator iterator; |
|
110 typedef tm_row_const_rep::const_iterator const_iterator; |
|
111 |
2990
|
112 tm_row_const (void) |
|
113 : rep (0) { } |
1827
|
114 |
2971
|
115 tm_row_const (const tree_argument_list& row) |
|
116 : rep (new tm_row_const_rep (row)) { } |
1827
|
117 |
2990
|
118 tm_row_const (const tm_row_const& x) |
|
119 : rep (x.rep) |
|
120 { |
|
121 if (rep) |
|
122 rep->count++; |
|
123 } |
1827
|
124 |
|
125 tm_row_const& operator = (const tm_row_const& x) |
2990
|
126 { |
|
127 if (this != &x && rep != x.rep) |
|
128 { |
|
129 if (rep && --rep->count == 0) |
|
130 delete rep; |
1741
|
131 |
2990
|
132 rep = x.rep; |
1827
|
133 |
2990
|
134 if (rep) |
|
135 rep->count++; |
|
136 } |
1741
|
137 |
2990
|
138 return *this; |
|
139 } |
1827
|
140 |
|
141 ~tm_row_const (void) |
2990
|
142 { |
|
143 if (rep && --rep->count == 0) |
|
144 delete rep; |
|
145 } |
1741
|
146 |
4765
|
147 int rows (void) |
|
148 { return (rep->dv.length () > 0 ? rep->dv(0) : 0); } |
|
149 |
|
150 int cols (void) |
|
151 { return (rep->dv.length () > 1 ? rep->dv(1) : 0); } |
|
152 |
|
153 dim_vector dims (void) { return rep->dv; } |
1827
|
154 |
2868
|
155 bool all_strings_p (void) const { return rep->all_str; } |
3110
|
156 bool some_strings_p (void) const { return rep->some_str; } |
2868
|
157 bool complex_p (void) const { return rep->is_cmplx; } |
|
158 bool all_empty_p (void) const { return rep->all_mt; } |
1827
|
159 |
4219
|
160 operator bool () const { return (rep && rep->ok); } |
1827
|
161 |
4219
|
162 iterator begin (void) { return rep->begin (); } |
|
163 const_iterator begin (void) const { return rep->begin (); } |
|
164 |
|
165 iterator end (void) { return rep->end (); } |
|
166 const_iterator end (void) const { return rep->end (); } |
1827
|
167 |
|
168 private: |
|
169 |
|
170 tm_row_const_rep *rep; |
|
171 }; |
|
172 |
4501
|
173 bool |
|
174 tm_row_const::tm_row_const_rep::do_init_element (tree_expression *elt, |
|
175 const octave_value& val, |
|
176 bool& first_elem) |
|
177 { |
|
178 int this_elt_nr = val.rows (); |
|
179 int this_elt_nc = val.columns (); |
|
180 |
4765
|
181 dim_vector this_elt_dv = val.dims (); |
|
182 |
|
183 if (!this_elt_dv.all_zero ()) |
4501
|
184 { |
|
185 all_mt = false; |
|
186 |
|
187 if (first_elem) |
|
188 { |
|
189 first_elem = false; |
|
190 |
4765
|
191 dv.resize (this_elt_dv.length ()); |
|
192 for (int i = 2; i < dv.length (); i++) |
|
193 dv.elem (i) = this_elt_dv.elem (i); |
|
194 |
|
195 dv.elem (0) = this_elt_nr; |
|
196 |
|
197 dv.elem (1) = 0; |
4501
|
198 } |
4765
|
199 else |
4501
|
200 { |
4765
|
201 if (this_elt_nr != dv (0)) |
|
202 { |
|
203 eval_error ("number of rows must match", |
|
204 elt->line (), elt->column (), this_elt_nr, dv (0)); |
|
205 return false; |
|
206 } |
|
207 for (int i = 2; i < this_elt_dv.length (); i++) |
|
208 { |
|
209 if (this_elt_dv (i) != dv (i)) |
|
210 { |
|
211 eval_error ("dimensions mismatch", elt->line (), elt->column (), this_elt_dv (i), dv (i)); |
|
212 return false; |
|
213 } |
|
214 } |
4501
|
215 } |
4765
|
216 dv.elem (1) = dv.elem (1) + this_elt_nc; |
4501
|
217 |
|
218 append (val); |
|
219 } |
|
220 else if (Vwarn_empty_list_elements) |
|
221 eval_warning ("empty matrix found in matrix list", |
|
222 elt->line (), elt->column ()); |
|
223 |
|
224 if (all_str && ! val.is_string ()) |
|
225 all_str = false; |
|
226 |
|
227 if (! some_str && val.is_string ()) |
|
228 some_str = true; |
|
229 |
|
230 if (! is_cmplx && val.is_complex_type ()) |
|
231 is_cmplx = true; |
|
232 |
|
233 return true; |
|
234 } |
|
235 |
1827
|
236 void |
2971
|
237 tm_row_const::tm_row_const_rep::init (const tree_argument_list& row) |
1827
|
238 { |
|
239 all_str = true; |
|
240 |
|
241 bool first_elem = true; |
|
242 |
4219
|
243 for (tree_argument_list::const_iterator p = row.begin (); |
|
244 p != row.end (); |
|
245 p++) |
1827
|
246 { |
4219
|
247 tree_expression *elt = *p; |
1827
|
248 |
2971
|
249 octave_value tmp = elt->rvalue (); |
1827
|
250 |
|
251 if (error_state || tmp.is_undefined ()) |
|
252 break; |
|
253 else |
|
254 { |
4501
|
255 if (tmp.is_cs_list ()) |
1827
|
256 { |
4587
|
257 octave_value_list tlst = tmp.list_value (); |
2602
|
258 |
4587
|
259 for (int i = 0; i < tlst.length (); i++) |
1827
|
260 { |
4587
|
261 if (! do_init_element (elt, tlst(i), first_elem)) |
4501
|
262 goto done; |
1827
|
263 } |
|
264 } |
4501
|
265 else |
|
266 { |
|
267 if (! do_init_element (elt, tmp, first_elem)) |
|
268 goto done; |
|
269 } |
1827
|
270 } |
|
271 } |
|
272 |
4501
|
273 done: |
|
274 |
1827
|
275 ok = ! error_state; |
1741
|
276 } |
|
277 |
2419
|
278 void |
|
279 tm_row_const::tm_row_const_rep::eval_error (const char *msg, int l, |
3661
|
280 int c, int x, int y) const |
2419
|
281 { |
|
282 if (l == -1 && c == -1) |
3661
|
283 { |
|
284 if (x == -1 || y == -1) |
|
285 ::error ("%s", msg); |
|
286 else |
|
287 ::error ("%s (%d != %d)", msg, x, y); |
|
288 } |
2419
|
289 else |
3661
|
290 { |
|
291 if (x == -1 || y == -1) |
|
292 ::error ("%s near line %d, column %d", msg, l, c); |
|
293 else |
|
294 ::error ("%s (%d != %d) near line %d, column %d", msg, x, y, l, c); |
|
295 } |
2419
|
296 } |
|
297 |
|
298 void |
|
299 tm_row_const::tm_row_const_rep::eval_warning (const char *msg, int l, |
|
300 int c) const |
|
301 { |
|
302 if (l == -1 && c == -1) |
|
303 ::warning ("%s", msg); |
|
304 else |
|
305 ::warning ("%s near line %d, column %d", msg, l, c); |
|
306 } |
|
307 |
1827
|
308 class |
4219
|
309 tm_const : public octave_base_list<tm_row_const> |
1827
|
310 { |
|
311 public: |
|
312 |
|
313 tm_const (const tree_matrix& tm) |
4765
|
314 : dv (), all_str (false), some_str (false), is_cmplx (false), |
3110
|
315 all_mt (true), ok (false) |
1827
|
316 { init (tm); } |
|
317 |
|
318 ~tm_const (void) { } |
|
319 |
4765
|
320 int rows (void) const { return (dv.length () > 0 ? dv.elem (0) : 0); } |
|
321 int cols (void) const { return (dv.length () > 1 ? dv.elem (1) : 0); } |
|
322 |
|
323 dim_vector dims (void) const { return dv; } |
1827
|
324 |
2868
|
325 bool all_strings_p (void) const { return all_str; } |
3110
|
326 bool some_strings_p (void) const { return some_str; } |
2868
|
327 bool complex_p (void) const { return is_cmplx; } |
|
328 bool all_empty_p (void) const { return all_mt; } |
1827
|
329 |
3145
|
330 operator bool () const { return ok; } |
1827
|
331 |
|
332 private: |
|
333 |
4765
|
334 dim_vector dv; |
1827
|
335 |
|
336 bool all_str; |
3110
|
337 bool some_str; |
1827
|
338 bool is_cmplx; |
2602
|
339 bool all_mt; |
1827
|
340 |
|
341 bool ok; |
|
342 |
|
343 tm_const (void); |
|
344 |
|
345 tm_const (const tm_const&); |
|
346 |
|
347 tm_const& operator = (const tm_const&); |
|
348 |
|
349 void init (const tree_matrix& tm); |
|
350 }; |
|
351 |
|
352 void |
|
353 tm_const::init (const tree_matrix& tm) |
1741
|
354 { |
1827
|
355 all_str = true; |
|
356 |
|
357 bool first_elem = true; |
|
358 |
|
359 // Just eval and figure out if what we have is complex or all |
|
360 // strings. We can't check columns until we know that this is a |
|
361 // numeric matrix -- collections of strings can have elements of |
|
362 // different lengths. |
|
363 |
4219
|
364 for (tree_matrix::const_iterator p = tm.begin (); p != tm.end (); p++) |
1827
|
365 { |
4219
|
366 tree_argument_list *elt = *p; |
1827
|
367 |
|
368 tm_row_const tmp (*elt); |
|
369 |
|
370 if (tmp) |
|
371 { |
2868
|
372 if (all_str && ! tmp.all_strings_p ()) |
1827
|
373 all_str = false; |
|
374 |
3110
|
375 if (! some_str && tmp.some_strings_p ()) |
|
376 some_str = true; |
|
377 |
2868
|
378 if (! is_cmplx && tmp.complex_p ()) |
1827
|
379 is_cmplx = true; |
|
380 |
2868
|
381 if (all_mt && ! tmp.all_empty_p ()) |
2602
|
382 all_mt = false; |
|
383 |
1827
|
384 append (tmp); |
|
385 } |
|
386 else |
|
387 break; |
|
388 } |
|
389 |
|
390 if (! error_state) |
|
391 { |
4219
|
392 for (iterator p = begin (); p != end (); p++) |
1827
|
393 { |
4219
|
394 tm_row_const elt = *p; |
1827
|
395 |
|
396 int this_elt_nr = elt.rows (); |
|
397 int this_elt_nc = elt.cols (); |
|
398 |
4765
|
399 dim_vector this_elt_dv = elt.dims (); |
|
400 |
|
401 if (!this_elt_dv.all_zero ()) |
1827
|
402 { |
2602
|
403 all_mt = false; |
|
404 |
1827
|
405 if (first_elem) |
|
406 { |
|
407 first_elem = false; |
|
408 |
4765
|
409 dv.resize (this_elt_dv.length ()); |
|
410 for (int i = 2; i < dv.length (); i++) |
|
411 dv.elem (i) = this_elt_dv.elem (i); |
|
412 |
|
413 dv.elem (0) = 0; |
|
414 |
|
415 dv.elem (1) = this_elt_nc; |
1827
|
416 } |
|
417 else if (all_str) |
|
418 { |
4765
|
419 if (this_elt_nc > cols ()) |
|
420 dv.elem (1) = this_elt_nc; |
1827
|
421 } |
4765
|
422 else |
1827
|
423 { |
4765
|
424 bool get_out = false; |
|
425 |
|
426 for (int i = 1; i < this_elt_dv.length (); i++) |
|
427 { |
|
428 if (i == 1 && this_elt_nc != dv (1)) |
|
429 { |
|
430 ::error ("number of columns must match (%d != %d)", |
|
431 this_elt_nc, dv (1)); |
|
432 get_out = true; |
|
433 break; |
|
434 } |
|
435 else if (this_elt_dv (i) != dv (i)) |
|
436 { |
|
437 ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, this_elt_dv (i), dv (i)); |
|
438 get_out = true; |
|
439 break; |
|
440 } |
|
441 } |
|
442 |
|
443 if (get_out) |
|
444 break; |
1827
|
445 } |
4765
|
446 dv.elem (0) = dv.elem (0) + this_elt_nr; |
1827
|
447 } |
4460
|
448 else if (Vwarn_empty_list_elements) |
|
449 warning ("empty matrix found in matrix list"); |
1827
|
450 } |
|
451 } |
|
452 |
|
453 ok = ! error_state; |
1741
|
454 } |
|
455 |
2990
|
456 tree_matrix::~tree_matrix (void) |
|
457 { |
4219
|
458 while (! empty ()) |
2990
|
459 { |
4219
|
460 iterator p = begin (); |
|
461 delete *p; |
|
462 erase (p); |
2990
|
463 } |
|
464 } |
|
465 |
1827
|
466 bool |
4267
|
467 tree_matrix::has_magic_end (void) const |
|
468 { |
|
469 for (const_iterator p = begin (); p != end (); p++) |
|
470 { |
|
471 tree_argument_list *elt = *p; |
|
472 |
|
473 if (elt && elt->has_magic_end ()) |
|
474 return true; |
|
475 } |
|
476 |
|
477 return false; |
|
478 } |
|
479 |
|
480 bool |
2529
|
481 tree_matrix::all_elements_are_constant (void) const |
1827
|
482 { |
4219
|
483 for (const_iterator p = begin (); p != end (); p++) |
1827
|
484 { |
4219
|
485 tree_argument_list *elt = *p; |
1827
|
486 |
2529
|
487 if (! elt->all_elements_are_constant ()) |
1827
|
488 return false; |
|
489 } |
|
490 |
|
491 return true; |
|
492 } |
|
493 |
|
494 // Just about as ugly as it gets. |
1741
|
495 // Less ugly than before, anyway. |
1827
|
496 // Looking better all the time. |
1741
|
497 |
2971
|
498 octave_value_list |
|
499 tree_matrix::rvalue (int nargout) |
|
500 { |
|
501 octave_value_list retval; |
|
502 |
3770
|
503 MAYBE_DO_BREAKPOINT; |
|
504 |
2971
|
505 if (nargout > 1) |
|
506 error ("invalid number of output arguments for matrix list"); |
|
507 else |
|
508 retval = rvalue (); |
|
509 |
|
510 return retval; |
|
511 } |
|
512 |
2086
|
513 octave_value |
2971
|
514 tree_matrix::rvalue (void) |
1741
|
515 { |
2086
|
516 octave_value retval; |
1741
|
517 |
1827
|
518 tm_const tmp (*this); |
1741
|
519 |
2868
|
520 bool all_strings_p = false; |
3110
|
521 bool some_strings_p = false; |
2868
|
522 bool all_empty_p = false; |
2602
|
523 |
3110
|
524 bool frc_str_conv = false; |
|
525 |
1827
|
526 if (tmp) |
|
527 { |
4765
|
528 dim_vector dv = tmp.dims (); |
1741
|
529 |
4765
|
530 NDArray nd; |
|
531 ComplexNDArray cnd; |
|
532 charNDArray chnd; |
1741
|
533 |
1827
|
534 // Now, extract the values from the individual elements and |
|
535 // insert them in the result matrix. |
1741
|
536 |
2868
|
537 bool found_complex = tmp.complex_p (); |
1741
|
538 |
2868
|
539 all_strings_p = tmp.all_strings_p (); |
3110
|
540 some_strings_p = tmp.some_strings_p (); |
2868
|
541 all_empty_p = tmp.all_empty_p (); |
2602
|
542 |
4452
|
543 frc_str_conv = some_strings_p; |
3110
|
544 |
2868
|
545 if (all_strings_p) |
4765
|
546 chnd.resize_and_fill (dv, Vstring_fill_char); |
1827
|
547 else if (found_complex) |
4765
|
548 cnd.resize_and_fill (dv, 0.0); |
1827
|
549 else |
4765
|
550 nd.resize_and_fill (dv, 0.0); |
1741
|
551 |
1827
|
552 int put_row = 0; |
1741
|
553 |
4219
|
554 for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) |
1827
|
555 { |
|
556 int put_col = 0; |
1741
|
557 |
4219
|
558 tm_row_const row = *p; |
1741
|
559 |
4219
|
560 for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) |
1827
|
561 { |
4219
|
562 octave_value elt = *q; |
1741
|
563 |
1827
|
564 if (found_complex) |
|
565 { |
|
566 if (elt.is_real_scalar ()) |
4765
|
567 cnd (put_row, put_col) = elt.double_value (); |
1827
|
568 else if (elt.is_real_matrix () || elt.is_range ()) |
4765
|
569 cnd.insert (elt.array_value (), put_row, put_col); |
1827
|
570 else if (elt.is_complex_scalar ()) |
4765
|
571 cnd (put_row, put_col) = elt.complex_value (); |
1827
|
572 else |
|
573 { |
4765
|
574 ComplexNDArray cnd_elt = elt.complex_array_value (); |
1741
|
575 |
1827
|
576 if (error_state) |
|
577 goto done; |
1741
|
578 |
4765
|
579 cnd.insert (cnd_elt, put_row, put_col); |
1827
|
580 } |
|
581 } |
|
582 else |
|
583 { |
|
584 if (elt.is_real_scalar ()) |
4765
|
585 nd (put_row, put_col) = elt.double_value (); |
2868
|
586 else if (elt.is_string () && all_strings_p) |
1827
|
587 { |
4765
|
588 charNDArray chnd_elt = elt.char_array_value (); |
1741
|
589 |
1827
|
590 if (error_state) |
|
591 goto done; |
1741
|
592 |
4765
|
593 chnd.insert (chnd_elt, put_row, put_col); |
1827
|
594 } |
|
595 else |
|
596 { |
4765
|
597 NDArray nd_elt = elt.array_value (frc_str_conv); |
1827
|
598 |
|
599 if (error_state) |
|
600 goto done; |
1741
|
601 |
4765
|
602 nd.insert (nd_elt, put_row, put_col); |
1827
|
603 } |
|
604 } |
|
605 |
4765
|
606 if (all_strings_p && chnd.rows () > 0 && chnd.cols () > 0) |
|
607 retval = octave_value (chnd, true); |
1827
|
608 else if (found_complex) |
4765
|
609 retval = cnd; |
1827
|
610 else |
4765
|
611 retval = nd; |
1827
|
612 |
|
613 put_col += elt.columns (); |
1741
|
614 } |
|
615 |
1827
|
616 put_row += row.rows (); |
1741
|
617 } |
|
618 } |
|
619 |
1827
|
620 done: |
1741
|
621 |
3110
|
622 if (! error_state) |
2602
|
623 { |
3110
|
624 if (retval.is_undefined () && all_empty_p) |
|
625 { |
|
626 if (all_strings_p) |
|
627 retval = ""; |
|
628 else |
4765
|
629 retval = NDArray (); |
3110
|
630 } |
|
631 else if (frc_str_conv && ! retval.is_string ()) |
|
632 retval = retval.convert_to_str (); |
2602
|
633 } |
|
634 |
1741
|
635 return retval; |
|
636 } |
|
637 |
|
638 void |
2124
|
639 tree_matrix::accept (tree_walker& tw) |
1741
|
640 { |
2124
|
641 tw.visit_matrix (*this); |
1741
|
642 } |
|
643 |
2172
|
644 static int |
4460
|
645 warn_empty_list_elements (void) |
2172
|
646 { |
4460
|
647 Vwarn_empty_list_elements = check_preference ("warn_empty_list_elements"); |
2172
|
648 |
|
649 return 0; |
|
650 } |
|
651 |
2254
|
652 static int |
|
653 string_fill_char (void) |
|
654 { |
|
655 int status = 0; |
|
656 |
3523
|
657 std::string s = builtin_string_variable ("string_fill_char"); |
2254
|
658 |
|
659 switch (s.length ()) |
|
660 { |
|
661 case 1: |
|
662 Vstring_fill_char = s[0]; |
|
663 break; |
|
664 |
|
665 case 0: |
|
666 Vstring_fill_char = '\0'; |
|
667 break; |
|
668 |
|
669 default: |
|
670 warning ("string_fill_char must be a single character"); |
|
671 status = -1; |
|
672 break; |
|
673 } |
|
674 |
|
675 return status; |
|
676 } |
|
677 |
2172
|
678 void |
|
679 symbols_of_pt_mat (void) |
|
680 { |
3258
|
681 DEFVAR (string_fill_char, " ", string_fill_char, |
3361
|
682 "-*- texinfo -*-\n\ |
|
683 @defvr {Built-in Variable} string_fill_char\n\ |
|
684 The value of this variable is used to pad all strings in a string matrix\n\ |
|
685 to the same length. It should be a single character. The default value\n\ |
|
686 is @code{\" \"} (a single space). For example,\n\ |
|
687 \n\ |
|
688 @example\n\ |
|
689 @group\n\ |
|
690 string_fill_char = \"X\";\n\ |
|
691 [ \"these\"; \"are\"; \"strings\" ]\n\ |
|
692 @result{} \"theseXX\"\n\ |
|
693 \"areXXXX\"\n\ |
|
694 \"strings\"\n\ |
|
695 @end group\n\ |
|
696 @end example\n\ |
3363
|
697 @end defvr"); |
4460
|
698 |
|
699 DEFVAR (warn_empty_list_elements, false, warn_empty_list_elements, |
|
700 "-*- texinfo -*-\n\ |
|
701 @defvr {Built-in Variable} warn_empty_list_elements\n\ |
|
702 If the value of @code{warn_empty_list_elements} is nonzero, print a\n\ |
|
703 warning when an empty matrix is found in a matrix list. For example,\n\ |
|
704 \n\ |
|
705 @example\n\ |
|
706 a = [1, [], 3, [], 5]\n\ |
|
707 @end example\n\ |
|
708 \n\ |
|
709 @noindent\n\ |
|
710 The default value is 0.\n\ |
|
711 @end defvr"); |
|
712 |
2172
|
713 } |
|
714 |
1741
|
715 /* |
|
716 ;;; Local Variables: *** |
|
717 ;;; mode: C++ *** |
|
718 ;;; End: *** |
|
719 */ |