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 |
2475
|
63 // We are likely to have a lot of tree_constants to allocate, so make |
|
64 // the grow_size large. |
|
65 octave_allocator tree_constant::allocator (sizeof (tree_constant), 1024); |
|
66 |
2390
|
67 Octave_map |
|
68 tree_constant::map_value (void) const |
|
69 { |
|
70 return val.map_value (); |
|
71 } |
|
72 |
|
73 void |
|
74 tree_constant::print (void) |
|
75 { |
|
76 } |
|
77 |
|
78 octave_value |
|
79 tree_constant::eval (bool print_result) |
|
80 { |
|
81 if (print_result) |
|
82 val.print (); |
|
83 |
|
84 return val; |
|
85 } |
|
86 |
|
87 octave_value_list |
|
88 tree_constant::eval (bool, int, const octave_value_list& idx) |
|
89 { |
|
90 octave_value_list retval; |
|
91 |
|
92 if (idx.length () > 0) |
|
93 retval (0) = index (idx); |
|
94 else |
|
95 retval (0) = val; |
|
96 |
|
97 return retval; |
|
98 } |
|
99 |
|
100 octave_value |
|
101 tree_constant::lookup_map_element (const string&, bool, bool) |
|
102 { |
|
103 octave_value retval; |
|
104 error ("tree_constant::lookup_map_element() not implemented"); |
|
105 return retval; |
|
106 } |
|
107 |
|
108 octave_value |
|
109 tree_constant::lookup_map_element (SLList<string>&, bool, bool) |
|
110 { |
|
111 octave_value retval; |
|
112 error ("tree_constant::lookup_map_element() not implemented"); |
|
113 return retval; |
|
114 } |
|
115 |
|
116 void |
|
117 tree_constant::accept (tree_walker& tw) |
|
118 { |
|
119 tw.visit_constant (*this); |
|
120 } |
|
121 |
96
|
122 /* |
1
|
123 ;;; Local Variables: *** |
|
124 ;;; mode: C++ *** |
|
125 ;;; End: *** |
|
126 */ |