annotate libinterp/parse-tree/pt-const.h @ 19632:76478d2da117

unconditionally disable the octave_allocator class * configure.ac: Delete the --enable-octave-allocator option. * oct-alloc.h: Delete octave_allocator class. Warn if file is included. Unconditionally define macros to be empty. * NEWS: Make note of these changes. * oct-alloc.cc: Delete. * liboctave/util/module.mk (UTIL_SRC): Remove it from the list. * make_int.cc, Cell.h, oct-obj.cc, oct-obj.h, audiodevinfo.cc, ov-base-int.h, ov-base-scalar.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc, ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-intx.h, ov-java.cc, ov-java.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, pt-const.cc, pt-const.h, idx-vector.cc, idx-vector.h: Delete uses of oct-alloc.h and OCTAVE_ALLOCATOR macros.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 13:43:29 -0500
parents ebb3ef964372
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
3 Copyright (C) 1993-2013 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
10 option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15 for more details.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 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: 5861
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: 5861
diff changeset
19 <http://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
23 #if !defined (octave_pt_const_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
24 #define octave_pt_const_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
26 #include <iosfwd>
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1630
diff changeset
27 #include <string>
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1630
diff changeset
28
500
5f91088cb98e [project @ 1994-07-08 02:16:02 by jwe]
jwe
parents: 495
diff changeset
29
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 1996
diff changeset
30 class octave_value_list;
2124
97a566037a75 [project @ 1996-05-12 07:16:36 by jwe]
jwe
parents: 2089
diff changeset
31 class tree_walker;
97a566037a75 [project @ 1996-05-12 07:16:36 by jwe]
jwe
parents: 2089
diff changeset
32
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2195
diff changeset
33 #include "ov.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
34 #include "pt-bp.h"
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
35 #include "pt-exp.h"
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
36 #include "symtab.h"
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 578
diff changeset
37
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
38 class
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
39 tree_constant : public tree_expression
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
40 {
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
41 public:
620
8e4e7e5f307e [project @ 1994-08-16 04:36:32 by jwe]
jwe
parents: 610
diff changeset
42
2879
4309724baab6 [project @ 1997-04-24 09:30:23 by jwe]
jwe
parents: 2859
diff changeset
43 tree_constant (int l = -1, int c = -1)
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
44 : tree_expression (l, c), val (), orig_text () { }
620
8e4e7e5f307e [project @ 1994-08-16 04:36:32 by jwe]
jwe
parents: 610
diff changeset
45
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2195
diff changeset
46 tree_constant (const octave_value& v, int l = -1, int c = -1)
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
47 : tree_expression (l, c), val (v), orig_text () { }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
48
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
49 tree_constant (const octave_value& v, const std::string& ot,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
50 int l = -1, int c = -1)
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
51 : tree_expression (l, c), val (v), orig_text (ot) { }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
52
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2195
diff changeset
53 ~tree_constant (void) { }
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2195
diff changeset
54
4267
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4192
diff changeset
55 bool has_magic_end (void) const { return false; }
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4192
diff changeset
56
1558
297e084c3857 [project @ 1995-10-12 07:20:28 by jwe]
jwe
parents: 1487
diff changeset
57 // Type. It would be nice to eliminate the need for this.
620
8e4e7e5f307e [project @ 1994-08-16 04:36:32 by jwe]
jwe
parents: 610
diff changeset
58
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3770
diff changeset
59 bool is_constant (void) const { return true; }
620
8e4e7e5f307e [project @ 1994-08-16 04:36:32 by jwe]
jwe
parents: 610
diff changeset
60
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3770
diff changeset
61 void maybe_mutate (void) { val.maybe_mutate (); }
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2390
diff changeset
62
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
63 void print (std::ostream& os, bool pr_as_read_syntax = false,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
64 bool pr_orig_txt = true);
1199
4f1bfa351b99 [project @ 1995-03-31 22:16:54 by jwe]
jwe
parents: 1168
diff changeset
65
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
66 void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
67 bool pr_orig_txt = true);
2942
026f342c2019 [project @ 1997-05-08 02:20:57 by jwe]
jwe
parents: 2891
diff changeset
68
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3770
diff changeset
69 bool rvalue_ok (void) const { return true; }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
70
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
71 octave_value rvalue1 (int = 1) { return val; }
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
72
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
73 octave_value_list rvalue (int nargout);
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
74
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
75 tree_expression *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
76 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
77
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
78 void accept (tree_walker& tw);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
79
1558
297e084c3857 [project @ 1995-10-12 07:20:28 by jwe]
jwe
parents: 1487
diff changeset
80 // Store the original text corresponding to this constant for later
297e084c3857 [project @ 1995-10-12 07:20:28 by jwe]
jwe
parents: 1487
diff changeset
81 // pretty printing.
620
8e4e7e5f307e [project @ 1994-08-16 04:36:32 by jwe]
jwe
parents: 610
diff changeset
82
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3770
diff changeset
83 void stash_original_text (const std::string& s) { orig_text = s; }
620
8e4e7e5f307e [project @ 1994-08-16 04:36:32 by jwe]
jwe
parents: 610
diff changeset
84
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3770
diff changeset
85 std::string original_text (void) const { return orig_text; }
2124
97a566037a75 [project @ 1996-05-12 07:16:36 by jwe]
jwe
parents: 2089
diff changeset
86
747
6182de8cb3b7 [project @ 1994-09-30 15:09:36 by jwe]
jwe
parents: 650
diff changeset
87 private:
6182de8cb3b7 [project @ 1994-09-30 15:09:36 by jwe]
jwe
parents: 650
diff changeset
88
2475
1d7925d6bede [project @ 1996-11-07 04:36:00 by jwe]
jwe
parents: 2468
diff changeset
89 // The actual value that this constant refers to.
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2195
diff changeset
90 octave_value val;
747
6182de8cb3b7 [project @ 1994-09-30 15:09:36 by jwe]
jwe
parents: 650
diff changeset
91
2475
1d7925d6bede [project @ 1996-11-07 04:36:00 by jwe]
jwe
parents: 2468
diff changeset
92 // The original text form of this constant.
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
93 std::string orig_text;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
94
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
95 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
96
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
97 tree_constant (const tree_constant&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
98
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
99 tree_constant& operator = (const tree_constant&);
13969
3b5afcec526b * pt-const.h, pt-const.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
100
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2195
diff changeset
101 };
2179
45052dc60643 [project @ 1996-05-13 17:21:52 by jwe]
jwe
parents: 2124
diff changeset
102
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
103 #endif