Mercurial > hg > octave-lyh
annotate src/pt-exp.cc @ 14383:07c55bceca23 stable
Fix guarded_eval() subfunction in fminunc (bug #35534).
* fminunc.m: Fix guarded_eval() subfunction in fminunc (bug #35534).
author | Olaf Till <olaf.till@uni-jena.de> |
---|---|
date | Wed, 15 Feb 2012 14:44:37 +0100 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
1741 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 1996-2012 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1741 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1741 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
3503 | 27 #include <iostream> |
2980 | 28 #include <string> |
29 | |
1741 | 30 #include "error.h" |
2980 | 31 #include "pager.h" |
2979 | 32 #include "oct-lvalue.h" |
2388 | 33 #include "ov.h" |
1741 | 34 #include "pt-exp.h" |
35 | |
2980 | 36 // Expressions. |
2960 | 37 |
2980 | 38 bool |
39 tree_expression::is_logically_true (const char *warn_for) | |
1741 | 40 { |
2980 | 41 bool expr_value = false; |
2971 | 42 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
43 octave_value t1 = rvalue1 (); |
2960 | 44 |
2980 | 45 if (! error_state) |
1741 | 46 { |
2980 | 47 if (t1.is_defined ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
48 return t1.is_true (); |
2388 | 49 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
50 ::error ("%s: undefined value used in conditional expression", |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
51 warn_for); |
1741 | 52 } |
2388 | 53 |
2980 | 54 return expr_value; |
1741 | 55 } |
56 | |
2086 | 57 octave_value |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
58 tree_expression::rvalue1 (int) |
1741 | 59 { |
2980 | 60 ::error ("invalid rvalue function called in expression"); |
61 return octave_value (); | |
2971 | 62 } |
63 | |
64 octave_value_list | |
2982 | 65 tree_expression::rvalue (int) |
2971 | 66 { |
2980 | 67 ::error ("invalid rvalue function called in expression"); |
68 return octave_value_list (); | |
2971 | 69 } |
70 | |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
71 octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
72 tree_expression::rvalue (int nargout, const std::list<octave_lvalue> *) |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
73 { |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
74 return rvalue (nargout); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
75 } |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
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 } |