utils.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_utils_h)
00024 #define octave_utils_h 1
00025 
00026 #include <cstdarg>
00027 
00028 #include <iosfwd>
00029 #include <string>
00030 #include <list>
00031 
00032 #include "dMatrix.h"
00033 #include "lo-utils.h"
00034 
00035 #include "cutils.h"
00036 
00037 class octave_value;
00038 class octave_value_list;
00039 class string_vector;
00040 
00041 extern OCTINTERP_API bool valid_identifier (const char *s);
00042 extern OCTINTERP_API bool valid_identifier (const std::string& s);
00043 
00044 extern OCTINTERP_API bool
00045 same_file (const std::string& f, const std::string& g);
00046 
00047 extern OCTINTERP_API int almost_match (const std::string& std,
00048                                        const std::string& s,
00049                                        int min_match_len = 1,
00050                                        int case_sens = 1);
00051 
00052 extern OCTINTERP_API int
00053 keyword_almost_match (const char * const *std, int *min_len,
00054                       const std::string& s, int min_toks_to_match,
00055                       int max_toks);
00056 
00057 extern OCTINTERP_API int empty_arg (const char *name, octave_idx_type nr,
00058                                     octave_idx_type nc);
00059 
00060 extern OCTINTERP_API std::string
00061 search_path_for_file (const std::string&, const string_vector&);
00062 
00063 extern OCTINTERP_API string_vector
00064 search_path_for_all_files (const std::string&, const string_vector&);
00065 
00066 extern OCTINTERP_API std::string
00067 file_in_path (const std::string&, const std::string&);
00068 
00069 extern OCTINTERP_API std::string contents_file_in_path (const std::string&);
00070 
00071 extern OCTINTERP_API std::string fcn_file_in_path (const std::string&);
00072 extern OCTINTERP_API std::string oct_file_in_path (const std::string&);
00073 extern OCTINTERP_API std::string mex_file_in_path (const std::string&);
00074 
00075 extern OCTINTERP_API std::string do_string_escapes (const std::string& s);
00076 
00077 extern OCTINTERP_API const char *undo_string_escape (char c);
00078 
00079 extern OCTINTERP_API std::string undo_string_escapes (const std::string& s);
00080 
00081 extern OCTINTERP_API void
00082 check_dimensions (dim_vector& dim, const char *warnfor);
00083 
00084 extern OCTINTERP_API void
00085 get_dimensions (const octave_value& a, const char *warn_for,
00086                 dim_vector& dim);
00087 
00088 extern OCTINTERP_API void
00089 get_dimensions (const octave_value& a, const octave_value& b,
00090                 const char *warn_for, octave_idx_type& nr,
00091                 octave_idx_type& nc);
00092 
00093 extern OCTINTERP_API void
00094 get_dimensions (const octave_value& a,const char *warn_for,
00095                 octave_idx_type& nr, octave_idx_type& nc);
00096 
00097 extern OCTINTERP_API octave_idx_type
00098 dims_to_numel (const dim_vector& dims, const octave_value_list& idx);
00099 
00100 extern OCTINTERP_API Matrix
00101 identity_matrix (octave_idx_type nr, octave_idx_type nc);
00102 
00103 extern OCTINTERP_API FloatMatrix
00104 float_identity_matrix (octave_idx_type nr, octave_idx_type nc);
00105 
00106 extern OCTINTERP_API size_t
00107 octave_format (std::ostream& os, const char *fmt, ...);
00108 
00109 extern OCTINTERP_API size_t
00110 octave_vformat (std::ostream& os, const char *fmt, va_list args);
00111 
00112 extern OCTINTERP_API std::string
00113 octave_vasprintf (const char *fmt, va_list args);
00114 
00115 extern OCTINTERP_API std::string octave_asprintf (const char *fmt, ...);
00116 
00117 extern OCTINTERP_API void octave_sleep (double seconds);
00118 
00119 extern OCTINTERP_API
00120 octave_value_list
00121 do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int),
00122                    const char *fun_name, const octave_value_list& args,
00123                    int nargout);
00124 
00125 extern OCTINTERP_API
00126 octave_value
00127 do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int),
00128                    const char *fun_name, const octave_value_list& args);
00129 
00130 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines