1
|
1 /* |
|
2 |
1827
|
3 Copyright (C) 1996 John W. Eaton |
1
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
1299
|
23 #if defined (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
240
|
27 #ifdef HAVE_CONFIG_H |
1192
|
28 #include <config.h> |
1
|
29 #endif |
|
30 |
1558
|
31 #include <cctype> |
1355
|
32 #include <cstring> |
|
33 |
1728
|
34 #include <string> |
|
35 |
1558
|
36 #include <fstream.h> |
581
|
37 #include <iostream.h> |
|
38 |
1742
|
39 #include <SLList.h> |
|
40 |
2181
|
41 #include "Array-flags.h" |
|
42 |
1558
|
43 #include "mx-base.h" |
|
44 #include "Range.h" |
1755
|
45 #include "str-vec.h" |
1558
|
46 |
2181
|
47 #include "defun.h" |
1
|
48 #include "error.h" |
|
49 #include "gripes.h" |
1558
|
50 #include "idx-vector.h" |
1742
|
51 #include "mappers.h" |
747
|
52 #include "oct-map.h" |
1742
|
53 #include "oct-obj.h" |
1355
|
54 #include "pager.h" |
1558
|
55 #include "pr-output.h" |
|
56 #include "sysdep.h" |
1742
|
57 #include "pt-const.h" |
2124
|
58 #include "pt-walk.h" |
1558
|
59 #include "unwind-prot.h" |
1430
|
60 #include "utils.h" |
1558
|
61 #include "variables.h" |
|
62 |
2477
|
63 // We are likely to have a lot of tree_constant objects to allocate, |
|
64 // so make the grow_size large. |
|
65 octave_allocator |
|
66 tree_constant::allocator (sizeof (tree_constant), 1024); |
2475
|
67 |
2390
|
68 Octave_map |
|
69 tree_constant::map_value (void) const |
|
70 { |
|
71 return val.map_value (); |
|
72 } |
|
73 |
|
74 void |
|
75 tree_constant::print (void) |
|
76 { |
|
77 } |
|
78 |
|
79 octave_value |
|
80 tree_constant::eval (bool print_result) |
|
81 { |
|
82 if (print_result) |
|
83 val.print (); |
|
84 |
|
85 return val; |
|
86 } |
|
87 |
|
88 octave_value_list |
|
89 tree_constant::eval (bool, int, const octave_value_list& idx) |
|
90 { |
|
91 octave_value_list retval; |
|
92 |
|
93 if (idx.length () > 0) |
|
94 retval (0) = index (idx); |
|
95 else |
|
96 retval (0) = val; |
|
97 |
|
98 return retval; |
|
99 } |
|
100 |
|
101 octave_value |
|
102 tree_constant::lookup_map_element (const string&, bool, bool) |
|
103 { |
|
104 octave_value retval; |
|
105 error ("tree_constant::lookup_map_element() not implemented"); |
|
106 return retval; |
|
107 } |
|
108 |
|
109 octave_value |
|
110 tree_constant::lookup_map_element (SLList<string>&, bool, bool) |
|
111 { |
|
112 octave_value retval; |
|
113 error ("tree_constant::lookup_map_element() not implemented"); |
|
114 return retval; |
|
115 } |
|
116 |
|
117 void |
|
118 tree_constant::accept (tree_walker& tw) |
|
119 { |
|
120 tw.visit_constant (*this); |
|
121 } |
|
122 |
96
|
123 /* |
1
|
124 ;;; Local Variables: *** |
|
125 ;;; mode: C++ *** |
|
126 ;;; End: *** |
|
127 */ |