annotate libinterp/octave-value/ov-null-mat.cc @ 20163:075a5e2e1ba5 stable

doc: Update more docstrings to have one sentence summary as first line. Reviewed build-aux, libinterp/dldfcn, libinterp/octave-value, libinterp/parse-tree directories. * build-aux/mk-opts.pl, libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/amd.cc, libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/audioread.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc, libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc, libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc, libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc, libinterp/octave-value/ov-base.cc, libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-cell.cc, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-fcn-handle.cc, libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-struct.cc, libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov.cc, libinterp/parse-tree/lex.ll, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/pt-binop.cc, libinterp/parse-tree/pt-eval.cc, libinterp/parse-tree/pt-mat.cc: doc: Update more docstrings to have one sentence summary as first line.
author Rik <rik@octave.org>
date Sun, 03 May 2015 21:52:42 -0700
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
1 /*
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
3 Copyright (C) 2008-2015 Jaroslav Hajek
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
4
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
5 This file is part of Octave.
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
6
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
10 option) any later version.
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
11
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
15 for more details.
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
16
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
20
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
21 */
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
22
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
24 #include <config.h>
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25 #endif
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
26
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
27 #include "ov-null-mat.h"
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
28 #include "ops.h"
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
29 #include "defun.h"
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
30
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
31 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_matrix, "null_matrix",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
32 "double");
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
34 const octave_value octave_null_matrix::instance (new octave_null_matrix ());
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
35
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
36 static octave_base_value *
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
37 default_null_matrix_numeric_conversion_function (const octave_base_value& a)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
38 {
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
39 // The cast is not necessary?
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
40 // CAST_CONV_ARG (const octave_null_matrix&);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
41
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
42 return a.empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
43 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
44
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
45 octave_base_value::type_conv_info
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
46 octave_null_matrix::numeric_conversion_function (void) const
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
47 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
48 return octave_base_value::type_conv_info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
49 (default_null_matrix_numeric_conversion_function,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
50 octave_matrix::static_type_id ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
51 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
52
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
53 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_str, "null_string", "char");
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
54
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
55 const octave_value octave_null_str::instance (new octave_null_str ());
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
56
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
57 static octave_base_value *
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
58 default_null_str_numeric_conversion_function (const octave_base_value& a)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
59 {
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
60 // The cast is not necessary?
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
61 // CAST_CONV_ARG (const octave_null_str&);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
62
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
63 return a.empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
64 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
65
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
66 octave_base_value::type_conv_info
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
67 octave_null_str::numeric_conversion_function (void) const
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
68 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
69 return octave_base_value::type_conv_info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
70 (default_null_str_numeric_conversion_function,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
71 octave_char_matrix_str::static_type_id ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
72 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
73
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
74 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_sq_str, "null_sq_string",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
75 "char");
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
76
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
77 const octave_value octave_null_sq_str::instance (new octave_null_sq_str ());
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
78
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
79 static octave_base_value *
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
80 default_null_sq_str_numeric_conversion_function (const octave_base_value& a)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
81 {
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
82 // The cast is not necessary?
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
83 // CAST_CONV_ARG (const octave_null_sq_str&);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
84
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
85 return a.empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
86 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
87
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
88 octave_base_value::type_conv_info
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
89 octave_null_sq_str::numeric_conversion_function (void) const
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
90 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
91 return octave_base_value::type_conv_info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
92 (default_null_sq_str_numeric_conversion_function,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
93 octave_char_matrix_sq_str::static_type_id ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
94 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
95
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
96 DEFUN (isnull, args, ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
97 "-*- texinfo -*-\n\
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
98 @deftypefn {Built-in Function} {} isnull (@var{x})\n\
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10846
diff changeset
99 Return true if @var{x} is a special null matrix, string, or single quoted\n\
20163
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
100 string.\n\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
101 \n\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
102 Indexed assignment with such a value on the right-hand side should delete\n\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
103 array elements. This function should be used when overloading indexed\n\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
104 assignment for user-defined classes instead of @code{isempty}, to\n\
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10846
diff changeset
105 distinguish the cases:\n\
14366
b76f0740940e doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
106 \n\
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
107 @table @asis\n\
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
108 @item @code{A(I) = []}\n\
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
109 This should delete elements if @code{I} is nonempty.\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 8920
diff changeset
110 \n\
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
111 @item @code{X = []; A(I) = X}\n\
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
112 This should give an error if @code{I} is nonempty.\n\
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
113 @end table\n\
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10846
diff changeset
114 @seealso{isempty, isindex}\n\
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
115 @end deftypefn")
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
116 {
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
117 octave_value retval;
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
118
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
119 int nargin = args.length ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
120
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
121 if (nargin == 1 && args(0).is_defined ())
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
122 retval = args(0).is_null_value ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
123 else
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
124 print_usage ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
125
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
126 return retval;
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
127 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
128
12814
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
129 /*
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
130 %!assert (isnull ([]), true)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
131 %!assert (isnull ([1]), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
132 %!assert (isnull (zeros (0,3)), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
133 %!assert (isnull (""), true)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
134 %!assert (isnull ("A"), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
135 %!assert (isnull (''), true)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
136 %!assert (isnull ('A'), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
137 %!test
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
138 %! x = [];
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
139 %! assert (isnull (x), false);
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
140 */