pt-exp.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <iostream>
00028 #include <string>
00029 
00030 #include "error.h"
00031 #include "pager.h"
00032 #include "oct-lvalue.h"
00033 #include "ov.h"
00034 #include "pt-exp.h"
00035 
00036 // Expressions.
00037 
00038 bool
00039 tree_expression::is_logically_true (const char *warn_for)
00040 {
00041   bool expr_value = false;
00042 
00043   octave_value t1 = rvalue1 ();
00044 
00045   if (! error_state)
00046     {
00047       if (t1.is_defined ())
00048         return t1.is_true ();
00049       else
00050         ::error ("%s: undefined value used in conditional expression",
00051                  warn_for);
00052     }
00053 
00054   return expr_value;
00055 }
00056 
00057 octave_value
00058 tree_expression::rvalue1 (int)
00059 {
00060   ::error ("invalid rvalue function called in expression");
00061   return octave_value ();
00062 }
00063 
00064 octave_value_list
00065 tree_expression::rvalue (int)
00066 {
00067   ::error ("invalid rvalue function called in expression");
00068   return octave_value_list ();
00069 }
00070 
00071 octave_value_list
00072 tree_expression::rvalue (int nargout, const std::list<octave_lvalue> *)
00073 {
00074   return rvalue (nargout);
00075 }
00076 
00077 octave_lvalue
00078 tree_expression::lvalue (void)
00079 {
00080   ::error ("invalid lvalue function called in expression");
00081   return octave_lvalue ();
00082 }
00083 
00084 std::string
00085 tree_expression::original_text (void) const
00086 {
00087   return std::string ();
00088 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines