1741
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1741
|
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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
1741
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
3503
|
31 #include <iostream> |
2980
|
32 #include <string> |
|
33 |
1741
|
34 #include "error.h" |
2980
|
35 #include "pager.h" |
2979
|
36 #include "oct-lvalue.h" |
2388
|
37 #include "ov.h" |
1741
|
38 #include "pt-exp.h" |
|
39 |
2980
|
40 // Expressions. |
2960
|
41 |
2980
|
42 bool |
|
43 tree_expression::is_logically_true (const char *warn_for) |
1741
|
44 { |
2980
|
45 bool expr_value = false; |
2971
|
46 |
2980
|
47 octave_value t1 = rvalue (); |
2960
|
48 |
2980
|
49 if (! error_state) |
1741
|
50 { |
2980
|
51 if (t1.is_defined ()) |
|
52 return t1.is_true (); |
2388
|
53 else |
2980
|
54 ::error ("%s: undefined value used in conditional expression", |
|
55 warn_for); |
1741
|
56 } |
2388
|
57 else |
2980
|
58 ::error ("%s: error evaluating conditional expression", warn_for); |
2388
|
59 |
2980
|
60 return expr_value; |
1741
|
61 } |
|
62 |
2086
|
63 octave_value |
2980
|
64 tree_expression::rvalue (void) |
1741
|
65 { |
2980
|
66 ::error ("invalid rvalue function called in expression"); |
|
67 return octave_value (); |
2971
|
68 } |
|
69 |
|
70 octave_value_list |
2982
|
71 tree_expression::rvalue (int) |
2971
|
72 { |
2980
|
73 ::error ("invalid rvalue function called in expression"); |
|
74 return octave_value_list (); |
2971
|
75 } |
|
76 |
2979
|
77 octave_lvalue |
2980
|
78 tree_expression::lvalue (void) |
2971
|
79 { |
2980
|
80 ::error ("invalid lvalue function called in expression"); |
|
81 return octave_lvalue (); |
2971
|
82 } |
|
83 |
3536
|
84 std::string |
2980
|
85 tree_expression::original_text (void) const |
2971
|
86 { |
3523
|
87 return std::string (); |
2958
|
88 } |
|
89 |
1741
|
90 /* |
|
91 ;;; Local Variables: *** |
|
92 ;;; mode: C++ *** |
|
93 ;;; End: *** |
|
94 */ |