Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-base-int.h @ 19589:b39cbe9f3bb0
allow ranges to be disabled
* ov.cc, ov.h: Allow creation of range object to be disabled.
Also allow range objects to be forced, even when generally disabled.
* pt-exp.h (tree_expression::for_cmd_expr): New member variable.
(tree_expression::mark_as_for_cmd_expr,
tree_expression::is_for_cmd_expr): New functions.
* oct-parse.in.yy: Mark for command expressions.
* pt-colon.cc (tree_colon_expression::make_range): Force creation of
range if expression is a for command expression.
* basics.txi, numbers.txi: Document changes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 08 Dec 2014 12:59:47 -0500 |
parents | 6113e0c6920b |
children | 76478d2da117 |
rev | line source |
---|---|
4903 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
3 Copyright (C) 2004-2013 John W. Eaton |
4903 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
4903 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
4903 | 20 |
21 */ | |
22 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
23 #if !defined (octave_ov_base_int_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #define octave_ov_base_int_h 1 |
4903 | 25 |
26 #include <cstdlib> | |
27 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
28 #include <iosfwd> |
4903 | 29 #include <string> |
30 | |
31 #include "mx-base.h" | |
32 #include "oct-alloc.h" | |
33 #include "str-vec.h" | |
34 | |
35 #include "error.h" | |
36 #include "ov-base.h" | |
37 #include "ov-base-mat.h" | |
38 #include "ov-base-scalar.h" | |
39 #include "ov-typeinfo.h" | |
40 | |
41 // base int matrix values. | |
42 | |
43 template <class T> | |
44 class | |
45 octave_base_int_matrix : public octave_base_matrix<T> | |
46 { | |
47 public: | |
48 | |
49 octave_base_int_matrix (void) : octave_base_matrix<T> () { } | |
50 | |
51 octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { } | |
52 | |
53 ~octave_base_int_matrix (void) { } | |
54 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 octave_base_value *clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 { return new octave_base_int_matrix (*this); } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 octave_base_value *empty_clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 { return new octave_base_int_matrix (); } |
4903 | 60 |
5759 | 61 octave_base_value *try_narrowing_conversion (void); |
4903 | 62 |
63 bool is_real_type (void) const { return true; } | |
64 | |
65 // void increment (void) { matrix += 1; } | |
66 | |
67 // void decrement (void) { matrix -= 1; } | |
68 | |
69 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |
70 | |
5992 | 71 octave_value convert_to_str_internal (bool, bool, char type) const; |
72 | |
6974 | 73 bool save_ascii (std::ostream& os); |
4903 | 74 |
75 bool load_ascii (std::istream& is); | |
76 | |
18833
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
77 bool save_binary (std::ostream& os, bool&); |
4903 | 78 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
79 bool load_binary (std::istream& is, bool swap, |
18833
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
80 oct_mach_info::float_format); |
4903 | 81 |
82 #if defined (HAVE_HDF5) | |
4917 | 83 bool save_hdf5 (hid_t loc_id, const char *name, bool); |
4903 | 84 |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
8950
diff
changeset
|
85 bool load_hdf5 (hid_t loc_id, const char *name); |
4903 | 86 #endif |
87 }; | |
88 | |
89 // base int scalar values. | |
90 | |
91 template <class T> | |
92 class | |
93 octave_base_int_scalar : public octave_base_scalar<T> | |
94 { | |
95 public: | |
96 | |
97 octave_base_int_scalar (void) : octave_base_scalar<T> () { } | |
98 | |
99 octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { } | |
100 | |
101 ~octave_base_int_scalar (void) { } | |
102 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 octave_base_value *clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 { return new octave_base_int_scalar (*this); } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 octave_base_value *empty_clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
106 { return new octave_base_int_scalar (); } |
4903 | 107 |
5759 | 108 octave_base_value *try_narrowing_conversion (void) { return 0; } |
4903 | 109 |
110 bool is_real_type (void) const { return true; } | |
111 | |
112 // void increment (void) { scalar += 1; } | |
113 | |
114 // void decrement (void) { scalar -= 1; } | |
115 | |
5992 | 116 octave_value convert_to_str_internal (bool, bool, char type) const; |
117 | |
6974 | 118 bool save_ascii (std::ostream& os); |
4903 | 119 |
120 bool load_ascii (std::istream& is); | |
121 | |
18833
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
122 bool save_binary (std::ostream& os, bool&); |
4903 | 123 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
124 bool load_binary (std::istream& is, bool swap, |
18833
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
125 oct_mach_info::float_format); |
4903 | 126 |
127 #if defined (HAVE_HDF5) | |
18833
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
128 bool save_hdf5 (hid_t loc_id, const char *name, bool); |
4903 | 129 |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
8950
diff
changeset
|
130 bool load_hdf5 (hid_t loc_id, const char *name); |
4903 | 131 #endif |
132 }; | |
133 | |
134 #endif |