annotate libinterp/parse-tree/pt-mat.cc @ 23602:214cb58ccc1c

use pointer to scope instead of scope id Eliminate symbol table scope ID and the global list of all scopes indexed by numeric ID. Function scope data is now only accessible from the function itself, or by asking a scope for its parent scope (if it exists). The top-level and global scopes are now regular data members of the symbol table class instead of being static. Symbol table scopes are now created in the lexer when parsing a function begins and stored in the function object when finishing the construction of function object. If an error occurs while parsing a function, the list of any pending scopes is deleted.
author John W. Eaton <jwe@octave.org>
date Wed, 14 Jun 2017 11:53:34 -0400
parents 1b4f4ec53b4a
children 609658f98feb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
1 /*
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1996-2017 John W. Eaton
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
4
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
6
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
16
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6867
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6867
diff changeset
19 <http://www.gnu.org/licenses/>.
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
20
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
21 */
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21261
diff changeset
24 # include "config.h"
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
25 #endif
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
26
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3373
diff changeset
27 #include <iostream>
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
28
19269
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
29 #include "oct-locbuf.h"
5502
dae5ba706ff2 [project @ 2005-10-20 06:37:30 by jwe]
jwe
parents: 5391
diff changeset
30 #include "quit.h"
dae5ba706ff2 [project @ 2005-10-20 06:37:30 by jwe]
jwe
parents: 5391
diff changeset
31
13294
7dce7e110511 make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents: 13219
diff changeset
32 #include "data.h"
2172
0de32e614930 [project @ 1996-05-13 15:00:42 by jwe]
jwe
parents: 2124
diff changeset
33 #include "defun.h"
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
34 #include "error.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
35 #include "errwarn.h"
22091
0f6fc2ec3b1a move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
36 #include "oct-map.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20853
diff changeset
37 #include "ovl.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents: 2971
diff changeset
38 #include "pt-arg-list.h"
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3661
diff changeset
39 #include "pt-bp.h"
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
40 #include "pt-exp.h"
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
41 #include "pt-mat.h"
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
42 #include "pt-tm-const.h"
2124
97a566037a75 [project @ 1996-05-12 07:16:36 by jwe]
jwe
parents: 2086
diff changeset
43 #include "pt-walk.h"
2201
e5db2ea7f7c8 [project @ 1996-05-15 05:37:55 by jwe]
jwe
parents: 2200
diff changeset
44 #include "utils.h"
2371
dd29ab8af9e7 [project @ 1996-10-12 00:09:55 by jwe]
jwe
parents: 2254
diff changeset
45 #include "ov.h"
dd29ab8af9e7 [project @ 1996-10-12 00:09:55 by jwe]
jwe
parents: 2254
diff changeset
46 #include "variables.h"
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
47
9460
1fddcf651559 avoid complex -> real conversion when constructing arrays with []
John W. Eaton <jwe@octave.org>
parents: 9389
diff changeset
48 #include "ov-cx-mat.h"
1fddcf651559 avoid complex -> real conversion when constructing arrays with []
John W. Eaton <jwe@octave.org>
parents: 9389
diff changeset
49 #include "ov-flt-cx-mat.h"
5630
512d0d11ae39 [project @ 2006-02-20 22:05:30 by dbateman]
dbateman
parents: 5533
diff changeset
50 #include "ov-re-sparse.h"
512d0d11ae39 [project @ 2006-02-20 22:05:30 by dbateman]
dbateman
parents: 5533
diff changeset
51 #include "ov-cx-sparse.h"
512d0d11ae39 [project @ 2006-02-20 22:05:30 by dbateman]
dbateman
parents: 5533
diff changeset
52
2254
0158c64f940c [project @ 1996-05-22 19:13:36 by jwe]
jwe
parents: 2201
diff changeset
53 // The character to fill with when creating string arrays.
3836
b8c1cb5b9fd9 [project @ 2001-05-31 19:30:49 by jwe]
jwe
parents: 3770
diff changeset
54 char Vstring_fill_char = ' ';
2254
0158c64f940c [project @ 1996-05-22 19:13:36 by jwe]
jwe
parents: 2201
diff changeset
55
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
56 namespace octave
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
57 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
58 std::string
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
59 get_concat_class (const std::string& c1, const std::string& c2)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
60 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
61 std::string retval = octave_base_value::static_class_name ();
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
62
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
63 if (c1 == c2)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
64 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
65 else if (c1.empty ())
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
66 retval = c2;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
67 else if (c2.empty ())
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
68 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
69 else if (c1 == "class" || c2 == "class")
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
70 retval = "class";
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
71 else
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
72 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
73 bool c1_is_int = (c1 == "int8" || c1 == "uint8"
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
74 || c1 == "int16" || c1 == "uint16"
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
75 || c1 == "int32" || c1 == "uint32"
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
76 || c1 == "int64" || c1 == "uint64");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
77 bool c2_is_int = (c2 == "int8" || c2 == "uint8"
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
78 || c2 == "int16" || c2 == "uint16"
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
79 || c2 == "int32" || c2 == "uint32"
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
80 || c2 == "int64" || c2 == "uint64");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
81
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
82 bool c1_is_char = (c1 == "char");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
83 bool c2_is_char = (c2 == "char");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
84
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
85 bool c1_is_double = (c1 == "double");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
86 bool c2_is_double = (c2 == "double");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
87
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
88 bool c1_is_single = (c1 == "single");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
89 bool c2_is_single = (c2 == "single");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
90
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
91 bool c1_is_logical = (c1 == "logical");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
92 bool c2_is_logical = (c2 == "logical");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
93
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
94 bool c1_is_built_in_type
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
95 = (c1_is_int || c1_is_char || c1_is_double || c1_is_single
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
96 || c1_is_logical);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
97
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
98 bool c2_is_built_in_type
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
99 = (c2_is_int || c2_is_char || c2_is_double || c2_is_single
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
100 || c2_is_logical);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
101
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
102 // Order is important here...
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
103
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
104 if (c1 == "struct" && c2 == c1)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
105 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
106 else if (c1 == "cell" || c2 == "cell")
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
107 retval = "cell";
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
108 else if (c1_is_char && c2_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
109 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
110 else if (c2_is_char && c1_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
111 retval = c2;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
112 else if (c1_is_int && c2_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
113 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
114 else if (c2_is_int && c1_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
115 retval = c2;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
116 else if (c1_is_single && c2_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
117 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
118 else if (c2_is_single && c1_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
119 retval = c2;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
120 else if (c1_is_double && c2_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
121 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
122 else if (c2_is_double && c1_is_built_in_type)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
123 retval = c2;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
124 else if (c1_is_logical && c2_is_logical)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
125 retval = c1;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
126 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
127
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
128 return retval;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
129 }
1827
effa9400766f [project @ 1996-02-02 14:07:51 by jwe]
jwe
parents: 1742
diff changeset
130
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
131 void
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
132 maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
133 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
134 if (! (all_dq_strings_p || all_sq_strings_p))
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
135 warning_with_id ("Octave:mixed-string-concat",
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
136 "concatenation of different character string types may have unintended consequences");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
137 }
5502
dae5ba706ff2 [project @ 2005-10-20 06:37:30 by jwe]
jwe
parents: 5391
diff changeset
138
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
139 tree_expression *
23602
214cb58ccc1c use pointer to scope instead of scope id
John W. Eaton <jwe@octave.org>
parents: 23573
diff changeset
140 tree_matrix::dup (symbol_table::scope& scope) const
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
141 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
142 tree_matrix *new_matrix = new tree_matrix (0, line (), column ());
5502
dae5ba706ff2 [project @ 2005-10-20 06:37:30 by jwe]
jwe
parents: 5391
diff changeset
143
23602
214cb58ccc1c use pointer to scope instead of scope id
John W. Eaton <jwe@octave.org>
parents: 23573
diff changeset
144 new_matrix->copy_base (*this, scope);
5502
dae5ba706ff2 [project @ 2005-10-20 06:37:30 by jwe]
jwe
parents: 5391
diff changeset
145
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
146 return new_matrix;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
147 }
1741
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
148 }
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
149
6ec1465f60f0 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents:
diff changeset
150
13140
98d23b0f16e1 maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents: 12864
diff changeset
151 /*
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
152 ## test concatenation with all zero matrices
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
153 %!assert ([ "" 65*ones(1,10) ], "AAAAAAAAAA")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
154 %!assert ([ 65*ones(1,10) "" ], "AAAAAAAAAA")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
155
13144
c99f24c10ca3 fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents: 13142
diff changeset
156 %!test
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
157 %! c = {"foo"; "bar"; "bazoloa"};
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
158 %! assert ([c; "a"; "bc"; "def"], {"foo"; "bar"; "bazoloa"; "a"; "bc"; "def"});
13144
c99f24c10ca3 fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents: 13142
diff changeset
159
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
160 %!assert (class ([int64(1), int64(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
161 %!assert (class ([int64(1), int32(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
162 %!assert (class ([int64(1), int16(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
163 %!assert (class ([int64(1), int8(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
164 %!assert (class ([int64(1), uint64(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
165 %!assert (class ([int64(1), uint32(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
166 %!assert (class ([int64(1), uint16(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
167 %!assert (class ([int64(1), uint8(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
168 %!assert (class ([int64(1), single(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
169 %!assert (class ([int64(1), double(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
170 %!assert (class ([int64(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
171 %!assert (class ([int64(1), true]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
172 %!assert (class ([int64(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
173
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
174 %!assert (class ([int32(1), int64(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
175 %!assert (class ([int32(1), int32(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
176 %!assert (class ([int32(1), int16(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
177 %!assert (class ([int32(1), int8(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
178 %!assert (class ([int32(1), uint64(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
179 %!assert (class ([int32(1), uint32(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
180 %!assert (class ([int32(1), uint16(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
181 %!assert (class ([int32(1), uint8(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
182 %!assert (class ([int32(1), single(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
183 %!assert (class ([int32(1), double(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
184 %!assert (class ([int32(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
185 %!assert (class ([int32(1), true]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
186 %!assert (class ([int32(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
187
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
188 %!assert (class ([int16(1), int64(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
189 %!assert (class ([int16(1), int32(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
190 %!assert (class ([int16(1), int16(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
191 %!assert (class ([int16(1), int8(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
192 %!assert (class ([int16(1), uint64(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
193 %!assert (class ([int16(1), uint32(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
194 %!assert (class ([int16(1), uint16(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
195 %!assert (class ([int16(1), uint8(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
196 %!assert (class ([int16(1), single(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
197 %!assert (class ([int16(1), double(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
198 %!assert (class ([int16(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
199 %!assert (class ([int16(1), true]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
200 %!assert (class ([int16(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
201
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
202 %!assert (class ([int8(1), int64(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
203 %!assert (class ([int8(1), int32(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
204 %!assert (class ([int8(1), int16(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
205 %!assert (class ([int8(1), int8(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
206 %!assert (class ([int8(1), uint64(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
207 %!assert (class ([int8(1), uint32(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
208 %!assert (class ([int8(1), uint16(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
209 %!assert (class ([int8(1), uint8(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
210 %!assert (class ([int8(1), single(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
211 %!assert (class ([int8(1), double(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
212 %!assert (class ([int8(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
213 %!assert (class ([int8(1), true]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
214 %!assert (class ([int8(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
215
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
216 %!assert (class ([uint64(1), int64(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
217 %!assert (class ([uint64(1), int32(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
218 %!assert (class ([uint64(1), int16(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
219 %!assert (class ([uint64(1), int8(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
220 %!assert (class ([uint64(1), uint64(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
221 %!assert (class ([uint64(1), uint32(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
222 %!assert (class ([uint64(1), uint16(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
223 %!assert (class ([uint64(1), uint8(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
224 %!assert (class ([uint64(1), single(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
225 %!assert (class ([uint64(1), double(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
226 %!assert (class ([uint64(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
227 %!assert (class ([uint64(1), true]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
228 %!assert (class ([uint64(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
229
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
230 %!assert (class ([uint32(1), int64(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
231 %!assert (class ([uint32(1), int32(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
232 %!assert (class ([uint32(1), int16(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
233 %!assert (class ([uint32(1), int8(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
234 %!assert (class ([uint32(1), uint64(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
235 %!assert (class ([uint32(1), uint32(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
236 %!assert (class ([uint32(1), uint16(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
237 %!assert (class ([uint32(1), uint8(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
238 %!assert (class ([uint32(1), single(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
239 %!assert (class ([uint32(1), double(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
240 %!assert (class ([uint32(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
241 %!assert (class ([uint32(1), true]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
242 %!assert (class ([uint32(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
243
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
244 %!assert (class ([uint16(1), int64(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
245 %!assert (class ([uint16(1), int32(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
246 %!assert (class ([uint16(1), int16(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
247 %!assert (class ([uint16(1), int8(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
248 %!assert (class ([uint16(1), uint64(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
249 %!assert (class ([uint16(1), uint32(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
250 %!assert (class ([uint16(1), uint16(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
251 %!assert (class ([uint16(1), uint8(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
252 %!assert (class ([uint16(1), single(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
253 %!assert (class ([uint16(1), double(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
254 %!assert (class ([uint16(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
255 %!assert (class ([uint16(1), true]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
256 %!assert (class ([uint16(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
257
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
258 %!assert (class ([uint8(1), int64(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
259 %!assert (class ([uint8(1), int32(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
260 %!assert (class ([uint8(1), int16(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
261 %!assert (class ([uint8(1), int8(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
262 %!assert (class ([uint8(1), uint64(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
263 %!assert (class ([uint8(1), uint32(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
264 %!assert (class ([uint8(1), uint16(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
265 %!assert (class ([uint8(1), uint8(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
266 %!assert (class ([uint8(1), single(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
267 %!assert (class ([uint8(1), double(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
268 %!assert (class ([uint8(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
269 %!assert (class ([uint8(1), true]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
270 %!assert (class ([uint8(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
271
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
272 %!assert (class ([single(1), int64(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
273 %!assert (class ([single(1), int32(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
274 %!assert (class ([single(1), int16(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
275 %!assert (class ([single(1), int8(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
276 %!assert (class ([single(1), uint64(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
277 %!assert (class ([single(1), uint32(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
278 %!assert (class ([single(1), uint16(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
279 %!assert (class ([single(1), uint8(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
280 %!assert (class ([single(1), single(1)]), "single")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
281 %!assert (class ([single(1), double(1)]), "single")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
282 %!assert (class ([single(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
283 %!assert (class ([single(1), true]), "single")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
284 %!assert (class ([single(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
285
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
286 %!assert (class ([double(1), int64(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
287 %!assert (class ([double(1), int32(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
288 %!assert (class ([double(1), int16(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
289 %!assert (class ([double(1), int8(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
290 %!assert (class ([double(1), uint64(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
291 %!assert (class ([double(1), uint32(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
292 %!assert (class ([double(1), uint16(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
293 %!assert (class ([double(1), uint8(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
294 %!assert (class ([double(1), single(1)]), "single")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
295 %!assert (class ([double(1), double(1)]), "double")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
296 %!assert (class ([double(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
297 %!assert (class ([double(1), true]), "double")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
298 %!assert (class ([double(1), "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
299
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
300 %!assert (class ([cell(1), int64(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
301 %!assert (class ([cell(1), int32(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
302 %!assert (class ([cell(1), int16(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
303 %!assert (class ([cell(1), int8(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
304 %!assert (class ([cell(1), uint64(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
305 %!assert (class ([cell(1), uint32(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
306 %!assert (class ([cell(1), uint16(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
307 %!assert (class ([cell(1), uint8(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
308 %!assert (class ([cell(1), single(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
309 %!assert (class ([cell(1), double(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
310 %!assert (class ([cell(1), cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
311 %!assert (class ([cell(1), true]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
312 %!assert (class ([cell(1), "a"]), "cell")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
313
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
314 %!assert (class ([true, int64(1)]), "int64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
315 %!assert (class ([true, int32(1)]), "int32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
316 %!assert (class ([true, int16(1)]), "int16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
317 %!assert (class ([true, int8(1)]), "int8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
318 %!assert (class ([true, uint64(1)]), "uint64")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
319 %!assert (class ([true, uint32(1)]), "uint32")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
320 %!assert (class ([true, uint16(1)]), "uint16")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
321 %!assert (class ([true, uint8(1)]), "uint8")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
322 %!assert (class ([true, single(1)]), "single")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
323 %!assert (class ([true, double(1)]), "double")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
324 %!assert (class ([true, cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
325 %!assert (class ([true, true]), "logical")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
326 %!assert (class ([true, "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
327
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
328 %!assert (class (["a", int64(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
329 %!assert (class (["a", int32(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
330 %!assert (class (["a", int16(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
331 %!assert (class (["a", int8(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
332 %!assert (class (["a", int64(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
333 %!assert (class (["a", int32(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
334 %!assert (class (["a", int16(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
335 %!assert (class (["a", int8(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
336 %!assert (class (["a", single(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
337 %!assert (class (["a", double(1)]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
338 %!assert (class (["a", cell(1)]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
339 %!assert (class (["a", true]), "char")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
340 %!assert (class (["a", "a"]), "char")
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 13140
diff changeset
341
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
342 %!assert (class ([cell(1), struct("foo", "bar")]), "cell")
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
343 %!error [struct("foo", "bar"), cell(1)]
16924
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
344
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23572
diff changeset
345 %!test <*39041> assert (class ([cell(0), struct()]), "cell")
23515
4d7928872999 Fix concatenation of a struct with an empty cell array (bug #39041)
Mike Miller <mtmiller@octave.org>
parents: 23435
diff changeset
346 %!test <51086> assert (class ([struct(), cell(0)]), "struct")
4d7928872999 Fix concatenation of a struct with an empty cell array (bug #39041)
Mike Miller <mtmiller@octave.org>
parents: 23435
diff changeset
347
16924
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
348 %!assert ([,1], 1)
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
349 %!assert ([1,], 1)
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
350 %!assert ([,1,], 1)
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
351 %!assert ([,1,;;], 1)
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
352 %!assert ([,1,;,;], 1)
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
353
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
354 %!assert ([1,1], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
355 %!assert ([,1,1], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
356 %!assert ([1,1,], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
357 %!assert ([,1,1,], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
358 %!assert ([,1,1,;;], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
359 %!assert ([,1,1,;,;], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
360 %!assert ([,;,1,1], ones (1, 2))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
361
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
362 %!assert ([1;1], ones (2, 1))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
363 %!assert ([1,;1], ones (2, 1))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
364 %!assert ([1,;,;1], ones (2, 1))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
365
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
366 %!error eval ("[,,]")
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
367 %!error eval ("[,,;,]")
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
368 %!error eval ("[,;,,;,]")
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
369
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
370 %!assert (isnull ([,]))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
371 %!assert (isnull ([;]))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
372 %!assert (isnull ([;;]))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
373 %!assert (isnull ([;,;]))
aebb54d99dba improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
374 %!assert (isnull ([,;,;,]))
13140
98d23b0f16e1 maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents: 12864
diff changeset
375 */
98d23b0f16e1 maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents: 12864
diff changeset
376
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
377 DEFUN (string_fill_char, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
378 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
379 @deftypefn {} {@var{val} =} string_fill_char ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
380 @deftypefnx {} {@var{old_val} =} string_fill_char (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
381 @deftypefnx {} {} string_fill_char (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
382 Query or set the internal variable used to pad all rows of a character
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
383 matrix to the same length.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
384
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
385 The value must be a single character and the default is @qcode{" "} (a
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
386 single space). For example:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
387
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
388 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
389 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
390 string_fill_char ("X");
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
391 [ "these"; "are"; "strings" ]
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
392 @result{} "theseXX"
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
393 "areXXXX"
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
394 "strings"
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
395 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
396 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
397
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
398 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
399 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
400 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
401 @end deftypefn */)
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
402 {
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
403 return SET_INTERNAL_VARIABLE (string_fill_char);
2172
0de32e614930 [project @ 1996-05-13 15:00:42 by jwe]
jwe
parents: 2124
diff changeset
404 }
12842
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
405
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
406 /*
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
407 ## string_fill_char() function call must be outside of %!test block
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
408 ## due to the way a %!test block is wrapped inside a function
12864
213c791292a6 test: Add 3 tests for string_fill_char()
Rik <octave@nomad.inbox5.com>
parents: 12842
diff changeset
409 %!shared orig_val, old_val
12842
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
410 %! orig_val = string_fill_char ();
12864
213c791292a6 test: Add 3 tests for string_fill_char()
Rik <octave@nomad.inbox5.com>
parents: 12842
diff changeset
411 %! old_val = string_fill_char ("X");
213c791292a6 test: Add 3 tests for string_fill_char()
Rik <octave@nomad.inbox5.com>
parents: 12842
diff changeset
412 %!test
12842
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
413 %! assert (orig_val, old_val);
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
414 %! assert (string_fill_char (), "X");
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
415 %! assert (["these"; "are"; "strings"], ["theseXX"; "areXXXX"; "strings"]);
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
416 %! string_fill_char (orig_val);
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
417 %! assert (string_fill_char (), orig_val);
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
418
21261
f982cfe3df03 When concatenating cells, suppress empty matrices (bug #43511).
Lachlan <lachlanbis@gmail.com>
parents: 21200
diff changeset
419 %!assert ( [ [], {1} ], {1} )
f982cfe3df03 When concatenating cells, suppress empty matrices (bug #43511).
Lachlan <lachlanbis@gmail.com>
parents: 21200
diff changeset
420
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
421 %!error (string_fill_char (1, 2))
12842
a52b4e9f45e3 codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
422 */