GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-exp.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <iostream>
28 #include <string>
29 
30 #include "error.h"
31 #include "pager.h"
32 #include "oct-lvalue.h"
33 #include "ov.h"
34 #include "pt-exp.h"
35 
36 // Expressions.
37 
38 bool
39 tree_expression::is_logically_true (const char *warn_for)
40 {
41  bool expr_value = false;
42 
43  octave_value t1 = rvalue1 ();
44 
45  if (t1.is_defined ())
46  return t1.is_true ();
47  else
48  error ("%s: undefined value used in conditional expression", warn_for);
49 
50  return expr_value;
51 }
52 
55 {
56  error ("invalid rvalue function called in expression");
57 }
58 
61 {
62  error ("invalid rvalue function called in expression");
63 }
64 
66 tree_expression::rvalue (int nargout, const std::list<octave_lvalue> *)
67 {
68  return rvalue (nargout);
69 }
70 
73 {
74  error ("invalid lvalue function called in expression");
75 }
76 
79 {
80  return "";
81 }
virtual std::string original_text(void) const
Definition: pt-exp.cc:78
bool is_defined(void) const
Definition: ov.h:536
void error(const char *fmt,...)
Definition: error.cc:570
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
bool is_true(void) const
Definition: ov.h:687
virtual octave_value rvalue1(int nargout=1)
Definition: pt-exp.cc:54
virtual octave_lvalue lvalue(void)
Definition: pt-exp.cc:72
virtual octave_value_list rvalue(int nargout)
Definition: pt-exp.cc:60
virtual bool is_logically_true(const char *)
Definition: pt-exp.cc:39
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854