Mercurial > hg > octave-nkf
annotate src/pt-exp.cc @ 12121:87237a866c71 release-3-2-x
this branch is no longer maintained and is closed for further development
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 22 Jan 2011 01:00:54 -0500 |
parents | eb63fbe60fab |
children | cd96d29c5efa |
rev | line source |
---|---|
1741 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1996, 1997, 2000, 2002, 2004, 2005, 2007, 2008, |
4 2009 John W. Eaton | |
1741 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
1741 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
1741 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
3503 | 28 #include <iostream> |
2980 | 29 #include <string> |
30 | |
1741 | 31 #include "error.h" |
2980 | 32 #include "pager.h" |
2979 | 33 #include "oct-lvalue.h" |
2388 | 34 #include "ov.h" |
1741 | 35 #include "pt-exp.h" |
36 | |
2980 | 37 // Expressions. |
2960 | 38 |
2980 | 39 bool |
40 tree_expression::is_logically_true (const char *warn_for) | |
1741 | 41 { |
2980 | 42 bool expr_value = false; |
2971 | 43 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
44 octave_value t1 = rvalue1 (); |
2960 | 45 |
2980 | 46 if (! error_state) |
1741 | 47 { |
2980 | 48 if (t1.is_defined ()) |
49 return t1.is_true (); | |
2388 | 50 else |
2980 | 51 ::error ("%s: undefined value used in conditional expression", |
52 warn_for); | |
1741 | 53 } |
2388 | 54 |
2980 | 55 return expr_value; |
1741 | 56 } |
57 | |
2086 | 58 octave_value |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
59 tree_expression::rvalue1 (int) |
1741 | 60 { |
2980 | 61 ::error ("invalid rvalue function called in expression"); |
62 return octave_value (); | |
2971 | 63 } |
64 | |
65 octave_value_list | |
2982 | 66 tree_expression::rvalue (int) |
2971 | 67 { |
2980 | 68 ::error ("invalid rvalue function called in expression"); |
69 return octave_value_list (); | |
2971 | 70 } |
71 | |
2979 | 72 octave_lvalue |
2980 | 73 tree_expression::lvalue (void) |
2971 | 74 { |
2980 | 75 ::error ("invalid lvalue function called in expression"); |
76 return octave_lvalue (); | |
2971 | 77 } |
78 | |
3536 | 79 std::string |
2980 | 80 tree_expression::original_text (void) const |
2971 | 81 { |
3523 | 82 return std::string (); |
2958 | 83 } |
84 | |
1741 | 85 /* |
86 ;;; Local Variables: *** | |
87 ;;; mode: C++ *** | |
88 ;;; End: *** | |
89 */ |