variables.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1993-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 #if !defined (octave_variables_h)
00024 #define octave_variables_h 1
00025 
00026 class octave_function;
00027 class octave_user_function;
00028 
00029 class tree_identifier;
00030 class octave_value;
00031 class octave_value_list;
00032 class octave_builtin;
00033 class string_vector;
00034 
00035 #include <climits>
00036 #include <cfloat>
00037 
00038 #include <string>
00039 
00040 #include "ov.h"
00041 #include "ov-builtin.h"
00042 #include "symtab.h"
00043 
00044 extern OCTINTERP_API void clear_mex_functions (void);
00045 
00046 extern OCTINTERP_API octave_function *
00047 is_valid_function (const octave_value&, const std::string& = std::string (),
00048                    bool warn = false);
00049 
00050 extern OCTINTERP_API octave_function *
00051 is_valid_function (const std::string&, const std::string& = std::string (),
00052                    bool warn = false);
00053 
00054 extern OCTINTERP_API octave_function *
00055 extract_function (const octave_value& arg, const std::string& warn_for,
00056                   const std::string& fname, const std::string& header,
00057                   const std::string& trailer);
00058 
00059 extern OCTINTERP_API string_vector
00060 get_struct_elts (const std::string& text);
00061 
00062 extern OCTINTERP_API string_vector
00063 generate_struct_completions (const std::string& text, std::string& prefix,
00064                              std::string& hint);
00065 
00066 extern OCTINTERP_API bool
00067 looks_like_struct (const std::string& text);
00068 
00069 extern OCTINTERP_API int
00070 symbol_exist (const std::string& name, const std::string& type = "any");
00071 
00072 extern OCTINTERP_API std::string
00073 unique_symbol_name (const std::string& basename);
00074 
00075 extern OCTINTERP_API octave_value lookup_function_handle (const std::string& nm);
00076 
00077 extern OCTINTERP_API octave_value
00078 get_global_value (const std::string& nm, bool silent = false);
00079 
00080 extern OCTINTERP_API void
00081 set_global_value (const std::string& nm, const octave_value& val);
00082 
00083 extern OCTINTERP_API octave_value
00084 get_top_level_value (const std::string& nm, bool silent = false);
00085 
00086 extern OCTINTERP_API void
00087 set_top_level_value (const std::string& nm, const octave_value& val);
00088 
00089 extern OCTINTERP_API octave_value
00090 set_internal_variable (bool& var, const octave_value_list& args,
00091                        int nargout, const char *nm);
00092 
00093 extern OCTINTERP_API octave_value
00094 set_internal_variable (char& var, const octave_value_list& args,
00095                        int nargout, const char *nm);
00096 
00097 extern OCTINTERP_API octave_value
00098 set_internal_variable (int& var, const octave_value_list& args,
00099                        int nargout, const char *nm,
00100                        int minval = INT_MIN, int maxval = INT_MAX);
00101 
00102 extern OCTINTERP_API octave_value
00103 set_internal_variable (double& var, const octave_value_list& args,
00104                        int nargout, const char *nm,
00105                        double minval = DBL_MIN, double maxval = DBL_MAX);
00106 
00107 extern OCTINTERP_API octave_value
00108 set_internal_variable (std::string& var, const octave_value_list& args,
00109                        int nargout, const char *nm, bool empty_ok = true);
00110 
00111 extern OCTINTERP_API octave_value
00112 set_internal_variable (int& var, const octave_value_list& args,
00113                        int nargout, const char *nm, const char **choices);
00114 
00115 #define SET_INTERNAL_VARIABLE(NM) \
00116   set_internal_variable (V ## NM, args, nargout, #NM)
00117 
00118 #define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM) \
00119   set_internal_variable (V ## NM, args, nargout, #NM, false)
00120 
00121 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \
00122   set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)
00123 
00124 // in the following, CHOICES must be a C string array terminated by null.
00125 #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \
00126   set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)
00127 
00128 extern OCTINTERP_API std::string builtin_string_variable (const std::string&);
00129 extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&, double&);
00130 extern OCTINTERP_API octave_value builtin_any_variable (const std::string&);
00131 
00132 extern OCTINTERP_API void bind_ans (const octave_value& val, bool print);
00133 
00134 extern OCTINTERP_API void
00135 bind_internal_variable (const std::string& fname, const octave_value& val);
00136 
00137 extern OCTINTERP_API void mlock (void);
00138 extern OCTINTERP_API void munlock (const std::string&);
00139 extern OCTINTERP_API bool mislocked (const std::string&);
00140 
00141 extern OCTINTERP_API void clear_function (const std::string& nm);
00142 extern OCTINTERP_API void clear_variable (const std::string& nm);
00143 extern OCTINTERP_API void clear_symbol (const std::string& nm);
00144 
00145 extern OCTINTERP_API void maybe_missing_function_hook (const std::string& name);
00146 
00147 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines